3
3
import os
4
4
import unittest
5
5
6
- from monty .tempfile import ScratchDir
7
6
from pytest import approx
8
7
9
8
from pymatgen .apps .borg .hive import (
@@ -26,25 +25,21 @@ def test_get_valid_paths(self):
26
25
assert len (self .drone .get_valid_paths (path )) > 0
27
26
28
27
def test_assimilate (self ):
29
- """Test assimilate data from "vasprun.xe.xml.gz" file."""
30
-
31
- with ScratchDir ("." ):
32
- # Need to rename the test file to "vasprun.xml.xe.gz" as
33
- # hive is looking for pattern "vasprun.xml*"
34
- os .symlink (f"{ VASP_OUT_DIR } /vasprun.xe.xml.gz" , "vasprun.xml.xe.gz" )
35
- entry = self .drone .assimilate ("." )
36
-
37
- for param in ("hubbards" , "is_hubbard" , "potcar_spec" , "run_type" ):
38
- assert param in entry .parameters
39
- assert entry .data ["efermi" ] == approx (- 6.62148548 )
40
- assert entry .reduced_formula == "Xe"
41
- assert entry .energy == approx (0.5559329 )
42
-
43
- entry = self .structure_drone .assimilate ("." )
44
- assert entry .reduced_formula == "Xe"
45
- assert entry .energy == approx (0.5559329 )
46
- assert isinstance (entry , ComputedStructureEntry )
47
- assert entry .structure is not None
28
+ """Test assimilate data from "vasprun.xml.xe.gz" file."""
29
+
30
+ entry = self .drone .assimilate (f"{ TEST_FILES_DIR } /app_borg/test_dir" )
31
+
32
+ for param in ("hubbards" , "is_hubbard" , "potcar_spec" , "run_type" ):
33
+ assert param in entry .parameters
34
+ assert entry .data ["efermi" ] == approx (- 6.62148548 )
35
+ assert entry .reduced_formula == "Xe"
36
+ assert entry .energy == approx (0.5559329 )
37
+
38
+ entry = self .structure_drone .assimilate (f"{ TEST_FILES_DIR } /app_borg/test_dir" )
39
+ assert entry .reduced_formula == "Xe"
40
+ assert entry .energy == approx (0.5559329 )
41
+ assert isinstance (entry , ComputedStructureEntry )
42
+ assert entry .structure is not None
48
43
49
44
def test_as_from_dict (self ):
50
45
dct = self .structure_drone .as_dict ()
@@ -81,16 +76,16 @@ def test_get_valid_paths(self):
81
76
def test_assimilate (self ):
82
77
test_file = f"{ TEST_FILES_DIR } /molecules/methane.log"
83
78
entry = self .drone .assimilate (test_file )
84
- for p in [
79
+ for param in [
85
80
"functional" ,
86
81
"basis_set" ,
87
82
"charge" ,
88
83
"spin_multiplicity" ,
89
84
"route_parameters" ,
90
85
]:
91
- assert p in entry .parameters
92
- for p in ["corrections" ]:
93
- assert p in entry .data
86
+ assert param in entry .parameters
87
+ for param in ["corrections" ]:
88
+ assert param in entry .data
94
89
95
90
assert entry .reduced_formula == "H4C"
96
91
assert entry .energy == approx (- 39.9768775602 )
@@ -99,8 +94,8 @@ def test_assimilate(self):
99
94
assert entry .energy == approx (- 39.9768775602 )
100
95
assert isinstance (entry , ComputedStructureEntry )
101
96
assert entry .structure is not None
102
- for p in ["properly_terminated" , "stationary_type" ]:
103
- assert p in entry .data
97
+ for param in ["properly_terminated" , "stationary_type" ]:
98
+ assert param in entry .data
104
99
105
100
def test_as_from_dict (self ):
106
101
dct = self .structure_drone .as_dict ()
0 commit comments