Modify Data File with MolTemplate

Hello all,

How do you remove a molecule from a system while adding a new one in the same position using moltemplate to generate a new data file?


deleting atoms:

1) If you already have a LAMMPS data file, and you want to convert it
into moltemplate format (LT format), you can use to do
that, and then select the range of molecule-IDs (or atom-types or
atom-IDs) you want to keep. Omit the atoms or molecules you don't
want. See appendix B of the moltemplate manual for examples. You
eventually need to run moltemplate on this LT file (or on another file
a which references this LT file) to convert it back into a LAMMPS data
file again.

2) If you are building everything from scratch using moltemplate, you
can use the "delete" command to remove molecules or molecular subunits
from your simulation. See sections 7.10 and 8.3 of the moltemplate
manual for examples. (However this is typically only useful when you
have an array of molecules and you want to delete some of them. Since
I don't think you built your system using moltemplate-style arrays, I
don't think this approach is relevant to you at the moment.)

    You can delete the molecule(s) in LAMMPS by using the
"delete_atoms" and "group" commands. (In your input scripts, do this
after you invoke "read_data".) For details see and
This eliminates the need for moltemplate:

Example, to delete all atoms with molecule-ID 50-100, use these LAMMPS
script commands:

group gJunk molecule <> 50 100
delete_atoms group gJunk

You can also delete atoms at a specific location or region, but you
have to be careful not to cut your molecule(s) in half.

4) Adding atoms or molecules to an system (using moltemplate)

   For an introductory tutorial showing how to add molecules to your
system, read chapter 4 of the moltemplate manual. (It is only 8 pages
long. Feel free to skip chapters 1-3.)

I hope this helps. (I'll send another email directly to you regarding
your problem.)