/
test_chiparams.py
49 lines (44 loc) · 1.48 KB
/
test_chiparams.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
import pytest
import numpy as np
import pyscal.core as pc
import pyscal.crystal_structures as pcs
def test_chiparamsbcc():
atoms, box = pcs.make_crystal('bcc', repetitions=[3,3,3], lattice_constant=4)
sys = pc.System()
sys.box = box
sys.atoms = atoms
sys.find_neighbors(method='cutoff', cutoff=0)
sys.calculate_chiparams()
atoms = sys.atoms
chip = atoms[2].chiparams
assert chip == [3, 0, 0, 0, 36, 12, 0, 36, 0]
def test_chiparamsfcc():
atoms, box = pcs.make_crystal('fcc', repetitions=[5,5,5], lattice_constant=4)
sys = pc.System()
sys.box = box
sys.atoms = atoms
sys.find_neighbors(method='cutoff', cutoff=0)
sys.calculate_chiparams()
atoms = sys.atoms
chip = atoms[2].chiparams
assert chip == [6, 0, 0, 0, 24, 12, 0, 24, 0]
def test_chiparamshcp():
atoms, box = pcs.make_crystal('hcp', repetitions=[3,3,3], lattice_constant=4)
sys = pc.System()
sys.box = box
sys.atoms = atoms
sys.find_neighbors(method='cutoff', cutoff=0)
sys.calculate_chiparams()
atoms = sys.atoms
chip = atoms[2].chiparams
assert chip == [3, 0, 6, 0, 21, 12, 0, 24, 0]
def test_chiparamsdia():
atoms, box = pcs.make_crystal('diamond', repetitions=[3,3,3], lattice_constant=4)
sys = pc.System()
sys.box = box
sys.atoms = atoms
sys.find_neighbors(method='cutoff', cutoff=0)
sys.calculate_chiparams()
atoms = sys.atoms
chip = atoms[2].chiparams
assert chip == [0, 0, 0, 0, 6, 0, 0, 0, 0]