Skip to content

Commit

Permalink
minor modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
EBB2675 committed Jan 28, 2025
1 parent 92fd95e commit b0eb159
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 135 deletions.
30 changes: 14 additions & 16 deletions src/nomad_simulations/schema_packages/atoms_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,20 +660,6 @@ class MolecularOrbitals(Entity):
"""

mo_type = Quantity(
type=str,
shape=['mo_num'],
description="""
Type of the molecular orbitals
e.g. 'canonical', 'localized'.
In case of CASSCF calculations, there will be orbital subspaces of different nature.
E.g. :
Internal orbitals : canonical
Active orbitals : natural
Virtual orbitals : canonical
""",
)

mo_num = Quantity(
type=np.int32,
description="""
Expand All @@ -689,6 +675,20 @@ class MolecularOrbitals(Entity):
""",
)

mo_type = Quantity(
type=str,
shape=['mo_num'],
description="""
Type of the molecular orbitals
e.g. 'canonical', 'localized'.
In case of CASSCF calculations, there will be orbital subspaces of different nature.
E.g. :
Internal orbitals : canonical
Active orbitals : natural
Virtual orbitals : canonical
""",
)

coefficient = Quantity(
type=np.float64,
shape=['mo_num', 'ao_num'],
Expand Down Expand Up @@ -743,5 +743,3 @@ class MolecularOrbitals(Entity):
Typically 0 for alpha, 1 for beta.
""",
)


30 changes: 15 additions & 15 deletions src/nomad_simulations/schema_packages/basis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,18 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:

class AtomCenteredFunction(ArchiveSection):
"""
Specifies a single contracted basis function in an atom-centered basis set.
In many quantum-chemistry codes, an atom-centered basis set is composed of
several "shells," each shell containing one or more basis functions of a certain
angular momentum. For instance, a shell of p-type orbitals (L=1) typically
Specifies a single contracted basis function in an atom-centered basis set.
In many quantum-chemistry codes, an atom-centered basis set is composed of
several "shells," each shell containing one or more basis functions of a certain
angular momentum. For instance, a shell of p-type orbitals (L=1) typically
consists of 3 degenerate functions (p_x, p_y, p_z) if `harmonic_type='cartesian'`
or 3 spherical harmonics if `harmonic_type='spherical'`.
A single "atom-centered function" can be a linear combination of multiple
primitive Gaussians (or Slater-type orbitals, STOs).
In practice, these contract together to form the final basis function used by
the SCF or post-SCF method. Often, each contraction is labeled by its
A single "atom-centered function" can be a linear combination of multiple
primitive Gaussians (or Slater-type orbitals, STOs).
In practice, these contract together to form the final basis function used by
the SCF or post-SCF method. Often, each contraction is labeled by its
angular momentum (e.g., s, p, d, f) and a set of exponents and coefficients.
**References**:
Expand Down Expand Up @@ -353,16 +353,16 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
class AtomCenteredBasisSet(BasisSetComponent):
"""
Defines an **atom-centered basis set** for quantum chemistry calculations.
Unlike plane-wave methods, these expansions are typically built around each atom's
Unlike plane-wave methods, these expansions are typically built around each atom's
position, using either:
- Slater-type orbitals (STO)
- Gaussian-type orbitals (GTO)
- Numerical atomic orbitals (NAO)
- Effective-core potentials or point-charges (PC, cECP, etc.)
This section references multiple `AtomCenteredFunction` objects, each describing
a single contracted function or shell. Additionally, one can label the overall
basis set name (e.g., "cc-pVTZ", "def2-SVP", "6-31G**") and specify the high-level
a single contracted function or shell. Additionally, one can label the overall
basis set name (e.g., "cc-pVTZ", "def2-SVP", "6-31G**") and specify the high-level
role of the basis set in the calculation.
**Common examples**:
Expand Down Expand Up @@ -411,7 +411,7 @@ class AtomCenteredBasisSet(BasisSetComponent):
'orbital',
'auxiliary_scf',
'auxiliary_post_hf',
'cabs',
'cabs',
),
description="""
The role of this basis set in the calculation:
Expand Down
15 changes: 7 additions & 8 deletions src/nomad_simulations/schema_packages/model_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -1272,17 +1272,17 @@ class IntegralDecomposition(BaseModelMethod):

class HartreeFock(ModelMethodElectronic):
"""
Defines a Hartree–Fock (HF) calculation using a specified reference determinant
Defines a Hartree–Fock (HF) calculation using a specified reference determinant
(RHF, UHF, or ROHF).
In HF theory:
- RHF = Restricted Hartree–Fock, for closed-shell systems.
- UHF = Unrestricted Hartree–Fock, allows different orbitals for alpha/beta spin.
- ROHF = Restricted Open-Shell Hartree–Fock, a partially restricted approach for
- ROHF = Restricted Open-Shell Hartree–Fock, a partially restricted approach for
open-shell systems.
**References**:
- Roothaan, C. C. J. (1951). "New Developments in Molecular Orbital Theory."
- Roothaan, C. C. J. (1951). "New Developments in Molecular Orbital Theory."
Rev. Mod. Phys. 23, 69.
- Szabo, A., & Ostlund, N. S. (1989). *Modern Quantum Chemistry*. McGraw-Hill.
- Jensen, F. (2007). *Introduction to Computational Chemistry*. 2nd ed., Wiley.
Expand All @@ -1306,7 +1306,7 @@ class HartreeFock(ModelMethodElectronic):
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
"""
Perform minimal consistency checks between the HF reference determinant
and the final molecular orbitals spin array (if available).
and the final molecular orbitals spin array (if available).NumericalIntegration
"""
super().normalize(archive, logger)

