Skip to content

Commit

Permalink
Patch failing imports (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaelman committed Dec 16, 2024
1 parent e6572c4 commit 2b54f18
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 38 deletions.
26 changes: 13 additions & 13 deletions electronicparsers/abacus/metainfo/abacus.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class x_abacus_section_specie_basis_set(MSection):

x_abacus_specie_basis_set_rcutoff = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
-
Expand All @@ -191,7 +191,7 @@ class BasisSet(runschema.method.BasisSet):

x_abacus_basis_sets_delta_k = Quantity(
type=np.float64,
unit='1/bohr',
unit='1/m',
shape=[],
description="""
-
Expand All @@ -200,7 +200,7 @@ class BasisSet(runschema.method.BasisSet):

x_abacus_basis_sets_delta_r = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
-
Expand All @@ -209,7 +209,7 @@ class BasisSet(runschema.method.BasisSet):

x_abacus_basis_sets_dr_uniform = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
-
Expand All @@ -218,7 +218,7 @@ class BasisSet(runschema.method.BasisSet):

x_abacus_basis_sets_rmax = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
-
Expand All @@ -245,7 +245,7 @@ class Calculation(runschema.calculation.Calculation):

x_abacus_longest_orb_rcut = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
-
Expand All @@ -254,7 +254,7 @@ class Calculation(runschema.calculation.Calculation):

x_abacus_longest_nonlocal_projector_rcut = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
-
Expand All @@ -263,7 +263,7 @@ class Calculation(runschema.calculation.Calculation):

x_abacus_searching_radius = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
-
Expand All @@ -272,7 +272,7 @@ class Calculation(runschema.calculation.Calculation):

x_abacus_searching_radius_unit = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
-
Expand Down Expand Up @@ -396,7 +396,7 @@ class Run(runschema.run.Run):


class Method(runschema.method.Method):
m_def = Section(validate=False)
# m_def = Section(validate=False)

x_abacus_initial_magnetization_total = Quantity(
type=np.float64,
Expand Down Expand Up @@ -617,7 +617,7 @@ class System(runschema.system.System):

x_abacus_alat = Quantity(
type=np.float64,
unit='bohr',
unit='m',
shape=[],
description="""
Lattice Parameter 'a', constant during a run and used as unit in other quantities
Expand All @@ -627,7 +627,7 @@ class System(runschema.system.System):
x_abacus_reciprocal_vectors = Quantity(
type=np.float64,
shape=[3, 3],
unit='1 / meter',
unit='1 / m',
description="""
The reciprocal cell
""",
Expand Down Expand Up @@ -675,7 +675,7 @@ class System(runschema.system.System):

x_abacus_cell_volume = Quantity(
type=np.float64,
unit='bohr**3',
unit='m**3',
shape=[],
description="""
Volume of unit cell
Expand Down
46 changes: 21 additions & 25 deletions electronicparsers/abacus/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from collections import namedtuple
from datetime import datetime

from .metainfo import abacus
# the fileparser import has to come after metainfo to overload the Quantity class
from .metainfo.abacus import *
from nomad.units import ureg
from nomad.parsing.file_parser import TextParser, Quantity, DataTextParser
from runschema.run import Run, Program, TimeRun
Expand Down Expand Up @@ -64,11 +65,6 @@
SinglePoint,
SinglePointMethod,
)
from .metainfo.abacus import (
Method as xsection_method,
x_abacus_section_parallel,
x_abacus_section_specie_basis_set,
)


# TODO determine if we can update regex to the following
Expand Down Expand Up @@ -132,86 +128,86 @@ def init_quantities(self):
),
Quantity('dft_plus_u', r'\n *dft_plus_u\s*(\d)', repeats=False, dtype=bool),
Quantity(
xsection_method.x_abacus_mixing_method,
'x_abacus_mixing_method',
rf'\n *mixing_type\s*(\S+)',
repeats=False,
),
Quantity(
xsection_method.x_abacus_mixing_beta,
'x_abacus_mixing_beta',
rf'\n *mixing_beta\s*({re_float})',
repeats=False,
),
Quantity(
xsection_method.x_abacus_diagonalization_algorithm,
'x_abacus_diagonalization_algorithm',
rf'\n *ks_solver\s*(\w+)',
repeats=False,
),
Quantity(
xsection_method.x_abacus_dispersion_correction_method,
'x_abacus_dispersion_correction_method',
r'\n *vdw_method\s*(\S+)',
repeats=False,
),
Quantity(
xsection_method.x_abacus_gamma_algorithms,
'x_abacus_gamma_algorithms',
rf'\n *gamma_only\s*(\d)',
repeats=False,
dtype=bool,
),
Quantity(
xsection_method.x_abacus_scf_threshold_density,
'x_abacus_scf_threshold_density',
rf'\n *scf_thr\s*({re_float})',
repeats=False,
dtype=float,
),
Quantity(
xsection_method.x_abacus_initial_magnetization_total,
'x_abacus_initial_magnetization_total',
rf'\n *tot_magnetization\s*({re_float})',
repeats=False,
dtype=float,
),
Quantity(
xsection_method.x_abacus_hse_omega,
'x_abacus_hse_omega',
rf'\n *exx_hse_omega\s*({re_float})',
repeats=False,
unit='1/bohr',
),
Quantity(
xsection_method.x_abacus_hybrid_xc_coeff,
'x_abacus_hybrid_xc_coeff',
rf'\n *exx_hybrid_alpha\s*({re_float})',
repeats=False,
),
Quantity(
xsection_method.x_abacus_exx_ccp_rmesh_times,
'x_abacus_exx_ccp_rmesh_times',
rf'\n *exx_ccp_rmesh_times\s*({re_float})',
repeats=False,
),
Quantity(
xsection_method.x_abacus_exx_dm_threshold,
'x_abacus_exx_dm_threshold',
rf'\n *exx_dm_threshold\s*({re_float})',
repeats=False,
),
Quantity(
xsection_method.x_abacus_exx_cauchy_threshold,
'x_abacus_exx_cauchy_threshold',
rf'\n *exx_cauchy_threshold\s*({re_float})',
repeats=False,
),
Quantity(
xsection_method.x_abacus_exx_schwarz_threshold,
'x_abacus_exx_schwarz_threshold',
rf'\n *exx_schwarz_threshold\s*({re_float})',
repeats=False,
),
Quantity(
xsection_method.x_abacus_exx_c_threshold,
'x_abacus_exx_c_threshold',
rf'\n *exx_c_threshold\s*({re_float})',
repeats=False,
),
Quantity(
xsection_method.x_abacus_exx_v_threshold,
'x_abacus_exx_v_threshold',
rf'\n *exx_v_threshold\s*({re_float})',
repeats=False,
),
Quantity(
xsection_method.x_abacus_exx_pca_threshold,
'x_abacus_exx_pca_threshold',
rf'\n *exx_pca_threshold\s*({re_float})',
repeats=False,
),
Expand Down Expand Up @@ -627,7 +623,7 @@ def str_to_polarization(val_in):
repeats=True,
),
Quantity(
xsection_method.x_abacus_pao_radial_cutoff,
'x_abacus_pao_radial_cutoff',
rf'PAO radial cut off \(Bohr\)\s*=\s*({re_float})',
unit='bohr',
dtype=float,
Expand Down Expand Up @@ -1771,7 +1767,7 @@ def parse_method(self):
orbital_settings.get('orbital_information', [])
):
sec_specie_basis_set = x_abacus_section_specie_basis_set()
bs.x_abacus_section_specie_basis_set.append(sec_specie_basis_set)
bs.x_abacus_section_specie_basis_set = [sec_specie_basis_set]
sec_specie_basis_set.x_abacus_specie_basis_set_filename = (
os.path.basename(header.get('orbital_files')[i])
)
Expand Down Expand Up @@ -1904,7 +1900,7 @@ def parse(self, filepath, archive, logger):

# parallel
sec_parallel = x_abacus_section_parallel()
sec_run.x_abacus_section_parallel.append(sec_parallel)
sec_run.x_abacus_section_parallel = [sec_parallel]
sec_parallel.x_abacus_nproc = self.out_parser.get('nproc')
for key in ['kpar', 'bndpar', 'diago_proc']:
val = self.input_parser.get(key)
Expand Down

0 comments on commit 2b54f18

Please sign in to comment.