Merge branch 'mdeval_dev'

# Conflicts:
#	src/mdevaluate/coordinates.py
This commit is contained in:
Sebastian Kloth 2024-02-26 14:20:12 +01:00
commit 31eb145a13
2 changed files with 14 additions and 26 deletions

View File

@ -218,7 +218,7 @@ class Coordinates:
self.get_frame.clear_cache() self.get_frame.clear_cache()
def __iter__(self): def __iter__(self):
for i in range(len(self)): for i in range(len(self.frames))[self._slice]:
yield self[i] yield self[i]
@singledispatchmethod @singledispatchmethod

View File

@ -15,46 +15,34 @@ def trajectory(request):
def test_get_fel(trajectory): def test_get_fel(trajectory):
test_array = np.array( test_array = np.array(
[ [
174.46253634, 184.4909136,
174.60905476, 233.79320471,
178.57658092, 223.12003988,
182.43001192, 228.49746397,
180.57916378, 200.5626769,
176.49886217, 212.82484221,
178.96018547, 165.10818396,
181.13561782, 170.74123681,
178.31026314, 175.86672931,
176.08903996,
180.71215345,
181.59703135,
180.34329368,
187.02474488,
197.99167477,
214.05788031,
245.58571282,
287.52457507,
331.53492965,
] ]
) )
OW = trajectory.subset(atom_name="OW") OW = trajectory.subset(atom_name="OW")
box = trajectory[0].box box = trajectory[0].box
box_voxels = (np.diag(box) // [0.05, 0.05, 0.05] + [1, 1, 1]) * [0.05, 0.05, 0.05] 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) occupation_matrix = fel.occupation_matrix(OW, skip=0, segments=10)
radius_maxima = 0.05 * 3 ** (1 / 2) + 0.05 / 100 radius_maxima = 0.05 * 3 ** (1 / 2) + 0.05 / 100
maxima_matrix = fel.find_maxima( maxima_matrix = fel.find_maxima(
occupation_matrix, occupation_matrix,
box=box_voxels, box=box_voxels,
radius=radius_maxima, radius=radius_maxima,
pore_geometry="cylindrical" pore_geometry="cylindrical",
) )
maxima_matrix = fel.add_distances(maxima_matrix, "cylindrical", np.diag(box) / 2) maxima_matrix = fel.add_distances(maxima_matrix, "cylindrical", np.diag(box) / 2)
r_bins = np.arange(0, 1, 0.02) r_bins = np.arange(0, 0.5, 0.02)
distance_bins = np.arange(0.05, 2.05, 0.1) distance_bins = np.arange(1.8, 1.9, 0.01)
energy_df = fel.distance_resolved_energies( energy_df = fel.distance_resolved_energies(
maxima_matrix, distance_bins, r_bins, box, "cylindrical", 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) result = fel.find_energy_maxima(energy_df, r_min=0.05, r_max=0.15)
assert (np.round(np.array(result["energy"])) == np.round(test_array)).all() assert (np.round(np.array(result["energy"])) == np.round(test_array)).all()