Skip to content

Commit c34b6a0

Browse files
authored
Revert "refactor convergence target schema"
1 parent 33c5c95 commit c34b6a0

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

+169
-11060
lines changed

src/nomad_simulation_parsers/parsers/abinit/parser.py

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

585581
return bandstructures
586-
582+
587583
def get_geometry_convergence(self):
584+
# TODO Add `is_reached` when it is parsed correctly
588585
# 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-
594586
return [
595-
EnergyConvergenceTarget(
596-
threshold=tolmxde,
597-
threshold_type='relative',
598-
),
599-
ForceConvergenceTarget(
600-
threshold=tolmxf,
601-
threshold_type='maximum',
602-
),
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+
}
603605
]
604606

605607

src/nomad_simulation_parsers/parsers/ams/file_parser.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,12 @@ 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: (
309-
np.transpose(
310-
np.array(
311-
[v.split() for v in x.strip().splitlines()],
312-
np.float64,
313-
)
314-
)[2:5].T
315-
),
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,
316314
),
317315
]
318316
),
@@ -825,16 +823,11 @@ def to_band_energy_ranges(val_in):
825823
'dipole_moment',
826824
rf'direction +dipole.+\s+\=+\s+((?:\w+ +{RE_FLOAT}.+\s+)+)',
827825
str_operation=lambda x: (
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-
),
826+
[float(v.strip().split()[2]) for v in x.strip().splitlines()]
827+
* ureg.debye
828+
)
829+
.to('C * m')
830+
.magnitude,
838831
),
839832
Quantity(
840833
'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)