Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reading grad.npy (psi4) #182

Open
sunghwan-choi opened this issue Feb 14, 2022 · 12 comments
Open

reading grad.npy (psi4) #182

sunghwan-choi opened this issue Feb 14, 2022 · 12 comments

Comments

@sunghwan-choi
Copy link

sunghwan-choi commented Feb 14, 2022

Dear developers
I am a newbie. I want to calculate IRC with psi4.
Based on the example, I wrote a simple YAML input as

irc:
 type: eulerpc              # Similar to EulerPC from Gaussian
 rms_grad_thresh: 1e-3      # Convergence threshold for rms(grad)
 max_cycles: 50             # Do at most this many IRC cycles
 hessian_recalc: 10          # Recalc exact hessian every n-th cycle
 #displ: energy              # Initial displacement from the TS. 'energy' is default.
                             # Another option is 'length'
 #displ_energy: 5e-4         # Energy lowering from TS in a.u.
 #displ_length: 0.1          # Displacement along the transition vector from the TS
 #forward: True
 #backward: True
 #downhill: False            # Used when starting an IRC from a non-stationary point
                             # with non-vanishing gradient
endopt:
 #fragments: False           # Optimize potential fragments separately
 trust_max: 0.1
 thresh: gau_tight
calc:
 type: psi4
 method:  WB97X-D3
 pal: 64
 charge: 0
 mult: 1
 basis: def2-TZVP
geom:
 type: cart
 fn: xyz/10.xyz
assert:
 irc.forward_is_converged: True
 irc.backward_is_converged: True

If I ran pysisyphus with psi4, the following error occurred.

File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/numpy/lib/npyio.py", line 416, in load
    fid = stack.enter_context(open(os_fspath(file), "rb"))
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/irc_000_000_vxurdou3/grad.npy'

In crashed_irc_000 folder, there is no grad.npy file.
but I think the generated input is fine because if I explicitly run psi4, then I can get grad.npy properly.

$cd crashed_irc_000/
$psi4 psi4.inp
PARSE ENERGY: -306.2800424989704
$ ls
grad.npy  psi.133970.clean  psi4.inp  psi4.inp.dat  psi4.out  timer.dat

Why did this error happen?
My environment files are written as

$ cat  ~/.pysisyphusrc
[psi4]
cmd=/home01/paop03/runpsi4.sh

$ cat ~/runpsi4.sh
#!/bin/bash
source activate /scratch/paop03/conda_env/psi4
psi4 -o stdout $1
@eljost
Copy link
Owner

eljost commented Feb 14, 2022

Dear sunghwan-choi,

the formatting you chose makes this issue quite hard to read ;) To me it appears as if your Psi4 is working, isn't it? It seems the calculation actually runs, as you get an energy value?!

If you use Psi4 via the runpsi.sh script please check if you can run the input pysisyphus generates by directly passing the input file to the script. This way you could exclude the possibility that something is wrong with your Psi4 setup.

Please try to run the following yaml input (which works on my machine ... ;)):

geom:
 type: cart
 fn: lib:hcn_iso_hf_sto3g_ts_opt.xyz
calc:
 type: psi4
 method: WB97X-D3
 pal: 2
 charge: 0
 mult: 1
 basis: def2-TZVP
irc:
 type: eulerpc
 rms_grad_thresh: 1e-3
 hessian_recalc: 10
endopt:
 thresh: gau_tight

All the best,
Johannes

@sunghwan-choi
Copy link
Author

sunghwan-choi commented Feb 14, 2022

Thank you for your super fast response and I am sorry for the weird formatting. I edited my original issue.

I found a clue...
If I run pysis on my login node, your new input properly works but on a computing node, it gives the same error.
[Errno 2] No such file or directory: '/var/tmp/pbs.9787327.pbs/irc_000_000_8oy391e4/grad.npy'
It could happen if writing grad.npy is not synchronized to the reading. (because file I/O speeds of login and computing nodes are slightly different) Is it a possible scenario?

