2023-12-06 09:55:55 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
import mdevaluate
|
|
|
|
from mdevaluate import free_energy_landscape as fel
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def trajectory(request):
|
2023-12-08 16:20:06 +00:00
|
|
|
return mdevaluate.open(os.path.join(os.path.dirname(__file__), "data/pore"))
|
2023-12-06 09:55:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_fel(trajectory):
|
|
|
|
test_array = np.array(
|
|
|
|
[
|
|
|
|
0.0,
|
2023-12-08 16:20:06 +00:00
|
|
|
12.87438176,
|
|
|
|
4.95868203,
|
|
|
|
11.02055197,
|
|
|
|
5.44195534,
|
|
|
|
6.73933442,
|
|
|
|
3.30971789,
|
|
|
|
6.10424055,
|
|
|
|
8.56153733,
|
|
|
|
5.45777331,
|
|
|
|
5.64545817,
|
|
|
|
8.42100423,
|
|
|
|
6.28132121,
|
|
|
|
7.4777172,
|
|
|
|
11.64839354,
|
|
|
|
4.52566354,
|
|
|
|
40.84730838,
|
|
|
|
93.86241602,
|
|
|
|
140.3039937,
|
|
|
|
173.55970021,
|
2023-12-06 09:55:55 +00:00
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
oxygens_water = trajectory.subset(atom_name="OW", residue_name="SOL")
|
2023-12-06 14:38:15 +00:00
|
|
|
r, energy_differences = fel.get_fel(
|
2023-12-06 09:55:55 +00:00
|
|
|
oxygens_water,
|
2023-12-08 16:20:06 +00:00
|
|
|
os.path.join(os.path.dirname(__file__), "data/pore"),
|
2023-12-06 09:55:55 +00:00
|
|
|
"cylindrical",
|
|
|
|
225,
|
|
|
|
edge=0.05,
|
|
|
|
radiusmin=0.05,
|
|
|
|
radiusmax=2.05,
|
|
|
|
z=[-np.inf, np.inf],
|
|
|
|
overwrite=True,
|
|
|
|
)
|
|
|
|
|
2023-12-08 16:20:06 +00:00
|
|
|
assert (np.round(energy_differences) == np.round(test_array)).all()
|