Hello everyone,
I am trying to learn how to use the LAMMPS Library Interface in a C++ code. I am wondering whether it is possible to extract energy or atomistic coordinates from the LAMMPS object…something like, lmp->AtomCoords?
Thanks,
Projesh
Hello everyone,
I am trying to learn how to use the LAMMPS Library Interface in a C++ code. I am wondering whether it is possible to extract energy or atomistic coordinates from the LAMMPS object…something like, lmp->AtomCoords?
Thanks,
Projesh
If you have to ask this kind of question and cannot determine the answer yourself from reading the LAMMPS source code, please use the C-library interface: 1. LAMMPS Library Interfaces — LAMMPS documentation
You will save yourself from a whole lot of trouble.
For those who need help …
– I found coordinates can be accessed using
double **xyz = lmp->atom->x
Mind that it gives you a pointer. Basically, you need to take a look at the /src/atom.h file for accessing the per atom properties.
– The energy can be accessed using,
double lammps_get_thermo(void *handle, const char *keyword);
– (double *) lammps_extract_variable (lmp,“”,“”), for any other variables defined in the script. These functions are listed in the /src/library.h file.