p.s. Could you share your output? because the IRC convergence from your input is not well achieved even though I run pysis on my login node

@eljost
Copy link
Owner

eljost commented Feb 14, 2022

Please see the attached logfile. I ran it with a development version of pysisyphus that I'll release soon. But there shouldn't be any major changes that would affect IRC convergence ...

                           d8b                            888
                           Y8P                            888
                                                          888
88888b.  888  888 .d8888b  888 .d8888b  888  888 88888b.  88888b.  888  888 .d8888b
888 "88b 888  888 88K      888 88K      888  888 888 "88b 888 "88b 888  888 88K
888  888 888  888 "Y8888b. 888 "Y8888b. 888  888 888  888 888  888 888  888 "Y8888b.
888 d88P Y88b 888      X88 888      X88 Y88b 888 888 d88P 888  888 Y88b 888      X88
88888P"   "Y88888  88888P' 888  88888P'  "Y88888 88888P"  888  888  "Y88888  88888P'
888           888                            888 888
888      Y8b d88P                       Y8b d88P 888
888       "Y88P"                         "Y88P"  888                            

Version 0.7.5.dev144+g3f3aa59d (Python 3.9.9, NumPy 1.22.1, SciPy 1.7.3)
Executed at Mon Feb 14 09:17:35 2022 on 'dachshoehle'
Platform: Linux-5.10.89-1-MANJARO-x86_64-with-glibc2.33
Interpreter: /home/johannes/.pyenv/versions/pysis/bin/python
Current working directory: /home/johannes/tmp/244_psi4irc

If pysisyphus benefitted your research please cite:

	https://doi.org/10.1002/qua.26390

Good luck!

{'calc': {'basis': 'def2-TZVP',
          'charge': 0,
          'method': 'WB97X-D3',
          'mult': 1,
          'pal': 2,
          'type': 'psi4'},
 'endopt': {'T': 298.15,
            'do_hess': False,
            'dump': True,
            'fragments': False,
            'geom': {'coord_kwargs': {}, 'type': 'redund'},
            'max_cycles': 150,
            'overachieve_factor': 5,
            'p': 101325,
            'thresh': 'gau_tight',
            'type': 'rfo'},
 'geom': {'coord_kwargs': {},
          'fn': 'lib:hcn_iso_hf_sto3g_ts_opt.xyz',
          'type': 'cart'},
 'irc': {'hessian_recalc': 10, 'rms_grad_thresh': '1e-3', 'type': 'eulerpc'}}

Read 1 geometries.
                                ###############
                                # RUNNING IRC #
                                ###############

Calculating energy and gradient at TS.
Transition vector is mode 0 with wavenumber -1096.44 cm⁻¹.
Energy-based (ΔE=0.001 au) initial displacement from the TS using 2rd derivatives.
Initial step lengths (not mass-weighted):
	 Forward: 0.1942 au
	Backward: 0.1942 au
IRC length in mw. coords, max(|grad|) and rms(grad) in unweighted coordinates.

                               #################
                               # IRC - FORWARD #
                               #################

Requested energy lowering:  0.0010 au ( 2.63 kJ mol⁻¹)
   Actual energy lowering:  0.0007 au ( 1.97 kJ mol⁻¹)
                        Δ:  0.0003 au ( 0.66 kJ mol⁻¹)


        Step   IRC length      dE / au  max(|grad|)    rms(grad)
        --------------------------------------------------------
           0     0.194126    -0.004556     0.024928     0.012939
           1     0.291866    -0.001974     0.019902     0.011187
           2     0.384751    -0.002278     0.023885     0.013112
           3     0.482529    -0.002683     0.027980     0.015120
           4     0.584002    -0.003029     0.031767     0.016852
           5     0.688261    -0.003320     0.035122     0.018282
           6     0.793885    -0.003537     0.037983     0.019400
           7     0.900298    -0.003692     0.040323     0.020219
           8     1.007119    -0.003790     0.042156     0.020758
           9     1.114089    -0.003828     0.043505     0.021032
          10     1.221351    -0.003828     0.044343     0.021078
          11     1.329898    -0.003839     0.044771     0.020934
          12     1.437631    -0.003751     0.044730     0.020597
          13     1.545368    -0.003662     0.044241     0.020084
          14     1.652979    -0.003545     0.043336     0.019411
          15     1.760450    -0.003400     0.042059     0.018586
          16     1.866704    -0.003193     0.040409     0.017630
          17     1.973002    -0.003014     0.038335     0.016545
          18     2.078814    -0.002811     0.035886     0.015344
          19     2.183507    -0.002576     0.033121     0.014036
          20     2.287005    -0.002330     0.030015     0.012629
          21     2.389526    -0.002074     0.026675     0.011143
          22     2.490467    -0.001797     0.023099     0.009580
          23     2.589843    -0.001508     0.019304     0.007954
          24     2.687856    -0.001221     0.015267     0.006268
          25     2.785241    -0.000937     0.011013     0.004513
          26     2.880813    -0.000627     0.006646     0.002718
          27     2.976726    -0.000316     0.002089     0.000900
        rms(grad) converged!

                               ##################
                               # IRC - BACKWARD #
                               ##################

Requested energy lowering:  0.0010 au ( 2.63 kJ mol⁻¹)
   Actual energy lowering:  0.0012 au ( 3.19 kJ mol⁻¹)
                        Δ: -0.0002 au (-0.57 kJ mol⁻¹)


        Step   IRC length      dE / au  max(|grad|)    rms(grad)
        --------------------------------------------------------
           0     0.162984    -0.004157     0.037137     0.015421
           1     0.266768    -0.001959     0.018877     0.009731
           2     0.358038    -0.001858     0.016394     0.009795
           3     0.452411    -0.001932     0.016508     0.009953
           4     0.550510    -0.001926     0.016491     0.009689
           5     0.650759    -0.001854     0.016061     0.009246
           6     0.752882    -0.001785     0.015540     0.008878
           7     0.855737    -0.001726     0.015221     0.008727
           8     0.959764    -0.001724     0.015176     0.008809
           9     1.064819    -0.001755     0.015308     0.009030
          10     1.170707    -0.001799     0.015507     0.009329
          11     1.277586    -0.001853     0.015670     0.009645
          12     1.384742    -0.001895     0.016004     0.009936
          13     1.492333    -0.001935     0.016313     0.010163
          14     1.600885    -0.001964     0.016699     0.010315
          15     1.709318    -0.001966     0.017187     0.010401
          16     1.818372    -0.001970     0.017501     0.010400
          17     1.926789    -0.001939     0.017606     0.010319
          18     2.035126    -0.001906     0.017538     0.010149
          19     2.142717    -0.001839     0.017278     0.009898
          20     2.249516    -0.001767     0.016673     0.009595
          21     2.355238    -0.001689     0.015993     0.009224
          22     2.460078    -0.001604     0.015193     0.008781
          23     2.564932    -0.001527     0.014254     0.008279
          24     2.668006    -0.001417     0.013245     0.007726
          25     2.770515    -0.001311     0.012139     0.007129
          26     2.871668    -0.001195     0.011004     0.006506
          27     2.971267    -0.001081     0.010070     0.005855
          28     3.070456    -0.000975     0.009014     0.005172
          29     3.166768    -0.000843     0.007846     0.004481
          30     3.260426    -0.000714     0.007051     0.003774
          31     3.352153    -0.000589     0.005873     0.003065
          32     3.442341    -0.000465     0.004586     0.002352
          33     3.530369    -0.000345     0.003180     0.001639
          34     3.618020    -0.000225     0.001666     0.000932
        rms(grad) converged!
                       #################################
                       # OPTIMIZING REACTION PATH ENDS #
                       #################################


                      +----------------------------------+
                      | RUNNING FORWARD_END OPTIMIZATION |
                      +----------------------------------+

   Input geometry: Geometry(C1_H1_N1, 3 atoms)
