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_atol=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")
- "opls_all_single_fit_dihedral_k_constants_figure.pdf"
- "opls_all_summed_dihedrals_k_constants_figure.pdf"
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.
For more complete setup information see the full installation documentation
The MoSDeF-dihedral-fit documentation can be found here.
OPLS-dihedral:
Ryckaert-Bellemans (RB)-torsions:
Periodic-dihedral:
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
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.
- Please cite MoSDeF-GOMC here
- Other tools used in this package can be found in the MoSDeF-Dihedral-Fit documentation.