Skip to content

Commit 33c5c95

Browse files
committed
Merge remote-tracking branch 'origin/schema_update_convergence_targets-JFR' into schema_update_convergence_targets
2 parents b896136 + 35ee41f commit 33c5c95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+11060
-169
lines changed

src/nomad_simulation_parsers/parsers/abinit/parser.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
MolecularDynamics,
1818
SinglePoint,
1919
)
20+
from nomad_simulations.schema_packages.workflow.general import (
21+
EnergyConvergenceTarget,
22+
ForceConvergenceTarget,
23+
)
2024
from nomad_simulations.schema_packages.workflow.geometry_optimization import (
2125
GeometryOptimization,
2226
GeometryOptimizationMethod,
@@ -579,29 +583,23 @@ def get_bandstructures(
579583
bandstructures[n]['occupations'] = occ
580584

581585
return bandstructures
582-
586+
583587
def get_geometry_convergence(self):
584-
# TODO Add `is_reached` when it is parsed correctly
585588
# TODO consider to do this for each dataset and not only the first one
589+
tolmxde = self.get_input_var('tolmxde', n_dataset=1, default=0.0, scalar=True)
590+
tolmxf = self.get_input_var(
591+
name='tolmxf', n_dataset=1, default=0.0, scalar=True
592+
)
593+
586594
return [
587-
{
588-
'convergence_parameter_name': 'energy',
589-
'threshold_type' : 'relative',
590-
'convergence_threshold_unit' : 'hartree',
591-
'convergence_threshold' : self.get_input_var('tolmxde',
592-
n_dataset=1,
593-
default=0.0,
594-
scalar=True),
595-
},
596-
{
597-
'convergence_parameter_name': 'force',
598-
'threshold_type' : 'maximum',
599-
'convergence_threshold_unit' : 'hartree/bohr',
600-
'convergence_threshold' : self.get_input_var(name='tolmxf',
601-
n_dataset=1,
602-
default=0.0,
603-
scalar=True),
604-
}
595+
EnergyConvergenceTarget(
596+
threshold=tolmxde,
597+
threshold_type='relative',
598+
),
599+
ForceConvergenceTarget(
600+
threshold=tolmxf,
601+
threshold_type='maximum',
602+
),
605603
]
606604

607605

src/nomad_simulation_parsers/parsers/ams/file_parser.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,14 @@ def to_band_energy_ranges(val_in):
305305
Quantity(
306306
'points',
307307
rf'No\. +Sym\..+\s+\-+((?:\d+ +\d+ +{RE_FLOAT}.+\s+)+)',
308-
str_operation=lambda x: np.transpose(
309-
np.array(
310-
[v.split() for v in x.strip().splitlines()],
311-
np.float64,
312-
)
313-
)[2:5].T,
308+
str_operation=lambda x: (
309+
np.transpose(
310+
np.array(
311+
[v.split() for v in x.strip().splitlines()],
312+
np.float64,
313+
)
314+
)[2:5].T
315+
),
314316
),
315317
]
316318
),
@@ -823,11 +825,16 @@ def to_band_energy_ranges(val_in):
823825
'dipole_moment',
824826
rf'direction +dipole.+\s+\=+\s+((?:\w+ +{RE_FLOAT}.+\s+)+)',
825827
str_operation=lambda x: (
826-
[float(v.strip().split()[2]) for v in x.strip().splitlines()]
827-
* ureg.debye
828-
)
829-
.to('C * m')
830-
.magnitude,
828+
(
829+
[
830+
float(v.strip().split()[2])
831+
for v in x.strip().splitlines()
832+
]
833+
* ureg.debye
834+
)
835+
.to('C * m')
836+
.magnitude
837+
),
831838
),
832839
Quantity(
833840
'band_energy_ranges',

src/nomad_simulation_parsers/parsers/exciting/info_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def init_quantities(self):
549549
repeats=False,
550550
dtype=float,
551551
unit=ureg.hartree / ureg.bohr,
552-
)
552+
),
553553
]
554554
),
555555
repeats=False,
@@ -688,4 +688,4 @@ def get_initialization_parameter(self, key, default=None):
688688
def has_geometry_optimization(self) -> bool:
689689
if self.get('structure_optimization', None) is not None:
690690
return True
691-
return False
691+
return False

0 commit comments

Comments
 (0)