Skip to content

Commit

Permalink
Adding LDAU pot rms parsing for impurity calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
dantogni committed Mar 14, 2024
1 parent 6c3b931 commit b33ba54
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
13 changes: 8 additions & 5 deletions masci_tools/io/parsers/kkrimp_parser_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
__copyright__ = ('Copyright (c), 2018, Forschungszentrum Jülich GmbH,'
'IAS-1/PGI-1, Germany. All rights reserved.')
__license__ = 'MIT license, see LICENSE.txt file'
__version__ = '0.8.0'
__contributors__ = ('Philipp Rüßmann', 'Fabian Bertoldo')
__version__ = '0.8.1'
__contributors__ = ('Philipp Rüßmann', 'Fabian Bertoldo', 'David Antognini Silva')

####################################################################################

Expand Down Expand Up @@ -359,11 +359,14 @@ def parse_kkrimp_outputfile(self, out_dict, file_dict, debug=False, ignore_nan=F
# also initialize convegence_group where all info stored for all iterations is kept
out_dict['convergence_group'] = tmp_dict
try:
rms_charge, rms_spin, result_atoms_last_charge, result_atoms_last_spin = get_rms(files['outfile'],
files['out_log'],
debug=debug)
rms_charge, rms_ldau, rms_spin, result_atoms_last_charge, result_atoms_last_spin = get_rms(files['outfile'],
files['out_log'],
debug=debug,
is_imp_calc=True)
tmp_dict['rms'] = rms_charge[-1]
tmp_dict['rms_all_iterations'] = rms_charge
tmp_dict['rms_LDAU'] = rms_ldau[-1]
tmp_dict['rms_LDAU_all_iterations'] = rms_ldau
tmp_dict['rms_per_atom'] = result_atoms_last_charge
if len(rms_spin) > 0:
tmp_dict['rms_spin'] = rms_spin[-1]
Expand Down
15 changes: 11 additions & 4 deletions masci_tools/io/parsers/kkrparser_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
__copyright__ = ('Copyright (c), 2017, Forschungszentrum Jülich GmbH,'
'IAS-1/PGI-1, Germany. All rights reserved.')
__license__ = 'MIT license, see LICENSE.txt file'
__contributors__ = 'Philipp Rüßmann'
__version__ = '1.8.2'
__contributors__ = 'Philipp Rüßmann, David Antognini Silva'
__version__ = '1.8.3'

####################################################################################

Expand Down Expand Up @@ -70,7 +70,7 @@ def parse_array_float(outfile, searchstring, splitinfo, replacepair=None, debug=
return res


def get_rms(outfile, outfile2, debug=False):
def get_rms(outfile, outfile2, debug=False, is_imp_calc=False):
"""
Get rms error per atom (both values for charge and spin) and total (i.e. average) value
"""
Expand All @@ -79,6 +79,10 @@ def get_rms(outfile, outfile2, debug=False):
rms_charge = parse_array_float(outfile, 'average rms-error', [2, '=', 1, 0], ['D', 'E'], debug=debug)
if debug:
print(rms_charge)
if is_imp_calc == True:
rms_ldau = parse_array_float(outfile, 'TOTAL RMS-ERROR for LDA+U:', [2, ':', 1, 0], debug=debug)
if debug:
print(rms_ldau)
rms_spin = parse_array_float(
outfile, ' v+ - v-', [1, '=', 1],
['D', 'E']) # this should be in the line after 'average rms-error' but is only present if NSPIN==2
Expand All @@ -98,7 +102,10 @@ def get_rms(outfile, outfile2, debug=False):
niter) # number of atoms in system, needed to take only atom resolved rms of last iteration
if debug:
print(natoms)
return rms_charge, rms_spin, rms_charge_atoms[-natoms:], rms_spin_atoms[-natoms:]
if is_imp_calc == True:
return rms_charge, rms_ldau, rms_spin, rms_charge_atoms[-natoms:], rms_spin_atoms[-natoms:]
else:
return rms_charge, rms_spin, rms_charge_atoms[-natoms:], rms_spin_atoms[-natoms:]


def get_noco_rms(outfile, debug=False):
Expand Down

0 comments on commit b33ba54

Please sign in to comment.