-
Notifications
You must be signed in to change notification settings - Fork 14
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
Added real and Fourier space spliner base classes #235
Conversation
Here is a pre-built version of the code in this pull request: wheels.zip, you can install it locally by unzipping |
e78f6bf
to
507168a
Compare
Regarding the class structure, should we have separate classes for atomic density and basis functions instead of putting everyone inside the spliner? Something like class GaussianDensity(AtomicDensityBase):
...
class DeltaDensity(AtomicDensityBase):
...
class RadiallyVaryingDensity(AtomicDensityBase):
...
class GTOBasis(RadialBasis):
...
class MonomialBasis(RadialBasis):
...
class RealSpaceSpliner():
def __init__(self, density: AtomicDensityBase, basis: RadialBasis):
...
class KSpaceSpliner():
def __init__(self, density: AtomicDensityBase, basis: RadialBasis):
... This way A partially unrelated thing I find weird is making the Which is also solved by the API above, using composition instead of inheritance for the density & basis functions! |
Yes, we can split this up even more. Shouldn't we then use inheritance, i.e. class GTORealSpaceSpliner(RealSpaceSpliner, GTOBasis, GaussianDensity):
.... |
I think composition is going to be much clearer than multiple inheritance here |
Yeah might be. First of all if to fix the code that it is actually working. Currently, I run into infinite loops when doing the integrals. |
9a5c938
to
570fa99
Compare
@Luthaf sorry for the delay but I continued the work on the spliner classes. Splitting the The LODE part is already working and agrees with the analytical implementation that we did in rust as the I will continue the work on the real space part next week. |
83021e1
to
f6955a8
Compare
After some rounds of debugging the implementation is working. The main and most important tests are testing that the Numerical implementation for the special case of GTOs + Gaussian densities agrees with the analytical implementation in rust for GTOs + Gaussian densities. In addition I already added some more interesting densities and basis classes. The theory part was written by @kvhuguenin 🙏. I just ported this from a LaTeX document to rst. |
f6955a8
to
13afad9
Compare
13afad9
to
f9f6b79
Compare
f9f6b79
to
bdc596f
Compare
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.
Looks mostly good. I'll try to reflow the docs a bit, but that's easier to do as a commit instead of github suggestions.
.. _k-space-radial-integral-1: | ||
|
||
K-space Radial Integral | ||
----------------------- |
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.
Is this missing?
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.
Yes, we have to write it 🤣 pinging @kvhuguenin here because heis the master for this. We can remove the section for now.
assert_allclose(coeffs_num, coeffs_exact) | ||
|
||
|
||
# def test_rspace_radial_integral(): |
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.
why is this commented out?
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.
Becuase, I still need to fix the analytical expression. 🫣
max_angular=max_angular, | ||
k_cutoff=k_cutoff, | ||
basis=basis, | ||
density=DeltaDensity(), # density does not enter in a Kspace radial integral |
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.
if the atomic density does not enter the K-space RI, should we remove the parameter from the constructor?
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.
But it does for the center contribution which we are not testing here.
@@ -401,3 +479,380 @@ def _radial_integral_derivative( | |||
return super()._radial_integral_derivative(n, ell, positions) | |||
else: | |||
return self.radial_integral_derivative_funcion(n, ell, positions) | |||
|
|||
|
|||
class RealSpaceSpliner(RadialIntegralSplinerBase): |
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.
Should these be called SoapSpliner
and LodeSpliner
instead?
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.
We can to be consistent with our namespace.
5bf424a
to
4c999a7
Compare
Thanks again for the feedback @Luthaf. If you want to give the docs another round of improvements I am happy if you provide a commit. Otherwise we can also proceed in another PR. This is already quite big... |
4c999a7
to
54ffc0e
Compare
Co-authored-by: Guillaume Fraux <[email protected]>
CI error is |
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.
Thanks for the really nice improvements @Luthaf !!!
I am happy with the PR and hope that this can be helpful and gives us more flexibility of the basis and density combinations.
As given in the title this PR adds two new base clases:
RealSpaceRadialIntegralSplinerBase
FourierSpaceRadialIntegralSplinerBase
With these base classes constructing (almost) any radial integral becomes quite easy. A developer/user only has to implement the method for her/his radial basis in a child class. The actual integral is performed numerically with
quad
. Also I added the option to (ortho)normalize the radial integral.For
RealSpaceRadialIntegralSplinerBase
I added support for delta atomic densities and Gaussian atomic densities. The support for custom atomic densities is prepared, but the logic is missing. Since the integral is a more complex we should do this in an upcoming PR.FourierSpaceRadialIntegralSplinerBase
already works for any atomic density and radial basis.TODO
I still have to document and test everything. Especially the equations for the radial integral should be added.
As a test I suggest that I add a GTO child class for LODE and SOAP and compare this to the analytical results which we already implemented in rust.
I would happy about some comments if the class structure makes sense and is understandable :-).
📚 Documentation preview 📚: https://rascaline--235.org.readthedocs.build/en/235/