From dfa9bd87c3c6117b7496be2d857f56c80dfdc8dd Mon Sep 17 00:00:00 2001 From: Martin Kuban <kuban@physik.hu-berlin.de> Date: Thu, 18 Jun 2020 16:27:06 +0200 Subject: [PATCH] added option to rescale dos values --- nomad_dos_fingerprints/DOSfingerprint.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nomad_dos_fingerprints/DOSfingerprint.py b/nomad_dos_fingerprints/DOSfingerprint.py index 1f844eb..b0a7627 100644 --- a/nomad_dos_fingerprints/DOSfingerprint.py +++ b/nomad_dos_fingerprints/DOSfingerprint.py @@ -14,8 +14,8 @@ class DOSFingerprint(): self.filling_factor = 0 self.grid_id = None - def calculate(self, dos_energies, dos_values, grid_id = 'dg_cut:56:-2:7:(-10, 5)'): - energy, dos = self._convert_dos(dos_energies, dos_values) + def calculate(self, dos_energies, dos_values, grid_id = 'dg_cut:56:-2:7:(-10, 5)', unit_cell_volume = 1, n_atoms = 1): + energy, dos = self._convert_dos(dos_energies, dos_values, unit_cell_volume = unit_cell_volume, n_atoms = n_atoms) raw_energies, raw_dos = self._integrate_to_bins(energy, dos) grid = Grid().create(grid_id = grid_id) self.grid_id = grid.get_grid_id() @@ -49,13 +49,13 @@ class DOSFingerprint(): y_integ = np.array([np.trapz(y_interp[idx:idx + 2], x_interp[idx:idx + 2]) for idx in range(len(x_interp)-1)]) return x_interp[:-1], y_integ - def _convert_dos(self, energy, dos): + def _convert_dos(self, energy, dos, unit_cell_volume = 1, n_atoms = 1): """ Convert units of DOS from energy: Joule; dos: states/volume/Joule to eV and sum spin channels if they are present. """ energy = np.array([value / ELECTRON_CHARGE for value in energy]) dos_channels = [np.array(values) for values in dos] - dos = sum(dos_channels) * ELECTRON_CHARGE + dos = sum(dos_channels) * ELECTRON_CHARGE * unit_cell_volume * n_atoms return energy, dos def _binary_bin(self, dos_value, grid_bins): -- GitLab