This repository has been archived by the owner on Aug 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
testme.py
91 lines (41 loc) · 1.46 KB
/
testme.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import soaplite
from ase import Atoms
import numpy as np
import math
from soaplite import genBasis
orig_atoms = Atoms(
cell=[
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0]
],
positions=[
[0, 0, 0],
[0.95, 0, 0],
[0.95*(1+math.cos(76/180*math.pi)), 0.95*math.sin(76/180*math.pi), 0.0]
],
symbols=["H", "O", "H"],
)
# Test the GTO basis
myAlphas, myBetas = genBasis.getBasisFunc(10.0, 5)
atoms = orig_atoms.copy()
features = soaplite.get_soap_structure(atoms, myAlphas, myBetas, rCut=10.0, nMax=5, Lmax=9, crossOver=True)
for rotation in ['x', 'y', 'z']:
# print("rotating in", rotation)
atoms.rotate(45, rotation)
rot_features = soaplite.get_soap_structure(atoms, myAlphas, myBetas, rCut=10.0, nMax=5, Lmax=9, crossOver=True)
deviation = np.max(np.abs(features - rot_features))
print("maximal numerical deviation:", deviation)
if deviation > 10e-8:
IS_PASS = False
# Test the poly basis
atoms = orig_atoms.copy()
features = soaplite.get_soap_structure_poly(atoms, rCut=10.0, nMax=5, Lmax=9)
for rotation in ['x', 'y', 'z']:
# print("rotating in", rotation)
atoms.rotate(45, rotation)
rot_features = soaplite.get_soap_structure_poly(atoms, rCut=10.0, nMax=5, Lmax=9)
deviation = np.max(np.abs(features - rot_features))
print("maximal numerical deviation:", deviation)
if deviation > 10e-8:
IS_PASS = False