Coordinate system: redund
        Optimizer: rfo


Spent 0.0 s preparing the first cycle.
If not specified otherwise, all quantities are given in au.

       cycle    Δ(energy) max(|force|)   rms(force)  max(|step|)    rms(step)      s/cycle
           0          nan     0.002183     0.001119     0.021818     0.010913         3.48
           1    -0.000031     0.000670     0.000335     0.009658     0.004829         3.54
           2    -0.000003     0.000013     0.000006     0.000126     0.000063         3.45
       Unexpected energy increase (0.000000 au)! Trust radius: old=0.5, new=0.125
           3     0.000000     0.000013     0.000007    86.975798    43.504488         3.56
Crashed input:

molecule mol{
  C -0.86201350 0.56246683 -32.01279748
H 0.46699835 1.67201219 16.55278598
N 0.46146579 -0.55880611 15.46001150
  0 1
symmetry c1
}

set_num_threads(2)
memory 1000 MB

set basis def2-TZVP



G, wfn = gradient('WB97X-D3', return_wfn=True)
G_arr = np.array(G)
np.save('grad', G_arr)
Wavefunction.to_file(wfn, '/home/johannes/tmp/244_psi4irc/qm_calcs/forward_end_001.004.wfn.npy')
print('PARSE ENERGY:', wfn.energy())



Copied contents of
	'/tmp/forward_end_001_004_mg4imamf'
to
	'/home/johannes/tmp/244_psi4irc/crashed_forward_end_001'.
Consider checking the log files there.

Optimization crashed!
                     +-----------------------------------+
                     | RUNNING BACKWARD_END OPTIMIZATION |
                     +-----------------------------------+

   Input geometry: Geometry(C1_H1_N1, 3 atoms)
Coordinate system: redund
        Optimizer: rfo


Spent 0.0 s preparing the first cycle.
If not specified otherwise, all quantities are given in au.

       cycle    Δ(energy) max(|force|)   rms(force)  max(|step|)    rms(step)      s/cycle
           0          nan     0.002253     0.001319     0.005411     0.003142         3.46
           1    -0.000011     0.002115     0.001221     0.078576     0.045375         3.49
           2    -0.000087     0.000791     0.000557     0.004561     0.002731         3.40
           3    -0.000001     0.000144     0.000083     0.005308     0.003065         3.47
       Unexpected energy increase (0.000001 au)! Trust radius: old=0.5, new=0.125
           4     0.000001     0.000158     0.000118     0.002397     0.001387         3.50
           5    -0.000000     0.000082     0.000065     0.002393     0.001384         3.47
           6    -0.000001     0.000017     0.000014     0.000680     0.000393         3.47
       Unexpected energy increase (0.000000 au)! Trust radius: old=0.125, new=0.1
           7     0.000000     0.000001     0.000000     0.000025     0.000014         3.42
       Converged!

Final summary:
            	max(forces, internal): 0.000001 hartree/(bohr,rad)
            	rms(forces, internal): 0.000000 hartree/(bohr,rad)
        	max(forces,cartesian): 0.000017 hartree/bohr
        	rms(forces,cartesian): 0.000009 hartree/bohr
        	energy: -93.40854690 hartree
       Wrote final, hopefully optimized, geometry to 'backward_end_final_geometry.xyz'

Moved 'backward_end_final_geometry.xyz' to 'backward_end_opt.xyz'.


                 #############################################
                 # BARRIER HEIGHTS AFTER END OPTIMIZATION(S) #
                 #############################################

There appears to be a problem with the internal coordinates in the first end-optimization (FORWARD_END OPTIMIZATION).
But to me, the IRC looks fine.

Figure_3

