LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] Combining Atom Style and Python Style Variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] Combining Atom Style and Python Style Variables

From: Axel Kohlmeyer <akohlmey@...24...>
Date: Tue, 19 Dec 2017 11:58:12 -0500

On Tue, Dec 19, 2017 at 11:49 AM, Brenda Rubenstein <rubenstein.brenda@...24...> wrote:
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.


syntax I am currently using: 

variable         values python someFunc

python           someFunc input 1 v_z return v_values format ff file

This is the test python function in (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?  

Dr. Brenda Rubenstein
Assistant Professor of Chemistry, Brown University

Check out the vibrant tech community on one of the world's most
engaging tech sites,!
lammps-users mailing list

Dr. Axel Kohlmeyer  akohlmey@...12...24...
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.