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

QC model method contributions #160

Draft
wants to merge 34 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d436e95
add main and auxiliary basis set quantities to AtomCenteredBasisSet
EBB2675 Sep 24, 2024
022c1fa
formatting
EBB2675 Sep 24, 2024
bf1f6f4
Merge branch 'develop' into coupled_cluster
EBB2675 Sep 25, 2024
af88624
add a draft for AtomCenteredFunction
EBB2675 Sep 25, 2024
0a9d98b
add a quantity for number of primitives
EBB2675 Sep 25, 2024
a204ec4
add atoms_state reference to AtomCenteredBasisSet
EBB2675 Sep 26, 2024
a325753
Merge remote-tracking branch 'origin/develop' into 130-atom-centered-…
EBB2675 Oct 1, 2024
8866ab7
assign JSON format to basis set
EBB2675 Oct 2, 2024
c7b078a
add type and auxiliary_type quantities to AtomCenteredBasisSet
EBB2675 Oct 8, 2024
1208e88
reformatted basis_set.py
EBB2675 Oct 8, 2024
fbc13f9
add NAO and point charges to basis set types
EBB2675 Oct 8, 2024
ddab789
add cECPs and pointcharges to AtomCenteredBasisSet
EBB2675 Oct 9, 2024
8c6ae1a
fix point charge Quantity type
EBB2675 Oct 11, 2024
c94e995
a bit of a cleanup
EBB2675 Oct 14, 2024
a007e1e
merge develop
EBB2675 Oct 18, 2024
62de243
move GTOIntegralDecomposition to NumericalSettings
EBB2675 Oct 24, 2024
c12adac
Merge branch 'develop' into 130-atom-centered-basis-set
EBB2675 Nov 19, 2024
52d6b9a
merge develop
EBB2675 Nov 19, 2024
646430c
add Mesh, NumericalIntegration and MolecularHamiltonianSubTerms
EBB2675 Nov 19, 2024
cca109f
minor adjustments to Mesh and NumericalIntegration
EBB2675 Nov 19, 2024
42f4f38
add integration_thresh and weight_cutoff to NumericalIntegration
EBB2675 Nov 20, 2024
0f92eb9
check whether n_primitive matches the lengths of exponents and contra…
EBB2675 Nov 20, 2024
e8fb5ef
add tests for AtomCenteredBasisSet and AtomCenteredFunction
EBB2675 Nov 20, 2024
4826f0c
add tests for Mesh and NumericalIntegration
EBB2675 Nov 20, 2024
c5141ab
modify Mesh
EBB2675 Nov 20, 2024
23d7615
MEnum for MolecularHamiltonianContributions
EBB2675 Nov 21, 2024
9ef13ea
remove contributions
EBB2675 Nov 21, 2024
80c8b64
add a normalizer function for the AtomCenteredFunction to handle comb…
EBB2675 Nov 28, 2024
4ac1076
fix test_basis_set.py
EBB2675 Dec 4, 2024
10e782c
add OrbitalLocalization to numerical_settings.py
EBB2675 Dec 4, 2024
5c15e97
add method to LocalCorrelation
EBB2675 Dec 4, 2024
2fd6398
add total_charge and total_spin to ModelSystem
EBB2675 Dec 5, 2024
c9d6118
add a simple HF class
EBB2675 Dec 10, 2024
816c7ba
a placeholder for MO and LCAO
EBB2675 Dec 11, 2024
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
157 changes: 151 additions & 6 deletions src/nomad_simulations/schema_packages/basis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from nomad import utils
from nomad.datamodel.data import ArchiveSection
from nomad.datamodel.metainfo.annotations import ELNAnnotation
from nomad.metainfo import MEnum, Quantity, SubSection
from nomad.metainfo import JSON, MEnum, Quantity, SubSection
from nomad.units import ureg

