PCMSolver / pcmsolver

An API for the Polarizable Continuum Model
http://pcmsolver.readthedocs.io/
GNU Lesser General Public License v3.0
33 stars 21 forks source link

Psi4 and PCMSolver: cavity file looks wrong with Psi4 1.9.1 #207

Open proteins247 opened 6 months ago

proteins247 commented 6 months ago

This may be related to https://github.com/PCMSolver/pcmsolver/issues/206, but it also might not be. If it's related, hopefully this can provide some clues to solving that issue.

I noticed that with a test molecule, when I visualize the cavity.off file (as well as the cavity.npz file), the cavity looks wrong. This occurs when I use Psi4 version 1.9.1, which I presume uses a later version of PCMSolver.

Here's what I see when I open the cavity.off file with GeomView: image

I installed an older version of Psi4, version 1.7, which uses an older version of PCMSolver. The cavity.off file looks correct when visualized: image

GeomView is only rendering what the .off files contain. It's apparent that the .off file generated from version 1.9.1 is strange. For example, here is the first face, spanning several angstroms.

0.00000000000000    5.38493480770725    -0.24495631562047    1.0000    1.0000    1.0000    0.7500   # Tess 1
7.48623343416459    6.51468476188352    -0.22384001935377    1.0000    1.0000    1.0000    0.7500   # Tess 1
6.65809546936335    0.02562006853899    3.07844533351791    1.0000    1.0000    1.0000    0.7500   # Tess 1

The input to Psi4 that I used to calculate this was as follows:

memory 15 GB

set_num_threads(16)

molecule {
0 1
N  -1.5465417693  -1.2796398575   0.0107903739
C  -0.8413899636  -2.3906314381  -0.0120482313
N   0.5052752739  -2.5213778186  -0.0345451095
C   1.2094891640  -1.4085182175  -0.0332303580
N   0.5765247879  -0.2053080169  -0.0109009439
C  -0.8176536479  -0.1485416994   0.0112079948
C  -1.1272753970   1.2054086149   0.0297830830
C   0.1198679222   1.8638606215   0.0171572095
N   1.1608971994   1.0102822254  -0.0076621882
C   0.3861857826   3.3247286526   0.0283747103
C  -2.4998302207   1.7721058115   0.0565833777
N   2.5464535183  -1.3943103040  -0.0510913442
H  -1.3929333841  -3.3217921764  -0.0132603618
H  -0.5365584640   3.8957889465   0.0444441706
H   0.9729286912   3.6055639415   0.9014309682
H   0.9531467069   3.6226355491  -0.8520120554
H  -2.4837924379   2.8584384720   0.0694927000
H  -3.0756048325   1.4590404534  -0.8135420402
H  -3.0501019187   1.4378645900   0.9352621355
H   3.0306629236  -0.5155845127  -0.0588247822
H   3.0415632768  -2.2638329572  -0.0779693955

}

set {
    basis def2-SVP
    scf_type df
    pcm true
}

pcm = {
    Units = Angstrom
    Medium {
    SolverType = CPCM
    correction = 0.5
    Solvent = Water
    }

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

set print 3
energy('BP86')

4-26 edited to add: changing units to Angstrom means area 0.3 is in angstroms^2. See followup comment.

When I look at the output of psi4 for both versions, the reported energetics are still the same

   => Energetics <=

    Nuclear Repulsion Energy =            696.3357089573493113
    One-Electron Energy =               -2119.6263820573644807
    Two-Electron Energy =                 953.7017744256992273
    DFT Exchange-Correlation Energy =     -75.9570151273202185
    Empirical Dispersion Energy =           0.0000000000000000
    VV10 Nonlocal Energy =                  0.0000000000000000
    PCM Polarization Energy =              -0.0074516131966917
    Total Energy =                       -545.5533654148330243

The cavity generated by Psi4 version 1.7 has 1262 tessera, while the cavity from Psi4 version 1.9.1 has 1252 tessera.

How this affects me is that Psi4 using PCMSolver seems to fail for many organic molecules that I am testing with the PCMSolver fatal error. S matrix is not positive-definite! error, as described in https://github.com/PCMSolver/pcmsolver/issues/206. In those cases, the cavity also looks incorrect. I took a molecule that failed with this error and found that the calculation successfully completes when I use Psi4 1.7.

Note that Psi4 1.9.1 does generate cavities that look correct as well, particular for smaller, simpler molecules that I've tested.

Your Environment

proteins247 commented 6 months ago

My misunderstanding about settings for PCMSolver led to a mistake in the psi4 input file above. I put in Units = Angstrom, but I also left in Area = 0.3, which I see is the default value in the documentation. But the documentation specifies 0.3 a.u.^2. With Units = Angstrom, I end up specifying faces that are roughly 4x larger, 0.3 Å^2. I also now understand that PCMSolver works with a.u., and the output cavity files are also in a.u.

I reran my test cases, now with the following input for psi4 in the PCMSolver section.

pcm = {
    Medium {
    SolverType = CPCM
    correction = 0.5
    Solvent = Water
    }

    Cavity {
    RadiiSet = Bondi
    Type = GePol
    Scaling = True              # default
    Area = 0.3                  # default
    Mode = Implicit             # default
    }
}

The results are not changed, however.