CodeEntropy 2.6.0__py3-none-any.whl → 2.7.0__py3-none-any.whl

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.
CodeEntropy/__init__.py CHANGED
@@ -8,4 +8,4 @@ entropy estimates, supporting a wide range of applications in molecular simulati
8
8
  and statistical mechanics.
9
9
  """
10
10
 
11
- __version__ = "2.6.0"
11
+ __version__ = "2.7.0"
@@ -82,15 +82,14 @@ class AxesCalculator:
82
82
  * Translational axes are principal axes of data_container.
83
83
  * Find edge heavy atom (i.e. heavy atoms bonded to neighbour residue).
84
84
  Compute rotation centre and axes as in get_terminal_axes.
85
- Compute custom MOI, using heavy atom positions and
86
- heavy atom + hydrogen masses.
85
+ Compute custom MOI, using all atoms positions and masses.
87
86
 
88
87
  - If bonded to at least two other residues:
89
88
  * Translational axes are principal axes of data_container.
90
89
  * Find edge heavy atoms (i.e. heavy atoms bonded to neighbour residues).
91
90
  Compute rotation centre and axes as in get_non_terminal_axes.
92
- Compute a custom MOI, using heavy atom positions and
93
- heavy atom + hydrogen masses.
91
+ Compute custom MOI, using all atoms positions and masses.
92
+
94
93
 
95
94
  Args:
96
95
  data_container (MDAnalysis.Universe or AtomGroup):
@@ -134,19 +133,8 @@ class AxesCalculator:
134
133
  f"resindex {index_next})"
135
134
  )
136
135
 
137
- uas = residue.select_atoms("mass 2 to 999")
138
- ua_masses = self.get_UA_masses(residue)
139
-
140
136
  if len(edge_atom_set) == 0:
141
- moi_tensor = self.get_moment_of_inertia_tensor(
142
- center_of_mass=np.array(residue.center_of_mass()),
143
- positions=uas.positions,
144
- masses=ua_masses,
145
- dimensions=data_container.dimensions[:3],
146
- )
147
- rot_axes, moment_of_inertia = self.get_principal_axes_from_tensor(
148
- moi_tensor
149
- )
137
+ rot_axes, moment_of_inertia = self.get_molecule_axes(residue)
150
138
  trans_axes = rot_axes # per original convention
151
139
  rot_center = np.array(residue.center_of_mass())
152
140
  else:
@@ -167,8 +155,8 @@ class AxesCalculator:
167
155
  )
168
156
  moment_of_inertia = self.get_custom_residue_moment_of_inertia(
169
157
  center_of_mass=rot_center,
170
- positions=uas.positions,
171
- masses=ua_masses,
158
+ positions=residue.atoms.positions,
159
+ masses=residue.atoms.masses,
172
160
  custom_rot_axes=rot_axes,
173
161
  dimensions=data_container.dimensions[:3],
174
162
  )
@@ -181,7 +169,6 @@ class AxesCalculator:
181
169
  mol,
182
170
  residue_atoms,
183
171
  topology,
184
- box: np.ndarray | None,
185
172
  ):
186
173
  """Compute residue axes using cached static topology.
187
174
 
@@ -195,7 +182,6 @@ class AxesCalculator:
195
182
  mol: Current-frame molecule fragment.
196
183
  residue_atoms: AtomGroup for the residue in the current frame.
197
184
  topology: Cached ``ResidueAxesTopology`` for this residue.
198
- box: Current periodic box lengths. If omitted, ``u.dimensions`` is used.
199
185
 
200
186
  Returns:
201
187
  Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
@@ -204,24 +190,10 @@ class AxesCalculator:
204
190
  - center: Residue centre, shape ``(3,)``.
205
191
  - moment_of_inertia: Principal moments, shape ``(3,)``.
