forked from QMCPACK/qmcpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_qmcsystem.py
50 lines (39 loc) · 1.37 KB
/
check_qmcsystem.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
class qmcsystem:
lattice = [[0.0, 0.0, 0.0],\
[0.0, 0.0, 0.0],\
[0.0, 0.0, 0.0]]\
def get_parameter (self, par_elem):
name = par_elem.attributes["name"]
print "name = " + name.value
val = ""
for elem in par_elem.childNodes:
print elem
if elem.nodeType == elem.TEXT_NODE:
print elem
val = elem.text
return (name,val)
def check_cell(self, cell_elem):
for elem in cell_elem.childNodes:
if elem.nodeType == elem.ELEMENT_NODE:
n = elem.localName
print n
if n == 'parameter':
self.get_parameter(elem)
return
def check_particleset (self, pset_elem):
print "checking particleset"
return
mydict = {"simulationcell" : check_cell,\
"particleset" : check_particleset }
def check (self, sys_elem, sim):
print 'checking qmcsystem element'
print 'lattice = ' + repr (sim.system.lattice)
for elem in sys_elem.childNodes:
if elem.nodeType == elem.ELEMENT_NODE:
n = elem.localName
print n
if (n in self.mydict):
self.mydict[n](self, elem)
def check_qmcsystem(sys_elem, sim):
sim.system.check (sys_elem, sim)
return