Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2023.4.0 #184

Merged
merged 183 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
7fe12f5
Update Sire requirement to 2023.4.0.dev. [ci skip]
lohedges Jun 29, 2023
4dc3969
Merge branch 'main' into devel [ci skip]
lohedges Jun 30, 2023
a0c7df7
Check for non-periodic cartesian space. [closes #124]
lohedges Jul 3, 2023
84a4882
Update Python variants for development builds.
lohedges Jul 3, 2023
bddd28d
Exclude all but the latest Python from all but Linux.
lohedges Jul 3, 2023
5eb871f
Merge pull request #125 from OpenBioSim/fix_124
lohedges Jul 3, 2023
39b3b82
Allow user to specify backend in process.getTrajectory()
lohedges Jul 7, 2023
009bb8f
Update search.
lohedges Jul 7, 2023
0eb2c7b
Blacken.
lohedges Jul 7, 2023
46de830
Fix PLUMED version check. [closes OpenBioSim/BioSimSpaceTutorials#35]
lohedges Jul 7, 2023
8aee0e8
Pass work_dir to Plumed constructor as a string.
lohedges Jul 7, 2023
637c462
Merge pull request #128 from OpenBioSim/fix_tutorials
lohedges Jul 7, 2023
ee5cad7
Import correct alchemlyb extract function. [closes #132]
lohedges Jul 10, 2023
5dae34c
Increase distance tolerance in test.
lohedges Jul 10, 2023
6000c22
Reduce box vectors using OpenMM code to avoid rounding issue.
lohedges Jul 11, 2023
6eb3ce2
Merge pull request #133 from OpenBioSim/fix_132
lohedges Jul 11, 2023
cdfbbbf
Merge pull request #135 from OpenBioSim/fix_134
lohedges Jul 11, 2023
d25022e
Fixed OpenMM compatibility in BSSEqBoundNode.ipynb. [ci skip]
mb2055 Jul 13, 2023
d9c37e6
Fix the extract in the gmx.process
xiki-tempula Jul 13, 2023
0c7601f
Merge pull request #17 from Exscientia/feat_2023.3
xiki-tempula Jul 14, 2023
d7f3c5c
Merge pull request #138 from OpenBioSim/fix_137
mb2055 Jul 14, 2023
376966d
Update issue template. [ci skip]
lohedges Jul 25, 2023
89bf399
Add support for aligning principal axes of system to solvent box.
lohedges Jul 25, 2023
10d39ec
Merge pull request #143 from OpenBioSim/feature_139
lohedges Jul 26, 2023
64183f8
Fixed squash and unsquash in the case of explicit dummies (#18)
msuruzhon Jul 31, 2023
86244be
Fix use of totalSteps in OpenMM StateDataReporter.
lohedges Aug 1, 2023
ff55b2a
Fix totalSteps for minimisation protocol.
lohedges Aug 1, 2023
5df899e
Need to use totalSteps=1.
lohedges Aug 1, 2023
d36e73c
Merge pull request #146 from OpenBioSim/fix_145
lohedges Aug 1, 2023
9aeebb3
Add support for trajectory RMSD calculations with Sire.
lohedges Aug 1, 2023
d89be54
Modify test so that it passes for debugging purposes.
lohedges Aug 1, 2023
430467d
Just align to first molecule for now. Make molecules whole on load.
lohedges Aug 1, 2023
3a18893
Update water topology for Gro87 format. [ref #148]
lohedges Aug 2, 2023
92a815c
Add parameter to allow user to optionally match water naming convention.
lohedges Aug 2, 2023
a702a6b
Optimise by avoiding duplication of water topology check.
lohedges Aug 2, 2023
f470d23
Make sure property map is passed using keyword formatting.
lohedges Aug 2, 2023
67531fc
Further optimisations by avoiding duplicate water topology checks.
lohedges Aug 2, 2023
0e353be
Use new Sire trajectory RMSD API.
lohedges Aug 3, 2023
c773e29
Update test to use atoms spanning multiple molecules as a reference.
lohedges Aug 3, 2023
8c4f38c
Exclude crystal waters from genion and allow user to preserve water.
lohedges Aug 3, 2023
e5ae912
Merge branch 'fix_148' into feature_crystal_water
lohedges Aug 3, 2023
a5e326d
Allow user to preserve water topology on solvation and write.
lohedges Aug 4, 2023
8f6c2fb
Add charged example system to ensure crystal waters aren't removed.
lohedges Aug 4, 2023
c36b04b
Use property map to specify crystal water residue name and skip flag.
lohedges Aug 4, 2023
28f97d7
Remove debug statement.
lohedges Aug 7, 2023
837937a
Try to disable MDAnalysis logging, although this doesn't appear to work.
lohedges Aug 7, 2023
01b1924
Remove redundant attributes and imports. [closes #150]
lohedges Aug 7, 2023
686141c
Merge pull request #151 from OpenBioSim/fix_150
lohedges Aug 7, 2023
96f96b0
Merge branch 'devel' into feature_crystal_water
lohedges Aug 7, 2023
0c3cac0
Allow user to choose topology compatibility during parameterisation.
lohedges Aug 7, 2023
55cd074
Merge branch 'devel' into feature_sire_trajectory_rmsd
lohedges Aug 8, 2023
da215b0
Only return incompatible molecule if makeCompatibleWith fails.
lohedges Aug 8, 2023
40db118
Merge pull request #152 from OpenBioSim/feature_sire_trajectory_rmsd
lohedges Aug 8, 2023
0f00eeb
Merge branch 'devel' into feature_crystal_water
lohedges Aug 8, 2023
8d11aec
Don't disable MDAnalysis logging. It doesn't work and is confusing.
lohedges Aug 9, 2023
bfa5360
Merge branch 'devel' into feature_crystal_water
lohedges Aug 9, 2023
8cd856d
Add tutorial section for crystal waters.
lohedges Aug 9, 2023
ff36bb4
Pass property map as a keyword argument.
lohedges Aug 9, 2023
850fb06
First pass at porting @annamherz's analysis code.
lohedges Aug 10, 2023
8d98b6a
Assert alchemlyb is imported when used as analysis method.
lohedges Aug 10, 2023
6f84111
Use internal command_split utility function.
lohedges Aug 10, 2023
a623f59
Expose threshold to instance checkOverlap method.
lohedges Aug 10, 2023
aaf4f63
Remove debug pickle file.
lohedges Aug 10, 2023
5742d67
Fix indentation of conditional block.
lohedges Aug 10, 2023
06b3964
Fix case in string comparison.
lohedges Aug 10, 2023
8a23197
Fix extraction of SOMD TI data.
lohedges Aug 10, 2023
70c10bc
Handle different data type for alchemlyb 2+.
lohedges Aug 10, 2023
b906f70
Fix use of alchemlyb extract functions following refactor.
lohedges Aug 10, 2023
53d8fe2
Grammar tweak.
lohedges Aug 10, 2023
e757cad
Reorder member functions.
lohedges Aug 11, 2023
2787f90
Silence excessive pymbar warnings on startup.
lohedges Aug 11, 2023
79856c1
Add FEP analysis unit test.
lohedges Aug 11, 2023
813dfba
Unpin alchemlyb requirement.
lohedges Aug 11, 2023
cbc244d
Add alchemlyb requirement.
lohedges Aug 11, 2023
22be4e1
Change dictionary name.
lohedges Aug 11, 2023
68a13d4
Formatting tweak.
lohedges Aug 11, 2023
9f69f2a
Remove GROMACS version check since meaningless in a staticmethod.
lohedges Aug 11, 2023
b05f707
Check GROMACS is installed when performing native analysis.
lohedges Aug 11, 2023
1849ee4
Fix ridiculous Copilot case adjustments. (What was it doing?)
lohedges Aug 11, 2023
8872354
Use pathlib for OS agnostic file globbing.
lohedges Aug 11, 2023
d6068b5
No need to wrap partial in a staticmethod.
lohedges Aug 11, 2023
2da1660
Blacken.
lohedges Aug 11, 2023
c835706
Refactor to provide separate u_nk and dhdl extraction functions.
lohedges Aug 14, 2023
0ab909c
Fix comments. [ci skip]
lohedges Aug 15, 2023
1f1802a
Make the saveMetric method more robust (#19)
xiki-tempula Aug 16, 2023
f3a6d82
Remove end state connectivy properties if they are the same.
lohedges Aug 21, 2023
19343e4
Add test to make sure only a single connectivity property is present.
lohedges Aug 21, 2023
fb42edb
Handle different connectivity in either end state.
lohedges Aug 21, 2023
7cc2d8a
Add @annamherz's suggestions. [ci skip]
lohedges Aug 21, 2023
594210f
Relative class isn't private. [ci skip]
lohedges Aug 21, 2023
e6c2ee9
Allow support for different engines for analysis only.
lohedges Aug 22, 2023
0b97a4a
Make sure np.matrix is used for all overlap objects.
lohedges Aug 22, 2023
42ebe5a
Use try/except on NumPy array conversion.
lohedges Aug 22, 2023
a13c1e2
Merge pull request #157 from OpenBioSim/fix_merge_connectivity
lohedges Aug 23, 2023
5e5bb53
Use a shared property for file format.
lohedges Aug 23, 2023
fe5e17c
Handle shared properties on read.
lohedges Aug 23, 2023
a614ac9
Add shared space property when converting to OpenMM format. [ref #159]
lohedges Aug 23, 2023
616a7eb
No need to set and add property.
lohedges Aug 23, 2023
6fdda73
Merge pull request #160 from OpenBioSim/fix_159
lohedges Aug 24, 2023
c37f9e2
Ensure that SOMD pert files are always correct for ABFE
Sep 1, 2023
f328386
Merge some recent bugfixes (#24)
msuruzhon Sep 1, 2023
9f522d7
Add support for generating SOMD2 input. [ci skip]
lohedges Sep 1, 2023
e26d2d0
Merge pull request #164 from fjclark/bugfix_somd_pert_files
lohedges Sep 1, 2023
3c3129c
Simplify SOMD data to dataframe conversion. [ci skip]
lohedges Sep 1, 2023
a5c5e1e
Add initial support for SOMD2 FEP analysis. [ci skip]
lohedges Sep 1, 2023
6358a4b
Fix reduced potential calculation. [ci skip]
lohedges Sep 2, 2023
eba8da2
Convert dataframe column index to float. [ci skip]
lohedges Sep 2, 2023
bd4a680
Drop NaN values from returned dataframes. [ci skip]
lohedges Sep 2, 2023
24bbaa0
Revert "Merge some recent bugfixes (#24)"
Sep 4, 2023
bd77d4e
Remove note regarding reduction rounding bias.
lohedges Sep 7, 2023
0930573
Update expected box angles in test.
lohedges Sep 7, 2023
7e79b8b
Add methods to rotate and reduce box vectors.
lohedges Sep 7, 2023
d01d82f
Allow user to rotate and/or reduce box on read.
lohedges Sep 7, 2023
a04ec64
Use correct property name to avoid confusion.
lohedges Sep 7, 2023
e3dced0
Update space property in system following rotation.
lohedges Sep 7, 2023
1abdc4e
Grammar tweak.
lohedges Sep 7, 2023
f70ee55
Allow user to specify the box origin for rotation of vector properties.
lohedges Sep 12, 2023
38a88e0
Add unit test for triclinic box vector rotation.
lohedges Sep 12, 2023
b392af9
Add comment regarding unchanged angles.
lohedges Sep 12, 2023
fe7ab04
Decouple custom parameters and additional LEaP commands.
lohedges Sep 14, 2023
db24da9
Allow user to compute delta G between single leg end states. [ci skip]
lohedges Sep 14, 2023
41a132a
Fix use of wrong error variable. [ci skip]
lohedges Sep 14, 2023
b7c6627
Don't generate velocities when performing a continuation. [closes #168]
lohedges Sep 15, 2023
a181413
Update expected box angles in test.
lohedges Sep 7, 2023
f9bed33
Added some fixes to the solvation (#25)
msuruzhon Sep 18, 2023
f1f5276
Fixed PBC fixing when unsquashing for dummy atoms (#20)
xiki-tempula Sep 18, 2023
55bb6fc
Have amber process write binary RST file instead of text rst7 file (#22)
xiki-tempula Aug 21, 2023
be48fe8
Merge pull request #169 from OpenBioSim/fix_168
lohedges Sep 18, 2023
591a535
remove skip
xiki-tempula Sep 18, 2023
e82f367
fix import
xiki-tempula Sep 18, 2023
05667a2
Merge pull request #26 from Exscientia/feat_merge_0.9.2
xiki-tempula Sep 18, 2023
3357367
Simplify expresssion. [ci skip]
lohedges Sep 18, 2023
12c2806
Fix gradient unit for SOMD TI analysis.
lohedges Sep 18, 2023
3786be3
Remove redundant code and fix gradient units for SOMD2 TI analysis.
lohedges Sep 18, 2023
4a1f7ea
Update expected TI result in test.
lohedges Sep 18, 2023
2320fc7
Merge branch 'devel' into feature_analysis
lohedges Sep 18, 2023
1d9bdf7
Merge branch 'devel' into feature_167
lohedges Sep 18, 2023
65045f0
Merge pull request #154 from OpenBioSim/feature_crystal_water
lohedges Sep 19, 2023
563f1ee
Merge branch 'devel' into feature_analysis [ci skip]
lohedges Sep 19, 2023
8dcc8bc
Merge branch 'devel' into feature_reduce
lohedges Sep 19, 2023
d5e28e8
Fix test in devel (#27)
xiki-tempula Sep 19, 2023
20da673
Fix the tests such that it no longer require the working directory to…
xiki-tempula Sep 19, 2023
3c4a23d
Add a function for marking the alchemical ion (#30)
xiki-tempula Sep 19, 2023
8f3f910
Don't replace original space if loaded system has Cartesian space.
lohedges Sep 20, 2023
8aa7426
Make sure space isn't replaced when parsing trajectory frames too.
lohedges Sep 20, 2023
a2619d8
Try to get the space information from the trajectory file.
lohedges Sep 20, 2023
e3014dc
Merge pull request #173 from OpenBioSim/fix_172
lohedges Sep 20, 2023
44def0b
Merge pull request #170 from OpenBioSim/feature_167
lohedges Sep 22, 2023
b321c13
Merge branch 'devel' into feature_analysis. [ci skip]
lohedges Sep 22, 2023
691ad64
Merge branch 'devel' into feature_reduce
lohedges Sep 22, 2023
c74693a
Operate on a copy of the system to avoid breaking later test.
lohedges Sep 22, 2023
3a4c5ca
Merge pull request #175 from OpenBioSim/feature_reduce
lohedges Sep 22, 2023
5e61d49
Merge branch 'devel' into feature_analysis [ci skip]
lohedges Sep 22, 2023
110fd04
Simplify SOMD2 analysis following to_alchemlyb Pandas conversion.
lohedges Sep 26, 2023
f691d4c
Simplify TI gradient calculation. [ci skip]
lohedges Sep 26, 2023
8debf89
Sire DataFrames now correctly use floats for fep-lamda and columns.
lohedges Sep 27, 2023
015c6ab
Remove redundant imports. [ci skip]
lohedges Sep 29, 2023
b757035
Add equality operators.
lohedges Oct 2, 2023
62f28f0
Fix docstring formatting.
lohedges Oct 2, 2023
3738ec9
Protocol options can be passed as floats and add equality operators.
lohedges Oct 3, 2023
dccb4fb
Allow delta in equality due to rounding on unit conversion.
lohedges Oct 3, 2023
b764f84
Fixed conditional block.
lohedges Oct 3, 2023
56a4480
Standardise exception message.
lohedges Oct 3, 2023
58ad468
Fix Copilot error.
lohedges Oct 3, 2023
25ba5aa
Add missing equality operators and attribute comparisons.
lohedges Oct 3, 2023
ff1fa23
Add tests for protocol instantiation equivalence.
lohedges Oct 3, 2023
d29be4d
Always set gpu = 0, since it is an index into CUDA_VISIBLE_DEVICES.
lohedges Oct 6, 2023
85c71bc
Merge pull request #179 from OpenBioSim/feature_string_protocol
lohedges Oct 11, 2023
527b5f6
Merge pull request #181 from OpenBioSim/fix_180
lohedges Oct 11, 2023
cd8095c
Merge branch 'devel' into feature_analysis [ci skip]
lohedges Oct 11, 2023
2782ab9
review small fixes
annamherz Oct 11, 2023
607f0c4
Merge pull request #182 from annamherz/feature_analysis
lohedges Oct 11, 2023
44cd871
Formatting tweak. [ci skip]
lohedges Oct 11, 2023
7dd1dae
Skip Sire MCS fallback on Windows since currently unsupported.
lohedges Oct 12, 2023
60feb0d
Merge pull request #155 from OpenBioSim/feature_analysis
lohedges Oct 12, 2023
2d4d01a
Merge remote-tracking branch 'exscientia/devel' into sync_exscientia
lohedges Oct 12, 2023
b9f1c84
Increase distance tolerance.
lohedges Oct 12, 2023
4cceb23
Guard tests against missing packages.
lohedges Oct 12, 2023
a203510
Merge pull request #183 from OpenBioSim/sync_exscientia
lohedges Oct 13, 2023
663ce2f
Merge branch 'main' into release_2023.4.0
lohedges Oct 13, 2023
95d81d6
Update Sire version.
lohedges Oct 13, 2023
cc5556e
Update Python variants.
lohedges Oct 13, 2023
fb0ec00
Update CHANGELOG for the 2023.4.0 release.
lohedges Oct 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Steps to reproduce the behavior:
2. Run the code '...'
3. This is the exception that was raised / this is what went wrong.

(If possible, please quote code snippets using the markdown formatting
described [here](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code). This makes it easy to copy and paste the example, avoiding any translation errors.)

**Expected behavior**
A clear and concise description of what you expected to happen
(or, it should not raise an exception if an exception was raised)
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/Sandpit_exs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macOS-latest",]
python-version: ["3.8", ]
python-version: ["3.10",]

steps:
- uses: actions/checkout@v2
Expand All @@ -35,12 +35,10 @@ jobs:

- name: Install dependency
run: |
mamba install -c conda-forge -c openbiosim/label/main biosimspace python=3.8 ambertools gromacs "sire=2023.2.2" alchemlyb pytest pyarrow "typing-extensions!=4.6.0" openff-interchange pint=0.21 "rdkit<2023" "jaxlib>0.3.7" tqdm
mamba install -c conda-forge -c openbiosim/label/main biosimspace python=3.10 ambertools gromacs "sire=2023.3" "alchemlyb>=2.1" pytest openff-interchange pint=0.21 rdkit "jaxlib>0.3.7" tqdm
python -m pip install git+https://github.com/Exscientia/MDRestraintsGenerator.git
# For the testing of BSS.FreeEnergy.AlchemicalFreeEnergy.analysis
python -m pip install https://github.com/alchemistry/alchemtest/archive/master.zip
# Before the new alchemlyb is released
python -m pip install git+https://github.com/alchemistry/alchemlyb.git

- name: Install the dev version
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
max-parallel: 9
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11"]
platform:
- { name: "windows", os: "windows-latest", shell: "pwsh" }
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
Expand Down
6 changes: 1 addition & 5 deletions doc/source/api/index_Box.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ To support triclinic boxes that work across the range of molecular simulation
engines that support, we represent the triclinic space in reduced form, using
the approach documented in Appendix A of Chapter 3 from
`"Molecular dynamics of sense and sensibility in processing and analysis of data" <https://research.rug.nl/files/2839528/01_c1.pdf>`__
by Tsjerk A. Wassenaar. Due to the fixed-width format used to represent box
dimensions and angles in the various molecular input files, repeated reading
and writing can lead to oscillation of the box angles on reduction due to
rounding precision errors. To account for this, we add a small bias so that
we always round in a consistent direction.
by Tsjerk A. Wassenaar.

.. automodule:: BioSimSpace.Box

Expand Down
16 changes: 16 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ company supporting open-source development of fostering academic/industrial coll
within the biomolecular simulation community. Our software is hosted via the `OpenBioSim`
`GitHub <https://github.com/OpenBioSim/biosimspace>`__ organisation.

`2023.4.0 <https://github.com/openbiosim/biosimspace/compare/2023.3.1...2023.4.0>`_ - Oct 13 2023
-------------------------------------------------------------------------------------------------

* Add support for computing trajectory RMSDs using Sire backend (`#152 <https://github.com/OpenBioSim/biosimspace/pull/152>`__).
* Add support for setting up systems containing crystal waters (`#154 <https://github.com/OpenBioSim/biosimspace/pull/154>`__).
* Add unified free-energy perturbation analysis using ``alchemlyb`` (`@annamherz <https://github.com/annamherz>`_) (`#155 <https://github.com/OpenBioSim/biosimspace/pull/155>`__).
* Fix handling of connectivity changes during molecular perturbations (`#157 <https://github.com/OpenBioSim/biosimspace/pull/157>`__).
* Fix issues related to new shared properties in Sire (`#160 <https://github.com/OpenBioSim/biosimspace/pull/160>`__).
* Fix issues in SOMD perturbation files for absolute binding free-energy simulations (`@fkclark <https://github.com/fjclark>`_) (`#164 <https://github.com/OpenBioSim/biosimspace/pull/164>`__).
* Don't generate velocities when performing a continuation with GROMACS (`#169 <https://github.com/OpenBioSim/biosimspace/pull/169>`__).
* Decouple custom parameters and additional commands in ``LEaP`` input (`#170 <https://github.com/OpenBioSim/biosimspace/pull/170>`__).
* Check for periodic space when updating box information from restart file or trajectory (`#173 <https://github.com/OpenBioSim/biosimspace/pull/173>`__).
* Add functionality to allow manual rotation and reduction of triclinic boxes, rather than performing automatically on read (`#175 <https://github.com/OpenBioSim/biosimspace/pull/175>`__).
* Allow unit-based protocol options to be passed as strings (`#179 <https://github.com/OpenBioSim/biosimspace/pull/179>`__).
* Fix assignment of ``gpu`` configuration option for SOMD (`#181 <https://github.com/OpenBioSim/biosimspace/pull/181>`__).

`2023.3.1 <https://github.com/openbiosim/biosimspace/compare/2023.3.0...2023.3.1>`_ - Aug 14 2023
-------------------------------------------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion doc/source/contributors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ can be recognised.
* `@msuruzon <https://github.com/msuruzhon>`__
* `@xiki-tempula <https://github.com/xiki-tempula>`__
* `@kexul <https://github.com/kexul>`__
* `@mb2055 <https://github.com/mb2055>`__
135 changes: 135 additions & 0 deletions doc/source/tutorials/crystal_water.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
.. _ref_crystal_water:
=============
Crystal water
=============

.. toctree::
:maxdepth: 2

Water molecules are important for the structure, function, and dynamics of
proteins. When setting up a simulation it may be important to preserve
specific water molecules, often referred to as *crystal waters*. For example,
many structures from the `Protein Data Bank <https://www.rcsb.org/>`__
contain the coordinates of water molecules that are resolvable via X-ray
crystallography. In this example, we will use BioSimSpace to parameterise
and solvate a `tyrosine kinase 2 <https://en.wikipedia.org/wiki/Tyrosine_kinase_2>`__
protein structure containing two crystal waters within its binding site.

Firstly, let's load the PDB structure:

>>> import BioSimSpace as BSS
>>> tyk2_xtal = BSS.IO.readMolecules(
... BSS.IO.expand(
... BSS.IO.tutorialUrl(), "tyk2_xtal.pdb"
... )
...)[0]

This is a single molecule that contains the oxgyen atoms of two crystal waters
at the end of the structure:

>>> for residue in tyk2_xtal.getResidues()[-2:]:
... for atom in residue:
... print(atom, atom.coordinates())
...
<BioSimSpace.Atom: name='O', molecule=2, index=4652> (-4.5180 A, -0.0520 A, -15.6070 A)
<BioSimSpace.Atom: name='O', molecule=2, index=4653> (-7.2040 A, -8.5540 A, -20.7520 A)

We can use BioSimSpace to search for and extract the protein and water
components of the system. In this case, the waters are part of a residue
named ``WAT``, so we can use this as our search term:

>>> tyk2 = tyk2_xtal.extract(
... [atom.index() for atom in tyk2_xtal.search("not resname WAT").atoms()]
... )
>>> xtal_water = tyk2_xtal.extract(
... [atom.index() for atom in tyk2_xtal.search("resname WAT").atoms()]
... )

Now we have the components, we can parameterise them individually. First the
protein:

>>> tyk2 = BSS.Parameters.ff14SB(tyk2).getMolecule()

And then the water:

>>> xtal_water = BSS.Parameters.tip3p(
... xtal_water,
... water_model="tip3p",
... ensure_compatible=False
... ).getMolecule()

In this case we need to specify the desired water model, and also that we don't
want to ensure that the parameterised molecule is compatible with the topology
of the molecule that we passed in. This is because we are only passing in
oxygen atoms, so ``tLEaP`` will add the missing hydrogens.

.. note ::

By default, BioSimSpace ensures that the topology of the parameterised molecule(s)
matches that of the input molecule and will raise an exception if this is not
the case. This is because the input system is often required as a reference by
the user, e.g. they might want to preserve a specific naming convention, chain
identifiers, etc.

Let's check one of the parameterised crystal waters:

>>> for atom in xtal_water[0].getAtoms():
... print(atom, atom.coordinates())
...
<BioSimSpace.Atom: name='O', molecule=9, index=0> (-4.5180 A, -0.0520 A, -15.6070 A)
<BioSimSpace.Atom: name='H1', molecule=9, index=1> (-3.5608 A, -0.0520 A, -15.6070 A)
<BioSimSpace.Atom: name='H2', molecule=9, index=2> (-4.7580 A, 0.8746 A, -15.6070 A)

Note that the coordinates of the oxygen atom are preserved.

Once both components are parameterised, we can combine them together to create
a new system:

>>> system = tyk2.toSystem() + xtal_water

The next step in our setup procedure is to solvate the system in a water box.
Here we will use a truncated octahedral box with a base length of 7 nanometers:

>>> box, angles = BSS.Box.truncatedOctahedron(7 * BSS.Units.Length.nanometer)
>>> solvated = BSS.Solvent.tip3p(system, box=box, angles=angles)

Since the protein is charged, during the solvation process ``gmx genion`` will
have been used to neutralise the solvated system by adding counter ions. We can
check this as follows:

>>> print(system.charge(), solvated.charge())
... -2.0000 |e| -1.5091e-07 |e|
>>> print(len(solvated.search("element Na")))
... 2

In this case, two sodium ions have been added to neutralise the system. In
doing so, ``gmx genion`` will have removed two *random* water molecules. In
order to ensure that crystal waters are not removed, we temporarily tag them
with a unique residue and molecule name during solvation.

To check that they are preserved we can re-solvate the system, asking to
preserve the water naming for the existing waters in the system. (By default,
they will be updated to the default ``GROMACS`` naming convention.)

>>> solvated_no_match = BSS.Solvent.tip3p(
... system,
... box=box,
... angles=angles,
... match_water=False
... )

We can check that the crystal waters are still present as follows:

>>> for residue in solvated_no_match.getWaterMolecules().toSystem().search("resname WAT").residues():
... print(residue)
<BioSimSpace.Residue: name='WAT', molecule=8, index=0, nAtoms=3>
<BioSimSpace.Residue: name='WAT', molecule=9, index=0, nAtoms=3>

.. note ::

When solvating, molecules in the original system will be centered within the
solvation box, hence the coordinates of the crystal waters after solvation
won't necessarily match those from before. By setting ``match_water=False``,
it is possible to preserve the naming convention used for any existing
waters in the system. However, note that some simulation engines rely on a
specific naming convention for water molecules and a single solvent group.
1 change: 1 addition & 0 deletions doc/source/tutorials/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ please :doc:`ask for support. <../support>`
.. toctree::
:maxdepth: 1

crystal_water
hydration_freenrg
metadynamics
76 changes: 49 additions & 27 deletions nodes/playground/prepareFEP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@
" BSS.Gateway.String(\n",
" help=\"The root name for the files describing the perturbation input1->input2.\"\n",
" ),\n",
")\n",
"node.addInput(\n",
" \"somd2\",\n",
" BSS.Gateway.Boolean(\n",
" help=\"Whether to generate input for SOMD2.\",\n",
" default=False,\n",
" ),\n",
")"
]
},
Expand Down Expand Up @@ -321,18 +328,28 @@
"source": [
"# Log the mapping used\n",
"writeLog(lig1, lig2, mapping)\n",
"# Are we saving output for SOMD2?\n",
"is_somd2 = node.getInput(\"somd2\")\n",
"# File root for all output.\n",
"root = node.getInput(\"output\")\n",
"BSS.IO.saveMolecules(\n",
" \"merged_at_lam0.pdb\",\n",
" merged,\n",
" \"PDB\",\n",
" {\"coordinates\": \"coordinates0\", \"bond\": \"bond0\", \"element\": \"element0\"},\n",
")\n",
"# Generate package specific input\n",
"protocol = BSS.Protocol.FreeEnergy(runtime=2 * BSS.Units.Time.femtosecond, num_lam=3)\n",
"process = BSS.Process.Somd(system1, protocol)\n",
"process.getOutput()\n",
"with zipfile.ZipFile(\"somd_output.zip\", \"r\") as zip_hnd:\n",
" zip_hnd.extractall(\".\")"
"if is_somd2:\n",
" BSS.Stream.save(system1, root)\n",
" stream_file = \"%s.bss\" % root\n",
"else:\n",
" # Generate package specific input\n",
" protocol = BSS.Protocol.FreeEnergy(\n",
" runtime=2 * BSS.Units.Time.femtosecond, num_lam=3\n",
" )\n",
" process = BSS.Process.Somd(system1, protocol)\n",
" process.getOutput()\n",
" with zipfile.ZipFile(\"somd_output.zip\", \"r\") as zip_hnd:\n",
" zip_hnd.extractall(\".\")"
]
},
{
Expand All @@ -341,12 +358,12 @@
"metadata": {},
"outputs": [],
"source": [
"root = node.getInput(\"output\")\n",
"mergedpdb = \"%s.mergeat0.pdb\" % root\n",
"pert = \"%s.pert\" % root\n",
"prm7 = \"%s.prm7\" % root\n",
"rst7 = \"%s.rst7\" % root\n",
"mapping_str = \"%s.mapping\" % root"
"if not is_somd2:\n",
" mergedpdb = \"%s.mergeat0.pdb\" % root\n",
" pert = \"%s.pert\" % root\n",
" prm7 = \"%s.prm7\" % root\n",
" rst7 = \"%s.rst7\" % root\n",
" mapping_str = \"%s.mapping\" % root"
]
},
{
Expand All @@ -355,18 +372,19 @@
"metadata": {},
"outputs": [],
"source": [
"os.replace(\"merged_at_lam0.pdb\", mergedpdb)\n",
"os.replace(\"somd.pert\", pert)\n",
"os.replace(\"somd.prm7\", prm7)\n",
"os.replace(\"somd.rst7\", rst7)\n",
"os.replace(\"somd.mapping\", mapping_str)\n",
"try:\n",
" os.remove(\"somd_output.zip\")\n",
" os.remove(\"somd.cfg\")\n",
" os.remove(\"somd.err\")\n",
" os.remove(\"somd.out\")\n",
"except Exception:\n",
" pass"
"if not is_somd2:\n",
" os.replace(\"merged_at_lam0.pdb\", mergedpdb)\n",
" os.replace(\"somd.pert\", pert)\n",
" os.replace(\"somd.prm7\", prm7)\n",
" os.replace(\"somd.rst7\", rst7)\n",
" os.replace(\"somd.mapping\", mapping_str)\n",
" try:\n",
" os.remove(\"somd_output.zip\")\n",
" os.remove(\"somd.cfg\")\n",
" os.remove(\"somd.err\")\n",
" os.remove(\"somd.out\")\n",
" except Exception:\n",
" pass"
]
},
{
Expand All @@ -375,7 +393,11 @@
"metadata": {},
"outputs": [],
"source": [
"node.setOutput(\"nodeoutput\", [mergedpdb, pert, prm7, rst7, mapping_str])"
"if is_somd2:\n",
" output = [stream_file]\n",
"else:\n",
" output = [mergedpdb, pert, prm7, rst7, mapping_str]\n",
"node.setOutput(\"nodeoutput\", output)"
]
},
{
Expand All @@ -390,7 +412,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -404,7 +426,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.10.11"
}
},
"nbformat": 4,
Expand Down
Loading
Loading