add support to run LAMMPS on the file instead of the edit buffer

This commit is contained in:
Axel Kohlmeyer
2023-08-25 15:12:48 -04:00
parent f94d00d435
commit c61aaa81d2
7 changed files with 123 additions and 53 deletions

View File

@ -27,16 +27,22 @@ public:
// execute LAMMPS in runner thread
void run() override
{
lammps->commands_string(input);
delete[] input;
if (input) {
lammps->commands_string(input);
delete[] input;
} else if (file) {
lammps->file(file);
delete[] file;
}
emit resultReady();
}
// transfer info to worker thread and reset LAMMPS instance
void setup_run(LammpsWrapper *_lammps, const char *_input)
void setup_run(LammpsWrapper *_lammps, const char *_input, const char *_file = nullptr)
{
lammps = _lammps;
input = _input;
file = _file;
lammps->command("clear");
}
@ -46,6 +52,7 @@ signals:
private:
LammpsWrapper *lammps;
const char *input;
const char *file;
};
#endif