Adding bond types not defined in OPLSAA in moltemplate input

Hi @jewettaij,

I’m new to using moltemplate. If there’s some reasonable bond type (e.g. C atom next to S in a thiene moiety which is bonded to an alkene RH-C=) in my system that’s not defined in the file, can you please tell me how to define it in the corresponding moltemplate file? Does the atom in question need to be defined as a new atom type as discussed [here] (adding exotic atomsto molecules in moltemplate (not defined in the force field)).

Thanks in advance!

The problem here is to find all the missing parameters, e.g. bonds, angles, dihedrals, and improper angles. Once you have them, just use the syntax of another atom type to enter the new parameters. Note that you must define unique coefficients such as @bond:custom_01 for every new entry.

If you don’t know how to parameterize a new molecule, ask for advice in your group/university/science club. Good luck!

1 Like

Thank you very much for the reply.

Hi Sadiya and Otello

Thank you Otello for responding! I am slowly catching up with old messages. (I owe Otello a reply as well!)
Adding new chemical groups and atom types to a force field is a non-trivial and delicate task even for people who are very familiar with moltemplate and LAMMPS. In full disclosure: I do not have much experience doing this. (In a former job, I used to run coarse-grained simulations. I am not an expert at running all-atom simulations.)

Otello raised an important point.
If your molecule contains a chemical group or moiety absent from the force field, it’s not enough to define a new bond type. You will also have to choose reasonable partial charges for the atoms in your new group/moiety (which can require a quantum calculation or a literature search). Also: In LAMMPS and other MD programs, bond types are typically used to look up the bond’s length and stiffness. However the forces acting on the atoms in your new chemical group will probably also depend on angular forces, such as the 3-body angles, 4-body torsions (dihedrals), and impropers formed by these atoms. Figuring out what those angles should be (and how stiff they should be) often also requires running a quantum chemistry calculation, and/or searching the published literature for similar molecules and the force field parameters they used. (In LAMMPS, these angular force parameters are specified in the data file or in the angle_coeff, dihedral_coeff, and improper_coeff sections of your input script. The “@angle:”, “@dihedral:”, and “@improper:” type names are used to refer to these angular interactions in the “In Settings”, “Data Angles”, and/or “Data Angles By Type” sections of your LT file.)

Alternatively, you can also search the “” file (or the “oplsaa.prm” file from which it was derived) or other force-field files for similar chemical groups and atom types and borrow their bond-length and bond-angle parameters (see below).

Alternatively, you can download a moltemplate file for your entire molecule from the ATB (see below).

When you create the LT file (moltemplate-style file) for your molecule, use OPLSAA force field for most of the atoms. However for the portion of the molecule which is not coverred by OPLSAA, you can use the new custom bonds, angles, dihedrals, impropers, and charges that you found by other means (such as from the litterature or from ATB). This is the approach I advocated in the link you posted. Note: Discord is completely ruined the formatting of my post, so instead of reading that link I suggest looking at this link instead:

However in some cases (when the atoms in your custom group or moiety are sufficiently similar to atoms which already exist in the OPLSAA), you can define new atom types based on the similar atom types from the OPLSAA, and customize their Lennard-Jones parameters and partial charges (leaving their bond and angular parameters the same, or introducing a new @dihedral type and customizing it’s parameters).

ATB database

You could also try using the ATB molecule database ( to find the (all-atom version) of your molecule already in moltemplate (LT) format. That file will include all of the atoms, bonds, angles, dihedrals, and impropers for that molecule, as well as the partial charges and Lennard-Jones parameters. Then you could either use the entire ATB molecule, or extract the charges, bonds, angles, and dihedrals associated with the atoms in your custom moiety from that molecule. The ATB molecule database is a fantastic resource, however I have never tried mixing ATB molecules (based on the GROMOS force field) with OPLSAA based molecules. But if you are only borrowing a few bond-lengths and angles and partial-charges from the ATB version of the molecule, I think this would be okay. (Opinions may differ. Again, I am not an expert at running all-atom simulations.)

Alternatively, if you find another way to build your molecule (either using EMC, or openbabel), and you still want to build the rest of your simulation in moltemplate, you can use the “” program to extract the molecule from your data file into moltemplate format. Here are some links and some quick examples explaining how to use

  2. moltemplate/ at b4388934dc710d92769ef94745902962c24861e4 · jewettaij/moltemplate · GitHub

And here are some more general links which might be relevant:

Either way, even once you have the correct parameters and partial charges for these new atoms, it can be a little bit tricky to use the correct format of the LT file so that moltemplate does not complain. This is where I can help if you get stuck. (I can be reached at jewett.aij at gmail. In some cases, if I don’t have time to reply, I will usually let you know.)

Note: I am not currently employed in this industry and I do not currently check discord, but I will try to respond to questions in the future, and I will not abandon moltemplate.


1 Like

Hi Andrew,

Thank you so much for this very informative reply! It’s really helpful! I can follow some of the suggestions and see.