Hello CASINO developers,
The adf2stowf.py utility included in the CASINO distribution is not working.
This is due to the fact that the scipy.weave module is outdated and no longer supported in recent versions of SciPy, along with several other minor issues.
I have created a project at https://github.com/Konjkov/adf2stowf with fixes and examples of the corrected script's functionality. However, upgrading to Python 3.10+ is not feasible, and I am dissatisfied with the loss of virtual orbital information. Additionally, the conversion fails for hydrogen atom.
I would prefer a lightweight script that does not perform cusp correction and generate plots but preserves virtual orbital information.
Best regards,
Vladimir.
Bug report & feature request for adf2stowf.py utility
-
Vladimir_Konjkov
- Posts: 188
- Joined: Wed Apr 15, 2015 3:14 pm
Bug report & feature request for adf2stowf.py utility
dark matter makes up most of something
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
-
Neil Drummond
- Posts: 125
- Joined: Fri May 31, 2013 10:42 am
- Location: Lancaster
- Contact:
Re: Bug report & feature request for adf2stowf.py utility
Thanks for this. I don't think any of us have access to ADF. Perhaps it would be best if we were simply to remove adf2stowf from CASINO and replace it with a note pointing to your version on GitHub.
Best wishes,
Neil.
Best wishes,
Neil.
-
Vladimir_Konjkov
- Posts: 188
- Joined: Wed Apr 15, 2015 3:14 pm
Re: Bug report & feature request for adf2stowf.py utility
ChatGPT told me that instead of scipy.weave, I could use pybind11 and rewrote part of the code as an example https://github.com/Konjkov/adf2stowf/bl ... stowfn.cpp, also fixed the calculation for the hydrogen atom and added comments... I think it will also help with the virtual orbitals.
Fashion exists in any area of human activity, including quantum chemistry. Right now, using LLMs such as ChatGPT, and others is all the rage, just as quantum Monte Carlo methods became widely adopted in their time.
Fashion exists in any area of human activity, including quantum chemistry. Right now, using LLMs such as ChatGPT, and others is all the rage, just as quantum Monte Carlo methods became widely adopted in their time.
Last edited by Vladimir_Konjkov on Fri Sep 12, 2025 5:18 am, edited 1 time in total.
dark matter makes up most of something
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
-
Neil Drummond
- Posts: 125
- Joined: Fri May 31, 2013 10:42 am
- Location: Lancaster
- Contact:
Re: Bug report & feature request for adf2stowf.py utility
I've spent much of my life so far happily telling computers what to do. I do hope it's not going to be the other way round in the future.ChatGPT told me that instead of scipy.weave, I could use pybind11 and rewrote part of the code as an...
-
Vladimir_Konjkov
- Posts: 188
- Joined: Wed Apr 15, 2015 3:14 pm
Re: Bug report & feature request for adf2stowf.py utility
I called it Cognilator (noun) - A device or system designed to assist human reasoning and cognitive processes, analogous to how a Сalculator assists with mathematical computations. A cognitive aid that helps users think through problems, analyze information, organize thoughts, or enhance decision-making capabilities.Neil Drummond wrote: ↑Thu Sep 11, 2025 9:59 pmI've spent much of my life so far happily telling computers what to do. I do hope it's not going to be the other way round in the future.ChatGPT told me that instead of scipy.weave, I could use pybind11 and rewrote part of the code as an...
LLMs cannot think complex thoughts (https://metr.org/blog/2025-03-19-measur ... ong-tasks/). Even if the complexity of tasks that LLMs can solve at a 50% success rate grows exponentially, the most complex problems will still remain ours.
PS: The sad social consequence will be an increasing number of people who essentially solve nothing in their lives—not only in terms of solving mathematical problems, but in the broader sense of making decisions at all.
dark matter makes up most of something
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
-
Vladimir_Konjkov
- Posts: 188
- Joined: Wed Apr 15, 2015 3:14 pm
Re: Bug report & feature request for adf2stowf.py utility
I have created a Python package, https://pypi.org/project/adf2stowf/ , which includes a version from the CASINO distribution with minimal modifications (only adjusted to ensure proper package installation). This version will serve as the reference implementation. Unfortunately, in this version, the flags:
PLOTCUSPS = False
CUSP_ENFORCE = True
have made editing more difficult.
Next week, I will release version 1.0.0, which will use pybind11 and be compatible with Python 3.10+.
PLOTCUSPS = False
CUSP_ENFORCE = True
have made editing more difficult.
Next week, I will release version 1.0.0, which will use pybind11 and be compatible with Python 3.10+.
dark matter makes up most of something
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
-
Vladimir_Konjkov
- Posts: 188
- Joined: Wed Apr 15, 2015 3:14 pm
Re: Bug report & feature request for adf2stowf.py utility
ChatGPT told me that the code contains two methods for enforcing cusp conditions at nuclei: the Projection method (cusp_projection_matrix), which is commented out, and the Enforcing method (cusp_enforcing_matrix). Both methods always assume that orbitals are orthogonal (S = I), which is not generally true.
Presumably, the overlap matrix (S-matrix) is stored in the file TAPE21.asc under the variable smx in packed (compressed) form, containing only the lower or upper triangular part of the symmetric matrix. The variable smx is present only in systems consisting of more than one atom.
However, applying the cusp condition for the hydrogen molecule—whose overlap matrix (S-matrix) has large off-diagonal elements—using methods that do not account for orbital non-orthogonality still yields accurate energy values.
for H2 molecule
ADF -1.13357693 a.u.
enforced -1.13356(1) ; var = 0.2237(5)
no cusp -1.13356(1) ; var = 0.227(1)
projected -1.13356(1) ; var = 0.2241(5)
for O3 molecule
ADF -224.37727604 a.u.
enforced -224.350(4) ; var = 49.8(8)
no cusp -224.353(4) ; var = 49.4(7)
projected -224.352(4) ; var = 49.7(7)
Presumably, the overlap matrix (S-matrix) is stored in the file TAPE21.asc under the variable smx in packed (compressed) form, containing only the lower or upper triangular part of the symmetric matrix. The variable smx is present only in systems consisting of more than one atom.
However, applying the cusp condition for the hydrogen molecule—whose overlap matrix (S-matrix) has large off-diagonal elements—using methods that do not account for orbital non-orthogonality still yields accurate energy values.
for H2 molecule
ADF -1.13357693 a.u.
enforced -1.13356(1) ; var = 0.2237(5)
no cusp -1.13356(1) ; var = 0.227(1)
projected -1.13356(1) ; var = 0.2241(5)
for O3 molecule
ADF -224.37727604 a.u.
enforced -224.350(4) ; var = 49.8(8)
no cusp -224.353(4) ; var = 49.4(7)
projected -224.352(4) ; var = 49.7(7)
dark matter makes up most of something
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
-
Vladimir_Konjkov
- Posts: 188
- Joined: Wed Apr 15, 2015 3:14 pm
Re: Bug report & feature request for adf2stowf.py utility
I've pushed a round of fixes to adf2stowf (the ADF TAPE21 → stowfn.data converter). The main one matters for any molecule with occupied d/f character, so it's worth flagging here.
Cartesian-to-spherical normalisation (the important fix). ADF stores MO coefficients referred to individually normalised Cartesian monomials — the per-function bnorm factors, which differ between components within a d or f shell (1:√3 for d, 1:√5:√15 for f). The converter was applying the bare cart2harm map and ignoring those factors, so the spherical-harmonic coefficients handed to CASINO were wrong whenever an MO mixed d/f with s/p. The transform is now conjugated by the two normalisations, diag(1/casino_norm) · cart2harm · diag(bnorm).
This was invisible for isolated atoms (a closed or half-filled subshell is invariant under any unitary mix of its m-components, so the error cancels in the determinant), which is why it survived for so long — but it was worth several mHa in molecules. After the fix the single-determinant VMC energies sit on top of the ADF HF reference: HCN, CN⁻ and O₃ all agree to ≈0.1–0.6σ where they were previously several σ out.
Pruning. Unused basis functions — empty polarisation d/f shells, their appended contamination companions, and diffuse s/p that no occupied orbital uses — are now dropped from stowfn.data. The wavefunction is unchanged; for atoms this roughly halves the AO count CASINO has to evaluate. --all-orbitals keeps them.
One open item worth recording: Be/QZ4P shows ~1 mHa where VMC sits above the printed ADF HF total. This one is not the converter — the determinant is reproduced faithfully (one-electron ⟨T⟩ and ⟨V_ne⟩ match ADF to 4 digits, orbitals orthonormal). It's ADF's fitted (ZlmFit/RI) two-electron energy on the ill-conditioned tight QZ4P core, and it persists with NumericalQuality / RI fit / integration / threshold all set to Excellent. pVQZ is well-conditioned and agrees, so the exact CASINO number is the trustworthy one there.
PS: Finally, a word of credit: most of these bugs were tracked down and fixed with the help of Anthropic's Claude (the Fable model). I've only been using it for a single day, and it has been nothing short of fantastic — well ahead of anything else I've tried for this kind of close numerical detective work.
https://github.com/Konjkov/adf2stowf
Cartesian-to-spherical normalisation (the important fix). ADF stores MO coefficients referred to individually normalised Cartesian monomials — the per-function bnorm factors, which differ between components within a d or f shell (1:√3 for d, 1:√5:√15 for f). The converter was applying the bare cart2harm map and ignoring those factors, so the spherical-harmonic coefficients handed to CASINO were wrong whenever an MO mixed d/f with s/p. The transform is now conjugated by the two normalisations, diag(1/casino_norm) · cart2harm · diag(bnorm).
This was invisible for isolated atoms (a closed or half-filled subshell is invariant under any unitary mix of its m-components, so the error cancels in the determinant), which is why it survived for so long — but it was worth several mHa in molecules. After the fix the single-determinant VMC energies sit on top of the ADF HF reference: HCN, CN⁻ and O₃ all agree to ≈0.1–0.6σ where they were previously several σ out.
Pruning. Unused basis functions — empty polarisation d/f shells, their appended contamination companions, and diffuse s/p that no occupied orbital uses — are now dropped from stowfn.data. The wavefunction is unchanged; for atoms this roughly halves the AO count CASINO has to evaluate. --all-orbitals keeps them.
One open item worth recording: Be/QZ4P shows ~1 mHa where VMC sits above the printed ADF HF total. This one is not the converter — the determinant is reproduced faithfully (one-electron ⟨T⟩ and ⟨V_ne⟩ match ADF to 4 digits, orbitals orthonormal). It's ADF's fitted (ZlmFit/RI) two-electron energy on the ill-conditioned tight QZ4P core, and it persists with NumericalQuality / RI fit / integration / threshold all set to Excellent. pVQZ is well-conditioned and agrees, so the exact CASINO number is the trustworthy one there.
PS: Finally, a word of credit: most of these bugs were tracked down and fixed with the help of Anthropic's Claude (the Fable model). I've only been using it for a single day, and it has been nothing short of fantastic — well ahead of anything else I've tried for this kind of close numerical detective work.
https://github.com/Konjkov/adf2stowf
dark matter makes up most of something
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about
but no one knows exactly what
it holds the galaxies together
like feelings no one talks about