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

Errors when running PCM model #138

Open
liwaerduo opened this issue Oct 13, 2024 · 2 comments
Open

Errors when running PCM model #138

liwaerduo opened this issue Oct 13, 2024 · 2 comments

Comments

@liwaerduo
Copy link

https://github.com/pyscf/pyscf.github.io/blame/2cd8b965a7959cb7e1f40a0eca5103dde7af28c2/source/user/solvent.rst#L39C4-L39C4
hello I get errors when I run the code from user guide https://pyscf.org/user/solvent.html#pcm-model
here is my input

import pyscf
mol = pyscf.M(atom='''
     C  0.    0.      -0.542
     O  0.    0.       0.677
     H  0.    0.935   -1.082
     H  0.   -0.935   -1.082''',
              basis='6-31g*', verbose=4)
mf = mol.RKS(xc='b3lyp').PCM()
mf.with_solvent.method = 'IEF-PCM' # C-PCM, SS(V)PE, COSMO
mf.with_solvent.eps = 78.3553 # for water
mf.run()

errors

Traceback (most recent call last):
  File "/home/ljw/test/testpyscf.py", line 20, in <module>
    mf = mol.RKS(xc='b3lyp').PCM()
  File "/home/ljw/.conda/envs/pyscf/lib/python3.7/site-packages/pyscf/scf/hf.py", line 1740, in __getattr__
    return object.__getattribute__(self, key)
AttributeError: 'RKS' object has no attribute 'PCM'

then I check the usage in souce code https://pyscf.org/_modules/pyscf/solvent.html#PCM

'''Initialize PCM model.

Examples:

>>> mf = PCM(scf.RHF(mol))
>>> mf.kernel()
>>> sol = PCM(mol)
>>> mc = PCM(CASCI(mf, 6, 6), sol)
>>> mc.kernel()
'''

so I change mf = mol.RKS(xc='b3lyp').PCM() into mf = pyscf.solvent.PCM(mol.RKS(xc='b3lyp')) and get no errors
am I miss something or they are the same function

@fishjojo
Copy link
Collaborator

@wxj6000 please take a look.

@sunqm
Copy link
Contributor

sunqm commented Oct 13, 2024

This is a bug in module import that was introduced by me in a PR of code cleanup. The .PCM() was register lazily when import the relevant solvent module. However, the automatic import code was removed accidentally. I will fix this problem in next release. For the moment, please use the second method mf = pyscf.solvent.PCM(mol.RKS(xc='b3lyp')) .

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