The energy profile looks reasonably smooth; the artifacts in the beginning stem from the fact, that the input geometry is not a proper TS at the given level of theory (wb97x-d3/def2-tzvp) but at HF/STO-3G. Disregarding the first points, the gradient-evolution along the IRC also looks good to me.

What error do you get?

@sunghwan-choi
Copy link
Author

sunghwan-choi commented Feb 15, 2022

  1. Your input does not yield consistent outputs.
    In most case, it gave an error like the following. but pysisyphus sometimes gives the output like the attached log file(log.txt
    ).
                           Y8P                            888
                                                          888
88888b.  888  888 .d8888b  888 .d8888b  888  888 88888b.  88888b.  888  888 .d8888b
888 "88b 888  888 88K      888 88K      888  888 888 "88b 888 "88b 888  888 88K
888  888 888  888 "Y8888b. 888 "Y8888b. 888  888 888  888 888  888 888  888 "Y8888b.
888 d88P Y88b 888      X88 888      X88 Y88b 888 888 d88P 888  888 Y88b 888      X88
88888P"   "Y88888  88888P' 888  88888P'  "Y88888 88888P"  888  888  "Y88888  88888P'
888           888                            888 888
888      Y8b d88P                       Y8b d88P 888
888       "Y88P"                         "Y88P"  888

Version 0.7.4+7.gd97190c (Python 3.9.7, NumPy 1.19.2, SciPy 1.6.2)
Git commit d97190cf8dc3d81ad48b169a36fc402052ac5b51
Executed at Tue Feb 15 09:39:19 2022 on 'node5816'
Platform: Linux-3.10.0-1062.el7.x86_64-x86_64-with-glibc2.17
Interpreter: /scratch/paop03/conda_env/psi4/bin/python

If pysisyphus benefitted your research please cite:

        https://doi.org/10.1002/qua.26390

Good luck!

{'calc': {'basis': 'def2-TZVP',
          'charge': 0,
          'method': 'WB97X-D3',
          'mult': 1,
          'pal': 2,
          'type': 'psi4'},
 'endopt': {'T': 298.15,
            'do_hess': False,
            'dump': True,
            'fragments': False,
            'geom': {'coord_kwargs': {}, 'type': 'redund'},
            'max_cycles': 100,
            'overachieve_factor': 3,
            'thresh': 'gau_tight',
            'type': 'rfo'},
 'geom': {'coord_kwargs': {},
          'fn': 'lib:hcn_iso_hf_sto3g_ts_opt.xyz',
          'type': 'cart'},
 'irc': {'hessian_recalc': 10, 'rms_grad_thresh': '1e-3', 'type': 'eulerpc'}}

Read 1 geometries.
                                ###############
                                # RUNNING IRC #
                                ###############

Calculating energy and gradient at TS.
Crashed input:

molecule mol{
  C 0.23801823 0.64326093 0.00000000
H -0.96303310 0.59539903 0.00000000
N -0.07708005 -0.53675142 0.00000000
  0 1
symmetry c1
}

set_num_threads(2)
memory 2000 MB

set basis def2-TZVP



G, wfn = gradient('WB97X-D3', return_wfn=True)
G_arr = np.array(G)
np.save('grad', G_arr)
Wavefunction.to_file(wfn, '/scratch/paop03/qchem/irc/test1/irc_000.000.wfn.npy')
print('PARSE ENERGY:', wfn.energy())



Copied contents of
        '/var/tmp/pbs.9789123.pbs/irc_000_000_6zusqbk_'
to
        '/scratch/paop03/qchem/irc/test1/crashed_irc_000'.
Consider checking the log files there.

