JoonhoLee-Group / ipie

ipie stands for Intelligent Python-based Imaginary-time Evolution with a focus on simplicity and speed.
Apache License 2.0
49 stars 24 forks source link

Question on UHF trial WF #272

Closed fdmalone closed 4 months ago

fdmalone commented 10 months ago

Discussed in https://github.com/JoonhoLee-Group/ipie/discussions/271

Originally posted by **vvp-nsk** November 7, 2023 Hi! Apparently, there is a little overlap in code base between QMCPACK and IPIE. In particular, both` pyscf_to_afqmc.py` and `pyscf_to_ipie.py` utils provide very similar functionality. However, according to the QMPACK's documentation, one should always pass the[ '-a/–ao' flag](https://qmcpack.readthedocs.io/en/develop/lab_afqmc.html) which forces the script to transform the integrals to an orthogonalised atomic orbital basis. On another hand, in 'pyscf_to_ipie.py' such feature is also [implemented and available](https://github.com/JoonhoLee-Group/ipie/blob/293db7ce5307dbdc9e04c4fed39f5f45b32e3326/tools/pyscf/pyscf_to_ipie.py#L4). Now I am puzzled a bit whether it is compulsory to pass '-o' flag to 'pyscf_to_ipie.py' with UHF trial WF? Thank you in advance! With best regards, Victor
fdmalone commented 10 months ago

they do indeed share a lot of features (as I (initially) wrote them both :)) The difference is that ipie's converter is slightly more feature rich and one can in principle use UHF MOs without the ortho-ao flag due to this contribution https://github.com/JoonhoLee-Group/ipie/pull/85. This allows you to use a UHF trial and freeze core orbitals which is not otherwise supported with the ortho-ao option. AFAIR this CAN lead to some issues if the alpha/beta UHF orbitals are sufficiently different from one another, but you should test it out and see (the Hartree--Fock energy should be identical once you dial up the cholesky cutoff).

vvp-nsk commented 10 months ago

Hi!

Thanks for your prompt reply. My question was related to the spin-project AFQMC trick which has been introduced long ago by Shiwei Zhang (J. Chem. Phys. 128, 114309 (2008)). Indeed, it is good to know that IPIE does support UHF trial with FC.

alpha/beta UHF orbitals are sufficiently different from one another

That is exactly my case. For my problem, the ph-AFQMC/UHF results are unreliable. There is a 'spin_proj' option available in IPIE. Could you please shed light on its meaning and purpose?

Let me ask you something on UHF trial. Very recently, two articles appeared on better sampling of UHF within AFQMC:

Both articles introduce more robust scheme for the case of UHF trial. Do you have a plan to implement any of them in IPIE?

Thank you in advance!

With best regards, Victor

fdmalone commented 10 months ago

Spin projection simply sets the initial walker to be from an RHF reference (or I guess in general a spin pure reference); the idea is from https://arxiv.org/pdf/0712.1935.pdf and is a means to remove spin contamination walkers. It simply amounts to setting the initial walker to be whatever single determinant wavefunction you like (RHF/ROHF/...). The spin_proj flag is a legacy thing which is no longer supported.

The way to do this now is by writiting things appropriately: https://github.com/JoonhoLee-Group/ipie/blob/293db7ce5307dbdc9e04c4fed39f5f45b32e3326/ipie/utils/io.py#L60 Accepts a phi0 argument which is the initial walker. If you have the transformation matrix (AO->OAO), let's call it X then you just need to do C' = X^{-1} C_RHF/ROHF, where C are your non-spin-contaminated molecular orbitals. Then phi0 = [C'[:, :nalpha], C'[:, :nbeta]].

Unfortunately it seems like currently the initial walker is ignored when constructing the SingleDeterminant walker class so we'll have to fix that. It's still possible to do (see https://github.com/JoonhoLee-Group/ipie/blob/293db7ce5307dbdc9e04c4fed39f5f45b32e3326/examples/08-custom_walker/run_afqmc.py#L176), here you wouldn't need to actually do all of the custom stuff, just use the existing UHF walker class and pass in the initial walker appropriately.

On your second question I have no plans to implement these, BUT the second paper for example would be very simple to implement in ipie (just derive a new propagator class from the existing one and update the constraint appropriately). So contributions are welcome!

The first should also be possible by glueing a few things together but I'm sort of skeptical that release constraint is more "robust" than, e.g., using a MSD trial. Release constraint approaches are exponentially scaling (like MSD trials), indeed the results from the paper seem to suggest that a CASSCF trial is fine (Fig. 6 / 7). Whether one is better than the other in general is I guess an open question (but I'm deeply skeptical of exponentially scaling methods in general :))

vvp-nsk commented 10 months ago

Dear Fionn Malone,

Many thanks for your detailed answers and fruitful discussion on the topic. In my eye, the main reason to have UHF is the broken-symmetry approach heavily used to tackle antiferromagnetically coupled 3d atoms. In such challenging system, the minimal-like CASSCF(N,N) will generate tens of thousands of SD with minor but non-neglible weights. It might happen that ph-AFQMC-MRC might be competitive to PHMSD ph-AFQMC with ~10^5 determinants in such cases. Alternatively, one might look for NOCI and NOMSD, but I doubt on how to use it. The main problem to generate NOMSD trial WF is such there is no public available code(s) for doing that :-)

Anyway, the ticket can be closed.

Thank you again!

With best regards, Victor