Dear all,

An error related to memory occurred in my SAPT calculation. I have set MEM_TOTAL to 4800000 MB, which is large enough according to the error information, yet the error still occurred.

```
Currently using 0.00 Mb of memory with 4800000.00 Mb still available
Storage of SAPT dispersion amplitudes will take 57988.7391357422 MB
Will need at least two times this in disk regardless of algorithm
==============================================================
Memory Requirements for SAPT (MEM_TOTAL)
IN CORE 1 (fastest) 117101.15 MB
IN CORE 2 59202.69 MB
DISK 1231.65 MB
===============================================================
```

Below is my input.

```
$molecule
[structure]
$end
$rem
mem_total 4800000
jobtype xsapt
basis 6-31g(d)
method b3lyp
$end
$sapt
algorithm ri-mo
basis dimer
$end
```

You may need to set AO2MO_DISK to a large value. (This mirrors how the old MP2 code used to work, although the latter has been rewritten.)

Alternatively, you could try SAPT+MBD, rather than SAPT0 (which is what your job is set up to do). This is a more accurate method that is O(N^3) rather than O(N^5) and without the large memory bottleneck of SAPT0. See:

https://doi.org/10.1021/acs.accounts.1c00387

Thank you for your advice. I tried larger AO2MO_DISK in both SAPT0 and SAPT+MBD calculations, yet similar error occurred.

Below is my input for SAPT+MBD calculation.

```
$rem
ao2mo_disk 5000000
jobtype xsapt
basis 6-31g(d)
method b3lyp
scf_guess autosad
$end
$sapt
algorithm ri-mo
basis dimer
dispersion mbd
$end
```

Can you provide the complete input, including the $molecule ?

This is the complete input:

```
$molecule
-1 1
-- cage
0 1
N 0.00900000 -0.00800000 -3.91400000
N 0.01000000 0.00000000 4.93600000
C 1.22900000 0.69000000 -4.31400000
H 1.04900000 1.76300000 -4.18300000
H 1.48200000 0.54000000 -5.37900000
C 0.00300000 -1.41400000 -4.31100000
H 1.02200000 -1.79500000 -4.17700000
H -0.25100000 -1.56100000 -5.37600000
C -1.20600000 0.69900000 -4.31300000
H -2.04500000 0.00800000 -4.17900000
H -1.20500000 0.99100000 -5.37800000
C -1.38800000 -0.13800000 5.34200000
H -1.86300000 0.83900000 5.20400000
H -1.50400000 -0.40300000 6.40800000
C 0.83000000 -1.14200000 5.34100000
H 0.22200000 -2.04200000 5.20300000
H 1.11800000 -1.11000000 6.40700000
C 0.59000000 1.28100000 5.33900000
H 1.67400000 1.20400000 5.20000000
H 0.41900000 1.51500000 6.40500000
C -2.04500000 -1.33100000 3.14100000
C 2.38800000 -0.15500000 -2.15600000
C -1.31100000 -1.99000000 -2.15300000
C -1.05000000 2.12900000 -2.15700000
C 2.19000000 -1.11500000 3.13900000
C -0.11600000 2.44300000 3.13700000
C -1.38600000 4.14000000 -0.68800000
C -1.60400000 5.51600000 -0.74800000
C -1.08200000 3.50800000 0.51900000
C -1.54600000 6.27400000 0.42200000
H -1.82200000 5.97100000 -1.70400000
C -0.96800000 4.29500000 1.66800000
C -1.19400000 5.67200000 1.63100000
H -1.09400000 6.26400000 2.53000000
C -2.88900000 -3.27900000 -0.68200000
C -2.48900000 -2.70100000 0.52400000
C -3.97800000 -4.14700000 -0.74300000
C -3.23100000 -2.99000000 1.67400000
C -4.66700000 -4.47000000 0.42700000
H -4.26600000 -4.56000000 -1.69900000
C -4.31700000 -3.86600000 1.63600000
H -4.88400000 -4.06900000 2.53400000
C 4.29700000 -0.86900000 -0.68500000
C 3.59700000 -0.81300000 0.52100000
C 5.59600000 -1.37000000 -0.74500000
C 4.22100000 -1.30400000 1.67200000
C 6.22300000 -1.79700000 0.42700000
H 6.09900000 -1.41100000 -1.70000000
C 5.52600000 -1.79800000 1.63500000
H 5.98800000 -2.18100000 2.53500000
N 3.70100000 -0.39100000 -1.88000000
N -2.17400000 -3.00600000 -1.87600000
N -1.50300000 3.38400000 -1.88200000
N 4.47700000 -0.11900000 -2.97000000
N -2.32800000 -3.81600000 -2.96500000
N -2.12800000 3.91800000 -2.97200000
N 3.67900000 0.27200000 -3.92300000
N -1.58900000 -3.32400000 -3.91900000
N -2.06900000 3.03100000 -3.92400000
N 3.52000000 -1.30000000 2.90500000
N -2.87600000 -2.38600000 2.90600000
N -0.61900000 3.68800000 2.90100000
N 4.18900000 -1.51700000 4.07600000
N -3.40200000 -2.85200000 4.07700000
N -0.76200000 4.37700000 4.07200000
N 3.30900000 -1.47300000 5.03500000
N -2.92200000 -2.11300000 5.03500000
N -0.36000000 3.59400000 5.03100000
C 2.06900000 -1.23400000 4.50600000
C -2.08900000 -1.16400000 4.50700000
C 0.05000000 2.39900000 4.50400000
C 2.39000000 0.26800000 -3.46700000
C -0.94400000 -2.20600000 -3.46300000
C -1.42000000 1.91700000 -3.46700000
C 7.61600000 -2.37500000 0.41300000
O 7.81700000 -3.44800000 0.98400000
N 8.60100000 -1.69500000 -0.26000000
C -1.74600000 7.76900000 0.40800000
O -0.91700000 8.48200000 0.97500000
N -2.83300000 8.27700000 -0.26000000
C -5.87200000 -5.37600000 0.41300000
O -6.89900000 -5.00300000 0.98300000
N -5.78500000 -6.57200000 -0.25600000
C -2.94800000 9.74000000 -0.42800000
C -3.13800000 10.49500000 0.89900000
C -1.78700000 10.32100000 -1.25100000
H -3.85800000 9.89100000 -1.01700000
C -3.33700000 11.99500000 0.64200000
H -2.25500000 10.33100000 1.52200000
H -3.99900000 10.08000000 1.43500000
C -1.99200000 11.82200000 -1.49300000
H -0.85200000 10.15200000 -0.71100000
H -1.71900000 9.78200000 -2.20400000
C -2.17700000 12.58200000 -0.17300000
H -3.44100000 12.52600000 1.59700000
H -4.27800000 12.15300000 0.09200000
H -1.14100000 12.22900000 -2.05300000
H -2.88200000 11.97500000 -2.12200000
H -2.34700000 13.64800000 -0.36700000
H -1.25100000 12.50900000 0.41600000
C 9.92400000 -2.33300000 -0.42500000
C 10.67400000 -2.54100000 0.90200000
C 9.84200000 -3.63200000 -1.24100000
H 10.51200000 -1.62500000 -1.01900000
C 12.07100000 -3.12300000 0.64600000
H 10.08900000 -3.21900000 1.52900000
H 10.74800000 -1.58500000 1.43300000
C 11.24200000 -4.21100000 -1.48200000
H 9.22700000 -4.35400000 -0.69700000
H 9.34100000 -3.42500000 -2.19500000
C 11.99400000 -4.42500000 -0.16200000
H 12.58400000 -3.29400000 1.60000000
H 12.67800000 -2.39100000 0.09100000
H 11.16600000 -5.15500000 -2.03700000
H 11.82100000 -3.52200000 -2.11600000
H 13.00200000 -4.81400000 -0.35600000
H 11.46800000 -5.18600000 0.43200000
C 8.46900000 -0.29500000 -0.70200000
C 9.43700000 0.65300000 0.02600000
C 8.58900000 -0.14200000 -2.22700000
H 7.46600000 0.02500000 -0.42200000
C 9.17200000 2.10700000 -0.39400000
H 10.47700000 0.39200000 -0.21000000
H 9.31300000 0.53400000 1.10900000
C 8.32500000 1.31000000 -2.64700000
H 9.59500000 -0.44100000 -2.55300000
H 7.88100000 -0.81300000 -2.72500000
C 9.26300000 2.28000000 -1.91600000
H 9.87900000 2.77600000 0.11200000
H 8.16700000 2.39900000 -0.05700000
H 8.43900000 1.41100000 -3.73200000
H 7.27900000 1.55800000 -2.42100000
H 9.03000000 3.31600000 -2.19300000
H 10.29800000 2.09200000 -2.23800000
C -7.00500000 -7.38700000 -0.42500000
C -7.57100000 -7.92800000 0.89900000
C -8.08000000 -6.65800000 -1.24700000
H -6.69200000 -8.25300000 -1.01800000
C -8.78100000 -8.83600000 0.63800000
H -7.86100000 -7.08000000 1.52500000
H -6.78700000 -8.47700000 1.43300000
C -9.28900000 -7.57100000 -1.49200000
H -8.39200000 -5.76100000 -0.70400000
H -7.64300000 -6.33200000 -2.19900000
C -9.86100000 -8.10900000 -0.17400000
H -9.19300000 -9.19100000 1.59100000
H -8.45700000 -9.73100000 0.08500000
H -10.06000000 -7.02700000 -2.05100000
H -8.98500000 -8.42000000 -2.12400000
H -10.70700000 -8.77900000 -0.37100000
H -10.25100000 -7.26900000 0.41800000
C -4.51000000 -7.17100000 -0.69100000
C -4.19000000 -8.48500000 0.04100000
C -4.43200000 -7.35500000 -2.21500000
H -3.72600000 -6.46900000 -0.40700000
C -2.80000000 -8.99600000 -0.37100000
H -4.94200000 -9.24900000 -0.19800000
H -4.23500000 -8.31700000 1.12300000
C -3.04400000 -7.86400000 -2.62600000
H -5.19800000 -8.07100000 -2.54200000
H -4.65000000 -6.40600000 -2.71600000
C -2.68900000 -9.16400000 -1.89200000
H -2.58500000 -9.94400000 0.13700000
H -2.04000000 -8.27900000 -0.03000000
H -3.00900000 -8.01500000 -3.71200000
H -2.30100000 -7.08900000 -2.39800000
H -1.67700000 -9.49000000 -2.16300000
H -3.37500000 -9.96100000 -2.21600000
C -3.97900000 7.45700000 -0.69300000
C -5.28200000 7.82200000 0.04000000
C -4.17900000 7.47600000 -2.21700000
H -3.75000000 6.43100000 -0.40800000
C -6.40700000 6.85900000 -0.36800000
H -5.58000000 8.85100000 -0.20100000
H -5.11100000 7.78100000 1.12200000
C -5.30500000 6.51600000 -2.62500000
H -4.42700000 8.49500000 -2.54600000
H -3.24600000 7.19900000 -2.71800000
C -6.61100000 6.84300000 -1.88900000
H -7.33800000 7.13600000 0.14100000
H -6.15300000 5.84600000 -0.02700000
H -5.45500000 6.55900000 -3.71100000
H -4.99200000 5.48800000 -2.39700000
H -7.39100000 6.12000000 -2.15900000
H -6.97100000 7.83100000 -2.21400000
H -1.50400000 -0.80600000 2.36500000
H 1.59300000 -0.29400000 -1.43600000
H -1.03200000 -1.23100000 -1.43400000
H -0.53100000 1.51000000 -1.43700000
H 1.46400000 -0.91400000 2.36300000
H 0.07100000 1.71200000 2.36200000
H -0.93800000 2.43300000 0.56100000
H -1.62600000 -2.04500000 0.56600000
H 2.59500000 -0.39900000 0.56300000
-- chloride
-1 1
Cl 0.01000000 -0.00400000 0.50100000
$end
$rem
ao2mo_disk 5000000
jobtype xsapt
basis 6-31g(d)
method b3lyp
scf_guess autosad
$end
$sapt
algorithm ri-mo
basis dimer
dispersion mbd
$end
```

I will run some tests this weekend. However, one thing that is immediately clear is that you are trying to do something that is very ill-advised, namely, to drop B3LYP orbitals into the SAPT0 formalism of 2nd-order perturbation theory. That’s a very bad idea because the B3LYP XC potential has incorrect asymptotic behavior, the HOMO/LUMO gap is too small, and as a result this will exaggerate problems with 2nd-order dispersion (which is already too large even when Hartree-Fock orbitals are used). For these “SAPT0(KS)” calculations, one should only use functionals with correct asymptotic behavior. My group recommends LRC-wPBE with a “tuned” value of omega, either via conventional IE tuning [IE(w) = -eHOMO(w)] or else via wGDD tuning. We’ve discussed this at various times in the literature, including the Accounts paper cited above but also the following papers:

https://doi.org/10.1063/5.0059364 (simplified wGDD tuning)

https://doi.org/10.1021/acs.jctc.8b00058 (wGDD vs. IE tuning)

https://doi.org/10.1063/1.4862644 [original SAPT0(KS) paper with LRC functionals]

Thank you for you help and advice!

I saw some application works used coupled-cluster related methods. This system is quite large so I tried B3LYP before inconsiderately.

The point is that you should not use orbitals from an asymptotically-incorrect functional within a perturbation theory formalism. You would be better off with Hartree-Fock orbitals if you just want something simple. Better still, use LRC-wPBE but in that case you need to tune w in a monomer-specific fashion, as described in the papers cited above

For the MBD calculation, you need to set ALGORITHM to AO in the $sapt input section, as described in the manual. In addition, if you are going to use DFT orbitals for the monomers then you should use the LRC-wPBE functional with w (omega) tuned separately for each monomer and specified via a $lrc_omega input section. Again, this is described in the manual. I have NOT carried out the tuning procedure here, but the following input section works for the $molecule specified above, runs to completion in about 90 min on 20 processors.

```
$rem
ao2mo_disk 400000
mem_total 100000
jobtype xsapt
basis 6-31g(d)
method lrc-wpbe
lrc_dft true
$end
$xpol
embed none
dft-lrc
$end
$lrc_omega
300
300
$end
$sapt
algorithm ao
basis projected
dispersion mbd
order 2
$end
```

(Actually the memory and disk settings are a holdover from your input and are probably not necessary here – the memory footprint for this calculation should be about the same as normal DFT on the same system, which is to say: modest.)

For the traditional SAPT0 calculation that you tried originally (Algorithm RI-MO), you need to specify an AUX_BASIS in $rem, and also this code uses MEM_STATIC rather than MEM_TOTAL. It appears this may be too big for the SAPT0 code that is based old MP2-style memory management that has since been overhauled for MP2 but not for SAPT0. If you are interested in this calculation you could submit this job as a bug report to Q-Chem, though I recommend SAPT0+MBD as a low-cost alternative.

Thank you jherbert!

I’ll try it according to your advice.