Updated free_energy_landscape.py to reflect code changes in mdevaluate

This commit is contained in:
Sebastian Kloth 2024-02-10 13:48:58 +01:00
parent a0e13b8f1f
commit 6b99ed67ff

View File

@ -1,3 +1,4 @@
#%%
import numpy as np
import mdevaluate as md
@ -13,14 +14,32 @@ trajectory = md.open(path_to_sim, topology="run.tpr", trajectory="out/traj_full.
OW = trajectory.subset(atom_name="OW")
box = np.diag(trajectory[0].box)
box_voxels = (box // [0.05, 0.05, 0.05] + [1, 1, 1]) * [0.05, 0.05, 0.05]
occupation_matrix = fel.occupation_matrix(OW, skip=0, segments=len(OW))
maxima_matrix = fel.find_maxima(occupation_matrix, box=box_voxels, edge_length=0.05)
box = trajectory[0].box
box_voxels = (np.diag(box) // [0.05, 0.05, 0.05] + [1, 1, 1]) * [0.05, 0.05, 0.05]
occupation_matrix = fel.occupation_matrix(OW, skip=0, segments=1000)
radius_maxima = 0.05 * 3 ** (1 / 2) + 0.05 / 100
maxima_matrix = fel.find_maxima(
occupation_matrix,
box=box_voxels,
radius=radius_maxima,
pore_geometry="cylindrical"
)
maxima_matrix = fel.add_distances(maxima_matrix, "cylindrical", box / 2)
r_bins = np.arange(0, 2, 0.02)
r_bins = np.arange(0, 1, 0.02)
distance_bins = np.arange(0.05, 1.55, 0.1)
energy_df = fel.distance_resolved_energies(
maxima_matrix, distance_bins, r_bins, box, 225
maxima_matrix, distance_bins, r_bins, box, "cylindrical", 225
)
result = fel.find_energy_maxima(energy_df, r_min=0.05, r_max=0.15)
#%%
print(sum(maxima_matrix["maxima"] == True))
#%%
energy_df = fel.distance_resolved_energies(
maxima_matrix, distance_bins, r_bins, box, temperature=250
)
# %%
print(energy_df)