Skip to content

Commit

Permalink
Merge pull request #111 from bc118/update_tests
Browse files Browse the repository at this point in the history
Added dihedral fits tests and updated/fixed build errors in the docs
  • Loading branch information
bc118 authored Aug 18, 2024
2 parents c1ff05a + 10ad1a3 commit 7921744
Show file tree
Hide file tree
Showing 8 changed files with 1,530 additions and 147 deletions.
3 changes: 2 additions & 1 deletion docs/environment_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ dependencies:
- pycifrw
- pytest
- pytest-cov
- mosdef-gomc>=1.3.0
- coverage
- mosdef-gomc>=1.4.0
- pre-commit
- sphinx=6.1.1
- pip
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/installation/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Install `GOMC <https://gomc-wsu.org/>`_
$ # The above line creates a symlink that should be findable for the gomc_binary_directory

.. note::
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.
The GOMC binary will be accessible when you activate the **mosdef_dihedral_fit** conda enviornment. 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**.

Install pre-commit
------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,34 @@ Fit the dihedral for Ethane using a Gaussian log file
-----------------------------------------------------
The ethane HC-CT-CT-HC dihedral fit example is provided below, where nine (9) of the HC-CT-CT-HC dihedral are fit simultaneously.


.. note::
The GOMC software need to be installed manually, outside of this Python install,
with it's directory/path specified in the dihedral fit function.

.. note::
**'atom_type_naming_style'** variable [str, optional, default= **'all_unique'**, (**'general'** or **'all_unique'**)].

Using **'general'** is preferred as it makes it easier to create the force field (FF) and is much
more human readable. For CHARMM-style FFs, like GOMC and NAMD, this means that all the general
atom/bead types that are in an atom class must have the same non-bonded VDW parameters
(i.e., for LJ for sigma and epsilon), but are allowed to have different partial charges;
otherwise, it will cause errors. This is because the partial charges are listed in the PSF file
for each atom individually, and not in the NAMD or GOMC FF file (.inp).
Typically, the bonded parameters are all handled as using general atom/bead classes
(Example: the carbon atoms in butane (C in CH3 and C in CH2) would have the same VDW and bonded
parameters, but will have different partial charges). The 'general' setting allows the fitting
of a group of atom/bead types together as an same atom class, where atom/bead class is
determined in the FF XML file for each atom/bead type.

Using **'all_unique'** basically sets each atom type as its own separate atom class. Therefore,
there is no distinction between atom type and atom class. This dihedral fit will on take into
account the specific atom type, and not fit the general class (ignoring any FF XML file settings),
which may make some dihedral fits more difficult. However, this could be the desired outcome in
some situations. Note: The MoSDeF force field does allow specific atom type dihedrals and other
bonded parameters, which override the atom class values, but all the atoms in the bonded FF
parameters must be the atom types.

atom_type_naming_style = 'general'

Perform the dihedral fit using the Gaussian log file as the Quantum Mechanics (QM) engine
and GOMC Molecular Mechanics (MM) engine, and write out all the viable dihedral fits via the standard
Expand Down Expand Up @@ -42,8 +65,14 @@ Select the desired variables, file, and set the temperature.
# 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.
# Atom type naming convention [str, optional, default='all_unique', ('general' or 'all_unique')].
# SEE TOP OF PAGE FOR MORE DETAILS.
# -----------------------------------------------------------------------------------------------
# The 'general' setting allows the fitting
# of a group of atom/bead types together as an same atom class, where atom/bead class is
# determined in the FF XML file for each atom/bead type.
# -----------------------------------------------------------------------------------------------
# Using 'all_unique' basically sets each atom type as its own separate atom class.
atom_type_naming_style = 'general'
# The GOMC binary path.
Expand Down Expand Up @@ -154,8 +183,14 @@ Select the desired variables, file, and set the temperature.
# 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.
# Atom type naming convention [str, optional, default='all_unique', ('general' or 'all_unique')].
# SEE TOP OF PAGE FOR MORE DETAILS.
# -----------------------------------------------------------------------------------------------
# The 'general' setting allows the fitting
# of a group of atom/bead types together as an same atom class, where atom/bead class is
# determined in the FF XML file for each atom/bead type.
# -----------------------------------------------------------------------------------------------
# Using 'all_unique' basically sets each atom type as its own separate atom class.
atom_type_naming_style = 'general'
# The GOMC binary path.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/contributing.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
================================
How to Contribute to the Project
=================================
================================

We welcome contributions to our project, whether it's adding a feature, fixing a bug, or improving documentation. The process is straightforward:

Expand Down
8 changes: 5 additions & 3 deletions docs/topic_guides/data_structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
Data Structures
===============


Calculate a Dihedral Angle
--------------------------

.. automodule:: mosdef_dihedral_fit.utils.math_operations
:members: dihedral_angle
.. automodule:: mosdef_dihedral_fit.utils.math_operations
:members: dihedral_angle


Fit a Dihedral
--------------

.. autofunction:: mosdef_dihedral_fit.dihedral_fit.fit_dihedral_with_gomc.fit_dihedral_with_gomc
.. automodule:: mosdef_dihedral_fit.dihedral_fit.fit_dihedral_with_gomc
:members: fit_dihedral_with_gomc
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ dependencies:
- pycifrw
- pytest
- pytest-cov
- mosdef-gomc>=1.3.0
- coverage
- mosdef-gomc>=1.4.0
- pre-commit
- sphinx=6.1.1
- pip
Expand Down
16 changes: 9 additions & 7 deletions mosdef_dihedral_fit/dihedral_fit/fit_dihedral_with_gomc.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ def fit_dihedral_with_gomc(
NOTE: The OPLS dihedral equation
.. math::
opls_dihedral_n_1 &= 1/2 *(
&= k0
&= + k1 * (1 + cos(1 * phi))
&= + k2 * (1 - cos(2 * phi))
&= + k3 * (1 + cos(3 * phi))
&= + k4 * (1 - cos(4 * phi))
&= )
U_{opls-dihedral} = 1/2 * (
k0 + k1 * (1 + cos[1 * phi])
+ k2 * (1 - cos[2 * phi])
.. math::
+ k3 * (1 + cos[3 * phi])
+ k4 * (1 - cos[4 * phi])
)
Parameters
----------
Expand Down
Loading

0 comments on commit 7921744

Please sign in to comment.