test.py 1.83 KB
Newer Older
Carl Poelking's avatar
Setup.  
Carl Poelking committed
1
2
3
4
5
6
7
8
#! /usr/bin/env python
import soap
import soap.tools

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

9
10
11
12
13
14
15
16
17
18
19
20
21
element_vdw_radius = { 
'C':1.70,
'N':1.55,
'O':1.52,
'H':1.20
}
element_mass = {
'C':12,
'N':14,
'O':16,
'H':1
}

Carl Poelking's avatar
Setup.  
Carl Poelking committed
22
23
24
25
26
27
28
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')
29
30
options.set('radialbasis.N', 9)
options.set('radialbasis.Rc', 4.0)
Carl Poelking's avatar
Setup.  
Carl Poelking committed
31
options.set('radialbasis.sigma', 0.5)
32
options.set('radialbasis.integration_steps', 15)
33
options.set('angularbasis.type', 'spherical-harmonic')
34
options.set('angularbasis.L', 6)
35
options.set('densitygrid.N', 20)
36
options.set('densitygrid.dx', 0.10)
Carl Poelking's avatar
Setup.  
Carl Poelking committed
37
38
39
40

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

41
osio << osio.mg << structure.label << endl
42

43
for atom in structure:
44
45
    atom.sigma = 0.4*element_vdw_radius[atom.type]
    atom.weight = 1. #element_mass[atom.type]
46
    osio << atom.name << atom.type << atom.weight << atom.sigma << atom.pos << endl
47

Carl Poelking's avatar
Setup.  
Carl Poelking committed
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# 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.