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

Add atom centered basis set #132

Draft
wants to merge 34 commits into
base: develop
Choose a base branch
from
Draft

Conversation

EBB2675
Copy link
Collaborator

@EBB2675 EBB2675 commented Sep 25, 2024

Fixes #130

@EBB2675 EBB2675 added the new feature New feature or request label Sep 25, 2024
@coveralls
Copy link

coveralls commented Sep 25, 2024

Pull Request Test Coverage Report for Build 12278300834

Details

  • 69 of 110 (62.73%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.8%) to 79.376%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/nomad_simulations/schema_packages/numerical_settings.py 22 27 81.48%
src/nomad_simulations/schema_packages/basis_set.py 16 29 55.17%
src/nomad_simulations/schema_packages/model_method.py 29 52 55.77%
Files with Coverage Reduction New Missed Lines %
src/nomad_simulations/schema_packages/numerical_settings.py 1 76.07%
Totals Coverage Status
Change from base Build 11890140918: -0.8%
Covered Lines: 2136
Relevant Lines: 2691

💛 - Coveralls

type=np.float32,
shape=['n_primitive'],
description="""
List of contraction coefficients corresponding to the exponents.
Copy link
Collaborator

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.

Comment on lines 233 to 238
main_basis_set = Quantity(
type=str,
description="""
Name of the main basis set.
""",
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the distinction between main and aux? If it's method routines, you can use BasisSetContainer to distinguish them.

type=AtomsState,
shape=['*'],
description="""
References to the `AtomsState` sections that define the atoms this basis set applies to.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Connected to my comment in the issue, you might also want a map to a ModelSystem.
For simplicity sake, I'd try to use only 1 type of linker when possible. Convenience can be added in other ways.

