psi4 icon indicating copy to clipboard operation
psi4 copied to clipboard

Diverging wb97m-v with Ghost Atoms

Open tallakahath opened this issue 1 year ago • 4 comments

Geom looks reasonable, and the calculation performed with the ghost atoms as real atoms goes just fine. Just this portion of the counterpoise-corrected intene goes off the rails.

I've tested in both 1.6.x and 1.7.x; I don't have 1.8.x installed but if someone else does it's a very light weight calc to try.

Input:

freeze_core true
basis def2-tzvppd
guess sad
}
molecule mol {
-1 1
@O -2.9015 2.0339 4.0653
@H -3.02228 2.5785 4.8759
@H -2.16632 1.41862 4.28713
O 0.0 0.0 0.0
C -0.67479 0.41341 -1.01466
O -0.87615 -0.42222 -1.96207
C -1.21823 1.79557 -1.10284
C -0.61745 2.829 -0.07843
H -1.1042 2.21706 -2.12009
H -2.30161 1.7313 -0.88466
H 0.4692 2.99187 -0.17478
H -0.84409 2.57987 0.97189
H -1.13803 3.76616 -0.33793
units angstrom
no_reorient
no_com
symmetry c1
}
energy('wb97m-v')

Output:


    -----------------------------------------------------------------------
          Psi4: An Open-Source Ab Initio Electronic Structure Package
                               Psi4 (inplace)

                         Git: Rev (inplace)


    D. G. A. Smith, L. A. Burns, A. C. Simmonett, R. M. Parrish,
    M. C. Schieber, R. Galvelis, P. Kraus, H. Kruse, R. Di Remigio,
    A. Alenaizan, A. M. James, S. Lehtola, J. P. Misiewicz, M. Scheurer,
    R. A. Shaw, J. B. Schriber, Y. Xie, Z. L. Glick, D. A. Sirianni,
    J. S. O'Brien, J. M. Waldrop, A. Kumar, E. G. Hohenstein,
    B. P. Pritchard, B. R. Brooks, H. F. Schaefer III, A. Yu. Sokolov,
    K. Patkowski, A. E. DePrince III, U. Bozkaya, R. A. King,
    F. A. Evangelista, J. M. Turney, T. D. Crawford, C. D. Sherrill,
    J. Chem. Phys. 152(18) 184108 (2020). https://doi.org/10.1063/5.0006002

                            Additional Code Authors
    E. T. Seidl, C. L. Janssen, E. F. Valeev, M. L. Leininger,
    J. F. Gonthier, R. M. Richard, H. R. McAlexander, M. Saitow, X. Wang,
    P. Verma, M. H. Lechner, A. Jiang, S. Behnle, A. G. Heide,
    M. F. Herbst, and D. L. Poole

             Previous Authors, Complete List of Code Contributors,
                       and Citations for Specific Modules
    https://github.com/psi4/psi4/blob/master/codemeta.json
    https://github.com/psi4/psi4/graphs/contributors
    http://psicode.org/psi4manual/master/introduction.html#citing-psifour

    -----------------------------------------------------------------------


    Psi4 started on: Tuesday, 26 September 2023 11:04AM

    Process ID: 419
    Host:       ...
    PSIDATADIR: ...
    Memory:     500.0 MiB
    Threads:    1
    
  ==> Input File <==

--------------------------------------------------------------------------
set {
freeze_core true
basis def2-tzvppd
guess sad
}
molecule mol {
-1 1
@O -2.9015 2.0339 4.0653
@H -3.02228 2.5785 4.8759
@H -2.16632 1.41862 4.28713
O 0.0 0.0 0.0
C -0.67479 0.41341 -1.01466
O -0.87615 -0.42222 -1.96207
C -1.21823 1.79557 -1.10284
C -0.61745 2.829 -0.07843
H -1.1042 2.21706 -2.12009
H -2.30161 1.7313 -0.88466
H 0.4692 2.99187 -0.17478
H -0.84409 2.57987 0.97189
H -1.13803 3.76616 -0.33793
units angstrom
no_reorient
no_com
symmetry c1
}
energy('wb97m-v')
--------------------------------------------------------------------------

Scratch directory: /tmp/