206
192
  """
207
- dimensions = (
208
- np.asarray(box, dtype=float)
209
- if box is not None
210
- else np.asarray(u.dimensions[:3], dtype=float)
211
- )
212
193
  center = residue_atoms.center_of_mass(unwrap=True)
213
194
 
214
195
  if not topology.has_neighbor_bonds:
215
- heavy_atoms = u.atoms[topology.residue_heavy_indices]
216
- moment_of_inertia_tensor = self.get_moment_of_inertia_tensor(
217
- center_of_mass=center,
218
- positions=heavy_atoms.positions,
219
- masses=topology.residue_ua_masses,
220
- dimensions=dimensions,
221
- )
222
- rot_axes, moment_of_inertia = self.get_principal_axes_from_tensor(
223
- moment_of_inertia_tensor
224
- )
196
+ rot_axes, moment_of_inertia = self.get_molecule_axes(residue_atoms)
225
197
  trans_axes = rot_axes
226
198
  else:
227
199
  make_whole(mol.atoms)
@@ -277,7 +249,7 @@ class AxesCalculator:
277
249
 
278
250
  index = int(index) # UA bead index
279
251
  heavy_atoms = data_container.select_atoms("mass 2 to 999")
280
- # use the same customPI trans axes as the residue level
252
+ # use the same trans axes as the residue level
281
253
  if len(heavy_atoms) > 1:
282
254
  if len(data_container.residues) == 1:
283
255
  # only the one residue => use principal axes
@@ -411,16 +383,7 @@ class AxesCalculator:
411
383
  heavy_atom = u.atoms[int(topology.heavy_atom_index)]
412
384
 
413
385
  if len(heavy_atoms) > 1:
414
- center = residue_atoms.center_of_mass(unwrap=True)
415
- moment_of_inertia_tensor = self.get_moment_of_inertia_tensor(
416
- center_of_mass=center,
417
- positions=heavy_atoms.positions,
418
- masses=topology.residue_ua_masses,
419
- dimensions=dimensions,
420
- )
421
- trans_axes, _moment_of_inertia = self.get_principal_axes_from_tensor(
422
- moment_of_inertia_tensor
423
- )
386
+ trans_axes = self.get_principal_axes_from_group(residue_atoms)
424
387
  else:
425
388
  make_whole(residue_atoms)
426
389
  trans_axes = self.get_principal_axes_from_group(residue_atoms)
@@ -921,8 +884,8 @@ class AxesCalculator:
921
884
 
922
885
  Args:
923
886
  center_of_mass: (3, ) COM for bead
924
- positions: (N,3) positions of the UAs in the bead
925
- masses: (N,) masses of the UAs in the bead
887
+ positions: (N,3) positions of the atoms in the bead
888
+ masses: (N,) masses of the atoms in the bead
926
889
  custom_rot_axes: (3,3) array of residue rotation axes
927
890
  dimensions: (3,) simulation_box_dimensions
928
891
 
@@ -1137,30 +1100,6 @@ class AxesCalculator:
1137
1100
  )
1138
1101
  return principal_axes
1139
1102
 
1140
- def get_UA_masses(self, molecule) -> list[float]:
1141
- """Return united-atom (UA) masses for a molecule.
1142
-
1143
- For a given molecule, return a list of masses of UAs (combination of the
1144
- heavy atoms + bonded hydrogen atoms). This list is used to get the moment
1145
- of inertia tensor for molecules larger than one UA.
1146
-
1147
- Args:
1148
- molecule: MDAnalysis AtomGroup representing the molecule.
1149
-
1150
- Returns:
1151
- list[float]: UA masses for each heavy atom.
1152
- """
1153
- ua_masses: list[float] = []
1154
- for atom in molecule:
1155
- if atom.mass > 1.1:
1156
- ua_mass = float(atom.mass)
1157
- bonded_atoms = molecule.select_atoms(f"bonded index {atom.index}")
1158
- bonded_h_atoms = bonded_atoms.select_atoms("mass 1 to 1.1")
1159
- for h in bonded_h_atoms:
1160
- ua_mass += float(h.mass)
1161
- ua_masses.append(ua_mass)
1162
- return ua_masses
1163
-
1164
1103
  def get_chain(self, residue, first, last):
1165
1104
  """
1166
1105
  For a given MDAnalysis AtomGroup and two given heavy atoms
@@ -578,7 +578,6 @@ class FrameCovarianceNode:
578
578
  relative_res_i=relative_res_i,
579
579
  axes_manager=axes_manager,
580
580
  axes_topology=axes_topology,
581
- box=box,
582
581
  customised_axes=customised_axes,
