/MoSDeF-dihedral-fit

MoSDeF-dihedral-fit: A simple software package to fit dihedrals using the MoSDeF

Primary LanguagePythonMIT LicenseMIT

pre-commit.ci status CI

MoSDeF-dihedral-fit

The MoSDeF-dihedral-fit: an open-source, transparent, and lightweight Python software package capable of fitting dihedrals with QM calculations for existing forces fields. This software fits the Optimized Potentials for Liquid Simulations (OPLS) style dihedrals, then also analytically converts them to the periodic dihedral and Ryckaert-Bellemans (RB) torsion.

import unyt as u
from mosdef_dihedral_fit.dihedral_fit.fit_dihedral_with_gomc import fit_dihedral_with_gomc
fit_dihedral_with_gomc(
        ["HC", "CT", "CT", "HC"], #atomclass names of the dihedral
        "molecule.mol2" # mol2 file with relevant structure
        "compound.xml", # xml file with other atomtyped parameters in foyer format
        298.15 * u.Kelvin, # relevant temperature
        gomc_binary_directory, # path to binary command from GOMC install
        {"HC_CT_CT_HC_multiplicity_1.log": []}, # log file to store info
        zero_dihedral_atom_types=None,
        qm_engine="gaussian",
        combining_rule='lorentz',
        atom_type_naming_style='general',
        gomc_cpu_cores=1,
        r_squared_min=0.99,
        r_squared_rtol=1e-03,
        opls_force_k0_zero=True
    )
import os
os.system("cat RB_torsion_k_constants_fit_energy.txt")
os.system("cat opls_torsion_k_constants_fit_energy.txt")
os.system("cat periodic_torsion_k_constants_fit_energy.txt")

The plotted dihedral fits:

- "opls_all_single_fit_dihedral_k_constants_figure.pdf"
- "opls_all_summed_dihedrals_k_constants_figure.pdf"

Quick Installation/Setup

Note the mamba is used as a drop-in replacement for conda in the below installation, but conda works as well.

mamba install -c conda-forge mosdef-dihedral-fit
conda activate mosdef-dihedral-fit
cd $CONDA_PREFIX
git clone https://github.com/GOMC-WSU/GOMC.git --branch v2.75a
cd GOMC
chmod u+x metamake.sh NVT
./metamake.sh
ln -s $CONDA_PREFIX/GOMC/bin/GOMC_CPU_NVT $CONDA_PREFIX/bin

GOMC will also be removed when the mosdef_dihedral_fit environment is removed. The installation can be placed anywhere though, that path will just have to manually be passed for the variable gomc_binary_directory.

More setup information

For more complete setup information see the full installation documentation

Documentation

The MoSDeF-dihedral-fit documentation can be found here.

Dihedral Equations

OPLS-dihedral:

$$U_{OPLS} = \frac{k_0}{2}$$

$$+ \frac{k_1}{2} * (1 + cos(\theta)) + \frac{k_2}{2} * (1-cos(2 * \theta))$$

$$+ \frac{k_3}{2} * (1 + cos(3 * \theta)) + \frac{k_4}{2} *(1-cos(4 * \theta))$$

Ryckaert-Bellemans (RB)-torsions:

$$U_{RB} = C_0$$

$$+ C_1 * cos(\psi) + C_2 * cos(\psi)^2$$

$$+ C_3 * cos(\psi)^3 + C_4 * cos(\psi)^4$$

$$\psi = \theta - 180^o$$

Periodic-dihedral:

$$U_{Periodic} = K_0 * (1 + cos(n_0*\theta - 90^o))$$

$$+ K_1 * (1 + cos(n_1*\theta - 180^o)) + K_2 * (1 + cos(n_2*\theta))$$

$$+ K_3 * (1 + cos(n_3*\theta - 180^o)) + K_4 * (1 + cos(n_4*\theta))$$

Examples

Some basic workflows that use this package and cover several force field (FF) types are here. A summary of the FFs covered in the examples are listed below.

  • OPLS-AA: ethane dihedral
  • OPLS-AA: propanoic acid dihedral
  • AMBER-AA: butane dihedral
  • TraPPE-UA: butane dihedral
  • Mie-UA: butane dihedral
  • Exp6-AA: butane dihedral

Resources

This package is made as an API with MoSDeF and MoSDeF-GOMC. For mosdef_dihedral_fit to function, the forcefield files must be in a supported MoSDeF format (preferably the GMSO force field format), and use MoSDeF-GOMC and GOMC to perform the simulation setup and simulations.

Citations

  • Please cite MoSDeF-GOMC here
  • Other tools used in this package can be found in the MoSDeF-Dihedral-Fit documentation.