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

Laplacian method for Species class #131

Merged
merged 9 commits into from
Dec 21, 2024
Merged

Laplacian method for Species class #131

merged 9 commits into from
Dec 21, 2024

Conversation

gabrielasd
Copy link
Collaborator

@gabrielasd gabrielasd commented Nov 28, 2024

This pull request adds support for computing the Laplacian of the electron density and fixes incorrectly assigned second derivative of density values in the numeric dataset compilation script.

Main changes:

  • A method named dd_dens_lapl_func is added to the Species class which (similar to dens_func ) returns a callable function. The function is set to zero when evaluated at $r=0$ (with a tolerance of $1.e-10$).
  • In the compilation script for the numeric HF dataset, the second derivative of the density was obtained taking the available gradient and Laplacian of the density values (i.e. the second derivative is equated from the formula for the Laplacian evaluated on a radial grid). Here also a tolerance value is used to handle division by zero cases.

@gabrielasd gabrielasd marked this pull request as ready for review December 2, 2024 16:11

from atomdb.periodic import Element


def load_numerical_hf_data():
def load_numerical_hf_data(data_path=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not def load_numerical_hf_data(data_path=DEFAULT_DATAPATH): ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Even more, I think this function should not have a default value. The only place where it is used inside run (line 183), a value is passed to this argument. I think the function that could/should have a default value should be the run function (line 155).

Copy link
Collaborator Author

@gabrielasd gabrielasd Dec 16, 2024

Choose a reason for hiding this comment

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

Good point!
I think I'll go along the lines of your first suggestion making the change to simply
def load_numerical_hf_data(data_path)

I wouldn't make the change to the run function to keep consistency across all compilation scripts, and since the default path gets defined as kwd argument in the load function from the species module:

AtomDB/atomdb/species.py

Lines 782 to 790 in 511a702

def load(
elem,
charge,
mult,
nexc=0,
dataset=DEFAULT_DATASET,
datapath=DEFAULT_DATAPATH,
remotepath=DEFAULT_REMOTE,
):

The way I see it, the run functions will hardly ever get used directly by the user, so having the default value of datapath only in load (and compile) seems OK to me.

Copy link
Member

Choose a reason for hiding this comment

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

Looks OK to me. If @marco-2023 and @gabrielasd are happy with it's fine to merge IMHO.

@marco-2023 marco-2023 self-requested a review December 21, 2024 07:29
Copy link
Collaborator

@marco-2023 marco-2023 left a comment

Choose a reason for hiding this comment

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

I think it is good

@marco-2023 marco-2023 merged commit 89b38d4 into master Dec 21, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants