forked from lucaparisi91/pimc-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestPimc.py
54 lines (22 loc) · 906 Bytes
/
testPimc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import unittest
from pimc import *
import json
import numpy as np
class TestParameter(unittest.TestCase):
def testLoad(self):
with open("input.json") as f:
j=json.load(f)
particles = jSonParameter("particles")
assert(particles[j] == [100] )
N = nParticlesParameter()
assert(N[j]==100)
V=volumeParameter()
np.testing.assert_almost_equal( 12.915496650148839**3, V[j] )
V0 = jSonParameter("action[0]/potential/V0",label="V0")
np.testing.assert_almost_equal(V0[j] , 11.057432794419006 )
alpha = jSonParameter("action[0]/potential/alpha",label="alpha")
np.testing.assert_almost_equal(6.4577483250744185 , alpha[j] )
nBeads = jSonParameter("nBeads",label="M")
self.assertEqual(nBeads[j] , 10 )
if __name__ == '__main__':
unittest.main()