Same input different results

Hi,
I started the same input file doing a geometry optimization twice. One of the two geometry optimizations completed in 28 cycles the other failed after 50 cycles. Is this expected? I could imagine that there is some randomness in the initialization of the hessian matrix, is there a better way?

Below is the input file.
Thanks!
Alberto



optMethod = 'hf'
optBasis  = '6-311g*'
finalMethod = 'mp2'
finalBasis  = 'aug-cc-pv[dt]z'


import time
t1 = time.time()
def saveFile(name, string):
    f=open(name,'w')
    f.write(string)
    f.close()

molecule rec0000004 {
0 1
C    19.421000    44.630001   30.513000
C    20.502001    45.252998   29.702999
C    20.663000    43.862999   30.209999
C    20.482000    42.773998   29.070999
O    19.398001    42.680000   28.385000
N    21.586000    41.832001   28.763000
C    21.386000    40.847000   27.728001
C    21.709999    39.511002   28.292000
C    22.889999    41.744999   29.422001
C    23.785999    40.590000   29.018999
N    23.125000    39.403999   28.490000
C    23.771999    38.130001   28.141001
O    23.066000    37.231998   27.705999
C    25.247999    37.744999   28.232000
C    25.604000    36.754002   29.219000
C    26.160000    38.056000   27.202999
F    25.826000    38.933998   26.233000
C    27.476999    37.537998   27.212999
C    27.827999    36.626999   28.232000
C    26.872999    36.250999   29.233000
C    27.319000    35.233002   30.304001
C    26.165001    34.379002   30.886000
C    25.993999    32.953999   30.659000
C    26.878000    32.198002   29.760000
C    26.622999    30.834999   29.514999
C    25.556999    30.184000   30.177000
C    24.684000    30.896999   31.062000
C    24.934000    32.291000   31.320000
C    24.100000    33.037998   32.240002
O    23.179001    32.527000   32.881001
N    24.285999    34.365002   32.410000
N    25.365000    34.993999   31.766001
H    19.228201    44.982498   31.537001
H    18.470200    44.347698   30.037300
H    20.350000    45.431900   28.628300
H    21.107901    46.066700   30.128099
H    21.385500    43.652599   31.012400
H    20.338499    40.866001   27.392900
H    22.047501    41.062199   26.875900
H    21.194799    39.385601   29.255800
H    21.377701    38.728401   27.594000
H    23.433201    42.677299   29.208401
H    22.710800    41.664700   30.504299
H    24.478100    40.958302   28.247400
H    24.357100    40.284901   29.908300
H    24.874201    36.414001   29.938900
H    28.194201    37.832001   26.460899
H    28.823799    36.209801   28.257999
H    28.055599    34.554100   29.849501
H    27.790400    35.785400   31.130301
H    27.719000    32.685699   29.289700
H    27.242300    30.286501   28.820801
H    25.397400    29.128599   30.012600
H    23.849600    30.395100   31.529200
H    23.663401    34.893398   32.987202
no_com
no_reorient
}

memory 8 Gb
set basis $optBasis
set opt_coordinates cartesian
set optking dynamic_level 1

optE, optWfn = optimize(optMethod, return_wfn=True)
t2 = time.time()

set basis $finalBasis

I also see that the compute time can vary by as much as 25% even when the number of geometry optimization cycles is the same.

I haven’t tried out your input file or anything, but is there an intco.dat file left btwn optimizations? Or are you running both opt simultaneously out of the same dir? Those intco’s can be insidious.

1 Like

The two runs where started indifferent directories and I also created a separate scratch directory for each run and set the PSI_SCRATCH correspondingly.
There were multiple jobs running in the same directory in one case but with different input file name and i see multiple intco files based on the input file name e.g.:

singlePsi4_rec0000001.rec0000001.intco
singlePsi4_rec0000002.rec0000002.intco

Thanks for looking into this!
Alberto

Is there a way to upload the output files?

I think there’s an upload button here on the forum. Otherwise a gist would do.

Thanks,
I uploaded the input and output files (two output files) to:

Thanks for looking at this!
Alberto

Do the two optimizations take an identical first step or distinct ones?

Besides the .intco file, there is the .1 binary file, but I doubt these are a problem if you are running in different directories.

The input geometry of the second step is nearly identical between the two runs. Small changes do appear e.g.:
C 19.6487808609 44.5171687685 29.9029085005
vs. C 19.6487808608 44.5171687685 29.9029085004

Thanks for taking a look!
Alberto

I reran the same input file twice on the same machine and noticed that even then there are slight differences even in the very first step of the SCF procedure.
I ran using “set print 5” and looked for the first place where differences appear and it turns out to be in the “## C (Symmetry 0) ##” matrix following the “## F (Symmetry 0) ##” matrix.

Below is the list of matrices the printed with the “set print 5” option. Op to the one highlighted all values are exactly identical between run one and run two. however after the highlighted one small differences are prevalent.

The differences are small (-0.10116103981167 vs 0.10116103981170) but i do not understand why the calculation is not exactly reproducible on the same machine and the differences could add up. Could there be a variable that is not initialized?

Thanks,
Alberto

  ## One-electron Hamiltonian (Symmetry 0) ##
  ## S (Symmetry 0) ##
  ## X (Symmetry 0) ##
  ## C (Symmetry 0) ##
  ## C (Symmetry 0) ##
  ## SCF density (Symmetry 0) ##
  ## SCF density (Symmetry 0) ##
  ## F (Symmetry 0) ##
  ## F (Symmetry 0) ##
  ## F (Symmetry 0) ##
  ## F (Symmetry 0) ##
  ## C (Symmetry 0) ## <------------------------------- Differences start here 

The value difference is around machine epsilon, and computers are not completely deterministic these days with respect to these tiny differences. This is especially true considering that the diagonalizer is iterative and QM computations are fairly sensitive in nature.