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
b6fab8c3
Commit
b6fab8c3
authored
Jun 28, 2018
by
Pardini, Lorenzo (lopa)
Browse files
BSE exciton
parent
75cc209a
Changes
4
Hide whitespace changes
Inline
Side-by-side
parser/parser-exciting/exciting_parser_XS_input.py
View file @
b6fab8c3
...
...
@@ -49,10 +49,10 @@ class InputHandler(xml.sax.handler.ContentHandler):
# self.vkloffScrDum = "-1.0 -1.0 -1.0"
self
.
screening
=
"none"
self
.
bse
=
"none"
self
.
screentype
=
"full"
#
self.screentype = "full"
############ BSE variables################
self
.
aresbse
=
"True"
self
.
bsetype
=
"singlet"
#
self.bsetype = "singlet"
self
.
lmaxdielt
=
14
self
.
nstlbse
=
[
0
,
0
,
0
,
0
]
######## DA FARE
self
.
nstlbseDum
=
[
0
,
0
,
0
,
0
]
######## DA FARE
...
...
@@ -193,11 +193,11 @@ class InputHandler(xml.sax.handler.ContentHandler):
self
.
rgkmaxScr
=
attrs
.
getValue
(
'rgkmax'
)
except
:
self
.
rgkmaxSrc
=
0.0
try
:
self
.
screentype
=
attrs
.
getValue
(
'screentype'
)
self
.
backend
.
addValue
(
"x_exciting_xs_screening_type"
,
int
(
self
.
screentype
))
except
:
self
.
backend
.
addValue
(
"x_exciting_xs_screening_type"
,
self
.
screentype
)
#
try:
#
self.screentype = attrs.getValue('screentype')
#
self.backend.addValue("x_exciting_xs_screening_type", int(self.screentype))
#
except:
#
self.backend.addValue("x_exciting_xs_screening_type", self.screentype)
# self.aresbse = "true"
# self.bsetype = "singlet"
...
...
@@ -222,11 +222,11 @@ class InputHandler(xml.sax.handler.ContentHandler):
self
.
backend
.
addValue
(
"x_exciting_xs_bse_antiresonant"
,
self
.
aresbse
)
except
:
self
.
backend
.
addValue
(
"x_exciting_xs_bse_antiresonant"
,
self
.
aresbse
)
try
:
self
.
bsetype
=
attrs
.
getValue
(
'bsetype'
)
self
.
backend
.
addValue
(
"x_exciting_xs_bse_type"
,
self
.
bsetype
)
except
:
self
.
backend
.
addValue
(
"x_exciting_xs_bse_type"
,
self
.
bsetype
)
#
try:
#
self.bsetype = attrs.getValue('bsetype')
#
self.backend.addValue("x_exciting_xs_bse_type", self.bsetype)
#
except:
#
self.backend.addValue("x_exciting_xs_bse_type", self.bsetype)
try
:
self
.
lmaxdielt
=
attrs
.
getValue
(
'lmaxdielt'
)
self
.
backend
.
addValue
(
"x_exciting_xs_bse_angular_momentum_cutoff"
,
int
(
self
.
lmaxdielt
))
...
...
parser/parser-exciting/exciting_parser_xs.py
0 → 100644
View file @
b6fab8c3
# Copyright 2017-2018 Lorenzo Pardini
#
# 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.
from
builtins
import
object
import
setup_paths
import
xml.sax
from
nomadcore.simple_parser
import
mainFunction
,
CachingLevel
from
nomadcore.simple_parser
import
SimpleMatcher
as
SM
from
nomadcore.local_meta_info
import
loadJsonFile
,
InfoKindEl
from
nomadcore.unit_conversion
import
unit_conversion
import
os
,
sys
,
json
,
logging
################################################################
# This is the subparser for the exciting GW output
################################################################
class
XSParser
(
object
):
"""context for wien2k In2 parser"""
def
__init__
(
self
):
pass
# self.excitonEnergys = []
# self.vertexLabels = []
# self.vertexNum = 0
# self.parser = None
# self.secSingleConfIndex = None
def
startedParsing
(
self
,
path
,
parser
):
"""called when parsing starts"""
self
.
parser
=
parser
# allows to reset values if the same superContext is used to parse different files
# self.initialize_values()
def
parseExciton
(
self
,
excFile
,
backend
,
excNum
,
excEn
,
excBindEn
,
osclStr
,
transCoeff
):
# if dftSingleConfigurationGindex is not None:
# backend.openNonOverlappingSection("section_calculation_to_calculation_refs")
# backend.addValue("calculation_to_calculation_ref", dftSingleConfigurationGindex)
# backend.addValue("calculation_to_calculation_kind", "starting_point")
# backend.closeNonOverlappingSection("section_calculation_to_calculation_refs")
# logging.error("GW onClose_section_single_configuration_calculation")
with
open
(
excFile
)
as
g
:
while
1
:
s
=
g
.
readline
()
if
not
s
:
break
s
=
s
.
strip
()
s
=
s
.
split
()
if
s
[
0
]
!=
"#"
:
excNum
[
-
1
].
append
(
int
(
s
[
0
]))
excEn
[
-
1
].
append
(
float
(
s
[
1
]))
excBindEn
[
-
1
].
append
(
float
(
s
[
2
]))
osclStr
[
-
1
].
append
(
float
(
s
[
3
]))
transCoeff
[
-
1
][
0
].
append
(
float
(
s
[
4
]))
transCoeff
[
-
1
][
1
].
append
(
float
(
s
[
5
]))
# print("s===",excNum)
# if len(st) == 3:
# if len(s) >= 40:
# print("vaaa")
# self.gmaxvr = float(gmaxvr[0])
# self.unitCellVol = float(unitCellVol[0])
# backend.openNonOverlappingSection("section_single_configuration_calculation")
# if dftSingleConfigurationGindex is not None:
# backend.openNonOverlappingSection("section_calculation_to_calculation_refs")
# backend.addValue("calculation_to_calculation_ref", dftSingleConfigurationGindex)
# backend.addValue("calculation_to_calculation_kind", "starting_point")
# backend.closeNonOverlappingSection("section_calculation_to_calculation_refs")
#
# dirPath = os.path.dirname(gwFile)
# if os.access(os.path.join(dirPath, "EVALQP.DAT"), os.F_OK):
# eigvalGWFile = os.path.join(dirPath, "EVALQP.DAT")
# elif os.access(os.path.join(dirPath, "EVALQP.TXT"), os.F_OK):
# eigvalGWFile = os.path.join(dirPath, "EVALQP.TXT")
# else:
# pass
# dosGWFile = os.path.join(dirPath, "TDOS-QP.OUT")
# bandCarbGWFile = os.path.join(dirPath, "bandstructure-qp.dat")
# bandBorGWFile = os.path.join(dirPath, "BAND-QP.OUT")
# vertexGWFile = os.path.join(dirPath, "BANDLINES.OUT")
# vertexLabGWFile = os.path.join(dirPath, "bandstructure.xml")
# selfCorGWFile = os.path.join(dirPath, "SELFC.DAT")
# inputFile = os.path.join(dirPath, "input.xml")
# inputgw1File = os.path.join(dirPath, "input-gw.xml")
# inputgw2File = os.path.join(dirPath, "input_gw.xml")
def
get_cachingLevelForMetaName
(
metaInfoEnv
,
CachingLvl
):
cachingLevelForMetaName
=
{}
# 'section_single_configuration_calculation': CachingLvl
# }
# cachingLevelForMetaName["gw_fundamental_gap"] = CachingLevel.Cache
# cachingLevelForMetaName["gw_optical_gap"] = CachingLevel.Cache
# cachingLevelForMetaName["gw_fermi_energy"] = CachingLevel.Cache
return
cachingLevelForMetaName
parser/parser-exciting/parser_exciting.py
View file @
b6fab8c3
...
...
@@ -23,7 +23,7 @@ from nomadcore.caching_backend import CachingLevel
from
nomadcore.unit_conversion
import
unit_conversion
from
nomadcore.unit_conversion.unit_conversion
import
convert_unit_function
import
os
,
sys
,
json
,
exciting_parser_dos
,
exciting_parser_bandstructure
,
exciting_parser_gw
,
exciting_parser_GS_input
import
exciting_parser_XS_input
import
exciting_parser_XS_input
,
exciting_parser_xs
from
ase
import
Atoms
import
logging
...
...
@@ -69,6 +69,10 @@ class ExcitingParserContext(object):
self
.
dummy
=
0
self
.
i
=
0
self
.
clathrates
=
False
self
.
bsetype
=
None
self
.
screentype
=
None
self
.
tensorComp
=
[]
self
.
excitonEnergies
=
[]
# self.volumeOptIndex = 0
def
onOpen_section_run
(
self
,
backend
,
gIndex
,
section
):
...
...
@@ -227,6 +231,11 @@ class ExcitingParserContext(object):
break
if
os
.
path
.
exists
(
xsFile
):
excNum
=
[]
excEn
=
[]
excBindEn
=
[]
osclStr
=
[]
transCoeff
=
[]
# print("BSE!!!")
# if os.path.exists(inputgwFile):
inputXSFile
=
os
.
path
.
join
(
dirPath
,
"input.xml"
)
...
...
@@ -238,10 +247,91 @@ class ExcitingParserContext(object):
backend
.
addValue
(
"method_to_method_ref"
,
self
.
secMethodIndex
)
backend
.
addValue
(
"method_to_method_kind"
,
"starting_point"
)
backend
.
closeNonOverlappingSection
(
"section_method_to_method_refs"
)
for
files
in
os
.
listdir
(
dirPath
):
if
files
[
0
:
11
]
==
"EXCITON_BSE"
:
dummyBse
=
files
[
11
:
13
]
# self.tensorComp = files[-6:-4]
self
.
tensorComp
.
append
(
files
[
-
6
:
-
4
])
if
dummyBse
==
'si'
:
self
.
bsetype
=
'singlet'
# name = "EXCITON_BSE" + self.bsetype
elif
dummyBse
==
'tr'
:
self
.
bsetype
=
'triplet'
elif
dummyBse
==
'RP'
:
self
.
bsetype
=
'RPA'
elif
dummyBse
==
'IP'
:
self
.
bsetype
=
'IP'
name
=
"EXCITON_BSE"
+
self
.
bsetype
+
'_SCR'
if
files
[
len
(
name
):
len
(
name
)
+
4
]
==
'full'
:
self
.
screentype
=
'full'
elif
files
[
len
(
name
):
len
(
name
)
+
4
]
==
'diag'
:
self
.
screentype
=
'diag'
elif
files
[
len
(
name
):
len
(
name
)
+
4
]
==
'noin'
:
self
.
screentype
=
'noinvdiag'
elif
files
[
len
(
name
):
len
(
name
)
+
4
]
==
'long'
:
self
.
screentype
=
'longrange'
backend
.
addValue
(
"x_exciting_xs_screening_type"
,
self
.
screentype
)
backend
.
addValue
(
"x_exciting_xs_bse_type"
,
self
.
bsetype
)
# print("===", self.tensorComp[0])
with
open
(
inputXSFile
)
as
f
:
exciting_parser_XS_input
.
parseInput
(
f
,
backend
,
self
.
rgkmax
)
backend
.
closeSection
(
"section_method"
,
selfXSSetGIndex
)
numberOfComponents
=
len
(
self
.
tensorComp
)
backend
.
openNonOverlappingSection
(
"section_single_configuration_calculation"
)
if
self
.
secSingleConfIndex
is
not
None
:
backend
.
openNonOverlappingSection
(
"section_calculation_to_calculation_refs"
)
backend
.
addValue
(
"calculation_to_calculation_ref"
,
self
.
secSingleConfIndex
)
backend
.
addValue
(
"calculation_to_calculation_kind"
,
"starting_point"
)
backend
.
closeNonOverlappingSection
(
"section_calculation_to_calculation_refs"
)
for
i
in
range
(
numberOfComponents
):
excNum
.
append
([])
excEn
.
append
([])
excBindEn
.
append
([])
osclStr
.
append
([])
transCoeff
.
append
([[],[]])
outputXSFile
=
os
.
path
.
join
(
dirPath
,
"EXCITON_BSE"
+
self
.
bsetype
+
'_SCR'
+
self
.
screentype
+
"_OC"
+
self
.
tensorComp
[
i
]
+
".OUT"
)
with
open
(
outputXSFile
)
as
g
:
xsParser
=
exciting_parser_xs
.
XSParser
()
xsParser
.
parseExciton
(
outputXSFile
,
backend
,
excNum
,
excEn
,
excBindEn
,
osclStr
,
transCoeff
)
#, dftMethodSectionGindex = self.secMethodIndex,
# dftSingleConfigurationGindex = self.secSingleConfIndex)
# backend.addvalue("x_exciting_xs_bse_number_of_components",numberOfComponents)
# backend.addvalue("x_exciting_xs_bse_number_of_excitons",len(excNum))
backend
.
addValue
(
"x_exciting_xs_bse_exciton_energies"
,
excEn
)
# print("===",excBindEn)
backend
.
closeNonOverlappingSection
(
"section_single_configuration_calculation"
)
# print(outputXSFile)
# for files in os.listdir(dirPath):
# if files[0:11] == "EXCITON_BSE":
# dummyBse = files[11:13]
# dummyTenCom = files[-6:-4]
# if dummyBse == 'si':
# self.bsetype = 'singlet'
## name = "EXCITON_BSE" + self.bsetype
# elif dummyBse == 'tr':
# self.bsetype = 'triplet'
# elif dummyBse == 'RP':
# self.bsetype = 'RPA'
# elif dummyBse == 'IP':
# self.bsetype = 'IP'
# name = "EXCITON_BSE" + self.bsetype + '_SCR'
# if files[len(name):len(name)+4] == 'full':
# self.screentype = 'full'
# elif files[len(name):len(name)+4] == 'diag':
# self.screentype = 'diag'
# elif files[len(name):len(name)+4] == 'noin':
# self.screentype = 'noinvdiag'
# elif files[len(name):len(name)+4] == 'long':
# self.screentype = 'longrange'
# print("===",self.screentype)
###########################TEST#############################
...
...
src/main/scala/eu/nomad_lab/parsers/ExcitingParser.scala
View file @
b6fab8c3
...
...
@@ -49,6 +49,7 @@ object ExcitingParser extends SimpleExternalParserGenerator(
"parser-exciting/exciting_parser_input.py"
,
"parser-exciting/exciting_parser_GS_input.py"
,
"parser-exciting/exciting_parser_XS_input.py"
,
"parser-exciting/exciting_parser_xs.py"
,
"parser-exciting/setup_paths.py"
,
"nomad_meta_info/public.nomadmetainfo.json"
,
"nomad_meta_info/common.nomadmetainfo.json"
,
...
...
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