Commit dbf6b623 authored by Martin Kuban's avatar Martin Kuban
Browse files

added meta-info section for DOS fingerprint

parent 7e907d39
Pipeline #76596 failed with stages
in 4 minutes and 52 seconds
......@@ -1201,6 +1201,56 @@ class section_calculation_to_folder_refs(MSection):
a_legacy=LegacyDefinition(name='calculation_to_folder_kind'))
class section_dos_fingerprint(MSection):
'''
Section for the fingerprint of the electronic density-of-states (DOS).
DOS fingerprints are a modification of the D-Fingerprints reported in Chem. Mater. 2015, 27, 3, 735–743
(doi:10.1021/cm503507h). The fingerprint consists of a binary representation of the DOS,
that is used to evaluate the similarity of materials based on their electronic structure.
'''
m_def = Section(validate=False, a_legacy=LegacyDefinition(name='section_dos_fingerprint'))
bins = Quantity(
type=str,
description='''
Byte representation of the DOS fingerprint.
''',
a_legacy=LegacyDefinition(name='bins'))
indices = Quantity(
type=int,
shape=['first_index_of_DOS_grid', 'last_index_of_DOS_grid'],
description='''
Indices used to compare DOS fingerprints of different energy ranges.
''',
a_legacy=LegacyDefinition(name='indices'))
stepsize = Quantity(
type=np.dtype(np.float64),
shape=[],
description='''
Stepsize of interpolation in the first step of the generation of DOS fingerprints.
''',
a_legacy=LegacyDefinition(name='stepsize'))
filling_factor = Quantity(
type=np.dtype(np.float64),
shape=[],
description='''
Proportion of '1' bins in the DOS fingerprint.
''',
a_legacy=LegacyDefinition(name='filling_factor'))
grid_id = Quantity(
type=str,
description='''
Identifier of the DOS grid that was used for the creation of the fingerprint.
Similarity can only be calculated if the same grid was used for both fingerprints.
''',
a_legacy=LegacyDefinition(name='grid_id'))
class section_dos(MSection):
'''
Section collecting information of a (electronic-energy or vibrational-energy) density
......@@ -1333,12 +1383,7 @@ class section_dos(MSection):
''',
a_legacy=LegacyDefinition(name='number_of_dos_values'))
dos_fingerprint = Quantity(
type=str,
description='''
The DOS fingerprint.
''',
a_legacy=LegacyDefinition(name='dos_fingerprint'))
dos_fingerprint = SubSection(section_dos_fingerprint, repeats=False)
class section_eigenvalues(MSection):
......
......@@ -67,12 +67,16 @@ class DosNormalizer(Normalizer):
# Data for DOS fingerprint
dos_energies = dos.dos_energies
print(type(dos_energies))
dos_fingerprint = json.dumps(DOSFingerprint().calculate(np.array(dos_energies), dos_normed).to_dict())
dos_fingerprint = DOSFingerprint().calculate(np.array(dos_energies), dos_normed)
# Add quantities to NOMAD's Metainfo
scc_url = '/section_run/0/section_single_configuration_calculation/%d/section_dos/0' % scc.m_parent_index
self._backend.openContext(scc_url)
dos.dos_values_normalized = dos_normed
dos.dos_fingerprint = dos_fingerprint
sec_dos_fingerprint = dos.m_create("section_dos_fingerprint")
sec_dos_fingerprint.bins = dos_fingerprint.bins
sec_dos_fingerprint.indices = dos_fingerprint.indices
sec_dos_fingerprint.stepsize = dos_fingerprint.stepsize
sec_dos_fingerprint.grid_id = dos_fingerprint.grid_id
sec_dos_fingerprint.filling_factor = dos_fingerprint.filling_factor
self._backend.closeContext(scc_url)
Supports Markdown
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