Expand All @@ -1319,15 +1319,15 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
# For RHF, we typically expect spin=0 (alpha) only
if not np.all(mo_spin == 0):
logger.warning(
"RHF reference used, but molecular_orbitals.spin contains non-zero spin indices."
'RHF reference used, but molecular_orbitals.spin contains non-zero spin indices.'
)
elif self.reference_determinant == 'UHF':
# UHF often has spin=0 for alpha and spin=1 for beta
# If we only see spin=0, that's effectively no spin polarization
if len(unique_spins) == 1 and unique_spins[0] == 0:
logger.info(
"UHF reference chosen, but only alpha spin found in MOs (spin=0). "
"This might still be valid if spin polarization is zero."
'UHF reference chosen, but only alpha spin found in MOs (spin=0). '
'This might still be valid if spin polarization is zero.'
)
# For ROHF, spin indexing can vary across codes, so no strict check here.

Expand Down Expand Up @@ -1376,7 +1376,6 @@ class PerturbationMethod(ModelMethodElectronic):
)



class LocalCorrelation(ArchiveSection):
"""
A base section used to define the parameters of a local correlation method for
Expand Down
129 changes: 33 additions & 96 deletions src/nomad_simulations/schema_packages/numerical_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
class OrbitalLocalization(SelfConsistency):
"""
Numerical settings that control orbital localization, typically applied
to transform canonical molecular orbitals into localized orbitals.
to transform canonical molecular orbitals into localized orbitals.
These localized orbitals can then be used for:
- Local correlation methods (e.g., LMP2, local CC)
- Interpretable chemical analysis (e.g., identifying bonds, lone pairs)
Expand All @@ -965,10 +965,10 @@ class OrbitalLocalization(SelfConsistency):
iterative, requiring thresholds and iteration limits akin to an SCF loop.
References:
- R. F. Boys, "Construction of Some Molecular Orbitals to Be Approximately Invariant
- R. F. Boys, "Construction of Some Molecular Orbitals to Be Approximately Invariant
for Changes in Molecular Conformation," Rev. Mod. Phys. 32, 296 (1960). [Boys]
- J. Pipek, P. G. Mezey, J. Chem. Phys. 90, 4916 (1989). [PM method]
- J. L. Knizia, "Intrinsic Atomic Orbitals: An Unbiased Bridge between Quantum Theory
- J. L. Knizia, "Intrinsic Atomic Orbitals: An Unbiased Bridge between Quantum Theory
and Chemical Concepts," J. Chem. Theory Comput. 9, 4834 (2013). [IBO method]
- P. Pulay, Chem. Phys. Lett. 100, 151 (1983). [Local correlation context]
"""
Expand Down Expand Up @@ -1010,113 +1010,50 @@ class OrbitalLocalization(SelfConsistency):
)


class PNOSettings(NumericalSettings):
class PairApproximationSettings(NumericalSettings):
"""
Numerical settings that control **Pair Natural Orbitals (PNOs)** in local correlation approaches.
Numerical settings that control Pair Natural Orbitals (PNOs) in local correlation approaches.
PNOs are a compact representation of the virtual orbital space for each pair (or domain)
of occupied orbitals, improving efficiency in post-HF methods (e.g., local MP2, local CC).
The nomenclature for these thresholds is adapted from different programs (e.g., Molpro, ORCA).
This class is code-agnostic and allows a single 'approximation_level' to store
code-specific presets such as:
'tightPNO', 'normalPNO', 'loosePNO' (ORCA) or
'default', 'tight', 'vtight' (Molpro), etc.
For more fine-grained custom thresholds, the user can fill the other
domain/pair fields (occupancies, energy thresholds, etc.) on the parser side as needed.
The nomenclature for these thresholds is adapted from Molpro, ORCA, etc.
See also:
- H.-J. Werner, P. J. Knowles, G. Knizia, F. R. Manby, M. Schütz,
"Molpro: a general-purpose quantum chemistry program package,"
"Molpro: a general-purpose quantum chemistry program package,"
WIREs Comput. Mol. Sci. 2, 242 (2012).
- F. Neese, "The ORCA program system,"
- F. Neese, "The ORCA program system,"
WIREs Comput. Mol. Sci. 2, 73-78 (2012) for DLPNO expansions.
- G. Knizia, "Intrinsic Bond Orbitals,"
- G. Knizia, "Intrinsic Bond Orbitals,"
J. Chem. Theory Comput. 9, 4834 (2013) for orbital transformations in local correlation.
"""

domain_connectivity = Quantity(
type=int,
description="""
the connectivity parameter for domain extension.
""",
)

domain_radius = Quantity(
type=int,
description="""
the radius parameter for domain extension.
""",
)

t_domain_osv_occ = Quantity(
type=np.float32,
description="""
OSV domain occupation number threshold.
""",
)

t_occ_lmp2 = Quantity(
type=np.float32,
description="""
LMP2 PNO domains (occ. number threshold).
""",
)

t_energy_lmp2 = Quantity(
type=np.float32,
description="""
LMP2 PNO domains (energy threshold).
""",
)

t_occ_lccsd = Quantity(
type=np.float32,
description="""
LCCSD PNO domains (occ. number threshold).
""",
)

t_energy_lccsd = Quantity(
type=np.float32,
description="""
LCCSD PNO domains (energy threshold).
""",
)
# type = Quantity(
# type=MEnum('PAO', 'OSV', 'PNO'),
# description="""
# PAO : pair atomic orbitals
# OSV : orbital-specific virtuals
# PNO : pair natural orbitals
# """,
# )