*** tstart() called on ...
*** at Tue Sep 26 11:04:21 2023

   => Loading Basis Set <=

    Name: DEF2-TZVPPD
    Role: ORBITAL
    Keyword: BASIS
    atoms 1, 4, 6   entry O          line   218 file .../share/psi4/basis/def2-tzvppd.gbs 
    atoms 2-3, 9-13 entry H          line    14 file .../share/psi4/basis/def2-tzvppd.gbs 
    atoms 5, 7-8    entry C          line   144 file .../share/psi4/basis/def2-tzvppd.gbs 


         ---------------------------------------------------------
                                   SCF
               by Justin Turney, Rob Parrish, Andy Simmonett
                          and Daniel G. A. Smith
                              RKS Reference
                        1 Threads,    500 MiB Core
         ---------------------------------------------------------

  ==> Geometry <==

    Molecular point group: c1
    Full point group: C1

    Geometry (in Angstrom), charge = -1, multiplicity = 1:

       Center              X                  Y                   Z               Mass       
    ------------   -----------------  -----------------  -----------------  -----------------
      Gh(O)          -2.901500000000     2.033900000000     4.065300000000    15.994914619570
      Gh(H)          -3.022280000000     2.578500000000     4.875900000000     1.007825032230
      Gh(H)          -2.166320000000     1.418620000000     4.287130000000     1.007825032230
         O            0.000000000000     0.000000000000     0.000000000000    15.994914619570
         C           -0.674790000000     0.413410000000    -1.014660000000    12.000000000000
         O           -0.876150000000    -0.422220000000    -1.962070000000    15.994914619570
         C           -1.218230000000     1.795570000000    -1.102840000000    12.000000000000
         C           -0.617450000000     2.829000000000    -0.078430000000    12.000000000000
         H           -1.104200000000     2.217060000000    -2.120090000000     1.007825032230
         H           -2.301610000000     1.731300000000    -0.884660000000     1.007825032230
         H            0.469200000000     2.991870000000    -0.174780000000     1.007825032230
         H           -0.844090000000     2.579870000000     0.971890000000     1.007825032230
         H           -1.138030000000     3.766160000000    -0.337930000000     1.007825032230

  Running in c1 symmetry.

  Rotational constants: A =      0.06565  B =      0.02593  C =      0.02115 [cm^-1]
  Rotational constants: A =   1968.08966  B =    777.38628  C =    634.17436 [MHz]
  Nuclear repulsion =  166.614552089989843

  Charge       = -1
  Multiplicity = 1
  Electrons    = 40
  Nalpha       = 20
  Nbeta        = 20

  ==> Algorithm <==

  SCF Algorithm Type is DF.
  DIIS enabled.
  MOM disabled.
  Fractional occupation disabled.
  Guess Type is SAD.
  Energy threshold   = 1.00e-06
  Density threshold  = 1.00e-06
  Integral threshold = 1.00e-12

  ==> Primary Basis <==

  Basis Set: DEF2-TZVPPD
    Blend: DEF2-TZVPPD
    Number of shells: 130
    Number of basis functions: 350
    Number of Cartesian functions: 393
    Spherical Harmonics?: true
    Max angular momentum: 3

  ==> DFT Potential <==

   => LibXC <=

    Version 6.0.0
    S. Lehtola, C. Steigemann, M. J.T. Oliveira, and M. A.L. Marques.,  SoftwareX 7, 1\u20135 (2018) (10.1016/j.softx.2017.11.002)

   => Composite Functional: WB97M-V <= 

    wB97M-V Hyb-GGA Exchange-Correlation Functional

    N. Mardirossian and M. Head-Gordon.,  J. Chem. Phys. 144, 214110 (2016) (10.1063/1.4952647)

    Deriv               =              1
    GGA                 =           TRUE
    Meta                =           TRUE

    Exchange Hybrid     =           TRUE
    MP2 Hybrid          =          FALSE

   => Exchange-Correlation Functionals <=

    1.0000   wB97M-V exchange-correlation functional

   => Exact (HF) Exchange <=

    0.8500            HF,LR [omega = 0.3000]
    0.1500               HF 

   => LibXC Density Thresholds  <==

    XC_HYB_MGGA_XC_WB97M_V:  1.00E-13 

   => VV10 Non-Local Parameters <=

    VV10 B              =     6.0000E+00
    VV10 C              =     1.0000E-02

   => Molecular Quadrature <=

    Radial Scheme          =       TREUTLER
    Pruning Scheme         =           NONE
    Nuclear Scheme         =       TREUTLER

    Blocking Scheme        =         OCTREE
    BS radius alpha        =              1
    Pruning alpha          =              1
    Radial Points          =             75
    Spherical Points       =            302
    Total Points           =         281815
    Total Blocks           =           2159
    Max Points             =            256
    Max Functions          =            305
    Weights Tolerance      =       1.00E-15

   => Loading Basis Set <=

    Name: (DEF2-TZVPPD AUX)
    Role: JKFIT
    Keyword: DF_BASIS_SCF
    atoms 1, 4, 6   entry O          line   318 file .../share/psi4/basis/def2-universal-jkfit.gbs 
    atoms 2-3, 9-13 entry H          line    18 file .../share/psi4/basis/def2-universal-jkfit.gbs 
    atoms 5, 7-8    entry C          line   198 file .../share/psi4/basis/def2-universal-jkfit.gbs 

  ==> Integral Setup <==

  ==> DiskDFJK: Density-Fitted J/K Matrices <==

    J tasked:                  Yes
    K tasked:                  Yes
    wK tasked:                 Yes
    Omega:               3.000E-01
    OpenMP threads:              1
    Integrals threads:           1
    Memory [MiB]:              243
    Algorithm:                Disk
    Integral Cache:           NONE
    Schwarz Cutoff:          1E-12
    Fitting Condition:       1E-10

   => Auxiliary Basis Set <=

  Basis Set: (DEF2-TZVPPD AUX)
    Blend: DEF2-UNIVERSAL-JKFIT
    Number of shells: 192
    Number of basis functions: 582
    Number of Cartesian functions: 686
    Spherical Harmonics?: true
    Max angular momentum: 4

  Cached 2.7% of DFT collocation blocks in 0.139 [GiB].

  Minimum eigenvalue in the overlap matrix is 7.9030311415E-06.
  Reciprocal condition number of the overlap matrix is 5.7126628552E-07.
    Using symmetric orthogonalization.

  ==> Pre-Iterations <==

  SCF Guess: Superposition of Atomic Densities via on-the-fly atomic UHF (no occupation information).

   -------------------------
    Irrep   Nso     Nmo    
   -------------------------
     A        350     350 
   -------------------------
    Total     350     350
   -------------------------

  ==> Iterations <==

                           Total Energy        Delta E     RMS |[F,P]|

   @DF-RKS iter SAD:  -266.76788027937141   -2.66768e+02   0.00000e+00 
   @DF-RKS iter   1:  -267.44459096234198   -6.76711e-01   2.70804e-03 DIIS/ADIIS
   @DF-RKS iter   2:  -266.62712078236223    8.17470e-01   4.29888e-03 DIIS/ADIIS
   @DF-RKS iter   3:   222.21931934020711    4.88846e+02   3.68763e-02 DIIS/ADIIS
   @DF-RKS iter   4:  -220.14524491052583   -4.42365e+02   1.39645e-02 DIIS/ADIIS
   @DF-RKS iter   5:   105.97080762091727    3.26116e+02   3.43637e-02 DIIS/ADIIS
   @DF-RKS iter   6:  -197.93937468185686   -3.03910e+02   1.64483e-02 DIIS/ADIIS
   @DF-RKS iter   7:    56.14560413977465    2.54085e+02   3.25972e-02 DIIS/ADIIS
   @DF-RKS iter   8:  -171.65878493154480   -2.27804e+02   1.92639e-02 DIIS/ADIIS
   @DF-RKS iter   9:    53.90807327580846    2.25567e+02   3.33501e-02 DIIS/ADIIS
   @DF-RKS iter  10:  -172.20635649564989   -2.26114e+02   1.94991e-02 DIIS/ADIIS

