Resolution of identity for CDFT?

cloning this to a separate thread so as not to clutter previous discussion.

Having to run larger, more expensive constrained DFT jobs with hybrid functionals so I started to explore the resolution of identity-based approximations. However, I find with the following input (RI_J and occ-RI-K) that it segfaults immediately before the first SCF cycle. Using Qchem 6.3.

$molecule
   1 2
  C      6.30855022     -4.93788338      3.88865279
  H      6.46844030     -5.83477413      3.28091071
  C      5.01765030     -4.35035744      4.19205135
  H      4.04802354     -4.72207231      3.84570655
  C      5.23841495     -3.22386205      5.02651884
  H      4.47447698     -2.55909283      5.44169462
  C      6.66721159     -3.10150946      5.22621529
  H      7.15976745     -2.33556271      5.83473897
  C      7.31655349     -4.20719489      4.58681439
  H      8.38968765     -4.41966656      4.59195632
  C      6.21501810     -1.01803699      2.56079378
  H      6.09904537     -0.12748159      3.18572776
  C      7.47643922     -1.62182529      2.21664122
  H      8.46168129     -1.27259229      2.54082808
  C      7.20721274     -2.73851668      1.37478405
  H      7.94488276     -3.41511989      0.93265470
  C      5.78075005     -2.82732645      1.20681162
  H      5.27058208     -3.57749332      0.59529050
  C      5.15516226     -1.69391917      1.85096660
  C      3.74477713     -1.34129407      1.83063937
  C      2.79744585     -2.10924529      1.10156345
  H      3.10807348     -3.02219605      0.58703002
  C      1.47285868     -1.69375406      0.97701026
  H      0.77759409     -2.27246231      0.35960808
  C      1.05307597     -0.50071272      1.58786675
  C      1.94333084      0.24494950      2.36842866
  H      1.63232837      1.17047784      2.85630207
  C      3.26858932     -0.17875360      2.48969492
  H      3.95611436      0.43480123      3.07808950
 Co      6.25310142     -2.97668890      3.20704943
  N     -0.32023883     -0.01937991      1.29546237
  C     -0.56952759      1.42091634      1.63016136
  H      0.20840818      2.02914160      1.15160308
  H     -1.55666329      1.68346606      1.22473574
  H     -0.56324389      1.55048325      2.72087926
  C     -1.37583337     -0.89912011      1.91359579
  H     -1.21877777     -1.93280239      1.57691648
  H     -1.28362197     -0.83601280      3.00726190
  H     -2.36068006     -0.53706103      1.58448065
  H     -0.41746428     -0.06422855      0.25424860
  C      2.74081181      0.23358296     -1.33464848
  C      3.07781445      1.33939183     -0.52471591
  C      3.77785252     -0.57596110     -1.85603517
  H      2.27171878      1.96727642     -0.13667488
  H      3.54385475     -1.43198863     -2.49568935
  C      4.41385497      1.62501708     -0.23428591
  C      5.11313185     -0.29445065     -1.55455647
  H      4.66306364      2.49129425      0.38751464
  H      5.90839827     -0.93004235     -1.95696942
  C      5.43472279      0.80285844     -0.73853255
  H      6.48090493      1.02669988     -0.50553360
  C      1.31075073     -0.06995661     -1.57864311
  O      0.41861174      0.57454350     -0.99120839
  C      0.93672357     -1.17041692     -2.54385239
  H      1.37713004     -2.13610755     -2.23949946
  H     -0.15882613     -1.26433396     -2.58213330
  H      1.32148929     -0.94112848     -3.55429865
$end

$rem
   METHOD       TPSSh
   MEM_TOTAL    400000
   JOBTYPE      opt
   BASIS        def2-tzvpp
   AUX_BASIS	RIJK-def2-tzvpp
   SCF_CONVERGENCE 8
   XC_GRID      2	SG-2
   RI_J 	TRUE
   OCC_RI_K 	TRUE
   RI_K_GRAD 	TRUE
   MAX_SCF_CYCLES 200
   GEOM_OPT_MAX_CYCLES 100
   SOLVENT_METHOD   smd
   DFT_D        D4
   CDFT         true
   CDFT_THRESH  8
   NO_REORIENT  true
   POINT_GROUP_SYMMETRY false
   INTEGRAL_SYMMETRY    false
   MOLDEN_FORMAT   TRUE
$end

$smx
solvent THF
$end

$opt
   CONSTRAINT
   stre  31  53  2.47538
   ENDCONSTRAINT
$end

$cdft
   -1.0
   1 1 40
   1.0
   1 1 40 s
$end
/global/homes/s/foo/qchem: line 122: 2090781 Segmentation fault      ${QCPROG_S} ${inp} ${scr}
Error in Q-Chem run part 1

When the memory is lowered to 4K (in case it’s allocated per thread), a different segfault results:

corrupted double-linked list
/global/homes/s/foo/qchem: line 122: 2357577 Aborted                 ${QCPROG_S} ${inp} ${scr}
Error in Q-Chem run part 1
Error in the Q-Chem run

Last time I tried this with def2-SVP on 6.2.1, it barely squeaks out the first SCF cycle before a similar segfault.

With RI_J set to false (so only occ-RI-K and the corresponding gradient) the job runs but very slowly, 8 hours for 2 converged SCF cycles. With def2-SVP, it’s about an hour per converged SCF cycle. The analytical gradients didn’t seem to be available in any of these cases for CDFT.

Just running the hybrid functional CDFT without the RI approximations, the opt job runs and completes normally with def2-TZVPP and takes about 20 node-hours for 25 geometry steps. I could afford to use it for a few single point calculations but not for the full dataset.

Possibly all of this is a CDFT issue so I am trying a test job without.

Note that CDFT is implemented only in Q-Chem’s old SCF code so some of the modern accoutrements may not be available. You can tell because the title block

 -----------------------------------------------------------------------
  General SCF calculation program by
  Eric Jon Sundstrom, Paul Horn, Yuezhi Mao, Dmitri Zuev, Alec White,
  David Stuck, Shaama M.S., Shane Yost, Joonho Lee, David Small,
  Daniel Levine, Susi Lehtola, Hugh Burton, Evgeny Epifanovsky,
  Bang C. Huynh
 -----------------------------------------------------------------------

for the new SCF code is not printed in CDFT jobs.

for sure - if that’s the case, so be it…