t_close_pair = Quantity(
code_specific_approximation_tier = Quantity(
type=str,
description="""
close pair energy threshold.
""",
)

t_weak_pair = Quantity(
type=np.float32,
description="""
weak pair energy threshold.
""",
)

t_distant_pair = Quantity(
type=np.float32,
description="""
distant pair energy threshold
""",
)

t_verydistant_pair = Quantity(
type=np.float32,
description="""
very distant pair energy threshold
A single keyword or label indicating a preset PNO approximation level. Examples:
- In ORCA: 'loosePNO', 'normalPNO', 'tightPNO'
- In Molpro: 'default', 'tight', 'vtight'
- In Psi4: 'loose', 'normal', 'tight' for PNO_CONVERGENCE keyword
- Or any other custom label recognized by your code
This field is purely descriptive to unify different codes' preset naming.
""",
)

t_triples_preselection = Quantity(
type=np.float32,
description="""
preselection of triples list.
""",
)

t_triples_iteration = Quantity(
type=np.float32,
description="""
selection of triples for iterations
""",
)

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)

1 comment on commit b0eb159

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations
   __init__.py4250%3–4
   _version.py11282%5–6
src/nomad_simulations/schema_packages
   __init__.py15287%39–41
   atoms_state.py2002190%13–15, 201–204, 228, 283–284, 352–353, 355, 537, 549–550, 611–615, 630–634, 641
   basis_set.py2654085%8–9, 122–133, 172–185, 320–347, 616–620, 642–643, 687–690, 809, 840, 842
   general.py89891%4–7, 121, 185, 295–296, 306
   model_method.py3068971%10–12, 175–178, 181–188, 280–281, 301, 322–343, 359–385, 388–405, 591, 784, 795, 837–844, 882, 901, 981, 1038, 1113, 1227, 1311–1328
   model_system.py3503789%45–51, 235, 254, 258, 261, 264, 290, 376–377, 454–455, 472–473, 686–689, 736–743, 917–918, 1155–1159, 1165–1166, 1174–1175, 1180, 1203
   numerical_settings.py2806676%12–14, 204–210, 280, 282–283, 286–289, 293–294, 301–304, 313–316, 320–323, 325–328, 333–336, 342–345, 532–559, 634, 669–672, 696, 699, 744, 746–749, 753, 757, 804, 808–829, 884–885, 952
   outputs.py1201092%9–10, 252–255, 295–298, 323, 325, 362, 381
   physical_property.py102793%20–22, 202, 331–333
   variables.py861286%8–10, 98, 121, 145, 167, 189, 211, 233, 256, 276
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%8–10, 135–136
   band_structure.py1232580%9–11, 232–265, 278, 285, 321–322, 325, 372–373, 378
   energies.py42979%7–9, 36, 57, 82, 103, 119, 134
   fermi_surface.py17476%7–9, 40
   forces.py22673%7–9, 36, 56, 79
   greens_function.py991387%7–9, 210–211, 214, 235–236, 239, 260–261, 264, 400
   hopping_matrix.py29583%7–9, 58, 94
   permittivity.py48883%7–9, 97–105
   spectral_profile.py26012851%9–11, 57–60, 95–98, 199–300, 356–368, 393–396, 416, 421–424, 466–502, 526, 573–576, 592–593, 598–604
   thermodynamics.py752764%7–9, 35, 56, 72, 81, 90, 101, 110, 137, 147, 157, 172–174, 177, 193, 213–215, 218, 234, 254–256, 259
src/nomad_simulations/schema_packages/utils
   utils.py791680%8–11, 65–74, 83–84, 89, 92, 169–170
TOTAL268454280% 

Tests Skipped Failures Errors Time
423 0 💤 0 ❌ 0 🔥 6.797s ⏱️

Please sign in to comment.