from nomad_simulations.schema_packages.atoms_state import AtomsState
Expand Down Expand Up @@ -190,25 +190,170 @@ class AtomCenteredFunction(ArchiveSection):
Specifies a single function (term) in an atom-centered basis set.
"""

pass
harmonic_type = Quantity(
type=MEnum(
'spherical',
'cartesian',
),
default='spherical',
description="""
Specifies whether the basis functions are spherical-harmonic or cartesian functions.
""",
)

function_type = Quantity(
type=MEnum(
's',
'p',
'd',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'sp',
'spd',
'spdf',
),
description="""
L=a+b+c
The angular momentum of GTO to be added.
""",
)

n_primitive = Quantity(
type=np.int32,
description="""
Number of primitives.
Linear combinations of the primitive Gaussians are formed to approximate the radial extent of an STO.
""",
)

exponents = Quantity(
type=np.float32,
shape=['n_primitive'],
description="""
List of exponents for the basis function.
""",
)

contraction_coefficients = Quantity(
type=np.float32,
shape=['*'], # Flexible shape to handle combined types (e.g. SP, SPD..)
description="""
List of contraction coefficients corresponding to the exponents.
""",
)

point_charge = Quantity(
type=np.float32,
description="""
the value of the point charge.
""",
)

# TODO: design system for writing basis functions like gaussian or slater orbitals
def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
"""
Validates the input data
and resolves combined types like SP, SPD, SPDF, etc.

Raises ValueError: If the data is inconsistent (e.g., mismatch in exponents and coefficients).
"""
super().normalize(archive, logger)

# Validate number of primitives
if self.n_primitive is not None:
if self.exponents is not None and len(self.exponents) != self.n_primitive:
raise ValueError(
f'Mismatch in number of exponents: expected {self.n_primitive}, '
f'found {len(self.exponents)}.'
)

# Resolve combined types
if self.function_type and len(self.function_type) > 1:
num_types = len(self.function_type) # For SP: 2, SPD: 3, etc.
if self.contraction_coefficients is not None:
expected_coeffs = num_types * self.n_primitive
if len(self.contraction_coefficients) != expected_coeffs:
raise ValueError(
f'Mismatch in contraction coefficients for {self.function_type} type: '
f'expected {expected_coeffs}, found {len(self.contraction_coefficients)}.'
)

# Split coefficients into separate lists for each type
self.coefficient_sets = {
t: self.contraction_coefficients[i::num_types]
for i, t in enumerate(self.function_type)
}

# Debug: Log split coefficients
for t, coeffs in self.coefficient_sets.items():
logger.info(f'{t}-type coefficients: {coeffs}')
else:
logger.warning(
f'No contraction coefficients provided for {self.function_type} type.'
)

# For single types, ensure coefficients match primitives
elif self.contraction_coefficients is not None:
if len(self.contraction_coefficients) != self.n_primitive:
raise ValueError(
f'Mismatch in contraction coefficients: expected {self.n_primitive}, '
f'found {len(self.contraction_coefficients)}.'
)


class AtomCenteredBasisSet(BasisSetComponent):
"""
Defines an atom-centered basis set.
"""

basis_set = Quantity(
type=str,
description="""
name of the basis set.
""",
)

type = Quantity(
type=MEnum(
'STO', # Slater-type orbitals
'GTO', # Gaussian-type orbitals
'NAO', # Numerical atomic orbitals
'cECP', # Capped effective core potentials
'PC', # Point charges
),
description="""
Type of the basis set, e.g. STO or GTO.
""",
)

role = Quantity(
type=MEnum(
'orbital',
'auxiliary_scf',
'auxiliary_post_hf',
'cabs', # complementary auxiliary basis set
),
description="""
The role of the basis set.
""",
)

total_number_of_basis_functions = Quantity(
type=np.int32,
description='',
)

functional_composition = SubSection(
sub_section=AtomCenteredFunction.m_def, repeats=True
) # TODO change name
)

def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None:
super().normalize(archive, logger)
# self.name = self.m_def.name
# TODO: set name based on basis functions
# ? use basis set names from Basis Set Exchange


class APWBaseOrbital(ArchiveSection):
Expand Down
Loading
Loading