Dear Lammps Users:
I am trying to create two PyLammps instances in a python script:
lmp_ins1 = PyLammps()
lmp_ins2 = PyLammps()
lmp_ins1 reads a data file and runs a simulation and returns to python script.
I can access atom info using
and create atoms and simulation box at the second instance.
lmp_ins2.command(create_atoms. … )
Also can run a simulation in lmp_ins2.
However after running simulation in lmp_ins2 I can not access atom info using:
Also lmp_ins2.system.natoms gives the correct number of atoms and looks like no problem with the
simulation in lmp_ins2. The only difference between lmp_ins1 and lmp_ins2 is the latter atoms created with create_atoms command.
Is it related to some sort of array issue or am I missing something?
Please post a simple-as-possible Python script illustrating the problem
With help of Muchal Kanski, the problem identified. Here is a simple python code:
lmp = lammps()
lmp.command(“atom_modify map yes”)
lmp.command("read_data %s " %datafile)
lmp.command(“pair_style reax/c NULL”)
lmp.command("pair_coeff * * %s s"( ffield, typeorder))
symbols = typeorder.split()
for i, symbol in enumerate(symbols):
lmp.command("mass %d f" (i+1, symbol_to_mass(symbol)))
lmp.command(“neighbor 2 bin”)
lmp.command(“neigh_modify every 10 delay 0 check no”)
#lmp.command(“fix 1 all nve”)
lmp.command(“fix 2 all qeq/reax 1 0.0 10.0 1e-6 reax/c”)
We created a lammps instance with ReaxFF potential. It seems like Lammps/ReaxFF does not use atom map
so normally we do not need atom_modify map yes command for a reaxff/lammps simulation. However
library.cpp [ line 1271 ] checks atom map before scattering atoms so
lmp.scatter_atoms(“x”,1,3,data) will raise a warning and will not write atom positions into the array.
When we uncomment 4th line above the problem solved. In my opinion there should be a note at doc page about this.