Combining Atom Style and Python Style Variables

Dear LAMMPS Listserv,
I was observing a thread about using both atom style and python style variables and had similar questions myself. What kind of syntax can be used for combining atom style and python style variables? More specifically, I would like to calculate the forces on all of the atoms in my simulations. These forces are computed using a python script based upon a very specific potential energy surface. What is the syntax to pass an atom style variable to a python script and then to have an atom style variable returned? It seems as though I can readily send atom style variables to my python script, but they don’t appear to return properly. Here is some of the syntax I am currently using:

variable values python someFunc

python someFunc input 1 v_z return v_values format ff file test.py

This is the test python function in test.py (which is in the same directory):

def someFunc(args):

for stuff in args:

args[stuff-1] += 2

print args

return args

I would like to get this to work before inserting my actual potential/force functions. The python function has obviously been tested. Any ideas about why such a call does not currently work (when actually called) or how to combine atom and python style variables would be greatly appreciated! Is the ff format incorrect?

Sincerely,
Dr. Brenda Rubenstein
Assistant Professor of Chemistry, Brown University
[email protected]…802…

Dear LAMMPS Listserv,
    I was observing a thread about using both atom style and python style
variables and had similar questions myself. What kind of syntax can be used
for combining atom style and python style variables? More specifically, I
would like to calculate the forces on all of the atoms in my simulations.
These forces are computed using a python script based upon a very specific
potential energy surface. What is the syntax to pass an atom style variable
to a python script and then to have an atom style variable returned? It
seems as though I can readily send atom style variables to my python
script, but they don't appear to return properly. Here is some of the

​you cannot treat python style variables like atom style variables and you
cannot pass them as arguments. python style variables can only be used in
the same places as equal style variables.
the only way to get access to and apply per-atom properties from within
python is using fix python and then using the python library interface from
within the function you define.

axel.​