Hi,
I am writing a TPS code in C++ that invokes LAMMPS as a library to perform the underlying dynamics. Currently, I am able to obtain the state of the thermostat/barostat at each frame of a trajectory by using a custom thermo_style and then something along the lines of (simplified):
double eta1;
lmp->output->thermo->evaluate_keyword(“f_p1[1]”,&eta1);
However, is there a way to modify the state of the thermostat/barostat e.g. if I wanted to perturb the value of eta1 and put this back into the first element of the global vector computed by fix npt?
I have had a look in library.cpp: there is void *lammps_extract_fix(…) which might provide another way to obtain this information, but I cannot see away to alter the values. I also tried something like:
lmp->modify->fix->eta[0] = &eta1
but this doesn’t work as double *eta is a protected variable in fix_nh.h (and possibly/probably for other reasons too…).
Any help appreciated!
Cheers,
Steve
PS I am happy to have a go at implementing a new library.cpp function similar to lammps_scatter_atoms() if necessary, but I will need pointing in the right direction.