Skip to content
Open
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion analysis/scripts/analyze_hydration.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
import MDAnalysis as mda
from MDAnalysis.analysis import rdf as mda_rdf

# np.trapz was deprecated in NumPy 2.0 in favour of np.trapezoid; fall
# back to the old name for environments still on NumPy 1.x.
_trapezoid = getattr(np, "trapezoid", np.trapz)


# ---------------------------------------------------------------------
# Configuration (edit atom-type names to match your Moltemplate output)
Expand Down Expand Up @@ -144,7 +148,7 @@ def coordination_number(

mask = r <= r_cut
integrand = g[mask] * r[mask] ** 2
n_coord = 4.0 * np.pi * rho_b * np.trapz(integrand, r[mask])
n_coord = 4.0 * np.pi * rho_b * _trapezoid(integrand, r[mask])
return float(r_cut), float(n_coord)


Expand Down