Hi LAMMPS users,
I would like to use lammps as a library and hybridize it with my MC code, so I need to update potential energy after MC steps. How can I get the trial potential energy without running MD step? I have tried to add the following function to library.cpp
double lammps_get_pe(void *ptr)
{
LAMMPS *lammps = (LAMMPS *) ptr;
//lammps->output->thermo->compute(1);
double pe;
lammps->output->thermo->evaluate_keyword(“pe”,&pe)
return pe;
}
However, the pe won’t update after changing coordinates (in example c_driver.c) as:
lammps_put_coords(ptr,x);
double pe_new= lammps_get_pe(ptr);
printf(“pe = %f\n”, pe_new/natoms);
Could someone can tell me how lammps invokes to calculate the potential energy after the change of coordinates? Thank you in advance.
Best!
Dongsheng