Traceback (most recent call last):
  File ".../bin/psi4", line 349, in <module>
    exec(content)
  File "<string>", line 42, in <module>
  File ".../lib/psi4/driver/driver.py", line 526, in energy
    wfn = procedures['energy'][lowername](lowername, molecule=molecule, **kwargs)
  File ".../lib/psi4/driver/procrouting/proc.py", line 2571, in run_scf
    scf_wfn = scf_helper(name, post_scf=False, **kwargs)
  File ".../lib/psi4/driver/procrouting/proc.py", line 1870, in scf_helper
    e_scf = scf_wfn.compute_energy()
  File ".../lib/psi4/driver/procrouting/scf_proc/scf_iterator.py", line 85, in scf_compute_energy
    self.iterations()
  File ".../lib/psi4/driver/procrouting/scf_proc/scf_iterator.py", line 419, in scf_iterate
    for engine_used in self.diis(Dnorm):
  File ".../lib/psi4/driver/procrouting/scf_proc/subclass_methods.py", line 114, in _RHF_diis
    return self.diis_manager_.extrapolate(self.Fa(), Dnorm=Dnorm)

tallakahath avatar Sep 26 '23 15:09 tallakahath

It also might be an issue with the functional. In my experience with finite element calculations, the B97 functionals are not very well-behaved numerically. I would not be surprised if this was also a case where the functional is so un-smooth that it produces a Fock matrix that causes the energy to blow up.

