test.py 1.47 KB
Newer Older
Carl Poelking's avatar
Setup.  
Carl Poelking committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /usr/bin/env python
import soap
import soap.tools

import os
import numpy as np
from momo import osio, endl, flush

ase_config_list = soap.tools.ase_load_all('configs')
config = ase_config_list[0]
osio << config.atoms << endl

# INITIALIZE OPTIONS
options = soap.Options()
options.set('radialbasis.type', 'gaussian')
options.set('radialbasis.N', 8)
options.set('radialbasis.Rc', 7.)
options.set('radialbasis.sigma', 0.5)
19
options.set('angularbasis.L', 6)
Carl Poelking's avatar
Setup.  
Carl Poelking committed
20
21
22
23
24

# LOAD STRUCTURE
structure = soap.tools.setup_structure_ase(config.config_file, config.atoms)
soap.tools.write_xyz('test.xyz', structure)

25
26
27
28
osio << osio.mg << structure.label << endl
for atom in structure:
    osio << atom.name << atom.type << atom.pos << endl

Carl Poelking's avatar
Setup.  
Carl Poelking committed
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
92
93
94
95
96
97
98
# COMPUTE SPECTRUM
spectrum = soap.Spectrum(structure, options)
spectrum.compute()







osio.okquit()




































structure = soap.Structure(config.config_file)

# BOX TESTS
osio << osio.mg << "Box checks ..." << endl
r1 = np.array([0.2,0.3,0.4])
r2 = np.array([0.8,1.0,1.2])
# OPEN BOX
structure.box = np.array([[0,0,0],[0,0,0],[0,0,0]])
print "Connect", r1, r2, " => ", structure.connect(r1,r2)
# CUBIC BOX
a = np.array([0.9,0,0])
b = np.array([0,0.7,0])
c = np.array([0,0,0.5])
structure.box = np.array([a,b,c])
print "Connect", r1, r2, " => ", structure.connect(r1,r2)


segment = structure.addSegment()
particle = structure.addParticle(segment)
particle.pos = np.array([-1,0,1]) # vec(0,1,-1)
print type(particle.pos), particle.pos
particle.mass = 12.