Traceback (most recent call last):
  File "/scratch/paop03/conda_env/psi4/bin/pysis", line 33, in <module>
    sys.exit(load_entry_point('pysisyphus==0.7.4+7.gd97190c', 'console_scripts', 'pysis')())
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/run.py", line 1919, in run
    run_result = run_from_dict(run_dict, **run_kwargs)
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/run.py", line 1875, in run_from_dict
    run_result = main(run_dict, restart, cwd, scheduler)
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/run.py", line 1504, in main
    irc = run_irc(geom, irc_key, irc_kwargs, calc_getter)
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/run.py", line 770, in run_irc
    irc.run()
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/irc/IRC.py", line 565, in run
    self.ts_gradient = self.gradient.copy()
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/irc/IRC.py", line 187, in gradient
    return self.geometry.gradient
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/Geometry.py", line 877, in gradient
    return -self.forces
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/Geometry.py", line 843, in forces
    forces = self.cart_forces
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/Geometry.py", line 823, in cart_forces
    results = self.calculator.get_forces(self.atoms, self._coords)
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/calculators/Psi4.py", line 157, in get_forces
    results = self.run(inp, calc="grad")
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/calculators/Calculator.py", line 470, in run
    raise err
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/calculators/Calculator.py", line 455, in run
    results = self.parser_funcs[calc](path, **parser_kwargs)
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/pysisyphus-0.7.4+7.gd97190c-py3.9.egg/pysisyphus/calculators/Psi4.py", line 184, in parse_grad
    gradient = np.load(path / "grad.npy")
  File "/scratch/paop03/conda_env/psi4/lib/python3.9/site-packages/numpy/lib/npyio.py", line 416, in load
    fid = stack.enter_context(open(os_fspath(file), "rb"))
FileNotFoundError: [Errno 2] No such file or directory: '/var/tmp/pbs.9789123.pbs/irc_000_000_6zusqbk_/grad.npy'

I think the convergence issue (shown in the attached log) comes from the same problem. (npy files are not properly generated) IRC calculation needs to update gradient and hessian but pysis read the previous one.

I think this is not the problem of psi4 because the explicit running of psi4 always generates npy files properly.

  1. On the other machine, your input provides the same log as the posted one even though psi4 and pysisyphus are both installed in the same manner as the original machine.

Anyhow, the problem is solved. but question remained; why pysisyphus cannot read npy file properly on a certain machine even though explicit psi4 running yields npy file properly. Also, I will report this situation to my system administrator. If I got some meaningful answers, I will post them.

@eljost
Copy link
Owner

eljost commented Feb 15, 2022

Does the following python script work?

from pysisyphus.calculators import Psi4
from pysisyphus.helpers import geom_loader

geom = geom_loader("lib:hcn_iso_hf_sto3g_ts_opt.xyz")
calc = Psi4(
    method="wb97x-d3",
    basis="def2-tzvp",
    pal=2,
    charge=0,
    mult=1
)
geom.set_calculator(calc)
energy = geom.energy
print("energy", energy)
forces = geom.forces
print("forces", forces)
hessian = geom.hessian
print("hessian", hessian)

Personally I experience no issues in parsing the grad.npy files ...

I'll try to look at the diverging endopt-Optimization. The generated internal coordinates are probably the issue.

@sunghwan-choi
Copy link
Author

sunghwan-choi commented Mar 8, 2022

Sorry for being late. Your script perfectly run and the output is following

energy -93.35173993414833
forces [-2.36056706e-02 -7.29682558e-02  1.32666659e-15  8.21992782e-03
 -5.02047741e-03  7.46162319e-16  1.53720694e-02  7.79701449e-02
  9.28242708e-16]
