Skip to content

Commit

Permalink
Merge pull request #45 from bc118/rename_variables
Browse files Browse the repository at this point in the history
rename function variables
  • Loading branch information
bc118 authored Nov 21, 2023
2 parents 89bda2b + 85c8fb2 commit dff3f0e
Show file tree
Hide file tree
Showing 11 changed files with 631 additions and 32,507 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,25 @@ Import the required packages.
import unyt as u
from mosdef_dihedral_fit.dihedral_fit.fit_dihedral_with_gomc import fit_dihedral_with_gomc
import os
Select the desired variables, file, and set the temperature.

.. code:: ipython3
# The MoSDeF force field (FF) XML file which will be used.
FF_XML_file = 'path_to_file/oplsaa_ethane_HC_CT_CT_HC.xml'
forcefield_file = 'path_to_file/oplsaa_ethane_HC_CT_CT_HC.xml'
# The mol2 file which is used.
mol2_file = 'path_to_file/ethane_aa.mol2'
# The temperature of the Molecular Mechanics (MM) simulation.
temperature_in_unyt_units = 298.15 * u.Kelvin
# Choose mixing rule (VDWGeometricSigma_bool) to override the value (True or False)
# that was chosen in the force field (FF) XML file. This variable is not required and will be
# selected automatically; however, you should override it if you are unsure of the setting.
VDWGeometricSigma_bool = True
# Override the chosen mixing rule (combining_rule), 'geometric' or 'lorentz'),
# which was set in the force field (FF) XML file. This variable is not required and will be
# selected automatically; however, you can override it if you are unsure of the setting.
combining_rule = 'geometric'
# Atom type naming convention ( str, optional, default=’all_unique’, (‘general’ or ‘all_unique’) )
# General is safe and recommended since we are using a single FF XML file.
Expand All @@ -53,15 +54,15 @@ Select the desired variables, file, and set the temperature.
# More than 1 Gaussian file can be loaded, allowing the user to run multiple dihedral angles in separate file,
# minimizing the time required to run the simulations
# (i.e., the user can split them up into many simulations to obtain the full dihedral rotation).
log_files_and_removed_points = {
qm_log_file_dict = {
'path_to_file/HC_CT_CT_HC_multiplicity_1.log': [0],
}
# The dihedral which is being fit.
fit_dihedral_atom_types = ['HC', 'CT', 'CT', 'HC']
# All the other dihedrals which can be zeroed in the fitting process, in a nested list
zeroed_dihedrals = None
zero_dihedral_atom_types = None
Run the dihedral fit to fit to the MM simulations:
Expand All @@ -72,27 +73,52 @@ Run the dihedral fit to fit to the MM simulations:
fit_dihedral_with_gomc(
fit_dihedral_atom_types,
mol2_file,
FF_XML_file,
forcefield_file,
temperature_in_unyt_units,
gomc_binary_directory,
log_files_and_removed_points,
zeroed_dihedral_atom_types=zeroed_dihedrals,
qm_log_file_dict,
zero_dihedral_atom_types=zero_dihedral_atom_types,
qm_engine="gaussian",
VDWGeometricSigma=VDWGeometricSigma_bool,
combining_rule=combining_rule,
atom_type_naming_style='general',
gomc_cpu_cores=1,
fit_min_validated_r_squared=0.99,
fit_validation_r_squared_rtol=1e-03
r_squared_min=0.99,
r_squared_rtol=1e-03
)
The most important output files:

.. code:: ipython3
# The OPLS dihedral fit constants
print('The OPLS dihedral fit constants:\n')
os.system("cat opls_dihedral_k_constants_fit_energy.txt")
# The converted OPLS to periodic dihedral fit constants
print('The converted OPLS to periodic dihedral fit constants:\n')
os.system("cat periodic_dihedral_k_constants_fit_energy.txt")
# The converted OPLS to RB-torsions dihedral fit constants
print('The converted OPLS to RB-torsions dihedral fit constants:\n')
os.system("cat RB_torsion_k_constants_fit_energy.txt")
# This file contains the raw points used in the fits (QM - MM_less_dihedral(s)_energy being fit)
print('This file contains the raw points used in the fits (QM - MM_less_dihedral(s)_energy being fit):\n')
os.system("cat all_normalized_energies_in_kcal_per_mol.txt")
The plotted dihedral fits:
#. opls_all_single_fit_dihedral_k_constants_figure.pdf
#. opls_all_summed_dihedrals_k_constants_figure.pdf


Fit a dihedral for propionic acid using Gaussian-style output files
-------------------------------------------------------------------
The propionic acid CT-CT-C-OH dihedral fit example is provided below. This is an example where the CT-CT-C-OH is fit for both
CT-CT-C-OH and CT-CT-C-O, by fitting the CT-CT-C-OH and zeroing the CT-CT-C-O, which makes it easier to fit.

Additionally, one can perform the dihedral fit with QM calculations with any QM engine as long as they are in the
`Gaussian style output files format <https://github.com/GOMC-WSU/MoSDeF-dihedral-fit/tree/main/mosdef_dihedral_fit/utils/files/gaussian_style_output_files>`_
`Gaussian style output files format <https://github.com/GOMC-WSU/MoSDeF-dihedral-fit/tree/main/mosdef_dihedral_fit/tests/files/gaussian_style_output_files>`_
together with the GOMC Molecular Mechanics (MM) engine, and write out all the viable dihedral fits via the standard
OPLS equation. It also outputs the periodic dihedral format and the RB torsions format,
which are analytically converted from the standard OPLS dihedral fit.
Expand All @@ -106,24 +132,26 @@ Import the required packages.
import unyt as u
from mosdef_dihedral_fit.dihedral_fit.fit_dihedral_with_gomc import fit_dihedral_with_gomc
import os
Select the desired variables, file, and set the temperature.

.. code:: ipython3
# The MoSDeF force field (FF) XML file which will be used.
FF_XML_file = 'path_to_file/oplsaa_CT_CT_C_OH_in_COOH.xml'
forcefield_file = 'path_to_file/gmso_oplsaa_CT_CT_C_OH_in_COOH.xml'
# The mol2 file which is used.
mol2_file = 'path_to_file/CT_CT_C_3_OH.mol2'
# The temperature of the Molecular Mechanics (MM) simulation.
temperature_in_unyt_units = 298.15 * u.Kelvin
temperature_in_unyt_units = 25 * u.Celcius
# Choose mixing rule (VDWGeometricSigma_bool) to override the value (True or False)
# that was chosen in the force field (FF) XML file. This variable is not required and will be
# selected automatically; however, you should override it if you are unsure of the setting.
VDWGeometricSigma_bool = True
# Override the chosen mixing rule (combining_rule), 'geometric' or 'lorentz'),
# which was set in the force field (FF) XML file. This variable is not required and will be
# selected automatically; however, you can override it if you are unsure of the setting.
combining_rule = 'geometric'
# Atom type naming convention ( str, optional, default=’all_unique’, (‘general’ or ‘all_unique’) )
# General is safe and recommended since we are using a single FF XML file.
Expand All @@ -137,7 +165,7 @@ Select the desired variables, file, and set the temperature.
# More than 1 Gaussian file can be loaded, allowing the user to run multiple dihedral angles in separate file,
# minimizing the time required to run the simulations
# (i.e., the user can split them up into many simulations to obtain the full dihedral rotation).
log_files_and_removed_points = {
qm_log_file_dict = {
'path_to_file/output_folder_part_1': [],
'path_to_file/output_folder_part_2': [],
}
Expand All @@ -146,7 +174,7 @@ Select the desired variables, file, and set the temperature.
fit_dihedral_atom_types = ['CT', 'CT', 'C', 'OH']
# All the other dihedrals which can be zeroed in the fitting process, in a nested list
zeroed_dihedrals = [['CT', 'CT', 'C', 'O_3']]
zero_dihedral_atom_types = [['CT', 'CT', 'C', 'O_3']]
Run the dihedral fit to fit to the MM simulations:

Expand All @@ -156,16 +184,41 @@ Run the dihedral fit to fit to the MM simulations:
fit_dihedral_with_gomc(
fit_dihedral_atom_types,
mol2_file,
FF_XML_file,
forcefield_file,
temperature_in_unyt_units,
gomc_binary_directory,
log_files_and_removed_points,
qm_log_file_dict,
manual_dihedral_atom_numbers_list=[3, 2, 1, 4],
zeroed_dihedral_atom_types=zeroed_dihedrals,
zero_dihedral_atom_types=zero_dihedral_atom_types,
qm_engine="gaussian_style_final_files",
VDWGeometricSigma=VDWGeometricSigma_bool,
combining_rule=combining_rule,
atom_type_naming_style='general',
gomc_cpu_cores=1,
fit_min_validated_r_squared=0.99,
fit_validation_r_squared_rtol=5e-03
r_squared_min=0.99,
r_squared_rtol=5e-03
)
The most important output files:

.. code:: ipython3
# The OPLS dihedral fit constants
print('The OPLS dihedral fit constants:\n')
os.system("cat opls_dihedral_k_constants_fit_energy.txt")
# The converted OPLS to periodic dihedral fit constants
print('The converted OPLS to periodic dihedral fit constants:\n')
os.system("cat periodic_dihedral_k_constants_fit_energy.txt")
# The converted OPLS to RB-torsions dihedral fit constants
print('The converted OPLS to RB-torsions dihedral fit constants:\n')
os.system("cat RB_torsion_k_constants_fit_energy.txt")
# This file contains the raw points used in the fits (QM - MM_less_dihedral(s)_energy being fit)
print('This file contains the raw points used in the fits (QM - MM_less_dihedral(s)_energy being fit):\n')
os.system("cat all_normalized_energies_in_kcal_per_mol.txt")
The plotted dihedral fits:
#. opls_all_single_fit_dihedral_k_constants_figure.pdf
#. opls_all_summed_dihedrals_k_constants_figure.pdf
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Ryckaert-Bellemans (RB) torsion.
The **MoSDeF-dihedral-fit** software produces dihedral fits for existing force fields, compatible with
`GPU Optimized Monte Carlo (GOMC) >= v2.75 <http://gomc.eng.wayne.edu>`_ and
`Molecular Simulation Design Framework (MoSDeF) <https://mosdef.org>`_, with only tens of lines of python code,
the `Gaussian 16 <https://www.gaussin.com>`_ log files, and a **mol2** file.
the `Gaussian 16 <https://gaussian.com>`_ log files, and a **mol2** file.

.. note::
Currently, this means that only the fourth (4th) cosine multiple or power is utilized in the dihedral fit.
Expand Down
2 changes: 1 addition & 1 deletion docs/overview/general_info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Ryckaert-Bellemans (RB) torsion.
The **MoSDeF-dihedral-fit** software produces dihedral fits for existing force fields, compatible with
`GPU Optimized Monte Carlo (GOMC) >= v2.75 <http://gomc.eng.wayne.edu>`_ and
`Molecular Simulation Design Framework (MoSDeF) <https://mosdef.org>`_, with only tens of lines of python code,
the `Gaussian 16 <https://www.gaussin.com>`_ log files, and a **mol2** file.
the `Gaussian 16 <https://gaussian.com>`_ log files, and a **mol2** file.

.. note::
Currently, this means that only the fourth (4th) cosine multiple or power is utilized in the dihedral fit.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/citing_mosdef_dihedral_fit_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Citing

If you use this code for your research, please cite for following sources:

`The GitHub repository <https://github.com/GOMC-WSU/MoSDeF-GOMC>`_:
`The GitHub repository <https://github.com/GOMC-WSU/MoSDeF-dihedral-fit>`_:

**ACS**

Expand Down
Loading

0 comments on commit dff3f0e

Please sign in to comment.