1
- < << << << HEAD
2
1
import os
3
- == == == =
4
2
import bson
5
3
import gzip
6
-
7
4
from pathlib import Path
8
- > >> >> >> 45 fcce62 (Tidy polarization tests )
9
5
10
6
from atomate .utils .testing import AtomateTest
11
7
from atomate .vasp .firetasks .parse_outputs import PolarizationToDb
12
8
13
9
__author__ = "Tess Smidt"
14
10
15
11
16
- < << << << HEAD
17
- module_dir = os .path .dirname (os .path .abspath (__file__ ))
18
- db_dir = os .path .join (module_dir , ".." , ".." , ".." , "common" , "test_files" )
19
- ref_dir = os .path .join (module_dir , ".." , ".." , "test_files" )
12
+ module_dir = Path (__file__ ).resolve ().parent
13
+ db_dir = module_dir / "../../../common/test_files"
14
+ ref_dir = module_dir / "../../test_files"
20
15
21
16
22
17
DEBUG_MODE = (
23
18
True # If true, retains the database and output dirs at the end of the test
24
19
)
25
20
# If None, runs a "fake" VASP. Otherwise, runs VASP with this command...
26
21
VASP_CMD = None
27
- == == == =
28
- module_dir = Path (__file__ ).resolve ().parent
29
- db_dir = module_dir / "../../../common/test_files"
30
- < << << << HEAD
31
- ref_dir = module_dir / "../..//test_files"
32
- > >> >> >> 45 fcce62 (Tidy polarization tests )
33
- == == == =
34
- ref_dir = module_dir / "../../test_files"
35
- > >> >> >> fcdf2e63 (Finish tidying polarization tests )
22
+
36
23
37
24
38
25
class TestPolarizationFiretasks (AtomateTest ):
39
26
def test_polarizationtodb (self ):
40
- < << << << HEAD
41
- import gzip
42
-
43
- import bson
44
-
45
- reference_dir = os .path .abspath (os .path .join (ref_dir , "ferroelectric_wf" ))
46
-
47
- with gzip .open (os .path .join (reference_dir , "tasks.bson.gz" )) as f :
48
- == == == =
49
27
wf_dir = ref_dir / "ferroelectric_wf"
50
28
51
29
with gzip .open (wf_dir / "tasks.bson.gz" ) as f :
52
- >> >> >> > 45 fcce62 (Tidy polarization tests )
53
30
coll_raw = f .read ()
54
31
55
32
coll = bson .decode_all (coll_raw )
@@ -69,8 +46,4 @@ def test_polarizationtodb(self):
69
46
# Check recovered change in polarization
70
47
coll = self .get_task_collection ("polarization_tasks" )
71
48
d = coll .find_one ()
72
- < << << << HEAD
73
- self .assertAlmostEqual (d ["polarization_change_norm" ], 46.288752795325244 , 5 )
74
- == == == =
75
49
self .assertAlmostEqual (d ["polarization_change_norm" ], 46.28875279532 , 5 )
76
- >> >> >> > 45 fcce62 (Tidy polarization tests )
0 commit comments