Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
parser-exciting
Commits
ec6392cb
Commit
ec6392cb
authored
Mar 13, 2018
by
Pardini, Lorenzo (lopa)
Browse files
added licence header + skipped forces
parent
5b44e43f
Changes
7
Hide whitespace changes
Inline
Side-by-side
parser/parser-exciting/exciting_parser_GS_input.py
View file @
ec6392cb
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com>
import
xml.sax
import
logging
import
numpy
as
np
...
...
parser/parser-exciting/exciting_parser_bandstructure.py
View file @
ec6392cb
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com>
import
xml.sax
import
logging
import
numpy
as
np
...
...
@@ -130,12 +145,6 @@ class BandHandler(xml.sax.handler.ContentHandler):
for
j
in
range
(
0
,
3
):
self
.
vertexCoord
[
i
][
j
]
=
float
(
self
.
vertexCoord
[
i
][
j
])
# for i in range(0,vertexNum-1):
# self.backend.addValue("band_k_points",bandKpoints[i])
# self.backend.addValue("band_segm_start_end",self.vertexCoord[i:i+2])
# self.backend.addValue("number_of_k_points_per_segment",numkPointsPerSegmL[i])
# self.backend.addValue("band_segm_labels",self.vertexLabels[i:i+2])
self
.
eigenSectionGIndex
=
self
.
backend
.
openSection
(
"section_eigenvalues"
)
self
.
backend
.
addValue
(
"number_of_band_segment_eigenvalues"
,
bands
)
self
.
backend
.
closeSection
(
"section_eigenvalues"
,
self
.
eigenSectionGIndex
)
...
...
@@ -155,13 +164,10 @@ class BandHandler(xml.sax.handler.ContentHandler):
for
k
in
range
(
0
,
numkPointsPerSegmL
[
i
]):
bandEnergiesBE
[
i
][
0
][
k
].
append
(
self
.
bandEnergies
[
0
][
j
][
i
][
k
])
bandEnergiesBE
[
i
][
1
][
k
].
append
(
self
.
bandEnergies
[
1
][
j
][
i
][
k
])
# bandEnergiesBE[i][0][k].append(self.bandEnergies[0][i][j][k])
# bandEnergiesBE[i][1][k].append(self.bandEnergies[1][i][j][k])
self
.
backend
.
addValue
(
"band_k_points"
,
bandKpoints
[
i
])
self
.
backend
.
addValue
(
"band_segm_start_end"
,
self
.
vertexCoord
[
i
:
i
+
2
])
self
.
backend
.
addValue
(
"number_of_k_points_per_segment"
,
numkPointsPerSegmL
[
i
])
self
.
backend
.
addValue
(
"band_segm_labels"
,
self
.
vertexLabels
[
i
:
i
+
2
])
# print("bandEnergiesBE[i]=",len(bandEnergiesBE[i][0]))
self
.
backend
.
addValue
(
"band_energies"
,
bandEnergiesBE
[
i
])
self
.
backend
.
closeSection
(
"section_k_band_segment"
,
self
.
normBandSectionGIndex
)
else
:
#### check for spin polarized!!!!
...
...
@@ -179,12 +185,6 @@ class BandHandler(xml.sax.handler.ContentHandler):
for
k
in
range
(
0
,
numkPointsPerSegmL
[
i
]):
bandEnergiesBE
[
i
][
0
][
k
].
append
(
self
.
bandEnergies
[
0
][
j
][
i
][
k
])
bandEnergiesBE
[
i
][
1
][
k
].
append
(
self
.
bandEnergies
[
1
][
j
][
i
][
k
])
# bandEnergiesBE[i][0][k].append(self.bandEnergies[0][i][j][k])
# bandEnergiesBE[i][1][k].append(self.bandEnergies[1][i][j][k])
# print("i=",i)
# print("bandKpoints[i]=",bandKpoints[i])
# print("numkPointsPerSegmL[i]=",numkPointsPerSegmL[i])
# print("len(bandEnergiesBE[i])=",len(bandEnergiesBE[i]))
self
.
backend
.
addValue
(
"band_k_points"
,
bandKpoints
[
i
])
self
.
backend
.
addValue
(
"band_segm_start_end"
,
self
.
vertexCoord
[
i
:
i
+
2
])
self
.
backend
.
addValue
(
"number_of_k_points_per_segment"
,
numkPointsPerSegmL
[
i
])
...
...
parser/parser-exciting/exciting_parser_dos.py
View file @
ec6392cb
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com>
import
xml.sax
import
logging
import
numpy
as
np
...
...
@@ -27,20 +42,13 @@ class DosHandler(xml.sax.handler.ContentHandler):
self
.
unitCellVol
=
float
(
unitCellVol
[
0
])
def
endDocument
(
self
):
# self.inDos = False
self
.
inDosProj
=
False
self
.
backend
.
closeSection
(
"section_dos"
,
self
.
dosSectionGIndex
)
# self.backend.closeSection("section_atom_projected_dos",self.dosProjSectionGIndex)
self
.
dosSectionGIndex
=
-
1
# self.dosProjSectionGIndex = -1
# print("self.unitCellVol=",self.unitCellVol)
def
startElement
(
self
,
name
,
attrs
):
ha_per_joule
=
convert_unit
(
1
,
"hartree"
,
"J"
)
# joule_in_eV = convert_unit(1, "eV", "J")
# a_cube_to_m_cube = convert_unit(1, "angstrom^3", "m^3")
# print("a_cube_to_m_cube= ", a_cube_to_m_cube)
# print("joule_in_ev=", joule_in_eV)
joule_in_ev
=
convert_unit
(
1
,
"eV"
,
"J"
)
fromH
=
unit_conversion
.
convert_unit_function
(
"hartree"
,
"J"
)
if
name
==
"totaldos"
:
self
.
dosSectionGIndex
=
self
.
backend
.
openSection
(
"section_dos"
)
...
...
@@ -56,11 +64,9 @@ class DosHandler(xml.sax.handler.ContentHandler):
elif
name
==
"point"
:
if
self
.
inDos
:
self
.
totDos
.
append
(
float
(
attrs
.
getValue
(
'dos'
))
*
ha_per_joule
)
# self.energy.append(float(attrs.getValue('e')))
self
.
energy
.
append
(
fromH
(
float
(
attrs
.
getValue
(
'e'
))))
elif
self
.
inDosProj
:
self
.
dosProj
.
append
(
float
(
attrs
.
getValue
(
'dos'
))
*
ha_per_joule
)
# self.energy.append(float(attrs.getValue('e')))
self
.
energy
.
append
(
fromH
(
float
(
attrs
.
getValue
(
'e'
))))
elif
name
==
"diagram"
:
if
not
self
.
speciesrn
:
pass
...
...
@@ -78,7 +84,6 @@ class DosHandler(xml.sax.handler.ContentHandler):
for
k
in
range
(
0
,
len
(
self
.
speciesrn
)):
self
.
dosProjDummy2
[
k
].
append
([])
self
.
dosProjSpin
[
i
][
j
].
append
([])
# print("self.dosProjSpinPrima=",self.dosProjSpin)
for
i
in
range
(
0
,
len
(
self
.
speciesrn
)):
if
not
self
.
spinTreat
:
self
.
dosProjDummy
[
i
]
=
self
.
dosProj
[
i
*
len
(
self
.
dosProjSpin
)
*
self
.
numDosVal
:(
i
+
1
)
*
len
(
self
.
dosProjSpin
)
*
self
.
numDosVal
]
...
...
@@ -92,21 +97,14 @@ class DosHandler(xml.sax.handler.ContentHandler):
for
j
in
range
(
0
,
len
(
self
.
speciesrn
)):
self
.
dosProjSpin
[
i
][
0
][
j
]
=
self
.
dosProjDummy2
[
j
][
i
]
self
.
dosProjSpin
[
i
][
1
][
j
]
=
self
.
dosProjDummy2
[
j
][
i
]
# print("self.dosProjSpin=",self.dosProjSpin)
else
:
for
j
in
range
(
0
,
len
(
self
.
speciesrn
)):
for
i
in
range
(
0
,
int
(
2
*
len
(
self
.
dosProjSpin
))):
if
i
<
len
(
self
.
dosProjSpin
):
# print("i=",i)
# pass
self
.
dosProjSpin
[
i
][
0
][
j
]
=
self
.
dosProjDummy2
[
j
][
i
]
else
:
k
=
int
(
i
-
len
(
self
.
dosProjSpin
))
# print("i=",i,"j=",j,"k=",k)
self
.
dosProjSpin
[
k
][
1
][
j
]
=
self
.
dosProjDummy2
[
j
][
i
]
# print("self.dosProjSpin=",len(self.dosProjSpin))
# print("self.dosProjSpin=",len(self.dosProjSpin))
# print("self.dosProjDummy2=",len(self.dosProjDummy2))
def
endElement
(
self
,
name
):
if
name
==
'totaldos'
:
self
.
inDos
=
False
...
...
@@ -119,7 +117,6 @@ class DosHandler(xml.sax.handler.ContentHandler):
self
.
backend
.
addValue
(
"dos_energies"
,
self
.
energySpin
)
self
.
backend
.
addValue
(
"number_of_dos_values"
,
self
.
numDosVal
)
self
.
backend
.
addValue
(
"dos_kind"
,
"electronic"
)
# print("self.totDosSpin=",self.totDosSpin)
else
:
self
.
numDosVal
=
int
(
len
(
self
.
energy
)
/
2
)
self
.
totDosSpin
[
0
]
=
self
.
totDos
[
0
:
self
.
numDosVal
]
...
...
@@ -130,14 +127,7 @@ class DosHandler(xml.sax.handler.ContentHandler):
self
.
backend
.
addValue
(
"number_of_dos_values"
,
self
.
numDosVal
)
elif
name
==
'partialdos'
:
pass
# self.inDosProj = False
# print("self.dosProjSpin=",self.dosProjSpin)
# self.backend.addArrayValues("atom_projected_dos_values_lm",np.asarray(self.dosProjSpin))
# self.backend.closeSection("section_atom_projected_dos",self.dosProjSectionGIndex)
# self.dosProjSectionGIndex = -1
elif
name
==
'interstitialdos'
:
# print("self.energy=",len(self.energy))
# print("self.dosProjSpinFine=",self.dosProjSpin)
self
.
backend
.
addValue
(
"atom_projected_dos_values_lm"
,
self
.
dosProjSpin
)
self
.
backend
.
addValue
(
"number_of_lm_atom_projected_dos"
,
len
(
self
.
dosProjSpin
))
self
.
backend
.
addValue
(
"number_of_atom_projected_dos_values"
,
self
.
numDosVal
)
...
...
@@ -146,7 +136,6 @@ class DosHandler(xml.sax.handler.ContentHandler):
self
.
backend
.
closeSection
(
"section_atom_projected_dos"
,
self
.
dosProjSectionGIndex
)
self
.
dosProjSectionGIndex
=
-
1
self
.
inDosProj
=
False
# backend.addValue()
def
startElementNS
(
self
,
name
,
qname
,
attrs
):
attrDict
=
{}
for
name
in
attrs
.
getNames
():
...
...
parser/parser-exciting/exciting_parser_gw.py
View file @
ec6392cb
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com>
from
builtins
import
object
import
setup_paths
import
xml.sax
...
...
@@ -31,9 +46,7 @@ class GWParser(object):
def
parseGW
(
self
,
gwFile
,
backend
,
dftMethodSectionGindex
,
dftSingleConfigurationGindex
,
xcName
,
unitCellVol
,
gmaxvr
):
# logging.error("GW onClose_section_single_configuration_calculation")
# print("xcNameGW=", xcName)
self
.
gmaxvr
=
float
(
gmaxvr
[
0
])
# print("gkmax= ",self.gmaxvr)
self
.
unitCellVol
=
float
(
unitCellVol
[
0
])
backend
.
openNonOverlappingSection
(
"section_single_configuration_calculation"
)
if
dftSingleConfigurationGindex
is
not
None
:
...
...
@@ -167,7 +180,6 @@ class GWParser(object):
if
os
.
path
.
exists
(
dosGWFile
):
dosGWGIndex
=
backend
.
openSection
(
"section_dos"
)
ha_per_joule
=
unit_conversion
.
convert_unit
(
1
,
"hartree"
,
"J"
)
# bohr_cube_to_m_cube = unit_conversion.convert_unit(1, "bohr^3", "m^3")
fromH
=
unit_conversion
.
convert_unit_function
(
"hartree"
,
"J"
)
with
open
(
dosGWFile
)
as
g
:
dosValues
=
[[],[]]
...
...
parser/parser-exciting/exciting_parser_input.py
View file @
ec6392cb
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com>
import
xml.sax
import
logging
import
numpy
as
np
...
...
parser/parser-exciting/parser_exciting.py
View file @
ec6392cb
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com>
from
builtins
import
object
import
setup_paths
import
numpy
as
np
...
...
@@ -48,18 +63,14 @@ class ExcitingParserContext(object):
self
.
secMethodIndex
=
gIndex
def
onClose_section_run
(
self
,
backend
,
gIndex
,
section
):
# logging.error("BASE onClose_section_run")
self
.
secRunIndex
=
gIndex
mainFile
=
self
.
parser
.
fIn
.
fIn
.
name
dirPath
=
os
.
path
.
dirname
(
self
.
parser
.
fIn
.
name
)
gw_File
=
os
.
path
.
join
(
dirPath
,
"GW_INFO.OUT"
)
gwFile
=
os
.
path
.
join
(
dirPath
,
"GWINFO.OUT"
)
# print("xcName= ",self.xcName)
for
gFile
in
[
gw_File
,
gwFile
]:
if
os
.
path
.
exists
(
gFile
):
# print("gFile=",gFile)
# logging.error("Starting GW")
gwParser
=
exciting_parser_gw
.
GWParser
()
gwParser
.
parseGW
(
gFile
,
backend
,
dftMethodSectionGindex
=
self
.
secMethodIndex
,
...
...
@@ -75,9 +86,7 @@ class ExcitingParserContext(object):
superContext
=
gwParser
)
with
open
(
gFile
)
as
fIn
:
subParser
.
parseFile
(
fIn
)
# logging.error("Finished GW")
break
# logging.error("done BASE onClose_section_run")
def
onClose_x_exciting_section_lattice_vectors
(
self
,
backend
,
gIndex
,
section
):
latticeX
=
section
[
"x_exciting_geometry_lattice_vector_x"
]
...
...
@@ -90,8 +99,6 @@ class ExcitingParserContext(object):
backend
.
addValue
(
"simulation_cell"
,
cell
)
def
onClose_x_exciting_section_reciprocal_lattice_vectors
(
self
,
backend
,
gIndex
,
section
):
# self.unit_cell_vol = section["x_exciting_unit_cell_volume"]
# print("self.unit_cell_vol= ",self.unit_cell_vol)
recLatticeX
=
section
[
"x_exciting_geometry_reciprocal_lattice_vector_x"
]
recLatticeY
=
section
[
"x_exciting_geometry_reciprocal_lattice_vector_y"
]
recLatticeZ
=
section
[
"x_exciting_geometry_reciprocal_lattice_vector_z"
]
...
...
@@ -102,7 +109,6 @@ class ExcitingParserContext(object):
def
onClose_x_exciting_section_xc
(
self
,
backend
,
gIndex
,
section
):
xcNr
=
section
[
"x_exciting_xc_functional"
][
0
]
# print("xcNr= ",xcNr)
xc_internal_map
=
{
2
:
[
'LDA_C_PZ'
,
'LDA_X_PZ'
],
3
:
[
'LDA_C_PW'
,
'LDA_X_PZ'
],
...
...
@@ -121,11 +127,9 @@ class ExcitingParserContext(object):
inputGSFile
=
os
.
path
.
join
(
dirPath
,
"input.xml"
)
with
open
(
inputGSFile
)
as
f
:
exciting_parser_GS_input
.
parseInput
(
f
,
backend
)
# pass
else
:
for
xcName
in
xc_internal_map
[
xcNr
]:
self
.
xcName
=
xcName
# print("xcName= ",self.xcName)
gi
=
backend
.
openSection
(
"section_XC_functionals"
)
backend
.
addValue
(
"XC_functional_name"
,
xcName
)
backend
.
closeSection
(
"section_XC_functionals"
,
gi
)
...
...
@@ -134,41 +138,64 @@ class ExcitingParserContext(object):
# logging.error("BASE onClose_section_single_configuration_calculation")
backend
.
addValue
(
'single_configuration_to_calculation_method_ref'
,
self
.
secMethodIndex
)
backend
.
addValue
(
'single_configuration_calculation_to_system_ref'
,
self
.
secSystemIndex
)
forceX
=
section
[
"x_exciting_atom_forces_x"
]
if
forceX
:
forceY
=
section
[
"x_exciting_atom_forces_y"
]
forceZ
=
section
[
"x_exciting_atom_forces_z"
]
forceCoreX
=
section
[
"x_exciting_atom_core_forces_x"
]
forceCoreY
=
section
[
"x_exciting_atom_core_forces_y"
]
forceCoreZ
=
section
[
"x_exciting_atom_core_forces_z"
]
forceIBSX
=
section
[
"x_exciting_atom_IBS_forces_x"
]
forceIBSY
=
section
[
"x_exciting_atom_IBS_forces_y"
]
forceIBSZ
=
section
[
"x_exciting_atom_IBS_forces_z"
]
forceHFX
=
section
[
"x_exciting_atom_HF_forces_x"
]
forceHFY
=
section
[
"x_exciting_atom_HF_forces_y"
]
forceHFZ
=
section
[
"x_exciting_atom_HF_forces_z"
]
fConv
=
convert_unit_function
(
"hartree/bohr"
,
"N"
)
atoms
=
len
(
forceX
)
atom_forces
=
[]
atom_core_forces
=
[]
atom_IBS_forces
=
[]
atom_HF_forces
=
[]
for
i
in
range
(
0
,
atoms
):
atom_forces
.
append
([
fConv
(
forceX
[
i
]),
fConv
(
forceY
[
i
]),
fConv
(
forceZ
[
i
])])
atom_core_forces
.
append
([
fConv
(
forceCoreX
[
i
]),
fConv
(
forceCoreY
[
i
]),
fConv
(
forceCoreZ
[
i
])])
atom_IBS_forces
.
append
([
fConv
(
forceIBSX
[
i
]),
fConv
(
forceIBSY
[
i
]),
fConv
(
forceIBSZ
[
i
])])
atom_HF_forces
.
append
([
fConv
(
forceHFX
[
i
]),
fConv
(
forceHFY
[
i
]),
fConv
(
forceHFZ
[
i
])])
backend
.
addValue
(
"atom_forces"
,
atom_forces
)
backend
.
addValue
(
"x_exciting_atom_core_forces"
,
atom_core_forces
)
backend
.
addValue
(
"x_exciting_atom_IBS_forces"
,
atom_IBS_forces
)
backend
.
addValue
(
"x_exciting_atom_HF_forces"
,
atom_HF_forces
)
#
##############TO DO. FIX FORCES#####################
# forceX = section["x_exciting_atom_forces_x"]
# if forceX:
# forceY = section["x_exciting_atom_forces_y"]
# forceZ = section["x_exciting_atom_forces_z"]
# print("forceX===",forceX)
# print("forceY===",forceY)
# print("forceZ===",forceZ)
# forceCoreX = section["x_exciting_atom_core_forces_x"]
# forceCoreY = section["x_exciting_atom_core_forces_y"]
# forceCoreZ = section["x_exciting_atom_core_forces_z"]
# print("forceCoreX===",forceCoreX)
## print("forceCoreY===",forceCoreY)
# print("forceCoreZ===",forceCoreZ)
# forceIBSX = section["x_exciting_atom_IBS_forces_x"]
# forceIBSY = section["x_exciting_atom_IBS_forces_y"]
# forceIBSZ = section["x_exciting_atom_IBS_forces_z"]
# print("forceIBSX===",forceIBSX)
# print("forceIBSY===",forceIBSY)
# print("forceIBSZ===",forceIBSZ)
# forceHFX = section["x_exciting_atom_HF_forces_x"]
# forceHFY = section["x_exciting_atom_HF_forces_y"]
# forceHFZ = section["x_exciting_atom_HF_forces_z"]
# fConv = convert_unit_function("hartree/bohr", "N")
# atoms = len(forceX)
# atom_forces = []
# atom_core_forces = []
# atom_IBS_forces = []
# atom_HF_forces = []
# for i in range(0,atoms):
# print("atoms===",atoms)
# print("i===",i)
# print("atom_forces===",atom_forces)
# print("forceX[i]===",forceX[i])
# print("forceY[i]===",forceY[i])
# print("forceZ[i]===",forceZ[i])
# print("forceCoreX[i]===",forceCoreX[i])
# print("forceCoreY[i]===",forceCoreY[i])
# print("forceCoreZ[i]===",forceCoreZ[i])
# print("forceIBSX[i]===",forceIBSX[i])
# print("forceIBSY[i]===",forceIBSY[i])
# print("forceIBSZ[i]===",forceIBSZ[i])
# atom_forces.append([fConv(forceX[i]),fConv(forceY[i]),fConv(forceZ[i])])
# atom_core_forces.append([fConv(forceCoreX[i]),fConv(forceCoreY[i]),fConv(forceCoreZ[i])])
# atom_IBS_forces.append([fConv(forceIBSX[i]),fConv(forceIBSY[i]),fConv(forceIBSZ[i])])
# atom_HF_forces.append([fConv(forceHFX[i]),fConv(forceHFY[i]),fConv(forceHFZ[i])])
# backend.addValue("atom_forces",atom_forces)
# backend.addValue("x_exciting_atom_core_forces",atom_core_forces)
# backend.addValue("x_exciting_atom_IBS_forces",atom_IBS_forces)
# backend.addValue("x_exciting_atom_HF_forces",atom_HF_forces)
# print("atom_forces=",atom_forces)
#
dirPath
=
os
.
path
.
dirname
(
self
.
parser
.
fIn
.
name
)
dosFile
=
os
.
path
.
join
(
dirPath
,
"dos.xml"
)
bandFile
=
os
.
path
.
join
(
dirPath
,
"bandstructure.xml"
)
fermiSurfFile
=
os
.
path
.
join
(
dirPath
,
"FERMISURF.bxsf"
)
eigvalFile
=
os
.
path
.
join
(
dirPath
,
"EIGVAL.OUT"
)
# inputFile = os.path.join(dirPath, "input.xml")
# logging.error("done BASE onClose_section_single_configuration_calculation")
if
os
.
path
.
exists
(
dosFile
):
...
...
@@ -295,9 +322,7 @@ class ExcitingParserContext(object):
def
onClose_section_system
(
self
,
backend
,
gIndex
,
section
):
self
.
unit_cell_vol
=
section
[
"x_exciting_unit_cell_volume"
]
# print("self.unit_cell_vol= ",self.unit_cell_vol)
self
.
gmaxvr
=
section
[
"x_exciting_gmaxvr"
]
# print("gkmax= ", self.gkmax)
backend
.
addArrayValues
(
'configuration_periodic_dimensions'
,
np
.
asarray
([
True
,
True
,
True
]))
self
.
secSystemDescriptionIndex
=
gIndex
...
...
@@ -347,7 +372,6 @@ class ExcitingParserContext(object):
backend
.
addValue
(
'electronic_structure_method'
,
"DFT"
)
energy_thresh
=
section
[
"x_exciting_scf_threshold_energy_change"
][
0
]
potential_thresh
=
section
[
"x_exciting_scf_threshold_potential_change_list"
][
0
]
# print("potential_thresh====",potential_thresh)
charge_thresh
=
section
[
"x_exciting_scf_threshold_charge_change_list"
][
0
]
if
section
[
"x_exciting_scf_threshold_force_change_list"
]:
force_thresh
=
section
[
"x_exciting_scf_threshold_force_change_list"
][
0
]
...
...
@@ -391,7 +415,6 @@ mainFileDescription = \
subMatchers
=
[
SM
(
r
"\s*muffin-tin radius\s*:\s*(?P<x_exciting_muffin_tin_radius__bohr>[-0-9.]+)"
,
repeats
=
True
),
SM
(
r
"\s*# of radial points in muffin-tin\s*:\s*(?P<x_exciting_muffin_tin_points>[-0-9.]+)"
,
repeats
=
True
),
# SM(startReStr = r"\s*atomic positions\s*\(lattice\)\s*:\s*",
SM
(
startReStr
=
r
"\s*atomic positions\s*\((?P<x_exciting_atom_position_format>[-a-zA-Z]+)\)\s*:\s*"
,
endReStr
=
r
"\s*magnetic fields\s*"
,
subMatchers
=
[
...
...
@@ -430,8 +453,6 @@ mainFileDescription = \
SM
(
startReStr
=
r
"\s*Exchange-correlation type\s*:\s*(?P<x_exciting_xc_functional>[-0-9.]+)"
,
sections
=
[
'x_exciting_section_xc'
]),
SM
(
r
"\s*Smearing scheme\s*:\s*(?P<x_exciting_smearing_type>[-a-zA-Z0-9]+)"
),
# SM(r"\s*Smearing width\s*:\s*(?P<x_exciting_smearing_width__hartree>[-0-9.]+)"),
# SM(r"\s*Smearing scheme\s*:\s*(?P<smearing_kind>[-a-zA-Z0-9]+)"),
SM
(
r
"\s*Smearing width\s*:\s*(?P<smearing_width__hartree>[-0-9.]+)"
),
SM
(
r
"\s*Using\s*(?P<x_exciting_potential_mixing>[-a-zA-Z\s*]+)\s*potential mixing"
)
]),
...
...
parser/parser-exciting/parser_exciting_helium.py
View file @
ec6392cb
# Copyright 2016-2018 The NOMAD Developers Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Main author and maintainer: Lorenzo Pardini <loren.pard@gmail.com>
from
builtins
import
object
import
setup_paths
import
numpy
as
np
...
...
@@ -72,11 +87,7 @@ class ExcitingHeliumParserContext(object):
bandFile
=
os
.
path
.
join
(
dirPath
,
"bandstructure.xml"
)
eigvalFile
=
os
.
path
.
join
(
dirPath
,
"EIGVAL.OUT"
)
fermiSurfFile
=
os
.
path
.
join
(
dirPath
,
"FERMISURF.bxsf"
)
# inputFile = os.path.join(dirPath, "input.xml")
# if os.path.exists(inputFile):
# with open(inputFile) as f:
# exciting_parser_input.parseInput(f, backend)
if
os
.
path
.
exists
(
dosFile
):
with
open
(
dosFile
)
as
f
:
exciting_parser_dos
.
parseDos
(
f
,
backend
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment