[lammps-users] Create atoms command fails

Dear LAMMPS-users,

I am running a script in which an atom is created by using the command:

create_atoms 1 single x y z

where x, y, z are the coordinates (which are initially read from a file and stored in the variables v_x, v_y, v_z). After adding this atom, the structure is relaxed using the command "minimize". The script is called many times, and it sometimes works without problems but sometimes doesn't add an atom. The behavior seems random to me, i.e. i cannot see any difference between sucessfully adding or failing. If the command works the atom is also placed as expected. After calling the script a few hundred times it fails completely and doesn't add any atoms any more - always without throwing an error.

This is the output in the .log file:

#create atom
create_atoms 1 single \{v\_x\} {v_y} \{v\_z\} create\_atoms 1 single 22\.8785 {v_y} \{v\_z\} create\_atoms 1 single 22\.8785 31\.235575 {v_z}
create_atoms 1 single 22.8785 31.235575 41.8517
Created 0 atoms #this is the problem
create_atoms CPU = 1.3113e-05 secs

Any help would be greatly appreciated! Thank you!

Kind regards,

Please always report the LAMMPS version you are using.

There is not enough information here to make an assessment of what is going wrong here.

Can you provide a minimal input that can reproduce the problem quickly?


Probably you are just seeing this feature of the create atoms command:

You cannot use any of the styles explained above to create atoms that are outside the simulation box; they will just be ignored by LAMMPS.