-
Notifications
You must be signed in to change notification settings - Fork 30
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
LASSI-PDFT updated the framework & example #74
Conversation
my_pyscf/mcpdft/__init__.py
Outdated
|
||
from mrh.my_pyscf.lassi import lassi, lassis | ||
|
||
if isinstance(mc_or_mf_or_mol, (lassi.LASSI, lassis.LASSIS)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unnecessary to check both lassi.LASSI and lassis.LASSIS: the latter is a child class of the former, so you only need to check the former.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
tests/mcpdft/test_lassipdft.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a test case involving more than one fragment. For instance, take a look at https://github.com/MatthewRHermes/mrh/blob/master/tests/lassi/test_22.py:
Lines 29 to 59 in 3dab0fa
xyz='''H 0 0 0 | |
H 1 0 0 | |
H 3 0 0 | |
H 4 0 0''' | |
mol = gto.M (atom=xyz, basis='sto3g', symmetry=False, verbose=0, output='/dev/null') | |
mf = scf.RHF (mol).run () | |
# Random Hamiltonian | |
rng = np.random.default_rng (424) | |
mf._eri = rng.random (mf._eri.shape) | |
hcore = rng.random ((4,4)) | |
hcore = hcore + hcore.T | |
mf.get_hcore = lambda *args: hcore | |
# LASSCF with CASCI-limit model space | |
las = LASSCF (mf, (2,2), (2,2), spin_sub=(1,1)) | |
las.lasci () | |
las1 = las | |
for i in range (2): las1 = all_single_excitations (las1) | |
charges, spins, smults, wfnsyms = get_space_info (las1) | |
lroots = 4 - smults | |
idx = (charges!=0) & (lroots==3) | |
lroots[idx] = 1 | |
las1.conv_tol_grad = las.conv_tol_self = 9e99 | |
las1.lasci (lroots=lroots.T) | |
las1.dump_spaces () | |
lsi = LASSI (las1) | |
lsi.kernel (opt=0) | |
# CASCI limit | |
mc = mcscf.CASCI (mf, 4, 4).run () |
lsi.e_roots[0]
equals mc.e_tot
here. The relationship should also hold for PDFT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test updated.
LASSI-PDFT energy is matching the CASCI-PDFT up to 9-decimal points.
There are mcpdft, mspdft, their gradients, and property unit test are there at Should one remove them?, since they have been shifted to pyscf-forge. |
No do not remove them. I left them there for a reason. Those marked "dupe" do not run on github CI but I run them locally. |
I have changed the example file according to recent example file of lassi.