Dear LAMMPS users,
I am using the python library interface to interact with Lammps between runs. I run Lammps in parallel and use the “extract_compute” command to retrieve per-molecule properties from each processor, calculated with the “compute rigid/local” command. The input file can be found below. I use Python2.7 and Lammps version 12Dec18.
I can use the extract_compute command without any issue for vector and array type properties. I also want to get the number of molecules at each processor by running extract_compute(“mol”,2,0). This, according to the doc, should return an integer with the length of the local array:
from the source code:
"for local data, accessing scalar data for the compute (type = 0),
returns a pointer that should be cast to (int *) which points to
an int with the number of local rows, i.e. the length of the local array.
returns a void pointer to the compute’s internal data structure
for the entity which the caller can cast to the proper data type
returns a NULL if id is not recognized or style/type not supported"
However, extract_compute(“mol”,2,0) returns None, as shown below:
MOL = lmp.extract_compute(“mol”,2,1) (works fine)
type(MOL)
<class ‘lammps.LP_c_double’>
length = lmp.extract_compute(“mol”,2,0) (here is the problem)
type(length)
<type ‘NoneType’>
What can I do to fix this problem? Any suggestion would be greatly appreciated.
This is the input script I am using:
water box simulation
Units and atom style
units real
atom_style full
atom_modify map array sort 0 0.0
Pair info
pair_style lj/cut/coul/long 9.0 9.0
pair_modify tail yes
kspace_style pppm 1.0e-4
bond_style harmonic
angle_style harmonic
dihedral_style none
improper_style none
read_data restart.dat
Neighbor list
neighbor 2.5 bin
neigh_modify every 2 delay 0 check yes
fix 1 all rigid/nve/small molecule
Compute rigid body molecule ids at each processor
compute mol all rigid/local 1 mol
run 100
Regards,
Pelin Su Bulutoglu