test.py 1.59 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
#! /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')
16
17
options.set('radialbasis.N', 9)
options.set('radialbasis.Rc', 4.0)
Carl Poelking's avatar
Setup.  
Carl Poelking committed
18
options.set('radialbasis.sigma', 0.5)
19
options.set('angularbasis.type', 'spherical-harmonic')
20
options.set('angularbasis.L', 6)
21
22
options.set('densitygrid.N', 20)
options.set('densitygrid.dx', 0.1)
Carl Poelking's avatar
Setup.  
Carl Poelking committed
23
24
25
26

# LOAD STRUCTURE
structure = soap.tools.setup_structure_ase(config.config_file, config.atoms)

27
28
osio << osio.mg << structure.label << endl
for atom in structure:
29
30
    osio << atom.name << atom.type << atom.weight << atom.sigma << atom.pos << endl
    atom.sigma = 0.0
31

Carl Poelking's avatar
Setup.  
Carl Poelking committed
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
99
100
101
# 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.