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

KROHF not working #149

Closed
efertitta opened this issue Nov 6, 2023 · 3 comments
Closed

KROHF not working #149

efertitta opened this issue Nov 6, 2023 · 3 comments

Comments

@efertitta
Copy link

I am encountering problems when running KROHF. It appear (error below) that there is a problem of indexing of the orbitals? The same script with KUHF runs seamlessly

File "/cluster/projects/nn8040k/SEP-QUEST/LiNiO2/C2m_KROHF/Embedding.py", line 76, in
emb = vayesta.ewf.EWF(mf, solver='CCSD', bath_options=dict(bathtype='dmet'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/Vayesta/vayesta/ewf/init.py", line 23, in EWF
return UEWF(mf.to_uhf(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/Vayesta/vayesta/ewf/ewf.py", line 70, in init
super().init(mf, solver=solver, log=log, **kwargs)
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/Vayesta/vayesta/core/qemb/qemb.py", line 294, in init
self.init_mf(mf)
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/Vayesta/vayesta/core/qemb/qemb.py", line 361, in init_mf
self._veff_orig = self.mf.get_veff()
^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/Vayesta/vayesta/core/foldscf.py", line 126, in get_veff
vk = self.kmf.get_veff(self.kmf.mol, dm, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/pyscf/pbc/scf/kuhf.py", line 442, in get_veff
vj, vk = self.get_jk(cell, dm_kpts, hermi, kpts, kpts_band)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/pyscf/pbc/scf/khf.py", line 529, in get_jk
vj, vk = self.with_df.get_jk(dm_kpts, hermi, kpts, kpts_band,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/pyscf/pbc/df/mdf.py", line 174, in get_jk
vk = mdf_jk.get_k_kpts(self, dm, hermi, kpts, kpts_band, exxdiv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/pyscf/pbc/df/mdf_jk.py", line 83, in get_k_kpts
vk_kpts = df_jk.get_k_kpts(mydf, dm_kpts, hermi, kpts, kpts_band, None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/pyscf/pbc/df/df_jk.py", line 308, in get_k_kpts
skmoR, skmoI = _format_mo(mo_coeff, mo_occ, shape=(nset,nkpts), order='F',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/pyscf/pbc/df/df_jk.py", line 1336, in _format_mo
mos = [mo[:,mocc>precision]*mocc[mocc>precision]**0.5
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cluster/home/edoardof/.local/lib/python3.11/site-packages/pyscf/pbc/df/df_jk.py", line 1336, in
mos = [mo[:,mocc>precision]*mocc[mocc>precision]**0.5
~~^^^^^^^^^^^^^^^^^^

@maxnus
Copy link
Contributor

maxnus commented Nov 8, 2023

Hi Edoardo,
We do not support restricted open-shell mean-field objects; you will have to convert it to a UHF class (after converging to the ROHF solution).
Since UHF is able to represent any ROHF solution, I believe that "CCSD@(ROHF->UHF)" should give the same result as "CCSD@ROHF", just perhaps be a bit less efficient. I think even PySCF does not have a RO-CCSD solver and just defers to UCCSD?

@efertitta
Copy link
Author

Hi Max,
Understood, however in the molecular case EWF@ROHF works. EWF does convert it to UHF as you say and invokes the UCCSD solver. This is not the case with the periodic code though.
In the error above, mf.to_uhf() is invoked (same as it happens in the molecular code) but I am not sure why it won't work
I will try to convert KROHF->KUHF before passing it to emb

@basilib
Copy link
Contributor

basilib commented Apr 17, 2024

#156 adds automatic conversion to UHF

@basilib basilib closed this as completed Apr 17, 2024
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