aux_c_basis_set = Quantity(
type=str,
description="""
AuxC type of basis set.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would also be good to elaborate on the description here.

Comment on lines 193 to 198
function_type = Quantity(
type=MEnum('S', 'P', 'D', 'F', 'G', 'H', 'I', 'J'),
description="""
the angular momentum of the shell to be added.
""",
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks more like something for AtomsState. @JosePizarro3

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think @EBB2675 wants to store the angular momentum here simply. I'd say if a string is enough, go ahead. Tho I will keep consistent with notation: small letters type=MEnum('s', 'p', 'd', 'f')

Now, are there cases where one needs to go to h, i, j? I must admit g "might" be ok in some excited state calculations, but the others... I am not sure.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Tho I will keep consistent with notation: small letters type=MEnum('s', 'p', 'd', 'f')

Shouldn't we use capital letters for the total momentum?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@EBB2675 Is this orbital angular momentum? Could you specify in the description, pls?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah sorry, if it is total ang mom yes, capital letters is good. Tho we need to decide where this kind of information should be living in a more consistent way.

We can leave that discussion out of this pr.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's the type of basis functions. Let me improve all the Quantity and class descriptions, it will be clearer



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

main_basis_set = Quantity(
type=str,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think str is fine for now, we'll likely want to constrain the choice here down the line.

@ndaelman-hu
Copy link
Collaborator

The basis set template works as follows:
BasisSetContainer bundles all the information per property (e.g. density, wavefunction, auxiliary grids, etc.).* Different properties go together in the list ModelMethod.numerical_settings.
The actual basis set data are stored under BasisSetContainer.basis_set_components.

In the case of LAPW, this would mean:

ModelMethod.numerical_settings = [
  ...,
  density: BasisSetContainer
  └ basis_set_components
      ├── 1 x plane-wave basis set
      └── n x muffin-tin regions -> references `AtomsState`
          └── l_max x l-channels
              ├── orbitals
              └── local orbitals,
  auxialary density: BasisSetContainer
  └ basis_set_components
      ├── 1 x plane-wave basis set
      └── m x muffin-tin regions -> references `AtomsState`
          └── l_max' x l-channels
              ├── orbitals
              └── local orbitals
]

@EBB2675 I'm curious what you think about splitting the various atom-centered auxiliary basis sets up like this.

*: Since we don't have an electronic structure yet, I Ieft it under a TODO. In the old schema, I used a str, which is fine in the beginning.

"""

basis_set_data = Quantity(
type=JSON, # Use JSON to store basis set information, including atom references
Copy link
Collaborator

Choose a reason for hiding this comment

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

@EBB2675 did you see my comment about this? it came up in my GH notifications, but I am not sure where it was stored. The comment was about using a repeating sub-section here instead of JSON

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JFRudzinski I have just seen it (but only in the notification E-mail)

Alright, im on it 👍

Copy link
Collaborator

@JFRudzinski JFRudzinski left a comment

Choose a reason for hiding this comment

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

Just a few small comments, I will come by to discuss...

""",
)

integration_thresh = Quantity(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would opt for integration_threshold, you are not really saving much with the abbreviation

""",
)

weights = Quantity(
integration_rule = Quantity(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would switch to Enum now and add a few most common integration rules with references in the description using the table like:

    integrator_type = Quantity(
        type=MEnum(
            'brownian',
            'conjugant_gradient',
            'langevin_goga',
            'langevin_schneider',
            'leap_frog',
            'rRESPA_multitimescale',
            'velocity_verlet',
            'langevin_leap_frog',
        ),
        shape=[],
        description="""
        Name of the integrator.

        Allowed values are:

        | Integrator Name          | Description                               |

        | ---------------------- | ----------------------------------------- |

        | `"langevin_goga"`           | N. Goga, A. J. Rzepiela, A. H. de Vries,
        S. J. Marrink, and H. J. C. Berendsen, [J. Chem. Theory Comput. **8**, 3637 (2012)]
        (https://doi.org/10.1021/ct3000876) |

        | `"langevin_schneider"`           | T. Schneider and E. Stoll,
        [Phys. Rev. B **17**, 1302](https://doi.org/10.1103/PhysRevB.17.1302) |

        | `"leap_frog"`          | R.W. Hockney, S.P. Goel, and J. Eastwood,
        [J. Comp. Phys. **14**, 148 (1974)](https://doi.org/10.1016/0021-9991(74)90010-2) |

        | `"velocity_verlet"` | W.C. Swope, H.C. Andersen, P.H. Berens, and K.R. Wilson,
        [J. Chem. Phys. **76**, 637 (1982)](https://doi.org/10.1063/1.442716) |

        | `"rRESPA_multitimescale"` | M. Tuckerman, B. J. Berne, and G. J. Martyna
        [J. Chem. Phys. **97**, 1990 (1992)](https://doi.org/10.1063/1.463137) |

        | `"langevin_leap_frog"` | J.A. Izaguirre, C.R. Sweet, and V.S. Pande
        [Pac Symp Biocomput. **15**, 240-251 (2010)](https://doi.org/10.1142/9789814295291_0026) |
        """,
    )

Since these are very established mathematical methods, I might just put a wikipedia link or something more easily accessible along with a more persistent reference

Weight of each point. A value smaller than 1, typically indicates a symmetry operation that was
applied to the mesh. This quantity is equivalent to `multiplicities`:
Accuracy threshold for integration grid.
GRIDTHR in Molpro.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is interesting...maybe making this into a table of aliases/related quantities would be useful as a general format in the description

"""
        Related code-specific quantities:

        | Quantity                    | Program          | Relation

        | ---------------------- | ----------------------------------------- |

        | GRIDTHR           | Molpro  | = integration_thresh

        | BFCut          | Orca | = integration_thresh
        """,

'cabs', # complementary auxiliary basis set
),
description="""
The role of the basis set.
Copy link
Collaborator

Choose a reason for hiding this comment

The 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

""",
)

pruning = Quantity(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering how general this is, i.e., how understandable or useful it is outside of the context of your particular methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add AtomCenteredBasisSet and AtomCenteredFunction to basis_set.py
5 participants