583
582
  )
584
583
 
@@ -615,7 +614,6 @@ class FrameCovarianceNode:
615
614
  relative_res_i: int,
616
615
  axes_manager: Any,
617
616
  axes_topology: Any | None,
618
- box: np.ndarray | None,
619
617
  customised_axes: bool,
620
618
  ) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
621
619
  """Return axes, centre, and inertia data for a residue bead.
@@ -630,7 +628,6 @@ class FrameCovarianceNode:
630
628
  might differ from residue index of first residue in topology.
631
629
  axes_manager: Axes helper used to select axes, centres, and moments.
632
630
  axes_topology: Optional cached axes topology generated during static setup.
633
- box: Optional periodic box vector.
634
631
  customised_axes: Whether customised residue axes should be used.
635
632
 
636
633
  Returns:
@@ -644,11 +641,7 @@ class FrameCovarianceNode:
644
641
 
645
642
  if residue_topology is not None:
646
643
  return axes_manager.get_residue_axes_from_topology(
647
- u=u,
648
- mol=mol,
649
- residue_atoms=res.atoms,
650
- topology=residue_topology,
651
- box=box,
644
+ u=u, mol=mol, residue_atoms=res.atoms, topology=residue_topology
652
645
  )
653
646
 
654
647
  return axes_manager.get_residue_axes(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: CodeEntropy
3
- Version: 2.6.0
3
+ Version: 2.7.0
4
4
  Summary: CodeEntropy is a Python package for computing the configurational entropy of macromolecular systems using forces sampled from molecular dynamics (MD) simulations. It implements the multiscale cell correlation method to provide accurate and efficient entropy estimates, supporting a wide range of applications in molecular simulation and statistical mechanics.
5
5
  Keywords: entropy,macromolecular systems,MD simulation
6
6
  Author-email: Arghya 'Argo' Chakravorty <arghyac@umich.edu>, Donald Chung-HK <donald.chung@stfc.ac.uk>, Sarah Fegan <sarah.fegan@stfc.ac.uk>, James Gebbie-Rayet <james.gebbie@stfc.ac.uk>, Sarah Harris <sarah.harris@sheffield.ac.uk>, Richard Henchman <rhen7213@uni.sydney.edu.au>, Jonathan Higham <j.higham4@lancaster.ac.uk>, Jas Kalayan <jas.kalayan@stfc.ac.uk>, Ioana Papa <iapapa1@sheffield.ac.uk>
@@ -1,4 +1,4 @@
1
- CodeEntropy/__init__.py,sha256=hAmtMNRexWP67gOAWLWAag9bka7HMDFyE3BMl7IRJHw,404
1
+ CodeEntropy/__init__.py,sha256=6RAN3bQeIAMTRqrJvnQxdaIyZdou_JcpKJo8Ve8-NTM,404
2
2
  CodeEntropy/__main__.py,sha256=5i_ZrxQaq0q2aPllbB4SZ6BApV6oUFCgx0cGyjfMPrU,108
3
3
  CodeEntropy/cli.py,sha256=nSshc8P7F7n3jAW36vzwXsFdffLfFdCpkfLvA-tJb3c,1318
4
4
  CodeEntropy/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -20,7 +20,7 @@ CodeEntropy/entropy/nodes/configurational.py,sha256=-3j2ji_p-twPjZyjQ1T3tgN0pYLS
20
20
  CodeEntropy/entropy/nodes/orientational.py,sha256=yPN_XRJ1LOxJ7hOE2cnsjIbgQlI2avM1g3mFbGhW6fM,2481
21
21
  CodeEntropy/entropy/nodes/vibrational.py,sha256=3uhRqaMpK8u7QK2SDQ6RLRcr2rS3sPh6-GlTaNdTFWw,16978
22
22
  CodeEntropy/levels/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- CodeEntropy/levels/axes.py,sha256=wmotkCwWcc7RzicWJQzXVwYFqkyw9WqWpyeRF1NB3zU,50338
23
+ CodeEntropy/levels/axes.py,sha256=2ws9a_n45ZHH4ya4DCttqEosHSqN_TrJO6dPHSbEeKE,47839
24
24
  CodeEntropy/levels/forces.py,sha256=c7XnNIBTFCHHXllr1WxTIrxEV_CkUB2b1vdFO8hUofY,11595
25
25
  CodeEntropy/levels/hierarchy.py,sha256=3cd4t6Tywg7VMgw4TboFF5VAHdhG4FaGBXsMptchisY,5158
26
26
  CodeEntropy/levels/linalg.py,sha256=PJlrKtIOYcYDycW3Tbetm6k94FKFZTq-hm28qiu_tS0,3565
@@ -47,7 +47,7 @@ CodeEntropy/levels/nodes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
47
47
  CodeEntropy/levels/nodes/accumulators.py,sha256=XM7phCAIo0RK9YAtx2wrdo2oinmpwXYrH9mp1_LQD7U,6259
48
48
  CodeEntropy/levels/nodes/axes_topology.py,sha256=QzrWbCL9YA8fzF4_WWpQGaIAAsOnjY6cVH7INDE40dk,11285
49
49
  CodeEntropy/levels/nodes/beads.py,sha256=9Ow065FY4jrIqPKCZJCvDNfIekJ17OBSX-bmEFsxtbc,8010
50
- CodeEntropy/levels/nodes/covariance.py,sha256=EY_-Ps-e4qtI9RIhV47j7cuvP3znJovGt6kK6yC77sU,30294
50
+ CodeEntropy/levels/nodes/covariance.py,sha256=T42iaL3AEswDp6qvI5uuTTKzksnjaJdEuQvNqsQjT_M,30100
51
51
  CodeEntropy/levels/nodes/detect_levels.py,sha256=YrM5SSceLiMqbOhr8Fy6SV-E_zkKRpvgHfDT8Grbin8,1864
52
52
  CodeEntropy/levels/nodes/detect_molecules.py,sha256=jILCddEicVngA7FjvQzafbG8HslaRICpT6hj2Uyi6YY,3059
53
53
  CodeEntropy/molecules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -58,8 +58,8 @@ CodeEntropy/trajectory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
58
58
  CodeEntropy/trajectory/frames.py,sha256=MSx_swzFjo4TgkZTR1y6W-1zuKNPg_C36I_uFqvOKpk,4354
59
59
  CodeEntropy/trajectory/mda.py,sha256=epKpAzxkNQi3rE7HJc_tsK_ZY4c575LdXmWewJoP1qE,16954
60
60
  CodeEntropy/trajectory/source.py,sha256=NfYsdm1amr29h2tmJP-RKyCp3phb1SOAtAELJmGm740,1475
61
- codeentropy-2.6.0.dist-info/entry_points.txt,sha256=8Oa3H9ErsrGtx5Hc6hIHOw73wK3Ylkvfgtl_4cBb_GU,52
62
- codeentropy-2.6.0.dist-info/licenses/LICENSE,sha256=hgMaAAVW1Q6dL586OHoz8vFO-6BYn-d2aAFBpVQylFc,1072
63
- codeentropy-2.6.0.dist-info/WHEEL,sha256=lqN8jXt_QloFOGcx9kStvWbryhfEXoI2F2z-YURm350,81
64
- codeentropy-2.6.0.dist-info/METADATA,sha256=dDomybrlzZoHk5m116Ap4v8TI9QtKclsW6XIJhSkQ5E,6547
65
- codeentropy-2.6.0.dist-info/RECORD,,
61
+ codeentropy-2.7.0.dist-info/entry_points.txt,sha256=8Oa3H9ErsrGtx5Hc6hIHOw73wK3Ylkvfgtl_4cBb_GU,52
62
+ codeentropy-2.7.0.dist-info/licenses/LICENSE,sha256=hgMaAAVW1Q6dL586OHoz8vFO-6BYn-d2aAFBpVQylFc,1072
63
+ codeentropy-2.7.0.dist-info/WHEEL,sha256=lqN8jXt_QloFOGcx9kStvWbryhfEXoI2F2z-YURm350,81
64
+ codeentropy-2.7.0.dist-info/METADATA,sha256=emvj_HvZSa0vFbaVwumBcY5NoK2Bb_VFW8Ees52sp00,6547
65
+ codeentropy-2.7.0.dist-info/RECORD,,