DFT SCF not converging

Trying to optimize a few thousand compounds using the pwpb95-d3bj/aug-cc-pVTZ level of theory but some simple organic compounds do not converge, e.g. 222-trifluoroethanol. Script is below. Can I fix this easily?

molecule mol_222_trifluoroethanol {
        0 1
        C  -0.419000000  0.014400000  0.005700000
        F  -0.618600000  -0.538400000  1.211700000
        C  0.903800000  0.760700000  -0.089100000
        O  2.011300000  -0.082400000  0.112400000
        F  -1.448900000  0.849600000  -0.240200000
        F  -0.478200000  -0.983900000  -0.907600000
        H  0.919500000  1.514600000  0.695800000
        H  0.924900000  1.264000000  -1.059900000
        H  2.067700000  -0.715700000  -0.610400000

        units angstrom
        no_reorient
}

set globals {
        basis aug-cc-pVQZ
}

set_memory(80000000000)
try:
    optimize('pwpb95-d3bj')
except SCFConvergenceError as e:
    unconverged_scf_wfn = e.wfn
    unconverged_scf_wfn.to_file(unconverged_scf_wfn.get_scratch_filename(180))
    set guess read
    optimize('pwpb95-d3bj')

Please add backticks around your input files in future, so that they format properly.

Can you simplify this example at all? For instance, do you encounter problems with the smaller cc-pVDZ basis set? Do you still have a problem if you remove the DFTD3 part of the functional? Do you still have a problem if you try a single point at the geometry where you get the SCFConvergenceError, or does this only seem occur in an optimization? Making the problem simpler usually makes it easier to solve.

Also, I recommend you look over the energy changes and steps in the previous stages of the optimization. Do any of them look suspiciously large?

Thanks for the quick reply and thanks for the tips.

Optimization with the aug-cc-pVTZ also stops with the same error.
Single point calculations work (have done 100 different conformations with either basis set).

A run without just the “pwpb95” also crashes with the same problem.

Which psi4 version are you using?

I remember having similar problems for pw6b95 and pwpb95. The current development branch has a better guess which helped, but not much. I attributed that to issues with the xc kernel, it seems more grid dependent than expected. My problems were that the energy converged well, but not the density.
PSI4 is very strict for DFT on the density convergence compared to most other programs.

A modest increase in grid points should help, and also give you more reliable results. Your are using an expensive double-hybrid, then you want also a good grid to go along with it.
Below is a medium grid (434,85), default is (302,75). If you use the development version, using grid pruning will increase efficiency.

        dft_spherical_points 434
        dft_radial_points 85
        dft_pruning_scheme robust

If you want to be safe, (590,99) is a common choice for an accurate grid.

Also note that double-hybrid gradients are only available numerically.

1 Like

I can get the single points to converge when I increase the grid size, per Holger’s recommendation.

You are almost certainly running into the fact that Psi4 demands tighter convergence when doing a finite difference gradient compared to when you just want a single point.

Thanks again both of you. I am using 1.3.2. I would have to reinstall in that case and redo all single point calculations as well.

Are you saying the Psi4 uses a different SCF convergence criterion for optimizations and single point calculations? Are the energies then still comparable?

1.3.2 allows you to increase the grid size. It just won’t have the dft_pruning_scheme option. I’ve heard that is a very nice option to have, but I haven’t tried it myself.

Yes, Psi4 has different SCF convergence criteria for optimizations and single point calculations. Numerical gradients are sensitive to the precision in your energies, so the default behavior is to demand more precise answers there. The energy difference should be under a microhartree, so the energies should be comparable for all but the most specialized uses. For DFT, check for the “==> Algorithm <==” section in your output to see all the details about convergence options.

If you want to keep the default convergence settings, you can set the convergence thresholds manually. (See the DFT section of the manual for the keyword name.) Psi shouldn’t override you then.

Tried to increase grid size but now I get a SEGV, this is dumped to stdout.

Performing finite difference calculations
43 displacements needed … 1forrtl: severe (174): SIGSEGV, segmentation fault occurred
forrtl: severe (174): SIGSEGV, segmentation fault occurred
*** longjmp causes uninitialized stack frame ***: /home/x_davva/wd/psi4conda/bin/python terminated

and a stack dump.

Oh dear. What happens when you run the computation without the dftd3? Are you absolutely sure the output file says you’re using version 1.3.2? It should give you the version number at the top of the file.

It works without dftd3 and it is indeed 1.3.2.
’ Psi4: An Open-Source Ab Initio Electronic Structure Package
Psi4 1.3.2 release

                     Git: Rev {HEAD} ecbda83 

Against my better judgement I reran the calculation that crashed before. It was not reproducible. So forget about this for now and thanks for the tips!

If you keep running into problems, let us know. In the meantime, I’m going to mark this topic as solved.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.