using OPLSAA or ATB with moltemplate? (Re: moltemplate error)

I´ve assigned the (partial) charges manually and would want to borrow
the force field parameters from OPLS.

To do this, I import the oplsaa.lt file into EMIm.lt and allow EMIm to
inherit OPLSAA. By then assigning the corresponding atom and bond
types in the EMIm.lt file for each atom/bond from the oplsaa.lt file,
do I then get the corresponding atom_coeffs and bond_coeffs in the
system.data file?

Since you are a student, I recommend using ATB instead of OPLSAA. But if you want to use OPLSAA, read on.

If you are using a force-field like OPLSAA with moltemplate, you only need to select the atom types, as well the list of pairs of atoms which are bonded together. You can omit the bond types. The atom types go in the 3rd column of the “Data Atoms” section of the LT file describing your molecule(s).

Once you have chosen the atom types and the bond pairs for your molecule, the partial charges, bond types, angle types, dihedral types, improper types, masses, and force-field parameters will be generated automatically by moltemplate according to the rules in “oplsaa.lt”.

I realize that the use of force-fields are not yet covered in the moltemplate manual (I should fix this), so I suggest that you look at one of the OPLSAA force-field examples and modify it to suit your needs. In your case, take a look at the “ethylene.lt” and “benzene.lt” files in this example:

https://moltemplate.org/visual_examples.html#ethylene+benzene

(These files are also available here.)

Note that when using force fields (such as OPLSAA, GAFF, or COMPASS), the list of bonds go in the “Data Bond List” section (which omits the 2nd column containing the bond type), as opposed to the ordinary “Data Bonds” section (which doesn’t). For OPLSAA and COMPASS (not GAFF), the charges in the “Data Atoms” section (4th column) are not specified (0.0) because they will be determined by the force-field (see below).

If you are using a force-field, the critical task is to choose the atom types correctly. (3rd column in the “Data Atoms” section.)

Currently, you must read the list of available atom types in the “oplsaa.lt” file (in the mass and charge sections) and choose the OPLSAA-specific type for each of the atoms in your molecule carefully. When using OPLSAA, make sure that the sum of all the charges in the molecule is an integer. This is a non-trivial (and sometimes impossible) task. Some suggestions for doing this are mentioned here. (Even if you are careful, not that the OPLSAA does not have rules that describe every possible molecule type.)

Because this task can be difficult/impossible, I often suggest using the ATB instead:
https://atb.uq.edu.au/

(In the future, if I manage to add support for OpenFF/SMIRNOFF force fields, I will recommend that approach as well as an open-source alternative to ATB. Incidentally, I have grown disappointed by the LigParGen server and I no longer recommend using it.)

I´ve assigned the (partial) charges manually and would want to borrow
the force field parameters from OPLS.

If you downloaded the LT file describing your molecule from the ATB server, then there should be no reason to do this. (That file already includes partial charges and force-field parameters. Note that there are united-atom and all-atom versions of each molecule, so be careful when selecting the file when downloading. The usage instructions contained in the ATB files might be a little bit more confusing compared to other moltemplate examples, but if you follow the instructions carefully, the simulation should work well.)

If you prefer using OPLSAA, moltemplate will generate a “system.in.charges” file containing the partial charges assigned according to the OPLSAA atom type. (In the “oplsaa.lt” file, every atom type has a unique partial charge. Many of them are identical aside from the partial charge. That’s one of the reasons there are so many different atom types in that file.) In order to use these partial charges, you will have to edit the input script (that you submit to LAMMPS, for example the “system.in” file), and make sure it contains “import system.in.charges”. This will override the partial charges in the “system.data” file (which come from the “Data Atoms” section of your LT files).
But again, if you are using the ATB, there is no reason to do this.

The ATB database
is quite useful as well. Thank you a lot!

(I agree!)

I hope this helps

Andrew