Commit b4262dc0 authored by Pardini, Lorenzo (lopa)'s avatar Pardini, Lorenzo (lopa)
Browse files

Few gw metadata

parent 1208962b
...@@ -21,9 +21,11 @@ class GWParser(object): ...@@ -21,9 +21,11 @@ class GWParser(object):
self.vertexLabels = [] self.vertexLabels = []
self.vertexNum = 0 self.vertexNum = 0
def parseGW(self, gwFile, backend, dftMethodSectionGindex, dftSingleConfigurationGindex, xcName, unitCellVol): def parseGW(self, gwFile, backend, dftMethodSectionGindex, dftSingleConfigurationGindex, xcName, unitCellVol,gmaxvr):
# logging.error("GW onClose_section_single_configuration_calculation") # logging.error("GW onClose_section_single_configuration_calculation")
# print("xcNameGW=", xcName) # print("xcNameGW=", xcName)
self.gmaxvr = float(gmaxvr[0])
# print("gkmax= ",self.gmaxvr)
self.unitCellVol = float(unitCellVol[0]) self.unitCellVol = float(unitCellVol[0])
backend.openNonOverlappingSection("section_single_configuration_calculation") backend.openNonOverlappingSection("section_single_configuration_calculation")
if dftSingleConfigurationGindex is not None: if dftSingleConfigurationGindex is not None:
...@@ -50,7 +52,7 @@ class GWParser(object): ...@@ -50,7 +52,7 @@ class GWParser(object):
if os.path.exists(inputFile): if os.path.exists(inputFile):
selfGWSetGIndex = backend.openSection("section_method") selfGWSetGIndex = backend.openSection("section_method")
backend.addValue('electronic_structure_method', "G0W0") backend.addValue('electronic_structure_method', "G0W0")
backend.addValue('x_exciting_gw_starting_point', xcName) backend.addValue('gw_starting_point', xcName)
if dftMethodSectionGindex is not None: if dftMethodSectionGindex is not None:
m2mGindex = backend.openNonOverlappingSection("section_method_to_method_refs") m2mGindex = backend.openNonOverlappingSection("section_method_to_method_refs")
backend.addValue("method_to_method_ref", dftMethodSectionGindex) backend.addValue("method_to_method_ref", dftMethodSectionGindex)
...@@ -66,8 +68,13 @@ class GWParser(object): ...@@ -66,8 +68,13 @@ class GWParser(object):
fgrid = "gaule2" fgrid = "gaule2"
lmaxmb = 3 lmaxmb = 3
epsmb = 0.0001 epsmb = 0.0001
# gmb = 1.0 gmb = 1.0
sciavtype = "isotropic" sciavtype = "isotropic"
cutofftype = "none"
pwm = 2.0
ngridq = [2,2,2]
freqmax = 1.0
nomeg = 16
k1 = 0 k1 = 0
k2 = 0 k2 = 0
# f1 = 0 # f1 = 0
...@@ -90,8 +97,8 @@ class GWParser(object): ...@@ -90,8 +97,8 @@ class GWParser(object):
s = s.split('=') s = s.split('=')
if s[0] == "<gw": k1 = i if s[0] == "<gw": k1 = i
if s[0] == "</gw>": k2 = i if s[0] == "</gw>": k2 = i
# if s[0] == "<freqgrid": f1 = i if s[0] == "<freqgrid": f1 = i
# if s[0] == "</freqgrid>": f2 = i if s[0] == "</freqgrid>": f2 = i
if s[0] == "<selfenergy": s1 = i if s[0] == "<selfenergy": s1 = i
if s[0] == "</selfenergy>": s2 = i if s[0] == "</selfenergy>": s2 = i
if s[0] == "<mixbasis": m1 = i if s[0] == "<mixbasis": m1 = i
...@@ -100,6 +107,8 @@ class GWParser(object): ...@@ -100,6 +107,8 @@ class GWParser(object):
if s[0] == "</barecoul>": bc2 = i if s[0] == "</barecoul>": bc2 = i
if s[0] == "<scrcoul": sc1 = i if s[0] == "<scrcoul": sc1 = i
if s[0] == "</scrcoul>": sc2 = i if s[0] == "</scrcoul>": sc2 = i
# print("m1= ",m1)
# print("m2= ",m2)
with open(inputFile) as g: with open(inputFile) as g:
i = 0 i = 0
while 1: while 1:
...@@ -108,43 +117,105 @@ class GWParser(object): ...@@ -108,43 +117,105 @@ class GWParser(object):
if not s: break if not s: break
s = s.strip() s = s.strip()
s = s.split('=') s = s.split('=')
if (s[0] == "coreflag") and (i >= k1): if (s[0] == "coreflag") and (i >= k1) and (i < (k2-1)):
coreflag = s[1][1:-1] coreflag = s[1][1:-1]
if (s[0] == "singularity") and (i >= k1): elif (s[0] == "coreflag") and (i == (k2-1)):
coreflag = s[1][1:-2]
if (s[0] == "singularity") and (i >= k1) and (i < (k2-1)):
freq_conv = s[1][1:-1] freq_conv = s[1][1:-1]
if (s[0] == "actype") and (i >= k1): elif (s[0] == "singularity") and (i == (k2-1)):
freq_conv = s[1][1:-2]
if (s[0] == "actype") and (i >= k1) and (i < (k2-1)):
actype = s[1][1:-1] actype = s[1][1:-1]
if (s[0] == "npol") and (i >= k1): elif (s[0] == "actype") and (i == (k2-1)):
npol = s[1][1:-1] actype = s[1][1:-2]
if (s[0] == "nempty") and (i >= k1) and (i <= k2): if (s[0] == "ngridq") and (i >= k1) and (i < (k2-1)):
pnempty = s[1][1:-1] dummy = s[1].split('"')
if (s[0] == "scrtype") and (i >= k1): dummy1 = dummy[1].split()
for j in range(0,3):
ngridq[j] = int(dummy1[j])
elif (s[0] == "ngrid") and (i == (k2-1)):
dummy = s[1].split('"')
dummy1 = dummy[1].split()
for j in range(0,3):
ngridq[j] = int(dummy1[j])
if (s[0] == "npol") and (i >= k1) and (i < (k2-1)):
npol = int(s[1][1:-1])
elif (s[0] == "npol") and (i == (k2-1)):
npol = int(s[1][1:-2])
if (s[0] == "nempty") and (i >= k1) and (i < (k2-1)):
pnempty = int(s[1][1:-1])
elif (s[0] == "nempty") and (i == (k2-1)):
pnempty = int(s[1][1:-2])
if (s[0] == "scrtype") and (i >= k1) and (i < (k2-1)):
scrtype = s[1][1:-1] scrtype = s[1][1:-1]
if (s[0] == "nempty") and (i >= s1) and (i <= s2): elif (s[0] == "scrtype") and (i == (k2-1)):
snempty = s[1][1:-1] scrtype = s[1][1:-2]
if (s[0] == "nempty") and (i >= m1) and (i <= m2): if (s[0] == "nempty") and (i >= s1) and (i < (s2-1)):
lmaxmb = s[1][1:-1] snempty = int(s[1][1:-1])
if (s[0] == "nempty") and (i >= m1) and (i <= m2): elif (s[0] == "nempty") and (i == (s2-1)):
epsmb = s[1][1:-1] snempty = int(s[1][1:-2])
# if (s[0] == "nempty") and (i >= m1) and (i <= m2): if (s[0] == "freqmax") and (i >= f1) and (i < (f2-1)):
# gmb = s[1][1:-1] freqmax = float(s[1][1:-1])
if (s[0] == "sciavtype") and (i >= sc11) and (i <= sc2): elif (s[0] == "freqmax") and (i == (f2-1)):
freqmax = float(s[1][1:-2])
if (s[0] == "nomeg") and (i >= f1) and (i < (f2-1)):
nomeg = int(s[1][1:-1])
elif (s[0] == "nomeg") and (i == (f2-1)):
nomeg = int(s[1][1:-2])
if (s[0] == "lmaxmb") and (i >= m1) and (i < (m2-1)):
lmaxmb = int(s[1][1:-1])
elif (s[0] == "lmaxmb") and (i == (m2-1)):
lmaxmb = int(s[1][1:-2])
if (s[0] == "epsmb") and (i >= m1) and (i < (m2-1)):
epsmb = float(s[1][1:-1])
elif (s[0] == "epsmb") and (i == (m2-1)):
epsmb = float(s[1][1:-2])
if (s[0] == "gmb") and (i >= m1) and (i < (m2-1)):
gmb = float(s[1][1:-1])
elif (s[0] == "gmb") and (i == (m2-1)):
gmb = float(s[1][1:-2])
if (s[0] == "sciavtype") and (i >= sc1) and (i < (sc2-1)):
sciavtype = s[1][1:-1] sciavtype = s[1][1:-1]
if (s[0] == "fgrid") and (i >= k1): elif (s[0] == "sciavtype") and (i == (sc2-1)):
sciavtype = s[1][1:-2]
if (s[0] == "fgrid") and (i >= k1) and (i < (k2-1)):
fgrid = s[1][1:-1] fgrid = s[1][1:-1]
backend.addValue("x_exciting_gw_frequency_grid_type", fgrid) elif (s[0] == "fgrid") and (i == (k2-1)):
backend.addValue("x_exciting_gw_self_energy_c_empty_states", int(snempty)) fgrid = s[1][1:-2]
backend.addValue("x_exciting_gw_core_treatment", coreflag) if (s[0] == "pwm") and (i >= bc1) and (i < (bc2-1)):
backend.addValue("x_exciting_gw_self_energy_singularity_treatment", singularity) pwm = float(s[1][1:-1])
backend.addValue("x_exciting_gw_self_energy_c_analytical_continuation", actype) elif (s[0] == "pwm") and (i == (bc2-1)):
backend.addValue("x_exciting_gw_self_energy_c_number_of_poles", int(npol)) pwm = float(s[1][1:-2])
backend.addValue("x_exciting_gw_screened_Coulomb", scrtype) if (s[0] == "cutofftype") and (i >= bc1) and (i < (bc2-1)):
backend.addValue("x_exciting_gw_polarizability_empty_states", int(pnempty)) cutofftype = s[1][1:-1]
backend.addValue("x_exciting_gw_basis_set", "mixed") elif (s[0] == "cutofftype") and (i == (bc2-1)):
backend.addValue("x_exciting_gw_mixed_basis_lmax", lmaxmb) cutofftype = s[1][1:-2]
backend.addValue("x_exciting_gw_mixed_basis_tolerance", epsmb) # gmb = gmb*self.gmaxvr
# backend.addValue("x_exciting_gw_mixed_basis_gmax", gmb) # pwm = pwm*gmb*self.gmaxvr
backend.addValue("x_exciting_gw_screened_coulomb_volume_average",sciavtype) # print("gmb= ",type(gmb))
# print("pwm= ", type(pwm))
# print("self.gmaxvr= ",type(self.gmaxvr))
backend.addValue("gw_frequency_grid_type", fgrid)
backend.addValue("gw_self_energy_c_number_of_empty_states", int(snempty))
backend.addValue("gw_core_treatment", coreflag)
backend.addValue("gw_self_energy_singularity_treatment", singularity)
backend.addValue("gw_self_energy_c_analytical_continuation", actype)
backend.addValue("gw_self_energy_c_number_of_poles", int(npol))
backend.addValue("gw_screened_Coulomb", scrtype)
backend.addValue("gw_polarizability_number_of_empty_states", int(pnempty))
backend.addValue("gw_basis_set", "mixed")
backend.addValue("gw_mixed_basis_lmax", lmaxmb)
backend.addValue("gw_mixed_basis_tolerance", epsmb)
backend.addValue("gw_mixed_basis_gmax", gmb*self.gmaxvr)
backend.addValue("gw_screened_coulomb_volume_average",sciavtype)
backend.addValue("gw_bare_coulomb_gmax", pwm*gmb*self.gmaxvr)
backend.addValue("gw_ngridq", ngridq)
backend.addValue("gw_bare_coulomb_cutofftype", cutofftype)
backend.addValue("gw_max_frequency", freqmax)
backend.addValue("gw_number_of_frequencies", nomeg)
backend.addValue("gw_qp_equation_treatment", "linearization")
# backend.addArrayValues
backend.closeSection("section_method",selfGWSetGIndex) backend.closeSection("section_method",selfGWSetGIndex)
if os.path.exists(vertexGWFile): if os.path.exists(vertexGWFile):
...@@ -176,6 +247,7 @@ class GWParser(object): ...@@ -176,6 +247,7 @@ class GWParser(object):
eigvalGWGIndex = backend.openSection("section_eigenvalues") eigvalGWGIndex = backend.openSection("section_eigenvalues")
with open(eigvalGWFile) as g: with open(eigvalGWFile) as g:
qpGWKpoint=[] qpGWKpoint=[]
Vxc = [[],[]]
Sx = [[],[]] Sx = [[],[]]
Sc = [[],[]] Sc = [[],[]]
qpE = [[],[]] qpE = [[],[]]
...@@ -188,6 +260,7 @@ class GWParser(object): ...@@ -188,6 +260,7 @@ class GWParser(object):
if "k-point" in s.split(): if "k-point" in s.split():
qpGWKpoint.append([]) qpGWKpoint.append([])
for i in range(0,2): for i in range(0,2):
Vxc[i].append([])
Sx[i].append([]) Sx[i].append([])
Sc[i].append([]) Sc[i].append([])
qpE[i].append([]) qpE[i].append([])
...@@ -212,14 +285,16 @@ class GWParser(object): ...@@ -212,14 +285,16 @@ class GWParser(object):
Sc[i][-1].append(fromH(float(s[5]))) Sc[i][-1].append(fromH(float(s[5])))
qpE[i][-1].append(fromH(float(s[3]))) qpE[i][-1].append(fromH(float(s[3])))
Znk[i][-1].append(float(s[9])) Znk[i][-1].append(float(s[9]))
Vxc[i][-1].append(fromH(float(s[6])))
backend.addValue("eigenvalues_kpoints", qpGWKpoint) backend.addValue("eigenvalues_kpoints", qpGWKpoint)
backend.addValue("number_of_eigenvalues", len(qpE[0])) backend.addValue("number_of_eigenvalues", len(qpE[0]))
backend.addValue("number_of_eigenvalues_kpoints", len(qpGWKpoint)) backend.addValue("number_of_eigenvalues_kpoints", len(qpGWKpoint))
backend.addValue("eigenvalues_values", qpE) backend.addValue("eigenvalues_values", qpE)
backend.addValue("x_exciting_gw_qp_linearization_prefactor", Znk) backend.addValue("gw_qp_linearization_prefactor", Znk)
backend.closeSection("section_eigenvalues",eigvalGWGIndex) backend.closeSection("section_eigenvalues",eigvalGWGIndex)
backend.addValue("x_exciting_gw_self_energy_x", Sx) backend.addValue("gw_self_energy_x", Sx)
backend.addValue("x_exciting_gw_self_energy_c", Sc) backend.addValue("gw_self_energy_c", Sc)
backend.addValue("gw_xc_potential", Vxc)
####################DOS###################### ####################DOS######################
......
...@@ -32,6 +32,7 @@ class ExcitingParserContext(object): ...@@ -32,6 +32,7 @@ class ExcitingParserContext(object):
self.secRunIndex = None self.secRunIndex = None
self.unit_cell_vol = 0 self.unit_cell_vol = 0
self.xcName = None self.xcName = None
self.gmaxvr = 0
def onOpen_section_system(self, backend, gIndex, section): def onOpen_section_system(self, backend, gIndex, section):
self.secSystemIndex = gIndex self.secSystemIndex = gIndex
...@@ -61,7 +62,8 @@ class ExcitingParserContext(object): ...@@ -61,7 +62,8 @@ class ExcitingParserContext(object):
dftMethodSectionGindex = self.secMethodIndex, dftMethodSectionGindex = self.secMethodIndex,
dftSingleConfigurationGindex = self.secSingleConfIndex, dftSingleConfigurationGindex = self.secSingleConfIndex,
xcName = self.xcName, xcName = self.xcName,
unitCellVol = self.unit_cell_vol) unitCellVol = self.unit_cell_vol,
gmaxvr = self.gmaxvr)
# logging.error("Finished GW") # logging.error("Finished GW")
break break
...@@ -247,6 +249,8 @@ class ExcitingParserContext(object): ...@@ -247,6 +249,8 @@ class ExcitingParserContext(object):
self.unit_cell_vol = section["x_exciting_unit_cell_volume"] self.unit_cell_vol = section["x_exciting_unit_cell_volume"]
# print("self.unit_cell_vol= ",self.unit_cell_vol) # 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])) backend.addArrayValues('configuration_periodic_dimensions', np.asarray([True, True, True]))
self.secSystemDescriptionIndex = gIndex self.secSystemDescriptionIndex = gIndex
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment