Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

264 deprecate extends base section #265

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 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 @@ -187,11 +187,11 @@ class BasisSet(runschema.method.BasisSet):
section for numerical atomic orbitals of ABACUS
"""

m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

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 @@ -232,7 +232,7 @@ class BasisSet(runschema.method.BasisSet):


class Calculation(runschema.calculation.Calculation):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abacus_init_velocities = Quantity(
type=bool,
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 @@ -321,7 +321,7 @@ class Calculation(runschema.calculation.Calculation):


class Run(runschema.run.Run):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abacus_input_filename = Quantity(
type=str,
Expand Down Expand Up @@ -396,7 +396,7 @@ class Run(runschema.run.Run):


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

x_abacus_initial_magnetization_total = Quantity(
type=np.float64,
Expand Down Expand Up @@ -613,11 +613,11 @@ class Method(runschema.method.Method):


class System(runschema.system.System):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

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 All @@ -693,7 +693,7 @@ class System(runschema.system.System):


class Symmetry(runschema.system.Symmetry):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abacus_ibrav = Quantity(
type=np.int32,
Expand Down Expand Up @@ -737,7 +737,7 @@ class Symmetry(runschema.system.Symmetry):


class AtomParameters(runschema.method.AtomParameters):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abacus_pp_type = Quantity(
type=str,
Expand Down Expand Up @@ -781,7 +781,7 @@ class AtomParameters(runschema.method.AtomParameters):


class ScfIteration(runschema.calculation.ScfIteration):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abacus_density_change_scf_iteration = Quantity(
type=np.float64,
Expand Down Expand Up @@ -822,7 +822,7 @@ class ScfIteration(runschema.calculation.ScfIteration):


class BandEnergies(runschema.calculation.BandEnergies):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abacus_eigenvalues_number_of_planewaves = Quantity(
type=np.int32,
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
15 changes: 9 additions & 6 deletions electronicparsers/abinit/metainfo/abinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class x_abinit_section_var(MSection):


class Run(runschema.run.Run):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abinit_parallel_compilation = Quantity(
type=str,
Expand Down Expand Up @@ -265,7 +265,7 @@ class Run(runschema.run.Run):


class Method(runschema.method.Method):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abinit_tolvrs = Quantity(
type=np.float64,
Expand Down Expand Up @@ -310,7 +310,7 @@ class Method(runschema.method.Method):


class System(runschema.system.System):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abinit_atom_xcart_final = Quantity(
type=str,
Expand Down Expand Up @@ -553,7 +553,7 @@ class BandEnergies(runschema.calculation.BandEnergies):
Could be depricated later on, since it runs counter to the regular way of working.
"""

m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abinit_qp_band_gaps_params = SubSection(
sub_section=x_abinit_qp_band_gaps_params.m_def, repeats=False
Expand Down Expand Up @@ -728,7 +728,7 @@ class x_abinit_gw_dataset(MSection):


class Calculation(runschema.calculation.Calculation):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abinit_magnetisation = Quantity(
type=np.float64,
Expand Down Expand Up @@ -848,7 +848,7 @@ class Calculation(runschema.calculation.Calculation):


class x_abinit_section_dataset(abinit_autogenerated.x_abinit_section_dataset):
m_def = Section(validate=False, extends_base_section=True)
m_def = Section(validate=False)

x_abinit_geometry_optimization_converged = Quantity(
type=str,
Expand All @@ -869,3 +869,6 @@ class x_abinit_section_dataset(abinit_autogenerated.x_abinit_section_dataset):
x_abinit_section_dataset_header = SubSection(
sub_section=x_abinit_section_dataset_header.m_def, repeats=True
)


m_package.__init_metainfo__()
Loading
Loading