Help needed with fix python/invoke and using python wrapper from it

Hi everyone,

I am trying to use the fix python/invoke (mentioned in LAMMPS docs) to run a python script which again calls upon my LAMMPS script. After getting the following error: Unknown fix style python/invoke, I browsed through the /src/PYTHON directory and noticed there is no fix_python_invoke.h (I am using the latest stable version—11 Aug 2017) but only a fix_python.h (But the former is available in the master branch on Github) file, and want to report this discrepancy.

Now, using the fix python seems to be running “without errors”, but the python function is not getting called at all. (It is checking for syntax consistencies, though). I am trying to use the end_of_timestep mode, and N<runtime. This brings me to my question: Is it possible to reference to the LAMMPS variables from a fix python running in the same script? (If not, then what is the SELF pointer in the input being referenced to?).

Also, does the extract_compute() command invoke and extract the value of a compute from the python wrapper, or one need to still invoke the values using fixes like fix ave/atom or fix store/state?

I know it is more for writing all the LAMMPS script in a python script as told by Axel here, but the SELF option in python functions, and the in.fix_python file in lammps/examples/python directory gave me a different impression.

Thanks for your help and criticism,

Praneeth

Hi everyone,

I am trying to use the fix python/invoke (mentioned in LAMMPS docs) to run
a python script which again calls upon my LAMMPS script. After getting the
following error: Unknown fix style python/invoke, I browsed through the
/src/PYTHON directory and noticed there is no fix_python_invoke.h (I am
using the latest stable version---11 Aug 2017) but only a fix_python.h (But
the former is available in the master branch on Github) file, and want to
report this discrepancy.

​please carefully review this​ page: http://lammps.sandia.gov/bug.html
the online docs always represent the latest patch release, *not* the stable
release. if you want to have a documentation that matches your specific
LAMMPS version you have to look at the html pages or the PDF file bundled
with it.

also, when using the python interface, i strongly recommend to use the
latest patch, as this is a work-in-progress feature, where there are
regularly bugfixes and significant enhancements added.

​axel.​

Now, using the fix python seems to be running "without errors", but the

Hi Axel,

Thanks for your reply, I will use the latest release for this purpose. Sorry about the false alarm.

If you don’t mind me asking again, does the extract_compute() command in Pylammps invoke and extract the value of a compute from the python wrapper?

I looked up the function definition of extract_compute() in lammps/python/lammps.py, but I see that the said definition has no information on whether the compute is evaluated/invoked or not. Where can I find this info?

If this is not so, I may have to use a fix like ave/atom or ave/time depending upon type of value evaluated by the compute. Ideally, I would want the compute to be evaluated for the same timestep as the fix python/invoke, and so I could perhaps use dumps/thermo options. But the dump command seems to be giving the “compute isn’t current between runs” error, and outputting in thermo may be computationally intensive.

Thanks a lot,

Praneeth

Hi Axel,

Thanks for your reply, I will use the latest release for this purpose.
Sorry about the false alarm.

If you don't mind me asking again, does the extract_compute() command in
Pylammps invoke and extract the value of a compute from the python wrapper?

I looked up the function definition of extract_compute() in
lammps/python/lammps.py, but I see that the said definition has no
information on whether the compute is evaluated/invoked or not. Where can I
find this info?

​as explained in the documentation of the python wrapper, this is a wrapper
of the C-style library interface to lammps, which is in the file
library.cpp​.
​computes are executed "on-demand" and "as needed".

If this is not so, I may have to use a fix like ave/atom or ave/time
depending upon type of value evaluated by the compute. Ideally, I would
want the compute to be evaluated for the same timestep as the fix
python/invoke, and so I could perhaps use dumps/thermo options. But the
dump command seems to be giving the "compute isn't current between runs"
error, and outputting in thermo may be computationally intensive.

​some computes can only be properly used during a run. to "cache" those
results (i.e. to avoid the "compute is not current" error), you ca​n use
fix ave/time and average over one step only.
this has been explain multiple times and thus should be in the mailing list
archives.

axel.