MolSSI-BSE / basis_set_exchange

A repository for quantum chemistry basis sets
https://molssi-bse.github.io/basis_set_exchange/
BSD 3-Clause "New" or "Revised" License
153 stars 44 forks source link

VeloxChem writer unconditionally enables Optimize General Contractions #319

Open jeffhammond opened 1 week ago

jeffhammond commented 1 week ago

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 commented 1 week ago

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 commented 6 days ago

It does seem to be forced to optimize general in the original PR: https://github.com/MolSSI-BSE/basis_set_exchange/blob/eacdd02daad32d05d794e1053b75f803849dc3f7/basis_set_exchange/writers/veloxchem.py#L45. 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 commented 6 days ago

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