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 #32

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Laplacian #32

wants to merge 11 commits into from

Conversation

Ali-Tehrani
Copy link
Collaborator

Added the second derivative of Slater orbital, second derivative of molecular orbital and the Laplacian of the atomic density.

The tests that were added are:

  • tested second derivative of slater orbital with finite difference of first derivative
  • tested second derivative of molecular orbital with finite-difference of first derivative
  • test Laplacian against analytic Laplacian of Hydrogen

@Ali-Tehrani Ali-Tehrani requested a review from FarnazH June 2, 2022 15:44
Ali-Tehrani and others added 8 commits June 6, 2022 15:24
When n=1, the first component (n-1)/r does not exist
Certain components of the derivatives aren't needed
when n=1,2
When r=0, n=1, then the kinetic energy should return infinity
When r=0, n=1, the Laplacian should be infinity
Copy link
Member

@FarnazH FarnazH left a comment

Choose a reason for hiding this comment

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

@Ali-Tehrani, my commit updates the comments to make it more clear how 1st and 2nd derivatives are computed. I also removed the Notes of the second_derivative_radial_slater_type_orbital docstring which stated that When :math:n=1,2 and :math:r=0, then the derivative is infinity. Are you fine with that?

Comment on lines +631 to +642
norm = np.power(2. * exps, numbers) * np.sqrt((2. * exps) / factorial(2. * numbers))
slater_minus_one = SlaterAtoms.radial_slater_orbital(
exps, numbers - 1, points, normalized=False
)
slater_r = norm.T * slater_minus_one
# When r=0 and n = 1, then slater/r is infinity.
i_r_zero = np.where(np.abs(points) == 0.0)[0]
i_numb_one = np.where(numbers[0] == 1)[0]
indices = np.array([[x, y] for x in i_r_zero for y in i_numb_one])
if len(indices) != 0: # if-statement needed to remove numpy warning using list
slater_r[indices] = np.inf
phi_i_r[:, index] += np.ravel(np.dot(slater_r, self.orbitals_coeff[orbital]))
Copy link
Member

Choose a reason for hiding this comment

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

@Ali-Tehrani can this be computed using first_derivative_radial_slater_type_orbital function?

Comment on lines +546 to +557
norm = np.power(2. * exps, numbers) * np.sqrt((2. * exps) / factorial(2. * numbers))
# Take unnormalized slater with number n-1, this is needed to remove divide by r^2
slater_minus_one = SlaterAtoms.radial_slater_orbital(
exps, numbers - 1, points, normalized=False
)
deriv_pref = norm.T * slater_minus_one
# When r=0 and n = 1, then the derivative is undefined and this returns infinity or nan
i_r_zero = np.where(np.abs(points) == 0.0)[0]
i_numb_one = np.where(numbers[0] == 1)[0]
indices = np.array([[x, y] for x in i_r_zero for y in i_numb_one])
if len(indices) != 0: # if-statement needed to remove numpy warning using list
deriv_pref[indices] = np.inf
Copy link
Member

Choose a reason for hiding this comment

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

@Ali-Tehrani can this be computed using first_derivative_radial_slater_type_orbital?

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.

2 participants