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

g orbitals (l=4) #11

Closed
eimrek opened this issue Oct 10, 2023 · 1 comment
Closed

g orbitals (l=4) #11

eimrek opened this issue Oct 10, 2023 · 1 comment

Comments

@eimrek
Copy link
Member

eimrek commented Oct 10, 2023

For some elements & basis sets, CP2K includes g orbitals (l=4). This needs to implemented here:

def _spherical_harmonic_grid(self, l, m, x_grid, y_grid, z_grid):
"""
Evaluates the spherical harmonics (times r^l) with some unknown normalization
(source: Carlo's Fortran code)
"""
c = (2.0/np.pi)**(3.0/4.0)
# s orbitals
if (l, m) == (0, 0):
return c
# p orbitals
elif (l, m) == (1, -1):
return c*2.0*y_grid
elif (l, m) == (1, 0):
return c*2.0*z_grid
elif (l, m) == (1, 1):
return c*2.0*x_grid
# d orbitals
elif (l, m) == (2, -2):
return c*4.0*x_grid*y_grid
elif (l, m) == (2, -1):
return c*4.0*y_grid*z_grid
elif (l, m) == (2, 0):
return c*2.0/np.sqrt(3)*(2*z_grid**2-x_grid**2-y_grid**2)
elif (l, m) == (2, 1):
return c*4.0*z_grid*x_grid
elif (l, m) == (2, 2):
return c*2.0*(x_grid**2-y_grid**2)
# f orbitals
elif (l, m) == (3, -3):
return c*np.sqrt(8/3)*y_grid*(3*x_grid**2-y_grid**2)
elif (l, m) == (3, -2):
return c*8.0*x_grid*y_grid*z_grid
elif (l, m) == (3, -1):
return c*np.sqrt(8/5)*y_grid*(4*z_grid**2-x_grid**2-y_grid**2)
elif (l, m) == (3, 0):
return c*4.0/np.sqrt(15.0)*z_grid*(2.0*z_grid**2-3.0*x_grid**2-3.0*y_grid**2)
elif (l, m) == (3, 1):
return c*np.sqrt(8/5)*x_grid*(4*z_grid**2-x_grid**2-y_grid**2)
elif (l, m) == (3, 2):
return c*4.0*z_grid*(x_grid**2-y_grid**2)
elif (l, m) == (3, 3):
return c*np.sqrt(8/3)*x_grid*(x_grid**2-3.0*y_grid**2)
print("No spherical harmonic found for l=%d, m=%d" % (l, m))
return 0

@eimrek
Copy link
Member Author

eimrek commented Feb 3, 2025

fixed by #12

@eimrek eimrek closed this as completed Feb 3, 2025
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

No branches or pull requests

1 participant