Skip to content

Commit 2ba2435

Browse files
Merge pull request #87 from wiederm/dev_doc
Merging dev_doc into main
2 parents 4643c08 + 58f77fc commit 2ba2435

File tree

82 files changed

+21455
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+21455
-101
lines changed

.github/workflows/build_page.yaml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: GH Pages build
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
- "main"
8+
pull_request:
9+
branches:
10+
- "master"
11+
- "main"
12+
workflow_dispatch:
13+
14+
env:
15+
# Increase this value to reset cache if etc/example-environment.yml has not changed
16+
CACHE_NUMBER: 1
17+
18+
jobs:
19+
build:
20+
strategy:
21+
matrix:
22+
include:
23+
- os: ubuntu-latest
24+
label: linux-64
25+
prefix: /usr/share/miniconda3/envs/fep
26+
name: ${{ matrix.label }}
27+
runs-on: ${{ matrix.os }}
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
32+
- name: Setup Mambaforge
33+
uses: conda-incubator/setup-miniconda@v2
34+
with:
35+
miniforge-variant: Mambaforge
36+
miniforge-version: latest
37+
activate-environment: fep
38+
auto-activate-base: false
39+
use-mamba: true
40+
- name: Set cache date
41+
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
42+
43+
- uses: actions/cache@v2
44+
with:
45+
path: ${{ matrix.prefix }}
46+
key: ${{ matrix.label }}-conda-${{ hashFiles('devtools/conda-envs/fep_env.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
47+
id: cache
48+
- name: Update environment
49+
run: mamba env update -n fep -f devtools/conda-envs/fep_env.yaml
50+
if: steps.cache.outputs.cache-hit != 'true'
51+
52+
#- name: Cache conda
53+
# uses: actions/cache@v2
54+
# with:
55+
# path: ~/conda_pkgs_dir
56+
# key:
57+
# ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
58+
# hashFiles('docs/requirements.yaml') }}
59+
#- name: Create conda env
60+
## # More info on options: https://github.com/conda-incubator/setup-miniconda
61+
# uses: conda-incubator/setup-miniconda@v2
62+
# with:
63+
# python-version: ${{ matrix.python-version }}
64+
# environment-file: docs/requirements.yaml
65+
# channels: conda-forge,defaults
66+
# activate-environment: docs
67+
## auto-update-conda: false
68+
# # auto-activate-base: false
69+
# show-channel-urls: true
70+
# use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
71+
- name: Run sphinx
72+
shell: bash -l {0}
73+
run: |
74+
pip install sphinx sphinx_rtd_theme
75+
sphinx-build docs docs/_build/html/
76+
# Create an artifact of the html output.
77+
- uses: actions/upload-artifact@v1
78+
with:
79+
name: DocumentationHTML
80+
path: docs/_build/html/
81+
# Publish built docs to gh-pages branch.
82+
# ===============================
83+
- name: Commit documentation changes
84+
run: |
85+
git clone https://github.com/wiederm/transformato.git --branch gh-pages --single-branch gh-pages
86+
cp -r docs/_build/html/* gh-pages/
87+
cd gh-pages
88+
touch .nojekyll
89+
git config --local user.email "[email protected]"
90+
git config --local user.name "GitHub Action"
91+
git add .
92+
git commit -m "Update documentation" -a || true
93+
# The above command will fail if no changes were present, so we ignore
94+
# that.
95+
- name: Push changes
96+
uses: ad-m/github-push-action@master
97+
with:
98+
branch: gh-pages
99+
directory: gh-pages

.github/workflows/restraints-test.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ ENV/
102102
.mypy_cache/
103103
transformato-vs.code-workspace
104104
.vscode/settings.json
105+
106+
# duecredit stuff
107+
*.duecredit.p

docs/.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 17f81071b0f509a41d8bac9566a79cdc
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/.nojekyll

Whitespace-only changes.

docs/Additional_Settings.rst

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
Additional Settings
2+
===================
3+
4+
Restraints
5+
##########
6+
7+
.. danger::
8+
This section only applies if you are running your simulations with **openMM**.
9+
Should you run your simulations using CHARMM, it will not apply the restraints
10+
and give **no warning about it**.
11+
12+
13+
14+
|trafo| supports two types of restraints: automatic and manual restraints.
15+
16+
Automatic Restraints
17+
*********************
18+
19+
To activate automatic restraints for your ligand, add
20+
21+
.. code-block:: yaml
22+
23+
simulation:
24+
restraints: "auto"
25+
26+
to your `config.yaml`. This wil restrain your ligand in its original position using a harmonic potential of the form :math:`E=0.5k \cdot (r-r_0)²` (where :math:`r`` is the current distance,:math:`r_0`` the initial distance, and :math:`k`` the force constant), applied within the centers of mass of your ligand and the surrounding protein structure, keeping these two vaguely fixed.
27+
28+
You may specify further keywords:
29+
30+
.. rubric:: Options for automatic restraints
31+
32+
.. object:: restraints: auto
33+
34+
35+
.. option:: k=[int]
36+
37+
*optional:* Defines the spring constant used for force calculations. Default is 3
38+
39+
.. option:: extremities=[int]
40+
41+
*optional:* If used, |trafo| will not restraint the entire common core but rather look for [int] extremities. These are then restrained to the surrounding protein carbon-alphas.
42+
43+
.. option:: shape=["harmonic","flatbottom"]`
44+
45+
*optional:* Defines the shape of the energy potential.
46+
47+
The potential energy term for the two forms is given as:
48+
49+
+ harmonic: :math:`E=0.5k \cdot (r-r_0)²`
50+
+ flatbottom: :math:`E=k \cdot step(|r-r_0|),thresh) \cdot (r-r_0)²,`
51+
52+
where :math:`r`` is the current distance, :math:`r_0`` the initial distance, and :math:`k`` the force constant. The step function returns 0 until the threshold :math:`thresh` (defined as :code:`wellsize` by the config.yaml) has been surpassed, after which it returns 1. As such,
53+
the flat-bottom potential is essentially a harmonic potential, where the energy within the \"well\" is zero. Note that the :code:`wellsize` acts like a *radius*, meaning it extends in all directions from its origin.
54+
55+
.. figure:: assets/images/harm_vs_fb.png
56+
:alt: harmonic and flatbottom potentials
57+
58+
Figure: The difference between a harmonic (*A*) and flat-bottom (*B*) potential. While both allow more movement closer to the restraint origin, a flat-bottom potential effectively allows defining
59+
a fixed sampling area that the ligand can move in without hindrance, but cannot leave (assuming a strong enough value for *k*).
60+
61+
.. option:: scaling
62+
63+
*optional:* If present, the k - Value of the force is linearly scaled in the first four intermediate states (``intst1: 0; intst2: 0.25; intst3: 0.5; intst4: 0.75; intst5: 1.0``)
64+
65+
.. option:: wellsize [float]
66+
67+
*optional*: Only takes effect in a flat-bottom potential. Defines the wellsize in nanometers. Default is 0.1 nm.
68+
69+
A full entry in your config.yaml might thus look like this:
70+
71+
72+
73+
.. code-block:: yaml
74+
75+
restraints: "auto k=10 extremities=3 shape=harmonic scaling"
76+
77+
78+
79+
.. caution:: Be somewhat sure of what your structure looks like, and do a sanity check on the generated restraints before production. As all restraints only act on the common core, setting an arbitrarily high number of extermities can lead to strange results
80+
81+
It should be noted that this means that a small file called `restraints.yaml` is created in your `intst*` - folders.
82+
These have the following structure:
83+
84+
85+
.. code-block:: yaml
86+
87+
system:
88+
structure:
89+
tlc: LIG # same as in the config.yaml, but only one structure (as only one relevant)
90+
91+
simulation:
92+
restraints: "auto" # same as in config.yaml
93+
ccs: # this represents an array of your common core, upon which restraints can be applied
94+
- C1
95+
- C2
96+
- H2
97+
intst:
98+
scaling:0.8 # for non-immediate switches, how far along the scaling is. Only relevant for harmonic potentials.
99+
100+
101+
It is not recommended to manually edit these files, as they are automatically created for each intermediate state.
102+
103+
Manual Restraints
104+
*****************
105+
106+
To activate manual restraints for your ligand, add
107+
108+
.. code-block:: yaml
109+
110+
simulation:
111+
restraints: "manual"
112+
113+
to your config.yaml. Below, you may now specify an arbitrary number
114+
of restraints using the
115+
`MDAnalysis selection syntax <https://docs.mdanalysis.org/stable/documentation_pages/selections.html#simple-selections>`_ :
116+
117+
.. code-block:: yaml
118+
119+
simulation:
120+
restraints: "manual"
121+
manualrestraints:
122+
restraint1:
123+
shape: "harmonic"
124+
group1: "resname LIG and type C"
125+
group2: "protein and type CA"
126+
k: 30
127+
r0: 2.41
128+
129+
You may define as many restraints as you like:
130+
131+
Code example with multiple restraints:
132+
133+
.. code-block:: yaml
134+
135+
simulation:
136+
restraints: "manual"
137+
manualrestraints:
138+
restraint1:
139+
shape: "harmonic"
140+
group1: "resname LIG and type C"
141+
group2: "protein and type CA"
142+
restraint2:
143+
shape: "flatbottom"
144+
group1: "resname LIG and type C"
145+
group2: "protein and type CA"
146+
restraint3:
147+
shape: "harmonic"
148+
group1: "resname LIG and name C14"
149+
group2: "sphlayer 5 15 name C14 and protein and type CA"
150+
151+
Note that the individual restraints all need to have distinct names (restraint1, restraint2 etc.). It is common that they are numbered, but not required - they simply need to adhere to the yaml syntax.
152+
153+
.. rubric:: Options for manual restraints
154+
155+
156+
.. object:: restraints: manual
157+
158+
.. object:: manual-restraint
159+
160+
You may freely choose the name of the restraint here. It may be useful to provide a 'speaking' name, as this will allow identification later.
161+
162+
.. option:: shape=["harmonic","flatbottom"]'
163+
164+
Shape of the energy potential. Default is "harmonic". See automatic restraints for details.
165+
166+
.. option:: group1,group2=[MDAnalysis selection string]
167+
168+
Defines which Common Core atoms are members of group1 or group2. Please note that group1 **must** be the ligand, and group2 the protein.
169+
170+
.. option:: k=[int]
171+
172+
*(optional):* Defines the harmonic force constant. Default is 3.
173+
174+
.. option:: wellsize=[float]
175+
176+
*(optional):* Defines the wellsize for flat-bottom restraints (unit is nanometers). Defaults to 0.1 nm.
177+
178+
179+
As with automatic restraints, even manually specified restraints will never act on atoms not in the common core, as this would lead to nonsensical energy calculations.
180+
181+
182+
Hydrogen Mass Repartitioning (HMR)
183+
####################################
184+
185+
To further accelerate MD simulations it is possible to reweight the masses of the hydrogen atoms and thus
186+
reduce the vibrational frequency of the corresponding hydrogen-heavy atom bond. When using ``cons: HBonds``
187+
one can safely increase the time step to 4 fs.
188+
To use HMR one can either check the box in the last step of the CHARMM-GUI solution builder while creating the
189+
system or one can use the `parmed <https://parmed.github.io/ParmEd/html/api/parmed/parmed.tools.actions.html#parmed.tools.actions.HMassRepartition>`_
190+
action tool (also available in the ``fep`` conda environment)
191+
192+
.. code-block:: python
193+
194+
psf = pm.charmm.CharmmPsfFile("step3_input_orig.psf")
195+
pm.tools.actions.HMassRepartition(psf).execute()
196+
psf.save("step3_input.psf", overwrite = True)
197+
198+
.. |trafo| replace:: :math:`\texttt{TRANSFORMATO}`
199+

0 commit comments

Comments
 (0)