theochem / gbasis

Python library for analytical evaluation and integration of Gaussian-type basis functions and related quantities.
http://gbasis.qcdevs.org/
GNU Lesser General Public License v3.0
39 stars 22 forks source link

[BUG] Test doesn't assert or fails when fixed (Diff Operator Integrals and Moment integral) #152

Closed Ali-Tehrani closed 9 months ago

Ali-Tehrani commented 9 months ago

Describe the bug

While I was fixing up the linter complaints. It mentioned that two tests didn't have assertion statements in them. If I did add them I get an error where the two arrays are not close at all. I haven't looked into but thought I put an issue for it.

As you can see below, the two tests don't have the obvious assert np.allclose(a, b) statement to them. If I add this fix, the shape is correct but the error is very large.

The first failed test is test_compute_differential_operator_integrals_multiarray in test_diff_operator_int.py https://github.com/theochem/gbasis/blob/c8268710b77c706f02487e907339f904c12397c9/tests/test_diff_operator_int.py#L315-L328

The second test is test_compute_multipole_moment_integrals_multiarray in test_moment_int.py: https://github.com/theochem/gbasis/blob/c8268710b77c706f02487e907339f904c12397c9/tests/test_moment_int.py#L800-L814

To Reproduce

pytest -v .

Additional context

leila-pujal commented 9 months ago

Hi, I was looking at the tests you linked. I have a question, at the end of the for loops you highlighted the == is used. I think it gives back a boolean based on the elements that they are comparing. I know it doesn't use assert but wouldn't it count as an assertation too? Also, what are the two arrays you are comparing that give different results?

Ali-Tehrani commented 9 months ago

Thanks, while trying to answer your question, I've ended up figuring it out and fixing it. It should be in pull-request #151

leila-pujal commented 9 months ago

Perfect! thanks. I'll close the issue then.