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

LASSI-PDFT updated the framework & example #74

Merged
merged 3 commits into from
Mar 20, 2024
Merged

LASSI-PDFT updated the framework & example #74

merged 3 commits into from
Mar 20, 2024

Conversation

JangidBhavnesh
Copy link
Contributor

I have changed the example file according to recent example file of lassi.


from mrh.my_pyscf.lassi import lassi, lassis

if isinstance(mc_or_mf_or_mol, (lassi.LASSI, lassis.LASSIS)):
Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Owner

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:

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.

Copy link
Contributor Author

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.

@JangidBhavnesh
Copy link
Contributor Author

There are mcpdft, mspdft, their gradients, and property unit test are there at
https://github.com/MatthewRHermes/mrh/tree/master/tests/mcpdft

Should one remove them?, since they have been shifted to pyscf-forge.

@MatthewRHermes
Copy link
Owner

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.

@MatthewRHermes MatthewRHermes merged commit 0fae0da into MatthewRHermes:dev Mar 20, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants