How to user-define a DF_BASIS_DCFT basis in PSI4

Hi all,

I would like to do a user-defined basis DCFT, my input is like below:

memory 10000 mb
molecule {
0 1
    AU           1.256748692802     0.000000000000     0.000000000000
    AU          -1.256748692802    -0.000000000000     0.000000000000
}

basis QZVPX2C {
spherical
****
--basis--
****
}

df_basis_scf QZVPX2CJK {
spherical
****
--DF basis--
****
}

df_basis_dcft QZVPX2CDCFT {
spherical
****
--DF basis--
****
}

set relativistic x2c
set basis QZVPX2C 
set basis_relativistic QZVPX2C
set df_basis_scf QZVPX2CJK 
set df_basis_dcft QZVPX2CDCFT 
set scf_type df

e, wfn = energy('dcft', return_wfn=True)

Psi4 will get below error:

Traceback (most recent call last):
  File "/root/miniconda3/envs/psi4/bin/psi4", line 289, in <module>
    exec(content)
  File "<string>", line 971
    df_basis_dcft QZVPX2CDCFT {
                            ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/miniconda3/envs/psi4/bin/psi4", line 306, in <module>
    suspect_lineno = traceback.extract_tb(exc_traceback)[1].lineno - 1  # -1 for 0 indexing
IndexError: list index out of range

If modified the input as below:

basis QZVPX2CDCFT {
spherical
****
--DF basis--
****
}

Then, the SCF level calculation is OK, after that, a DCFT calculation is running, but got below error:

Could not find requested basisset (DF_BASIS_DCFT).
Traceback (most recent call last):
  File "/root/miniconda3/envs/psi4/bin/psi4", line 289, in <module>
    exec(content)
  File "<string>", line 1353, in <module>
  File "/root/miniconda3/envs/psi4/lib//python3.7/site-packages/psi4/driver/driver.py", line 561, in energy
    wfn = procedures['energy'][lowername](lowername, molecule=molecule, **kwargs)
  File "/root/miniconda3/envs/psi4/lib//python3.7/site-packages/psi4/driver/procrouting/proc.py", line 1488, in run_dcft
    dcft_wfn = core.dcft(ref_wfn)

RuntimeError: 
Fatal Error: Wavefunction::get_basisset: Requested basis set (DF_BASIS_DCFT) was not set!

Error occurred in file: /scratch/psilocaluser/conda-builds/psi4-multiout_1563819946209/work/psi4/src/psi4/libmints/wavefunction.cc on line: 660
The most recent 5 function calls were:

psi::Wavefunction::get_basisset(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)



Printing out the relevant lines from the Psithon --> Python processed input file:
    core.set_global_option("BASIS", "QZVPX2C")
    core.set_global_option("BASIS_RELATIVISTIC", "QZVPX2C")
    core.set_global_option("DF_BASIS_SCF", "QZVPX2CJK")
    core.set_global_option("DF_BASIS_DCFT", "QZVPX2CDCFT")
    core.set_global_option("SCF_TYPE", "df")
--> energy('dcft')

    Psi4 stopped on: Wednesday, 11 September 2019 02:49PM
    Psi4 wall time for execution: 0:02:47.43

I have searched in Psi web manual and this forum and also github site, I am so sorry I can not find any information about this.

Can any one have experience about this, Thank so much.

Qinqing.

Hi, I’m the developer who has inherited the DCFT code. Before I actually answer the question, I need to give you a long technical disclaimer.

The Disclaimer

There are two errors in the DF-DCFT code.
(1) When we compute gradients, we’re contracting against the wrong integrals. If you’re just computing energy single points, that isn’t directly important to you.
(2) There are two types of density-fitting integrals. When the original authors of the code decided which type of integral belonged in which term, they made a choice with unexpected consequences: the equations in Psi aren’t exactly correct. I’ve spoken with the authors of the original paper, and we’re agreed that the correct decision is to make a different choice. I’ve run benchmarks, and relative energies are the same for the current version and the future version, to within 0.1 kcal.

I would love to fix both of those errors now, but I can’t. Fixing (2) is straightforward, but Psi needs some new infrastructure to fix (1). I will add that infrastructure, but I can’t start until November. Since nobody seemed to be using DF-DCFT, I thought it would be least confusing to fix (1) and (2) at the same time, so that way we only have old DF-DCFT and new DF-DCFT. If I fixed (2) and then (1) separately, I’d have old DF-DCFT, temporary DF-DCFT, and then new DF-DCFT…

If you’d like, I can fix (2) immediately to eliminate one source of error from your calculations. However, (1) will not be fixed until 2020.

The Answer

Your found a bug in Psi4. I’ll post here when I’ve fixed it. Expect it fixed within 48 hours.

A quick comment on Jonathon’s reply. The errors that he is referring to vanish in the limit of a large auxiliary basis set. In practice, the errors are very small and will not affect your results if you are interested in optimized geometries and relative energies. If you want to be certain that the errors are small, just make sure to use a large auxiliary basis set.

@ssh2 is correct. And now that I’ve double-checked my numbers, I was overly pessimistic. Even with a DZ quality basis set, reaction energies are the same to within 0.001 kcal/mol between the two schemes. It’s a small difference, but one I’d be happy to make now if you think it’s important.

@jmisiewicz Thanks so much for your clarification.I will wait for updation.

Thanks for your patience, as some changes took longer than expected!

This bug is fixed in the developer version of Psi4. Note that in the last version, dcft has been renamed to dct, which is what we’ve been calling the method in newer papers. Your input file should run with the newest version, after replacing dcft with dct.

You can get the latest version of Psi4 here for Linux. Be sure to select the nightly build.

Let us know if your input file works, or if you encounter more problems.