shirtsgroup / InterMol

Conversion tool for molecular simulations
MIT License
185 stars 53 forks source link

Fix: LAMMPS to Gromacs Conversion Issues #396

Open Jeet-Majumdar opened 1 year ago

Jeet-Majumdar commented 1 year ago

Implementation of opls dihedrals and cvff improper

Added few lines of code to correctly implement the conversion; which otherwise was throwing errors.

Input files: files can be found inside zip: lammps_input_files_and_correct_conversions.zip:

  1. _UNK8742A6.lmp (From Ligpargen )
  2. in.lammps

Command: python InterMol/intermol/convert.py --lmp_in in.lammps --gromacs

error_opls_dihedral_cvff_improper


Now lets say we remove the dihedral information from the LAMMPS input script and data file (which were resulting errors)

New Input files: files can be found inside zip: modified_lammps_input_files_and_incorrect_conversion_in_harmonic_bond_coefficients.zip:

  1. _UNK_8742A6modified.lmp
  2. _in.lammpsmodified

Command: python InterMol/intermol/convert.py --lmp_in in.lammps_modified_ --gromacs

Although this does the conversion, but the harmonic bond coefficient (k: force constant) is wrong. It is supposed to be multiplied by 2, which the current version is not doing because of a bug in the implementation.

Comparisons are made between in_converted.top (that is generated by intermol) and UNK_8742A6.itp. The files UNK_8742A6.itp and UNK_8742A6.lmp were both obtained from Ligpargen server for a single Ethanol molecule.

Ligpargen is a popular tool to do OPLS-AA parameterization of molecules, and it gives parameters of Ethanol molecule in both formats, LAMMPS as well as Gromacs. Here I have taken their their LAMMPS format (UNK_8742A6.lmp) and used Intermol to convert it into Gromacs (in_converted.top). This converted intermol output is then compared with the Ligpargen given Gromacs parameters (UNK_8742A6.itp).

Harmonic style bond coefficients

In intermol/lammps/lammps_parser.py, line number 92 and 95, the comparison was between incorrect types. As a result the canonical_force_scale was never never multiplied during the conversion. This was however correctly done in the case of angle coefficient conversions. I have followed similar implementation style to correct the bond part now.

Also implemented the parsing and conversion of OPLS dihedral and cvff impropers.

The correct conversions and their comparison can be found in the zip: lammps_input_files_and_correct_conversions.zip The correct conversion results are provided in the same zip, which can be compared with UNK_8742A6.itp

Request maintainers to please have a look into the attached zip files and the modifications that are done here.

Thanks, Jeet

lammps_input_files_and_correct_conversions.zip modified_lammps_input_files_and_incorrect_conversion_in_harmonic_bond_coefficients.zip ligpargen_files_Ethanol.zip