@pcmsolver.inp file not found bug

Hi,

I setup a torsion scan calculation where 36 jobs are executed in parallel. Those jobs sample a torsion at 10 degree increments and are executed in parallel in a HPC environment. This works fine for gas phase calculations. I decided to include solvation and enabled pcm with the following options.

set {
basis 6-31G*
scf_type df
guess sad
ints_tolerance 1.0E-8
maxiter 200
pcm true
pcm_scf_type total
}

pcm = {
Units = Angstrom
Medium {
SolverType = IEFPCM
Solvent = Water
}
Cavity {
RadiiSet = UFF
Type = GePol
Scaling = False
Area = 0.3
Mode = Implicit
}
}

With PCM enabled, each of the 36 parallel jobs creates a pcmsolver.inp and @pcmsolver.inp file. This results in a race condition where multiple instances of the pcmsolver are trying to read and write to the same two files. Jobs are crashing with OSError: [Errno 2] No such file or directory: ‘@pcmsolver.inp error messages (see below for traceback). Is there a way for each PSI4 instance to create its own unique pcmsolver files?

Traceback (most recent call last):
File “/home/centos/miniconda2/share/psi4/python/inputparser.py”, line 709, in process_input
temp = re.sub(pcm, process_pcm_command, temp)
File “/home/centos/miniconda2/lib/python2.7/re.py”, line 155, in sub
return _compile(pattern, flags).sub(repl, string, count)
File “/home/centos/miniconda2/share/psi4/python/inputparser.py”, line 379, in process_pcm_command
pcmsolver.parse_pcm_input(‘pcmsolver.inp’)
File “/home/centos/miniconda2/bin/pcmsolver.py”, line 138, in parse_pcm_input
os.remove(parsedFile)
OSError: [Errno 2] No such file or directory: ‘@pcmsolver.inp

Thanks,

JW

Can you send your psi4 version (psi4 --version or an output file header)? pcmsolver.inp has been reworked in pre-1.1, but I don’t swear that what you describe wouldn’t still happen. @robertodr

Version number is: 1.0.54

Ok, that’s 1.0-era, so no use making improvements to code that’s been reworked. Are you ok with Linux+Py3.5 (you don’t have to supply the Py3.5, it comes with the conda package)? Create a new conda environment with the command below. That should give you Psi4 1.1a2.dev260 that has the reworked pcmsolver. See if it still has the parallelism problem.

conda create -n p4env python=3.5 psi4 numpy dftd3 -c psi4/label/test -c psi4

I ran the following input with the latest master and it seems to be working:

molecule HOOH {
symmetry c1
    H
    O 1 0.90
    O 2 1.40 1 100.0
    H 3 0.90 2 100.0 1 D
}

set {
    basis STO-3G
    scf_type df
    guess sad
    pcm true
}

pcm = {
   Units = Angstrom
   Medium {
   SolverType = IEFPCM
   Solvent = Water
   }

   Cavity {
   RadiiSet = UFF
   Type = GePol
   Scaling = False
   Area = 0.3
   Mode = Implicit
   }
}

Dvals = [115.0, 120.0, 125.0]
energies = {}

for D in Dvals:
    HOOH.D = D
    energies[D] = energy('b3lyp') # single point energy

psi4.print_out("\n")
psi4.print_out("DFT-B3LYP/STO-3G energies\n\n")
psi4.print_out("        D [deg]         E [kcal/mol]                 \n")
psi4.print_out("-----------------------------------------------------\n")
for D in Dvals:
   e = energies[D] * psi_hartree2kcalmol
   psi4.print_out("        %3.1f            %10.6f\n" % (D, e))

Notice that it is not possible to include PCM in geometry optimizations, in case you are interested in a relaxed scan.

I am still seeing the same error. Here is the stacktrace. To reproduce the error, I think you have to start multiple jobs (>20) and execute them in parallel.

Traceback (most recent call last):
File “/home/centos/miniconda2/envs/p4env/bin/psi4”, line 204, in
content = psi4.process_input(content)
File “/home/centos/miniconda2/envs/p4env/lib//python3.5/site-packages/psi4/driver/inputparser.py”, line 724, in process_input
temp = re.sub(pcm, process_pcm_command, temp)
File “/home/centos/miniconda2/envs/p4env/lib/python3.5/re.py”, line 182, in sub
return _compile(pattern, flags).sub(repl, string, count)
File “/home/centos/miniconda2/envs/p4env/lib//python3.5/site-packages/psi4/driver/inputparser.py”, line 394, in process_pcm_command
pcmsolver.parse_pcm_input(‘pcmsolver.inp’)
File “/home/centos/miniconda2/envs/p4env/lib/python3.5/site-packages/pcmsolver/pcmsolver.py”, line 186, in parse_pcm_input
os.remove(parsedFile)
FileNotFoundError: [Errno 2] No such file or directory: ‘@pcmsolver.inp

Can you elaborate this statement “Notice that it is not possible to include PCM in geometry optimizations, in case you are interested in a relaxed scan.”

Does that mean PCM options are ignored in geometry optimization? So “optimize(‘b3lyp’)” will optimize in gas phase? Does PCM work only for energy calculations using the energy() function?

Thanks,

JW

  • PCM can be used for energies and first-order properties (i.e. expectation values, like multipole moments) for all SCF models. That is Hartree-Fock and density-functional theory.
  • Starting from a PCM-SCF solution, you could be able to run a correlated energy calculation in the so-called PTE approximation, where the “solvated” orbitals in the correlated treatment. This is currently untested
  • There are additional terms in the analytic molecular gradient from PCM that have not been implemented yet. You can of course run optimizations using the finite difference molecular gradient. I am not familiar with the internal set up of optimizations in Psi4, it might be that requesting PCM routes the optimizer to use the numerical molecular gradient already. @loriab is this the case?

@jwfeng The problem you reported should not appear with the current master.