hessian [[ 1.74164820e-01  1.23587498e-01 -1.14945657e-07 -1.73265219e-01
   7.68672643e-02  1.65582876e-08 -8.99600774e-04 -2.00454762e-01
   9.83873694e-08]
 [ 1.23587498e-01  7.42048854e-01 -2.32775069e-07  3.84874773e-02
   3.59062423e-02  2.85269122e-08 -1.62074975e-01 -7.77955096e-01
   2.04248157e-07]
 [-1.14945657e-07 -2.32775069e-07  3.44783355e-02  1.00160608e-07
  -1.27991498e-08 -1.83396845e-03  1.47850486e-08  2.45574219e-07
  -3.26443670e-02]
 [-1.73265219e-01  3.84874773e-02  1.00160608e-07  2.26399678e-01
  -4.18266467e-02 -1.34124336e-08 -5.31344595e-02  3.33916932e-03
  -8.67481748e-08]
 [ 7.68672643e-02  3.59062423e-02 -1.27991498e-08 -4.18266467e-02
  -3.11860409e-02 -2.76314900e-09 -3.50406177e-02 -4.72020132e-03
   1.55622988e-08]
 [ 1.65582876e-08  2.85269122e-08 -1.83396845e-03 -1.34124336e-08
  -2.76314900e-09  4.25831563e-03 -3.14585402e-09 -2.57637632e-08
  -2.42434717e-03]
 [-8.99600774e-04 -1.62074975e-01  1.47850486e-08 -5.31344595e-02
  -3.50406177e-02 -3.14585402e-09  5.40340603e-02  1.97115593e-01
  -1.16391946e-08]
 [-2.00454762e-01 -7.77955096e-01  2.45574219e-07  3.33916932e-03
  -4.72020132e-03 -2.57637632e-08  1.97115593e-01  7.82675297e-01
  -2.19810455e-07]
 [ 9.83873694e-08  2.04248157e-07 -3.26443670e-02 -8.67481748e-08
   1.55622988e-08 -2.42434717e-03 -1.16391946e-08 -2.19810455e-07
   3.50687142e-02]]

Are there any ways to set a scratch directory of calculations instead of the default /tmp/ directory?

@eljost
Copy link
Owner

eljost commented Mar 8, 2022

Good to know that it worked for you 😄

Are there any ways to set a scratch directory of calculations instead of the default /tmp/ directory?

Yes! pysisyphus uses a function from the python stlib (tempfile.mkdtemp) and you can control the location, where the temporary directory is created by setting an environment variable.

The default directory is chosen from a platform-dependent list, but the user of the application can control the directory location by setting the TMPDIR, TEMP or TMP environment variables.

Personally, I use export TMPDIR=[path to my directory that will contain the scratch-directories] in my submit-script and it works fine.

All the best,
Johannes

@sunghwan-choi
Copy link
Author

sunghwan-choi commented Mar 8, 2022

Thank you for your superfast answer.
I tested TMPDIR='/scratch/paop03/' pysis pysisyphus.yaml but it failed too.
The error message is FileNotFoundError: [Errno 2] No such file or directory: '/scratch/paop03/irc_000_000_r_j5xcw7/grad.npy' I think my environmental variable works fine but I still wonder why this error happen....

@eljost
Copy link
Owner

eljost commented Mar 8, 2022

But the scratch directory is created in the specified directory, isn't it?

@sunghwan-choi
Copy link
Author

scratch directory(in my case, irc_000_000_r_j5xcw7) was properly created.
BUT grad.npy was not created in there.
I thought this fail (reading grad.npy) is related to some file quota or I/O speed but it was not.... because even though I changed the tmperary directory to scratch, nothing changed.

@eljost
Copy link
Owner

eljost commented Mar 8, 2022

And does the simple script run with a modified TEMPDIR? When you run pysisyphus on a node and a force a certain TEMPDIR, can the node access this directory?

Given the fact that pysisyphus appears to work when started on your login node, but doesn't work when executed from another node make this seem to be a problem on your side/your HPC cluster configuration...

As I don't have access to your cluster I can't really reproduce this issue and right now I also ran out of ides of what to try ...

Do you have experience with debugging python scripts with pdb? 😃 This would my last resort ... to drop into the debugger and follow to the simple script above step by step, to see where things go wrong.

@holazzer
Copy link

Hi, I have this issue before, but later I found it was due to insufficient memory allocated for psi4 to run. psi4 would directly exit and pysis would falsely assume that psi4 was done calculating, and try to read the grad. I was able to change the memory in file.
Is it possible that it is psi4 exiting without finishing calculation (for some reason) that causes this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants