-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_structure.py
More file actions
51 lines (37 loc) · 2.03 KB
/
test_structure.py
File metadata and controls
51 lines (37 loc) · 2.03 KB
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
import os
from express.parsers.structure import StructureParser
from tests.fixtures.data import JVASP_677, SI, SiC, GE
from tests.integration import IntegrationTestBase
class TestStructureParser(IntegrationTestBase):
def setUp(self):
super(IntegrationTestBase, self).setUp()
def tearDown(self):
super(IntegrationTestBase, self).tearDown()
@property
def parser(self):
manifest = self.getManifest()
with open(os.path.join(self.rootDir, manifest["structurePath"])) as f:
kwargs = {
"structure_string": f.read(),
"cell_type": manifest.get("cell_type", "original"),
"structure_format": manifest.get("structureFormat", "poscar"),
}
return StructureParser(**kwargs)
def test_structure_espresso_basis(self):
self.assertDeepAlmostEqual(self.parser.basis(), SI["basis"], places=2)
def test_structure_espresso_lattice_bravais(self):
self.assertDeepAlmostEqual(self.parser.lattice_bravais(), SI["lattice"], places=2)
def test_structure_vasp_basis(self):
self.assertDeepAlmostEqual(self.parser.basis(), SI["basis"], places=2)
def test_structure_vasp_lattice_bravais(self):
self.assertDeepAlmostEqual(self.parser.lattice_bravais(), SI["lattice"], places=2)
def test_structure_jarvis_db_entry_basis(self):
self.assertDeepAlmostEqual(self.parser.basis(), JVASP_677["basis"], places=2)
def test_structure_jarvis_db_entry_lattice_bravais(self):
self.assertDeepAlmostEqual(self.parser.lattice_bravais(), JVASP_677["lattice"], places=2)
def test_structure_pymatgen_core_structure_basis(self):
self.assertDeepAlmostEqual(self.parser.basis(), GE["basis"], places=2)
def test_structure_pymatgen_core_structure_lattice_bravais(self):
self.assertDeepAlmostEqual(self.parser.lattice_bravais(), GE["lattice"], places=2)
def test_material_vasp_structure_order_of_elements(self):
self.assertDeepAlmostEqual(self.parser.basis(), SiC["basis"], places=2)