waterEntropy 2.0.0__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. {waterentropy-2.0.0 → waterentropy-2.2.0}/.github/workflows/ci.yml +4 -4
  2. {waterentropy-2.0.0 → waterentropy-2.2.0}/.github/workflows/release.yml +2 -2
  3. {waterentropy-2.0.0 → waterentropy-2.2.0}/.readthedocs.yml +2 -1
  4. {waterentropy-2.0.0 → waterentropy-2.2.0}/PKG-INFO +3 -3
  5. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/Makefile +2 -3
  6. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/source/conf.py +2 -2
  7. {waterentropy-2.0.0 → waterentropy-2.2.0}/pyproject.toml +2 -2
  8. waterentropy-2.2.0/tests/recipes/test_bulk_water.py +94 -0
  9. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/recipes/test_interfacial_solvent.py +36 -3
  10. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/__init__.py +1 -1
  11. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/analysis/HB_labels.py +11 -6
  12. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/analysis/shell_labels.py +3 -0
  13. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/analysis/shells.py +1 -0
  14. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/entropy/orientations.py +104 -4
  15. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/entropy/vibrations.py +27 -3
  16. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/recipes/bulk_water.py +1 -0
  17. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/recipes/interfacial_solvent.py +1 -2
  18. {waterentropy-2.0.0 → waterentropy-2.2.0}/.github/dependabot.yml +0 -0
  19. {waterentropy-2.0.0 → waterentropy-2.2.0}/.gitignore +0 -0
  20. {waterentropy-2.0.0 → waterentropy-2.2.0}/.pre-commit-config.yaml +0 -0
  21. {waterentropy-2.0.0 → waterentropy-2.2.0}/LICENSE +0 -0
  22. {waterentropy-2.0.0 → waterentropy-2.2.0}/README.md +0 -0
  23. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/.gitignore +0 -0
  24. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/source/images/ccpbiosim-logo-white-background.png +0 -0
  25. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/source/images/waterentropy_logo_grey.png +0 -0
  26. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/source/index.rst +0 -0
  27. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/source/user_guide/hpc.rst +0 -0
  28. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/source/user_guide/parallel.rst +0 -0
  29. {waterentropy-2.0.0 → waterentropy-2.2.0}/docs/source/user_guide/serial.rst +0 -0
  30. {waterentropy-2.0.0 → waterentropy-2.2.0}/example_inputs/lysozyme_solution/system.gro +0 -0
  31. {waterentropy-2.0.0 → waterentropy-2.2.0}/example_inputs/lysozyme_solution/system.tpr +0 -0
  32. {waterentropy-2.0.0 → waterentropy-2.2.0}/example_inputs/lysozyme_solution/system.trr +0 -0
  33. {waterentropy-2.0.0 → waterentropy-2.2.0}/notebooks/interfacial_water_entropy.ipynb +0 -0
  34. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/__init__.py +0 -0
  35. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/analysis/test_RAD.py +0 -0
  36. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/__init__.py +0 -0
  37. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/amber/arginine_solution/README.md +0 -0
  38. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/amber/arginine_solution/system.nc +0 -0
  39. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/amber/arginine_solution/system.prmtop +0 -0
  40. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/gromacs/aspirin_solution/README.md +0 -0
  41. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/gromacs/aspirin_solution/system.gro +0 -0
  42. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/gromacs/aspirin_solution/system.prmtop +0 -0
  43. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/gromacs/aspirin_solution/system.trr +0 -0
  44. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/input_files/load_inputs.py +0 -0
  45. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/maths/test_trig.py +0 -0
  46. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/utils/__init__.py +0 -0
  47. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/utils/test_dask_clusters.py +0 -0
  48. {waterentropy-2.0.0 → waterentropy-2.2.0}/tests/utils/test_selections.py +0 -0
  49. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/analysis/HB.py +0 -0
  50. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/analysis/RAD.py +0 -0
  51. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/analysis/__init__.py +0 -0
  52. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/cli/runWaterEntropy.py +0 -0
  53. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/cli/run_find_Nc.py +0 -0
  54. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/entropy/__init__.py +0 -0
  55. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/entropy/convariances.py +0 -0
  56. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/maths/__init__.py +0 -0
  57. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/maths/transformations.py +0 -0
  58. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/maths/trig.py +0 -0
  59. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/recipes/__init__.py +0 -0
  60. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/recipes/forces_torques.py +0 -0
  61. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/utils/__init__.py +0 -0
  62. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/utils/dask_clusters.py +0 -0
  63. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/utils/helpers.py +0 -0
  64. {waterentropy-2.0.0 → waterentropy-2.2.0}/waterEntropy/utils/selections.py +0 -0
@@ -50,10 +50,10 @@ jobs:
50
50
  timeout-minutes: 15
51
51
  steps:
52
52
  - uses: actions/checkout@v6
53
- - name: Set up Python 3.11
53
+ - name: Set up Python 3.13
54
54
  uses: actions/setup-python@v6
55
55
  with:
56
- python-version: 3.11
56
+ python-version: 3.13
57
57
  - name: Install python dependencies
58
58
  run: |
59
59
  pip install --upgrade pip
@@ -66,10 +66,10 @@ jobs:
66
66
  timeout-minutes: 15
67
67
  steps:
68
68
  - uses: actions/checkout@v6
69
- - name: Set up Python 3.11
69
+ - name: Set up Python 3.13
70
70
  uses: actions/setup-python@v6
71
71
  with:
72
- python-version: 3.11
72
+ python-version: 3.13
73
73
  - name: Install python dependencies
74
74
  run: |
75
75
  pip install --upgrade pip
@@ -54,7 +54,7 @@ jobs:
54
54
 
55
55
  - name: send PR
56
56
  id: pr_id
57
- uses: peter-evans/create-pull-request@v8.0.0
57
+ uses: peter-evans/create-pull-request@v8.1.0
58
58
  with:
59
59
  commit-message: Update version to ${{ github.event.inputs.version }}
60
60
  branch: version-update
@@ -96,7 +96,7 @@ jobs:
96
96
  steps:
97
97
 
98
98
  - name: create release
99
- uses: softprops/action-gh-release@v2.5.0
99
+ uses: softprops/action-gh-release@v2.6.1
100
100
  with:
101
101
  name: v${{ github.event.inputs.version }}
102
102
  generate_release_notes: true
@@ -3,7 +3,7 @@ version: 2
3
3
  build:
4
4
  os: "ubuntu-22.04"
5
5
  tools:
6
- python: "3.11"
6
+ python: "3.13"
7
7
 
8
8
  python:
9
9
  install:
@@ -15,3 +15,4 @@ python:
15
15
  sphinx:
16
16
  # Path to your Sphinx configuration file.
17
17
  configuration: docs/source/conf.py
18
+ fail_on_warning: false
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: waterEntropy
3
- Version: 2.0.0
3
+ Version: 2.2.0
4
4
  Summary: Python package for calculating interfacial water entropy from molecular dynamics simulations.
5
5
  Keywords: water,entropy,molecular dynamics,forces
6
6
  Author-email: Jas Kalayan <jas.kalayan@stfc.ac.uk>
@@ -14,9 +14,9 @@ Classifier: Development Status :: 3 - Alpha
14
14
  License-File: LICENSE
15
15
  Requires-Dist: mdanalysis>=2.10.0
16
16
  Requires-Dist: numpy==2.3.5
17
- Requires-Dist: dask==2025.7.0
17
+ Requires-Dist: distributed==2026.1.2
18
+ Requires-Dist: dask==2026.1.2
18
19
  Requires-Dist: dask-jobqueue==0.9.0
19
- Requires-Dist: distributed==2025.7.0
20
20
  Requires-Dist: psutil==7.1.3
21
21
  Requires-Dist: sphinx ; extra == "docs"
22
22
  Requires-Dist: sphinx_rtd_theme ; extra == "docs"
@@ -21,10 +21,9 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
21
21
 
22
22
  .PHONY: all help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext customdefault
23
23
 
24
- ## Runs nit-picky and converting warnings into errors to
25
- ## make sure the documentation is properly written
24
+ ## Runs nit-picky
26
25
  customdefault:
27
- $(SPHINXBUILD) -b html -nW $(ALLSPHINXOPTS) $(BUILDDIR)/html
26
+ $(SPHINXBUILD) -b html -n $(ALLSPHINXOPTS) $(BUILDDIR)/html
28
27
 
29
28
  all: html
30
29
 
@@ -239,8 +239,8 @@ htmlhelp_basename = "waterentropy-doc"
239
239
  # Warnings to ignore when using the -n (nitpicky) option
240
240
  # We should ignore any python built-in exception, for instance
241
241
  nitpick_ignore = [
242
- ("py:class", "Logger"),
243
- ("py:class", "QbFields"),
242
+ # ignore warnings for `py:class reference target not found` for classes
243
+ ("py:class", "waterEntropy.analysis.HB_labels"),
244
244
  ]
245
245
 
246
246
  # -- Options for LaTeX output ---------------------------------------------
@@ -23,9 +23,9 @@ requires-python = ">=3.11"
23
23
  dependencies = [
24
24
  "mdanalysis>=2.10.0",
25
25
  "numpy==2.3.5",
26
- "dask==2025.7.0",
26
+ "distributed==2026.1.2",
27
+ "dask==2026.1.2",
27
28
  "dask-jobqueue==0.9.0",
28
- "distributed==2025.7.0",
29
29
  "psutil==7.1.3",
30
30
  ]
31
31
 
@@ -0,0 +1,94 @@
1
+ """ Tests for waterEntropy bulk water functions in neighbours."""
2
+
3
+ import numpy as np
4
+ import pytest
5
+
6
+ from tests.input_files import load_inputs
7
+ import waterEntropy.recipes.bulk_water as GetBulk
8
+
9
+
10
+ def bulk_water_entropy():
11
+ """Return the entropy dictionaries calcalated via serial process"""
12
+ system = load_inputs.get_amber_arginine_soln_universe()
13
+ Sorient_dict, covariances, vibrations = GetBulk.get_bulk_water_orient_entropy(
14
+ system, start=0, end=1, step=1
15
+ )
16
+ return (
17
+ Sorient_dict,
18
+ covariances,
19
+ vibrations,
20
+ )
21
+
22
+
23
+ BULK_WATER_ENTROPY_DICTS = pytest.mark.parametrize(
24
+ "bulk_water_entropy_dicts",
25
+ [bulk_water_entropy()],
26
+ )
27
+
28
+
29
+ @BULK_WATER_ENTROPY_DICTS
30
+ def test_Sorient_dict(bulk_water_entropy_dicts):
31
+ """Test outputted orientational entropy values of solvent molecules around a given solute molecule"""
32
+ # resid: {resname = [Sorient, count]}
33
+ Sorient_dict = bulk_water_entropy_dicts[0]
34
+ assert Sorient_dict["WAT"]["WAT"] == pytest.approx(
35
+ [
36
+ 11.295694179188464,
37
+ 867,
38
+ 6.053509907760105,
39
+ 6.053509907760105,
40
+ 6.053509907760105,
41
+ 0.2291068586055006,
42
+ 9.775154915649155,
43
+ 9.775154915649155,
44
+ ]
45
+ )
46
+
47
+
48
+ @BULK_WATER_ENTROPY_DICTS
49
+ def test_covariances(bulk_water_entropy_dicts):
50
+ """Test the covariance matrices"""
51
+
52
+ covariances = bulk_water_entropy_dicts[1]
53
+ forces = covariances.forces[("WAT", "WAT")]
54
+ torques = covariances.torques[("WAT", "WAT")]
55
+ count = covariances.counts[("WAT", "WAT")]
56
+
57
+ assert np.allclose(
58
+ forces,
59
+ np.array(
60
+ [
61
+ [677766.79725371, 57015.33553172, 1713.75817016],
62
+ [57015.33553172, 1498012.49688953, 37806.43086811],
63
+ [1713.75817016, 37806.43086811, 951068.82244533],
64
+ ]
65
+ ),
66
+ )
67
+ assert np.allclose(
68
+ torques,
69
+ np.array(
70
+ [
71
+ [8.82222234e06, -1.57822726e05, 5.92784745e05],
72
+ [-1.57822726e05, 6.49223541e06, 6.08836668e03],
73
+ [5.92784745e05, 6.08836668e03, 1.41024728e07],
74
+ ]
75
+ ),
76
+ )
77
+ assert count == 867
78
+
79
+
80
+ @BULK_WATER_ENTROPY_DICTS
81
+ def test_vibrations(bulk_water_entropy_dicts):
82
+ "Test the vibrational entropies"
83
+ vibrations = bulk_water_entropy_dicts[2]
84
+ Strans = vibrations.translational_S[("WAT", "WAT")]
85
+ Srot = vibrations.rotational_S[("WAT", "WAT")]
86
+ trans_freqs = vibrations.translational_freq[("WAT", "WAT")]
87
+ rot_freqs = vibrations.rotational_freq[("WAT", "WAT")]
88
+
89
+ assert np.allclose(Strans, np.array([17.59459292, 14.34269432, 16.2012916]))
90
+ assert np.allclose(sum(Strans), 48.1385788374531)
91
+ assert np.allclose(Srot, np.array([7.36084486, 8.51428332, 5.6781004]))
92
+ assert np.allclose(sum(Srot), 21.553228577722663)
93
+ assert np.allclose(trans_freqs, np.array([[677766, 1498012, 951068]]))
94
+ assert np.allclose(rot_freqs, np.array([[8822222, 6492235, 14102472]]))
@@ -59,9 +59,42 @@ def test_Sorient_dict(interfacial_entropy_dicts):
59
59
  """Test outputted orientational entropy values of solvent molecules around a given solute molecule"""
60
60
  # resid: {resname = [Sorient, count]}
61
61
  Sorient_dict = interfacial_entropy_dicts[0]
62
- assert Sorient_dict[1]["ACE"] == pytest.approx([2.2473807716251804, 13])
63
- assert Sorient_dict[2]["ARG"] == pytest.approx([2.6481382191024245, 35])
64
- assert Sorient_dict[3]["NME"] == pytest.approx([0.9503950365967891, 12])
62
+ assert Sorient_dict[1]["ACE"] == pytest.approx(
63
+ [
64
+ 2.2473807716251804,
65
+ 13,
66
+ 6.467857142857143,
67
+ 5.257142857142858,
68
+ 2.9594964080590276,
69
+ 0.10765314493056646,
70
+ 10.670272583734757,
71
+ 8.183120170171872,
72
+ ]
73
+ )
74
+ assert Sorient_dict[2]["ARG"] == pytest.approx(
75
+ [
76
+ 2.6481382191024245,
77
+ 35,
78
+ 7.3085782312925165,
79
+ 5.835721088435374,
80
+ 3.2771824257183773,
81
+ 0.10732165472942556,
82
+ 12.039086367415315,
83
+ 9.1274183064461,
84
+ ]
85
+ )
86
+ assert Sorient_dict[3]["NME"] == pytest.approx(
87
+ [
88
+ 0.9503950365967891,
89
+ 12,
90
+ 6.538461538461538,
91
+ 5.1923076923076925,
92
+ 2.050259026687599,
93
+ 0.07010328362114078,
94
+ 10.77132783200613,
95
+ 8.187096360116465,
96
+ ]
97
+ )
65
98
 
66
99
 
67
100
  @INTERFACIAL_ENTROPY_DICTS
@@ -3,4 +3,4 @@
3
3
  # Add imports here
4
4
  # from waterEntropy.neighbours.force_torque import *
5
5
 
6
- __version__ = "2.0.0"
6
+ __version__ = "2.2.0"
@@ -18,12 +18,13 @@ class HBLabelCollection:
18
18
  The counts are placed into two dictionaries used for statistics later,
19
19
  the structure of these two dictionaries are as follows:
20
20
 
21
- dict1 = {"resname": {("labelled_shell"): {"shell_count": 0,
21
+ dict1 = {"resname": {("labelled_shell"): {"shell_count": 0, "N_w": N_w,
22
22
  "donates_to": {"labelled_donators": 0,},
23
23
  "accepts_from": {"labelled_acceptors": 0,}
24
24
  }}}
25
25
  dict2 = {"nearest_resid": {"resname":
26
26
  {("labelled_shell"): {"shell_count": 0,
27
+ "N_w": N_w,
27
28
  "donates_to": {"labelled_donators": 0,},
28
29
  "accepts_from": {"labelled_acceptors": 0,}
29
30
  }}}
@@ -33,14 +34,14 @@ class HBLabelCollection:
33
34
  self.labelled_shell_counts = nested_dict() # save shell instances in here
34
35
  self.resid_labelled_shell_counts = nested_dict() # save shell instances in here
35
36
 
36
- def add_data(self, resid, resname, labelled_shell, donates_to, accepts_from):
37
+ def add_data(self, resid, resname, labelled_shell, donates_to, accepts_from, N_w):
37
38
  # pylint: disable=too-many-arguments
38
39
  """Add data to class dictionaries"""
39
- self.add_shell_counts(resid, resname, labelled_shell)
40
+ self.add_shell_counts(resid, resname, labelled_shell, N_w)
40
41
  self.add_donates_to(resid, resname, labelled_shell, donates_to)
41
42
  self.add_accepts_from(resid, resname, labelled_shell, accepts_from)
42
43
 
43
- def add_shell_counts(self, resid, resname, labelled_shell):
44
+ def add_shell_counts(self, resid, resname, labelled_shell, N_w):
44
45
  """
45
46
  Add a labelled shell to a dictionary that keeps track of the counts
46
47
  for each labelled shell type with constituents alpha-numerically
@@ -54,6 +55,7 @@ class HBLabelCollection:
54
55
  labelled_shell = tuple(sorted(labelled_shell))
55
56
  if "shell_count" not in self.labelled_shell_counts[resname][labelled_shell]:
56
57
  self.labelled_shell_counts[resname][labelled_shell]["shell_count"] = 1
58
+ self.labelled_shell_counts[resname][labelled_shell]["N_w"] = N_w
57
59
  else:
58
60
  self.labelled_shell_counts[resname][labelled_shell]["shell_count"] += 1
59
61
 
@@ -64,6 +66,9 @@ class HBLabelCollection:
64
66
  self.resid_labelled_shell_counts[resid][resname][labelled_shell][
65
67
  "shell_count"
66
68
  ] = 1
69
+ self.resid_labelled_shell_counts[resid][resname][labelled_shell][
70
+ "N_w"
71
+ ] = N_w
67
72
  else:
68
73
  self.resid_labelled_shell_counts[resid][resname][labelled_shell][
69
74
  "shell_count"
@@ -213,7 +218,7 @@ class HBLabelCollection:
213
218
  in self.resid_labelled_shell_counts[resid][resname][
214
219
  labelled_shell
215
220
  ]
216
- ):
221
+ ) and D_A_count_key != "N_w": # N_w = fixed
217
222
  self.resid_labelled_shell_counts[resid][resname][
218
223
  labelled_shell
219
224
  ][D_A_count_key] += other.resid_labelled_shell_counts[
@@ -277,7 +282,7 @@ class HBLabelCollection:
277
282
  if (
278
283
  D_A_count_key
279
284
  in self.labelled_shell_counts[resname][labelled_shell]
280
- ):
285
+ ) and D_A_count_key != "N_w": # N_w = fixed
281
286
  self.labelled_shell_counts[resname][labelled_shell][
282
287
  D_A_count_key
283
288
  ] += other.labelled_shell_counts[resname][labelled_shell][
@@ -34,6 +34,7 @@ def get_shell_labels(atom_idx: int, system, shell, shells: ShellCollection):
34
34
  if nearest_nonlike_idx is not None:
35
35
  nearest_nonlike = system.atoms[nearest_nonlike_idx]
36
36
  shell_labels = []
37
+ N_w = 0
37
38
  for n in shell.UA_shell:
38
39
  neighbour = system.atoms[n]
39
40
  # 3a. label nearest nonlike atom as "0_RESNAME"
@@ -51,6 +52,7 @@ def get_shell_labels(atom_idx: int, system, shell, shells: ShellCollection):
51
52
  neighbour.index != nearest_nonlike.index
52
53
  and neighbour.resname == center.resname
53
54
  ):
55
+ N_w += 1
54
56
  neighbour_shell = shells.find_shell(neighbour.index)
55
57
  if not neighbour_shell:
56
58
  neighbour_shell = RADShell.get_RAD_shell(neighbour, system, shells)
@@ -81,6 +83,7 @@ def get_shell_labels(atom_idx: int, system, shell, shells: ShellCollection):
81
83
  shell_labels.append(f"X_{neighbour.resname}")
82
84
  shell.labels = shell_labels # sorted(shell_labels) #don't sort yet
83
85
  shell.nearest_nonlike_idx = nearest_nonlike.index
86
+ shell.N_w = N_w
84
87
  return shell
85
88
 
86
89
 
@@ -55,6 +55,7 @@ class ShellCollection:
55
55
  self.set_property(atom_idx, "labels", None)
56
56
  self.set_property(atom_idx, "donates_to_labels", None)
57
57
  self.set_property(atom_idx, "accepts_from_labels", None)
58
+ self.set_property(atom_idx, "N_w", None)
58
59
 
59
60
  def set_property(self, atom_idx, key: str, value):
60
61
  """Set a property for a specific atom shell, ensuring it exists first.
@@ -3,6 +3,7 @@ Store orientational entropies here
3
3
  """
4
4
 
5
5
  from collections import Counter
6
+ import textwrap
6
7
 
7
8
  import numpy as np
8
9
 
@@ -17,6 +18,8 @@ class WaterOrientCalculator:
17
18
 
18
19
  def __init__(self):
19
20
  self.Sorient = 0
21
+ self.Nc_eff = 0
22
+ self.pbias_ave = 0
20
23
 
21
24
  def add_data(self, shell_label: list, shell_values: dict):
22
25
  """
@@ -35,6 +38,31 @@ class WaterOrientCalculator:
35
38
  degeneracy, pD_dict, pA_dict
36
39
  )
37
40
  self.Sorient = self.get_orientation_S(Nc_eff, pbias_ave)
41
+ self.Nc_eff = Nc_eff
42
+ self.pbias_ave = pbias_ave
43
+
44
+ def get_non_HB_data(self, Nc):
45
+ """
46
+ Calculate water orientational entropies without accounting for
47
+ HB biasing, using the following equation (as in the host-guest systems
48
+ paper, https://doi.org/10.1007/s10822-021-00406-5):
49
+
50
+ .. math::
51
+ S_\\mathrm{orient} = \\ln \\Bigg(N_c ^ {(3 / 2)} \times \\pi ^ {0.5}
52
+ \times \frac{p_\\mathrm{corr}}{\\sigma} \\Bigg)
53
+
54
+ where :math:`N_{c}` is the number of UAs in the coordination shell,
55
+ :math:`p_\\mathrm{corr}` is the probability that the neighboring
56
+ molecules are oriented suitably for each solute, which is set to 0.25
57
+ for water. And :math:`\\sigma` is the symmetry number for water which
58
+ is 2.
59
+
60
+ """
61
+ S_orient = 0
62
+ if Nc != 0:
63
+ S_orient = np.log((Nc) ** (3 / 2) * np.pi**0.5 * 0.25 / 2)
64
+ S_orient = max(S_orient, 0)
65
+ return S_orient * self.GAS_CONSTANT
38
66
 
39
67
  def get_shell_degeneracy(self, shell_label: list):
40
68
  """
@@ -234,7 +262,7 @@ class Orientations:
234
262
  shell with format:
235
263
 
236
264
  resid_labelled_dict = {"nearest_resid": {"resname":
237
- {("labelled_shell"): {"shell_count": 0,
265
+ {("labelled_shell"): {"shell_count": 0, "N_w": N_w,
238
266
  "donates_to": {"labelled_donators": 0,},
239
267
  "accepts_from": {"labelled_acceptors": 0,}
240
268
  }}}
@@ -276,6 +304,7 @@ class Orientations:
276
304
  shell with format:
277
305
 
278
306
  labelled_dict = {"resname": {("labelled_shell"): {"shell_count": 0,
307
+ "N_w": N_w,
279
308
  "donates_to": {"labelled_donators": 0,},
280
309
  "accepts_from": {"labelled_acceptors": 0,}
281
310
  }}}
@@ -287,13 +316,58 @@ class Orientations:
287
316
  """
288
317
  for resname, shell_label_key in sorted(list(labelled_dict.items())):
289
318
  Sorient_ave, tot_count = 0, 0
319
+ N_c_ave, N_w_ave, Nc_eff_ave, pbias_ave = 0, 0, 0, 0
320
+ Sorient_Nc_ave, Sorient_Nw_ave = 0, 0
290
321
  for shell_label, values in sorted(list(shell_label_key.items())):
322
+ # create object for Sorient
291
323
  water = WaterOrientCalculator()
324
+ # calculate Sorient for water with given shell and solute
325
+ # neighbour using HB biasing
292
326
  water.add_data(shell_label, values)
327
+
328
+ # add water entropies using previous methods that don't account
329
+ # for HBing
330
+ N_c = len(shell_label)
331
+ N_w = values["N_w"]
332
+ Sorient_Nc = water.get_non_HB_data(N_c)
333
+ Sorient_Nw = water.get_non_HB_data(N_w)
334
+
335
+ # only update tot_count here
336
+ # get running average for HB biased Sorient
293
337
  Sorient_ave, tot_count = self.get_running_average(
294
338
  water.Sorient, values["shell_count"], Sorient_ave, tot_count
295
339
  )
296
- Sorient_dict[resname] = [Sorient_ave, tot_count]
340
+ # ignore the _tot_count
341
+ # get running average for non-HB Sorient
342
+ Sorient_Nc_ave, _tot_count = self.get_running_average(
343
+ Sorient_Nc, values["shell_count"], Sorient_Nc_ave, tot_count
344
+ )
345
+ Sorient_Nw_ave, _tot_count = self.get_running_average(
346
+ Sorient_Nw, values["shell_count"], Sorient_Nw_ave, tot_count
347
+ )
348
+ # get average terms for Nc and pbais
349
+ Nc_eff_ave, _tot_count = self.get_running_average(
350
+ water.Nc_eff, values["shell_count"], Nc_eff_ave, tot_count
351
+ )
352
+ pbias_ave, _tot_count = self.get_running_average(
353
+ water.pbias_ave, values["shell_count"], pbias_ave, tot_count
354
+ )
355
+ N_c_ave, _tot_count = self.get_running_average(
356
+ N_c, values["shell_count"], N_c_ave, tot_count
357
+ )
358
+ N_w_ave, _tot_count = self.get_running_average(
359
+ N_w, values["shell_count"], N_w_ave, tot_count
360
+ )
361
+ Sorient_dict[resname] = [
362
+ Sorient_ave,
363
+ tot_count,
364
+ N_c_ave,
365
+ N_w_ave,
366
+ Nc_eff_ave,
367
+ pbias_ave,
368
+ Sorient_Nc_ave,
369
+ Sorient_Nw_ave,
370
+ ]
297
371
 
298
372
 
299
373
  def print_Sorient_dicts(Sorient_dict: dict):
@@ -302,6 +376,32 @@ def print_Sorient_dicts(Sorient_dict: dict):
302
376
 
303
377
  :param Sorient_dict: dictionary containing orientational entropy values
304
378
  """
379
+ terms = """
380
+ Orientations
381
+ ============
382
+ resid: residue ID of the closest solute to the waters
383
+ resname: name of the residue associated with the residue ID
384
+ Sor: Orientational entropy of water around residue using HB biasing
385
+ count: total number of waters around the residue across frames analysed
386
+ N_c: average number of UAs around waters analysed
387
+ N_w: average number of water UAs around waters analysed
388
+ Nc_eff: average number of effective neighbouts that waters can HB with
389
+ pbias: average of the probability of forming HBs with neighbouring UAs
390
+ Sor_Nc: Orientational entropy of water around residue using Nc (no HB bias)
391
+ Sor_Nw: Orientational entropy of water around residue using Nw (no HB bias)
392
+ """
393
+ print(textwrap.dedent(terms))
394
+
395
+ print("resid resname Sor count N_c N_w Nc_eff pbias Sor_Nc Sor_Nw")
305
396
  for resid, resname_key in sorted(list(Sorient_dict.items())):
306
- for resname, [Sor, count] in sorted(list(resname_key.items())):
307
- print(resid, resname, Sor, count)
397
+ for resname, [Sor, count, N_c, N_w, Nc_eff, pbias, Sor_Nc, Sor_Nw] in sorted(
398
+ list(resname_key.items())
399
+ ):
400
+ decimals = 4
401
+ print(
402
+ f"{resid} {resname} {Sor:.{decimals}f} {count} "
403
+ f"{N_c:.{decimals}f} {N_w:.{decimals}f} "
404
+ f"{Nc_eff:.{decimals}f} {pbias:.{decimals}f} "
405
+ f"{Sor_Nc:.{decimals}f} {Sor_Nw:.{decimals}f} "
406
+ )
407
+ print()
@@ -2,6 +2,8 @@
2
2
  Store vibrational entropy from covariance matrices
3
3
  """
4
4
 
5
+ import textwrap
6
+
5
7
  import numpy as np
6
8
  from numpy import linalg as LA
7
9
 
@@ -197,15 +199,37 @@ def print_Svib_data(vibrations: Vibrations, covariances: CovarianceCollection):
197
199
  :param vibrations: instance of Vibrations class
198
200
  :param covariances: instance of CovarianceCollection class
199
201
  """
202
+ terms = """
203
+ Vibrations
204
+ ==========
205
+ resid: residue ID of the closest solute to the waters
206
+ resname: name of the residue associated with the residue ID
207
+ solvent_name: name of the solvent near the solute
208
+ Strans: sum of 3 translational terms to give total translational entropy
209
+ Srot: sum of 3 rotational terms to give total rotational entropy
210
+ Svib: vibrational entropy (Strans+Srot) of water molecules
211
+ counts: total number of waters around the nearest solute across frames analysed
212
+ """
213
+ print(textwrap.dedent(terms))
214
+ print("resid resname solvent_name Strans Srot Svib counts")
215
+ decimals = 4
200
216
  for near_solvent_name, Strans in vibrations.translational_S.items():
201
- near = near_solvent_name[0]
217
+ if "_" in near_solvent_name[0]:
218
+ resname, resid = near_solvent_name[0].split("_")
219
+ else:
220
+ resname, resid = near_solvent_name[0], "N/A"
202
221
  solvent_name = near_solvent_name[1]
203
222
  # forces = covariances.forces[near_solvent_name]
204
223
  # torques = covariances.torques[near_solvent_name]
205
224
  Strans = vibrations.translational_S[near_solvent_name]
206
225
  Srot = vibrations.rotational_S[near_solvent_name]
226
+ Svib = sum(Strans) + sum(Srot)
207
227
  # trans_freqs = vibrations.translational_freq[near_solvent_name]
208
228
  # rot_freqs = vibrations.rotational_freq[near_solvent_name]
209
229
  counts = covariances.counts[near_solvent_name]
210
- print(near, solvent_name, Strans, Srot, counts)
211
- print(near, solvent_name, sum(Strans), sum(Srot), counts)
230
+ # print(near, solvent_name, Strans, Srot, counts)
231
+ print(
232
+ f"{resid} {resname} {solvent_name} {sum(Strans):.{decimals}f} "
233
+ f"{sum(Srot):.{decimals}f} {Svib:.{decimals}f} {counts}"
234
+ )
235
+ print()
@@ -59,6 +59,7 @@ def get_bulk_water_orient_entropy(
59
59
  shell.labels,
60
60
  shell.donates_to_labels,
61
61
  shell.accepts_from_labels,
62
+ len(shell.labels), # set N_w
62
63
  )
63
64
  # 3e. calculate the running average of force and torque
64
65
  # covariance matrices
@@ -118,7 +118,6 @@ def get_interfacial_shells(system, start: int, end: int, step: int):
118
118
  frame_solvent_shells = nested_dict()
119
119
  # pylint: disable=unused-variable
120
120
  for ts in system.trajectory[start:end:step]:
121
- # print(ts)
122
121
  # initialise the RAD and HB class instances to store shell information
123
122
  shells = ShellCollection()
124
123
  # 1. find > 1 UA molecules in system, these are the solutes
@@ -305,7 +304,6 @@ def _entropy_per_step(args):
305
304
  # 7. iterate through first shell solvent and find their RAD shells,
306
305
  # HBing in the shells and shell labels
307
306
  for solvent in first_shell_solvent:
308
- # print(solvent)
309
307
  # 8a. find RAD shell of interfacial solvent
310
308
  shell = RADShell.get_RAD_shell(solvent, system, shells)
311
309
  # 8b. find HBing in the shell
@@ -326,6 +324,7 @@ def _entropy_per_step(args):
326
324
  shell.labels,
327
325
  shell.donates_to_labels,
328
326
  shell.accepts_from_labels,
327
+ shell.N_w,
329
328
  )
330
329
  frame_solvent_indices = save_solvent_indices(
331
330
  ts.frame,
File without changes
File without changes
File without changes