Can I pass per-atom computed variables to an embedded python function in lammps?

Hi all,

I have a python function that I would like to call from within my lammps input file. The input variables to the function include some per-atom variables such as centrosymmetry and energy of each atom. I was wondering if I can pass c_* (vectors) variables to the python function?
I am currently getting the following error and I am not sure if it is because I am passing an array of floats rather than a single float.

Error: Expected floating point parameter in input script or data file (…/python.cpp:344)

I appreciate your help in advance.

Arash,

Hi all,

I have a python function that I would like to call from within my lammps input file. The input variables to the function include some per-atom variables such as centrosymmetry and energy of each atom. I was wondering if I can pass c_* (vectors) variables to the python function?

No.

I am currently getting the following error and I am not sure if it is because I am passing an array of floats rather than a single float.

You are passing a string. The python package does not know what it represents internally in lammps.

It should be possible to access simulation data through loading the python wrapper inside your python function, if I remember correctly.

Axel

It should be possible to access simulation data through loading the python wrapper inside your python function, if I >remember correctly.

This is the right way to do that. Have your Python code call a LAMMPS library function

that evaluates a compute and returns (a pointer to) its output.

This is all discussed in the Python doc pages in LAMMPS.

Steve