You can try adding damping or switching to another functional. You might have better success by preconverging the orbitals with something else like HF or a simpler density functional.

susilehtola avatar Sep 26 '23 18:09 susilehtola

Hello, I'm the developer who implemented ADIIS in Psi4. Thanks for your patience. Between some life changes and issues compiling Psi4, I haven't been able to look at this issue previously.

  1. Following Susi's suggestion, B3LYP converges straightforwardly. The SCF iterations takes one bad step early on, but this happens whether ADIIS is on or off.
  2. If I disable ADIIS completely using your original functional, it still fails. Once the energy gets to around 284 Eh, it doesn't become negative again. Contrary to the topic title, ADIIS is not at fault.
  3. The title suggests that you've had previous ADIIS issues previously. If so, please send me specific examples. My experience has been that ADIIS itself is fine, but can break when other parts of the code are badly behaved.

I'll do some digging to see if I can suggest an alternate protocol that will actually converge.

JonathonMisiewicz avatar Oct 05 '23 13:10 JonathonMisiewicz

Sorry, for (3), I meant how the code specifically tells you to file an ADIIS bug if you get this, and looking through the history there's been a number of (unrelated) bugs that also hit ADIIS issues (and, as you've pointed out, often because something else went haywire).

(2) seems reasonable to me. I'll play with some other settings, seeing if turning off density-fitting or changing the grid prods things. I've run the same calc in Orca which seems to go alright; both use LibXC for wb97M-V, though Orca has its own VV10 impl. I'll see if non-self-consistent VV10 hits the same issue; if not, I'll play with the VV10 grid settings, too.

I do have some other calculations in this dataset with perfectly reasonable geometries which failed due to "ADIIS", which I'd like to sort out. I suspect they may have a common cause in whatever actually caused this failure, and I'll see what I can dig up.

On Thu, Oct 5, 2023 at 9:44 AM Jonathon Misiewicz @.***> wrote:

Hello, I'm the developer who implemented ADIIS in Psi4. Thanks for your patience. Between some life changes and issues compiling Psi4, I haven't been able to look at this issue previously.

  1. Following Susi's suggestion, B3LYP converges straightforwardly. The SCF iterations takes one bad step early on, but this happens whether ADIIS is on or off.
  2. If I disable ADIIS completely using your original functional, it still fails. Once the energy gets to around 284 Eh, it doesn't become negative again. Contrary to the topic title, ADIIS is not at fault.
  3. The title suggests that you've had previous ADIIS issues previously. If so, please send me specific examples. My experience has been that ADIIS itself is fine, but can break when other parts of the code are badly behaved.

I'll do some digging to see if I can suggest an alternate protocol that will actually converge.

— Reply to this email directly, view it on GitHub https://github.com/psi4/psi4/issues/3051#issuecomment-1748931430, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTN7JEC2WPIX354RHZG4ZTX522TPAVCNFSM6AAAAAA5H47C7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBYHEZTCNBTGA . You are receiving this because you authored the thread.Message ID: @.***>

tallakahath avatar Oct 05 '23 13:10 tallakahath

Sounds good! @susilehtola's diagnosis of a badly behaved numerical functional sounds viable to me. He's more knowledgeable about how to treat such situations than I am.

And yes, I'm starting to think I should amend the ADIIS/EDIIS error message to explicitly mention that something else is the usual culprit.

JonathonMisiewicz avatar Oct 05 '23 13:10 JonathonMisiewicz