diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bea85a9..56bb8b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: trailing-whitespace exclude: '^docs/|setup.cfg|\.txt$|\.log$|\.xyz$|\.pdb$|\.mol2$' - repo: https://github.com/psf/black - rev: 23.11.0 + rev: 23.10.0 hooks: - id: black exclude: '^docs/|setup.cfg|\.txt$|\.log$|\.xyz$' diff --git a/README.md b/README.md index da5fd9d..2a9b59d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,88 @@ # MoSDeF-dihedral-fit -MoSDeF-dihedral-fit: A simple software package to fit dihedrals via the MoSDeF software +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)](https://pubs.acs.org/doi/10.1021/ja9621760) style +dihedrals, then also analytically converts them to the periodic dihedral and +Ryckaert-Bellemans (RB) torsion. + +```python +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 + ) +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" + + +## Installation/Setup +``` +conda install -c conda-forge mosdef-dihedral-fit +git clone https://github.com/GOMC-WSU/GOMC.git +cd GOMC +chmod u+x metamake.sh +./metamake.sh +``` + +## Documentation + +## Dihedral Equations + +OPLS-dihedral: + +$$OPLS_{Energy} = \frac{f_0}{2}$$ + +$$+ \frac{f_1}{2}*(1+cos(\theta)) + \frac{f_2}{2}*(1-cos(2*\theta))$$ +$$+ \frac{f_3}{2}*(1+cos(3*\theta)) + \frac{f_4}{2}*(1-cos(4*\theta))$$ + +Ryckaert-Bellemans (RB)-torsions: + +$$RB_{Energy} = 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: + +$$Periodic_{Energy} = 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
+ + - [ethane dihedral](https://github.com/GOMC-WSU/GOMC_Examples/tree/main/MoSDeF-dihedral-fit/ethane_HC_CT_CT_HC)
+ - [propanoic acid dihedral](https://github.com/GOMC-WSU/GOMC_Examples/tree/main/MoSDeF-dihedral-fit/protonated_fragment_CT_CT_C_OH)
+ +## Resources +This package is made as an API with [MoSDeF](https://github.com/mosdef-hub) and [MoSDeF-GOMC](https://github.com/GOMC-WSU/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. + + - [MoSDeF tools](https://mosdef.org) + - [MoSDeF-GOMC integration](https://mosdef-gomc.readthedocs.io/en/latest/index.html) + - [GOMC Examples](https://github.com/GOMC-WSU/GOMC_Examples/tree/main/MoSDef-GOMC) + - [MoSDeF GMSO Sample Forcefields](https://github.com/mosdef-hub/gmso/tree/main/gmso/utils/files/gmso_xmls/test_ffstyles) + +## Citations + + - Please cite MoSDeF-GOMC [here](https://mosdef-gomc.readthedocs.io/en/latest/reference/citing_mosdef_gomc_python.html) + - Other tools used in this package can be found in the MoSDeF-Dihedral-Fit documentation.