Hi all,
I'm using the python/C interface to interact with LAMMPS between runs.
At the moment, I can start/stop simulations and tweak the fixes,
basically by feeding text commands into the "command()" function, and
I've also used the "extract_atom()" function to read and update
properties like atom positions.
What I'd like to do now is be able to use LAMMPS' compute
functionality to calculate energy for me (I've tried doing it myself
in Python, but I don't seem to get answers that are consistent with
the thermodynamic output from LAMMPS, and I trust its numbers more
than my own!) I can already see the output I think I want on stdout,
but I need to be able to retrieve that data into Python through the
interface.
Initially I took a look at the "extract_compute()" function, but that
seems to refer to a compute already set up somehow, rather than
allowing me to say "run this compute and return the answer".
My question is, is there a way to do this already, say by running a
command and then extracting a LAMMPS variable with
"extract_variable()", or do I need to modify the interface to allow
it?
Any help on this, and how to write a one-liner in LAMMPS script that
calculates kinetic plus potential energy and stores it in a variable,
would be much appreciated.
Thanks,
Joe