Adding Atoms to a Polymer System

Hello all,

I’m new to lammps and wondering how I can add n atoms to my system of 8 polymer chains.

For some background: I have a system of 8 polymer chains surrounded by 80 H2O molecules. I deleted the H2O molecules and updated the data file, but now I want to add in Helium atoms, then delete those and add in H2 molecules. I just don’t know how to add in the molecules in. I want to start simple with helium since its monoatomic and don’t need to worry about bonds.

I saw the selection2mols tool in TopoTools and wondering if that would be an easy way to go, or is there another way of updating the data file using the molecule and/or create_atom command.

Thank you,

1 Like

If "n" is small, then simplest thing to do is to edit your data file
with a text editor and manually add the atoms to the "Atoms" section
of your DATA file.

If you want to create something more complicated, then the tool you
use depends on what you are familiar with or comfortable with.

If you like TOPOTOOLS, then you can use "readlammpsdata" command to
read an existing DATA file, make modifications to it, and
"writelammpsdata" to create a new data file.

If you like MOLTEMPLATE, then you can use the "ltemplify.py" python
script to extract one or more molecules from an existing LAMMPS DATA
file and convert them to a molecule-object (an LT file).

If you have LAMMPS DATA files (for the new atoms you want to add), you
can probably merge it with your existing file using pizza.py (if you
prefer not to use topotools or moltemplate). Other tools, like EMC,
Xenoview, and MolecularDynamicsStudio might be able to read and
combine LAMMPS data file information together as well.

------ How to do this in moltemplate ------
Suppose your polymers have molecule-IDs from 1 to 8, and the remaining
molecules have larger molecule-IDs. You can select out the polymers
and the waters using these commands (run from the shell/terminal):

ltemplify.py -name Polymers -molid "1*8" file.in file.data > polymers.lt
ltemplify.py -name Waters -molid "9*" file.in file.data > waters.lt

Then, create a "system.lt" file, and run moltemplate on it:
The system.lt file would resemble this one:

----- system.lt ------
import polymers.lt # Define object type "Polymers"
import waters.lt # Define object type "Waters"

polys = new Polymers

# NOTE: This puts all the polymers in a single object named "polys", (of type
# "Polymers"), but you could have created separate object/type for each polymer,
# instead if you prefer. Now instantiate the water molecules:

wats = new Waters

# ADD YOUR NEW ATOMS OR MOLECULES HERE

# You must specify the physical size of your simulation.
# You can find cut the size of the boundary box from
# your old DATA file, and paste that information below:
write_once("Data Boundary")
{
  0 100.0 xlo xhi
  0 100.0 ylo yhi
  0 100.0 zlo zhi
}