How to create molecules at specific positions using molecule template?

Hi LAMMPS users,

I have questions about creating molecules with molecule template. My goal is to create molecules at some specific positions in a cylindrical region. Now I’m trying to use following commands in my script:

region conf cylinder x 0 0 16 -60 60
molecule add_poly addpoly.molecule_template
create_atoms 0 random 1 2804 conf mol add_poly 55

I specify the coords of each atom of several different molecules in the molecule template “addpoly.molecule_template”. The result I get is the molecules are created at some random positions within the cylindrical region “conf”. My question is: Is there any way to create molecules at the exact position I specified in the molecule template? I also tried to use “single” style with “units box” for the create_atoms command but the molecules seem to be still show up on some random positions. I checked the documentation of create_atoms and molecule command but still could not figure out the logic. It will be appreciated if anyone can give me some suggestion for handling the positions of created molecules. Thank you.

Why use a molecule file for this? Why not create a data file instead and then use the read_data command? That will read the coordinates as specified and that is what data files are for.

What you observe that happens is exactly what the documentation says it does.

  • with create_atoms random, LAMMPS will pick N randomly selected positions inside the defined region and place the center of mass of a molecule at that position
  • unless explicitly specified differently, each created molecule will be placed at a random orientation around the center of mass at the selected location

Then there is little that can be done to help you, since what is written in the documentation is what happens.

For what you say you what to do, using a data file with the read_data command is the best approach.

Hi Axel,

Thank you for answering my question. Sorry I forgot to explain the reason why I choose to use molecule template for my simulation. The reason is I read restart files from previous simulations that presumably reach equilibrium and I want to add more molecules into the system and continue simulate. For this case, I don’t know if there is a way to combine the restart file and the information of molecules to be added together as a new input data file?

Please study the documentation of the read_data command.

Ok. I found the way to handle this. I appreciate for the hint.