-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add atom centered basis set #132
Draft
EBB2675
wants to merge
34
commits into
develop
Choose a base branch
from
130-atom-centered-basis-set
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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 022c1fa
formatting
EBB2675 bf1f6f4
Merge branch 'develop' into coupled_cluster
EBB2675 af88624
add a draft for AtomCenteredFunction
EBB2675 0a9d98b
add a quantity for number of primitives
EBB2675 a204ec4
add atoms_state reference to AtomCenteredBasisSet
EBB2675 a325753
Merge remote-tracking branch 'origin/develop' into 130-atom-centered-…
EBB2675 8866ab7
assign JSON format to basis set
EBB2675 c7b078a
add type and auxiliary_type quantities to AtomCenteredBasisSet
EBB2675 1208e88
reformatted basis_set.py
EBB2675 fbc13f9
add NAO and point charges to basis set types
EBB2675 ddab789
add cECPs and pointcharges to AtomCenteredBasisSet
EBB2675 8c6ae1a
fix point charge Quantity type
EBB2675 c94e995
a bit of a cleanup
EBB2675 a007e1e
merge develop
EBB2675 62de243
move GTOIntegralDecomposition to NumericalSettings
EBB2675 c12adac
Merge branch 'develop' into 130-atom-centered-basis-set
EBB2675 52d6b9a
merge develop
EBB2675 646430c
add Mesh, NumericalIntegration and MolecularHamiltonianSubTerms
EBB2675 cca109f
minor adjustments to Mesh and NumericalIntegration
EBB2675 42f4f38
add integration_thresh and weight_cutoff to NumericalIntegration
EBB2675 0f92eb9
check whether n_primitive matches the lengths of exponents and contra…
EBB2675 e8fb5ef
add tests for AtomCenteredBasisSet and AtomCenteredFunction
EBB2675 4826f0c
add tests for Mesh and NumericalIntegration
EBB2675 c5141ab
modify Mesh
EBB2675 23d7615
MEnum for MolecularHamiltonianContributions
EBB2675 9ef13ea
remove contributions
EBB2675 80c8b64
add a normalizer function for the AtomCenteredFunction to handle comb…
EBB2675 4ac1076
fix test_basis_set.py
EBB2675 10e782c
add OrbitalLocalization to numerical_settings.py
EBB2675 5c15e97
add method to LocalCorrelation
EBB2675 2fd6398
add total_charge and total_spin to ModelSystem
EBB2675 c9d6118
add a simple HF class
EBB2675 816c7ba
a placeholder for MO and LCAO
EBB2675 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you should add a short description for each of these within a table, to make sure the usage is clear |
||
""", | ||
) | ||
|
||
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): | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would elaborate a bit more here, keeping also non-experts in mind.