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

VeloxChem writer unconditionally enables Optimize General Contractions #319

Open
jeffhammond opened this issue Sep 7, 2024 · 3 comments

Comments

@jeffhammond
Copy link

jeffhammond commented Sep 7, 2024

If one emits, e.g., the cc-pVDZ basis set for oxygen for NWChem or PSI4, enabling or disabling the "Optimize General Contractions" option will cause 8 or 9 non-zero primitives to be produced for the first two S orbitals.

However, when requesting the VeloxChem format, the result expected for the Optimize General Contractions case is unconditionally emitted.

This is confusing and makes it hard to compare codes. While very few properties will change based on this, performance is one of them, which matters to some people.

I'll also note that it is confusing that the default is to disable "Optimize General Contractions" when NWChem's internal default is to enable this. This means that what one gets by default out the BSE does not agree with NWChem even when the bse basis set option is used.

The molecular properties that depend on this setting include Mulliken analysis shell coefficients and the basis function weights in the molecular orbitals, for anyone who is curious. No observable depends on the linear dependency in the basis set, as expected.

BASIS "ao basis" SPHERICAL PRINT
#BASIS SET: (9s,4p,1d) -> [3s,2p,1d]
O    S
      1.172000E+04           7.100000E-04          -1.600000E-04           0.000000E+00
      1.759000E+03           5.470000E-03          -1.263000E-03           0.000000E+00
      4.008000E+02           2.783700E-02          -6.267000E-03           0.000000E+00
      1.137000E+02           1.048000E-01          -2.571600E-02           0.000000E+00
      3.703000E+01           2.830620E-01          -7.092400E-02           0.000000E+00
      1.327000E+01           4.487190E-01          -1.654110E-01           0.000000E+00
      5.025000E+00           2.709520E-01          -1.169550E-01           0.000000E+00
      1.013000E+00           1.545800E-02           5.573680E-01           0.000000E+00
      3.023000E-01          -2.585000E-03           5.727590E-01           1.000000E+00
O    P
      1.770000E+01           4.301800E-02           0.000000E+00
      3.854000E+00           2.289130E-01           0.000000E+00
      1.046000E+00           5.087280E-01           0.000000E+00
      2.753000E-01           4.605310E-01           1.000000E+00
O    D
      1.185000E+00           1.0000000
END
BASIS "ao basis" SPHERICAL PRINT
#BASIS SET: (9s,4p,1d) -> [3s,2p,1d]
O    S
      1.172000E+04           7.100000E-04          -1.600000E-04           0.000000E+00
      1.759000E+03           5.470000E-03          -1.263000E-03           0.000000E+00
      4.008000E+02           2.783700E-02          -6.267000E-03           0.000000E+00
      1.137000E+02           1.048000E-01          -2.571600E-02           0.000000E+00
      3.703000E+01           2.830620E-01          -7.092400E-02           0.000000E+00
      1.327000E+01           4.487190E-01          -1.654110E-01           0.000000E+00
      5.025000E+00           2.709520E-01          -1.169550E-01           0.000000E+00
      1.013000E+00           1.545800E-02           5.573680E-01           0.000000E+00
      3.023000E-01           0.0000000E+00          0.0000000E+00          1.000000E+00
O    P
      1.770000E+01           4.301800E-02           0.000000E+00
      3.854000E+00           2.289130E-01           0.000000E+00
      1.046000E+00           5.087280E-01           0.000000E+00
      2.753000E-01           0.0000000E+00          1.000000E+00
O    D
      1.185000E+00           1.0000000
END
@BASIS_SET cc-pVDZ

! OXYGEN       (17s,4p,1d) -> [3s,2p,1d]
@ATOMBASIS O
S    8    1
1.172000E+04      7.100000E-04
1.759000E+03      5.470000E-03
4.008000E+02      2.783700E-02
1.137000E+02      1.048000E-01
3.703000E+01      2.830620E-01
1.327000E+01      4.487190E-01
5.025000E+00      2.709520E-01
1.013000E+00      1.545800E-02
S    8    1
1.172000E+04     -1.600000E-04
1.759000E+03     -1.263000E-03
4.008000E+02     -6.267000E-03
1.137000E+02     -2.571600E-02
3.703000E+01     -7.092400E-02
1.327000E+01     -1.654110E-01
5.025000E+00     -1.169550E-01
1.013000E+00      5.573680E-01
S    1    1
3.023000E-01      1.000000E+00
P    3    1
1.770000E+01      4.301800E-02
3.854000E+00      2.289130E-01
1.046000E+00      5.087280E-01
P    1    1
2.753000E-01      1.000000E+00
D    1    1
1.185000E+00      1.0000000
@END
aa00b0494c3d1bfeed7c8556745fc324
@jeffhammond
Copy link
Author

Here are some NWChem output files in case somebody wants to see the differences.
cc-pvdz is the NWChem internal basis set. cc-pvdz8 is the optimized general contraction basis set from BSE. cc-pvdz9 is the unoptimized general contraction basis set from BSE.

The MO coefficients differ by more than I would have expected, even though the energies are identical.

w10_scf_cc-pvdz_property.log
w10_scf_cc-pvdz9_property.log
w10_scf_cc-pvdz8_property.log

@bennybp
Copy link
Member

bennybp commented Sep 9, 2024

It does seem to be forced to optimize general in the original PR:

basis = manip.optimize_general(basis, False)
. Maybe @robertodr can comment? Straightforward to fix if needed.

About the NWChem library - I didn't realize it was being incorporated in the NWChem software directly. There is a function to create archives for a particular output format (which I assume NWChem might be using), but right now that doesn't take any options for optimizing contractions or anything. This could be easily added if that would be useful.

@jeffhammond
Copy link
Author

Nothing is needed for NWChem now. I didn't realize that the GC optimization existed or that NWChem applied it internally automatically until now.

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

2 participants