Use of the previous geometry guess for the scf calculation

Hi all,

For a diatomic molecule (H2), I want to use the orbital guess of the previous geometry for a SCF calculation.
I am doing it the following way

import psi4

bondlen_init = 1.0
bondlen_fin = 2.0
bond_gap = 0.1

bond_info = [None]*3
bond_info[0] = bondlen_init
bond_info[1] = bondlen_fin
bond_info[2] = bond_gap

psi4_option = {
               'basis':        'cc-pvtz',
               'scf_type':     'pk',
               'reference':    'rhf',
               'guess': 'read',
               'SOSCF': True,
               'e_convergence': 1e-8,
              }

mol = psi4.geometry("""
0 1
H
H 1 R
symmetry c1
units bohr
""")
########################################
ref_point = 1.0
psi4out = 'psi4out_ref.out'
psi4.core.set_output_file(psi4out, False)
mol.R = ref_point
mol.update_geometry()
psi4.set_options(psi4_option)

scf_e, ref_wfn = psi4.energy('scf', mol=mol, return_wfn=True)
########################################

npoint = abs(int(round((bond_info[1]-bond_info[0])/bond_info[2])))+1

for i in range(npoint):
    bondlen = bond_info[0]+i*bond_info[2]
    ext = format(bondlen, '.2f')
    print("calculation started for bond length ==> " + ext)
    psi4out = 'psi4out_'+ext+'.out'
    psi4.core.set_output_file(psi4out, False)
    mol.R = bondlen
    mol.update_geometry()
    psi4.set_options(psi4_option)
    scf_e, ref_wfn = psi4.energy('scf', mol=mol, return_wfn=True)

But in the output, I am getting the following warning:

Unable to find file 180, defaulting to SAD guess.

and thus, it uses SAD guess to start SCF calculation.

Am I missing any keyword in the input to do this correctly?

With regards,
Sudip

You’re not missing keywords; the keywords you already have interfere with Psi’s ability to locate the orbitals.

When you use set_output_file, you tell Psi that from now on, all writing should involve that extension. When Psi tries to read your wavefunction, it needs to know where to look. And where does it look to find the last written wavefunction? It looks where it would think to write a wavefunction now - using the new extension, and not the old extension you want. It, of course, does not find the orbitals and uses SAD.

If you want orbital reads, there are only a couple options:

  1. Do not change the output file. (Easy, but may make reading output more annoying.)
  2. Manually move the wavefunction file to use the new extension. (Harder.)
  3. Psi’s file reading/writing changes so you can split the output without changing where scratch files are written to. (Much harder. May not even be plausible.)

Thanks Jonathon. I used the option 1 of your advice and now it’s working as expected!

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