jewettaij / moltemplate

A general cross-platform tool for preparing simulations of molecules and complex molecular assemblies
http://www.moltemplate.org
MIT License
257 stars 99 forks source link

How to change the force-field in an ATB file (to OLPSAA) #91

Open HaoWan321 opened 1 year ago

HaoWan321 commented 1 year ago

HI, I am new to Moltemplate. I am trying to build a small organic molecule for lammps. I obtained the all_atom_geometry_optimized.lt, In this file it automatically using GROMOS_54A7_ATB which I wanna replace with OPLASS but there seems it has problem if I just replace the GROMOS_54A7_ATB with OPLASS in all_atom_geometry_optimized.ltand also add "import 'OPLASS'" in the system.lt. It complains the bonds part in the all_atom_geometry_optimized.lt. Do you have any solution for this?

BW

Hao

jewettaij commented 1 year ago

Hello Hao

Moltemplate can be used to setup simulations with very unorthodox force-fields. But for standard all-atom force-fields like OPLSAA, you may find other molecule builders that are more convenient to use.

Some molecule-builder programs are comparatively easy to use. After you specify the atom types and bond topology (for example by using a SMILES string), you can load the atomic coordinates using a PDB, PDBx, PDBXML, mmCIF, XYZ, or Mol2 file. After that, you can specify the force-field(s) you want to use, offering you several choices (such as OPLS, CHARMM, various versions of AMBER, GROMOS, Compass, PCFF, SMIRNOFF, ...). It sounds like perhaps you have used one of these programs in the past.

Unfortunately moltemplate cannot do that. When using moltemplate, it is not easy to change the force-field afterwards. Whenever you change the force field for a molecule, internally the number of angles, dihedrals, and impropers will probably also change. Some programs hide all this complexity from the user. Moltemplate doesn't. Those details are sometimes stored explicitly in the LT file. So you might have to change the LT file in many places to change the force-field for that molecule.

(Incidentally, adding "import oplsaa.lt" to the beginning of your LT file loads force-field parameters but does not change the force-field that your molecule is using. You need to change each of the atom types to do that, and use "inherits OPLSAA", as shown in the OPLSAA examples. For ATB molecules, you have to make many more changes as well.)

Changing the force field for ATB files is especially difficult. Molecule files downloaded from ATB were only intended for use with the special ATB version of the GROMOS force-field. In ATB, the force-field parameters (and charges) are customized for each molecule, by simulating that molecule using DFT. That extra information is baked into each LT file downloaded from ATB. The authors of ATB argue that these custom ATB force-field parameters are potentially more accurate than parameters from more traditional force-fields such as OPLSAA, CHARMM, AMBER, GROMOS, PCFF, or even SMIRNOFF, that use simple rules and tables instead of DFT. (I don't know if this is true.) So there is no easy way to automatically convert a molecule downloaded from the ATB to some-other popular force-field, such as OPLS. (If you did, it would defeat the point.)

If you really want to change the force field, then, fortunately the LT files you have already downloaded from ATB should be easy to read. You can open them with a text-editor and extract the atom coordinates and bond-list. Then you can construct a new LT file that uses the atom types from a different force-field, such as OPLSAA. If your molecule isn't very large, this is the easiest solution. Alternatively, if you don't want to use the ATB force-field, or moltemplate, I believe you can also download files from ATB in PDB format which you can load into other software which accepts that format.

I hope this reply is not too late to be useful. I'll leave this question open so other people can read it.

zhuwenli0723 commented 5 months ago

If I create a structure with VMD/topotools, and I want to use the “ltemplify.py” utility to convert this data file into “LT” format with force-field OLPSAA. Is this the same as Example 6 in the manual? I just need to change the forcefiled name and strip the original file.data the angle, dihedral, improper, and bond-type information? Thanks so much!