2 import WeeksChandlerAndersen_DistanceOffset
as WCAD
4 def test_constructor_get_parameters():
7 with pytest.raises(TypeError):
10 with pytest.raises(TypeError):
13 with pytest.raises(TypeError):
17 with pytest.raises(ValueError):
20 with pytest.raises(ValueError):
23 with pytest.raises(ValueError):
30 assert isinstance(pot.getEpsilon(), float)
31 assert pot.getEpsilon() == 1.0
33 assert isinstance(pot.getSigma(), float)
34 assert pot.getSigma() == 2.5
36 assert isinstance(pot.getD(), float)
37 assert pot.getD() == 3.0
40 def test_getPotential():
48 pot = WCAD(epsilon, sigma, d)
51 if isinstance(r, Vector3DReal):
58 if 2 ** (1.0 / 6.0) * sigma - r + d > 0:
59 frac = sigma / (r - d)
68 with pytest.raises(TypeError):
70 with pytest.raises(ValueError):
73 r = Vector3DReal(0, 0, 0)
74 with pytest.raises(ValueError):
76 with pytest.raises(ValueError):
77 pot.getPotential(r.getLength())
79 for i
in range(0, 100):
80 r = Vector3DReal(-0.1 + i, i * 0.1, 2 * i)
84 with pytest.raises(ValueError):
88 assert pot.getPotential(r) == pytest.approx(e)
89 assert pot.getPotential(r.getLength()) == pytest.approx(e)