Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out.xml Parser Changes #29

Merged
merged 13 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions masci_tools/io/parsers/fleur/default_parse_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
'name': 'band'
}
},
'bz_integration': {
'parse_type': 'attrib',
'path_spec': {
'name': 'mode',
'tag_name': 'bzIntegration'
}
}
},
#--------Defintions for general info from outfile (start, endtime, number_iterations)--------
'general_out_info': {
Expand All @@ -138,12 +145,6 @@
'name': 'targetComputerArchitectures'
}
},
'creator_target_structure': {
'parse_type': 'text',
'path_spec': {
'name': 'targetStructureClass'
}
},
'output_file_version': {
'parse_type': 'attrib',
'path_spec': {
Expand All @@ -168,6 +169,13 @@
'name': 'ntype'
}
},
'number_of_kpoints': {
'parse_type': 'attrib',
'path_spec': {
'name': 'count',
'contains': 'numericalParameters'
}
},
'start_date': {
'parse_type': 'allAttribs',
'path_spec': {
Expand Down Expand Up @@ -387,7 +395,7 @@
},
'distances': {
'_minimal': True,
'charge_density': {
'density_convergence': {
'parse_type': 'attrib',
'path_spec': {
'name': 'distance',
Expand All @@ -406,14 +414,14 @@
'magnetic_distances': {
'_minimal': True,
'_modes': [('jspin', 2)],
'overall_charge_density': {
'overall_density_convergence': {
'parse_type': 'attrib',
'path_spec': {
'name': 'distance',
'tag_name': 'overallChargeDensity'
}
},
'spin_density': {
'spin_density_convergence': {
'parse_type': 'attrib',
'path_spec': {
'name': 'distance',
Expand Down Expand Up @@ -484,6 +492,7 @@
}
},
'bandgap': {
'_modes': [('bz_integration', 'hist')],
'bandgap': {
'parse_type': 'singleValue',
'path_spec': {
Expand Down Expand Up @@ -514,6 +523,7 @@
}
},
'forces': {
'_minimal': True,
'_modes': [('relax', True)],
'_conversions': ['convert_forces'],
'force_units': {
Expand Down
6 changes: 4 additions & 2 deletions masci_tools/io/parsers/fleur/fleur_outxml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def outxml_parser(outxmlfile, version=None, parser_info_out=None, iteration_to_p
if parser_info_out is None:
parser_info_out = {'parser_warnings': [], 'fleur_modes': {}, 'debug_info': {}}

parser_version = '0.3.0'
parser_version = '0.4.0'
parser_info_out['parser_info'] = f'Masci-Tools Fleur out.xml Parser v{parser_version}'

outfile_broken = False
Expand Down Expand Up @@ -309,7 +309,9 @@ def parse_general_information(root, parser, outschema_dict, iteration_to_parse=N

#For certain fleur modes we need to overwrite the tasks
if fleurmode['dos'] or fleurmode['band']:
parser.iteration_tasks = ['iteration_number', 'fermi_energy', 'bandgap']
parser.iteration_tasks = ['iteration_number', 'fermi_energy']
if fleurmode['bz_integration'] == 'hist':
parser.iteration_tasks = ['iteration_number', 'fermi_energy', 'bandgap']

if fleurmode['relax'] and iteration_to_parse == 'last':
if 'distances' in parser.iteration_tasks:
Expand Down
14 changes: 6 additions & 8 deletions masci_tools/io/parsers/fleur/fleur_schema/schema_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,15 @@ def fromVersion(cls, version, inp_version=None, parser_info_out=None, no_cache=F
parser_info_out['parser_warnings'].append(
f'Creating OutputSchemaDict object for differing versions (out: {version}; inp: {inp_version})')

version_hash = hash((version, inp_version))

if version_hash in cls.__schema_dict_cache and not no_cache:
return cls.__schema_dict_cache[version_hash]
if (version, inp_version) in cls.__schema_dict_cache and not no_cache:
return cls.__schema_dict_cache[(version, inp_version)]

inpschema_dict = InputSchemaDict.fromVersion(inp_version, no_cache=no_cache)
cls.__schema_dict_cache[version_hash] = cls.fromPath(schema_file_path,
inp_path=inpschema_file_path,
inpschema_dict=inpschema_dict)
cls.__schema_dict_cache[(version, inp_version)] = cls.fromPath(schema_file_path,
inp_path=inpschema_file_path,
inpschema_dict=inpschema_dict)

return cls.__schema_dict_cache[version_hash]
return cls.__schema_dict_cache[(version, inp_version)]

@classmethod
def fromPath(cls, path, inp_path=None, inpschema_dict=None):
Expand Down
37 changes: 17 additions & 20 deletions masci_tools/io/parsers/fleur/outxml_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def convert_relax_info(out_dict, parser_info_out=None):

out_dict['relax_atomtype_info'] = []
for specie in species:
out_dict['relax_atomtype_info'].append([specie, species_info[specie]])
out_dict['relax_atomtype_info'].append((specie, species_info[specie]))

return out_dict

Expand All @@ -210,42 +210,39 @@ def convert_forces(out_dict, parser_info_out=None):
"""
parsed_forces = out_dict.pop('parsed_forces')

if 'force_largest' not in out_dict:
out_dict['force_largest'] = []
if 'force_largest_component' not in out_dict:
out_dict['force_largest_component'] = []
out_dict['force_atoms'] = []
out_dict['abspos_atoms'] = []

if isinstance(parsed_forces['atom_type'], int):
parsed_forces = {key: [val] for key, val in parsed_forces.items()}

largest_force = 0.0
forces = []
abspos = []
for index, atomType in enumerate(parsed_forces['atom_type']):

if f'force_x_type{atomType}' not in out_dict:
out_dict[f'force_x_type{atomType}'] = []
out_dict[f'force_y_type{atomType}'] = []
out_dict[f'force_z_type{atomType}'] = []
out_dict[f'abspos_x_type{atomType}'] = []
out_dict[f'abspos_y_type{atomType}'] = []
out_dict[f'abspos_z_type{atomType}'] = []

force_x = parsed_forces['f_x'][index]
force_y = parsed_forces['f_y'][index]
force_z = parsed_forces['f_z'][index]

x = parsed_forces['x'][index]
y = parsed_forces['y'][index]
z = parsed_forces['z'][index]

forces.append((atomType, [force_x, force_y, force_z]))
abspos.append((atomType, [x, y, z]))

if abs(force_x) > largest_force:
largest_force = abs(force_x)
if abs(force_y) > largest_force:
largest_force = abs(force_y)
if abs(force_z) > largest_force:
largest_force = abs(force_z)

out_dict[f'force_x_type{atomType}'].append(force_x)
out_dict[f'force_y_type{atomType}'].append(force_y)
out_dict[f'force_z_type{atomType}'].append(force_z)

out_dict[f'abspos_x_type{atomType}'].append(parsed_forces['x'][index])
out_dict[f'abspos_y_type{atomType}'].append(parsed_forces['y'][index])
out_dict[f'abspos_z_type{atomType}'].append(parsed_forces['z'][index])

out_dict['force_largest'].append(largest_force)
out_dict['force_largest_component'].append(largest_force)
out_dict['force_atoms'].append(forces)
out_dict['abspos_atoms'].append(abspos)

return out_dict
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ output_dict:
bandgap: 2.2729704824
bandgap_units: eV
charge_den_xc_den_integral: -41.7653329254
charge_density: 0.026112816
creator_name: fleur 32
creator_target_architecture: GEN
creator_target_structure: null
density_convergence: 0.026112816
density_convergence_units: me/bohr^3
end_date:
date: 2020/12/10
Expand All @@ -25,6 +24,7 @@ output_dict:
number_of_atoms: 2
number_of_iterations: 6
number_of_iterations_total: 6
number_of_kpoints: 2
number_of_species: 1
number_of_spin_components: 1
number_of_symmetries: 48
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
output_dict:
bandgap: -580.0645652222
charge_den_xc_den_integral: -41.7653329254
charge_density: 0.026112816
creator_name: fleur 32
creator_target_architecture: GEN
creator_target_structure: null
density_convergence: 0.026112816
density_convergence_units: me/bohr^3
end_date:
date: 2020/12/10
Expand All @@ -24,6 +23,7 @@ output_dict:
number_of_atoms: 2
number_of_iterations: 6
number_of_iterations_total: 6
number_of_kpoints: 2
number_of_species: 1
number_of_spin_components: 1
number_of_symmetries: 48
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ output_dict:
bandgap: 2.2729704824
bandgap_units: eV
charge_den_xc_den_integral: -41.7653329254
charge_density: 0.026112816
core_info:
core_info_atom_type: 1
core_info_atomic_number: 14
Expand All @@ -12,7 +11,7 @@ output_dict:
core_info_spin: 1
creator_name: fleur 32
creator_target_architecture: GEN
creator_target_structure: null
density_convergence: 0.026112816
density_convergence_units: me/bohr^3
end_date:
date: 2020/12/10
Expand All @@ -32,6 +31,7 @@ output_dict:
number_of_atoms: 2
number_of_iterations: 6
number_of_iterations_total: 6
number_of_kpoints: 2
number_of_species: 1
number_of_spin_components: 1
number_of_symmetries: 48
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ output_dict:
bandgap: 2.2729704824
bandgap_units: eV
charge_den_xc_den_integral: -41.7653329254
charge_density: 0.026112816
core_eig_val_sum: -130.3854013875
creator_name: fleur 32
creator_target_architecture: GEN
creator_target_structure: null
density_convergence: 0.026112816
density_convergence_units: me/bohr^3
end_date:
date: 2020/12/10
Expand All @@ -26,6 +25,7 @@ output_dict:
number_of_atoms: 2
number_of_iterations: 6
number_of_iterations_total: 6
number_of_kpoints: 2
number_of_species: 1
number_of_spin_components: 1
number_of_symmetries: 48
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ output_dict:
- -41.7699610697
- -41.7648027154
- -41.7653329254
charge_density:
creator_name: fleur 32
creator_target_architecture: GEN
density_convergence:
- 8.7379598265
- 8.2515493263
- 1.0238480245
- 0.5765372317
- 0.2277277793
- 0.026112816
creator_name: fleur 32
creator_target_architecture: GEN
creator_target_structure: null
density_convergence_units: me/bohr^3
end_date:
date: 2020/12/10
Expand Down Expand Up @@ -73,6 +72,7 @@ output_dict:
number_of_atoms: 2
number_of_iterations: 6
number_of_iterations_total: 6
number_of_kpoints: 2
number_of_species: 1
number_of_spin_components: 1
number_of_symmetries: 48
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ output_dict:
bandgap: 0.0323610284
bandgap_units: eV
charge_den_xc_den_integral: -111.9182938603
charge_density:
- 9.2786635283
- 5.4278279348
creator_name: fleur 32
creator_target_architecture: GEN
creator_target_structure: null
density_convergence:
- 9.2786635283
- 5.4278279348
density_convergence_units: me/bohr^3
end_date:
date: null
Expand Down Expand Up @@ -36,12 +35,13 @@ output_dict:
number_of_atoms: 2
number_of_iterations: 4
number_of_iterations_total: 2
number_of_kpoints: 3
number_of_species: 1
number_of_spin_components: 2
number_of_symmetries: 16
output_file_version: '0.34'
overall_charge_density: 10.8914872112
spin_density: 10.6059102509
overall_density_convergence: 10.8914872112
spin_density_convergence: 10.6059102509
spin_dependent_charge_interstitial:
- 1.00491
- 1.0077593
Expand All @@ -63,6 +63,7 @@ output_dict:
warnings:
fleur_modes:
band: false
bz_integration: hist
dos: false
film: false
jspin: 2
Expand All @@ -71,10 +72,9 @@ warnings:
relax: false
soc: false
last_iteration_parsed: 2
parser_info: Masci-Tools Fleur out.xml Parser v0.3.0
parser_info: Masci-Tools Fleur out.xml Parser v0.4.0
parser_warnings:
- The out.xml file is broken I try to repair it.
- No text found for tag targetStructureClass
- No values found for attribute date at tag endDateAndTime
- No values found for attribute time at tag endDateAndTime
- Endtime was unparsed, inp.xml prob not complete, do not believe the walltime!
Expand Down
Loading