5
$\begingroup$

I am currently interested in using pySCF to generate density matrices (first order single particle density matrices) and then using them in Molpro. In principle, this should be possible if the matrix coefficients refer to the same basis set.

However, the matrop program of Molpro has some conventions and pySCF has some conventions for writing these and they are probably not identical. Ideally somebody already would have written a converter. However, if somebody can point me toward the conventions (I only found this dead link) that would also be useful.

$\endgroup$
3
  • 1
    $\begingroup$ Welcome to the site! Definitely an interesting question. One place to check if you run into dead links is the Wayback Machine. For example, I was able to find a cached version of your link from about a year ago. $\endgroup$
    – Tyberius
    Commented Aug 5, 2022 at 19:57
  • 1
    $\begingroup$ TiborGY has provided much useful information. I'd like to add some supplement/comments: usually transferring molecular orbitals between two quantum chemistry packages is sufficient, since the density matrix or CI coefficients can be re-calculated in the target package if needed. So would you please offer an example (shown here or in the issue page gitlab.com/jxzou/mokit/-/issues) to show that what you exactly want? Maybe transferring density matrix is not needed. $\endgroup$
    – jxzou
    Commented Aug 7, 2022 at 17:11
  • 1
    $\begingroup$ I am interested in transferring the density matrix of a correlated method like UCCSD or FCI into my program. Hence the orbitals sadly won't suffice. $\endgroup$ Commented Aug 18, 2022 at 11:09

2 Answers 2

6
$\begingroup$

Interoperability between quantum chemistry packages is almost non-existent when it comes to more complicated data structures, and there is no real standard for wavefunction or density matrix interchange. There are some exceptions to this, where one QC package has implemented the idiosyncratic file format of some other other QC package, like the interface to MRCC in Molpro, the CFOUR and MRCC interface in Psi4, and similar, but even still these interfaces are not always well maintained and sometimes break upon updating one of the QC packages.

The closest thing I am aware of that can transfer wavefunctions between PySCF and Molpro is MOKIT by Jingxiang Zou (https://gitlab.com/jxzou/mokit). Unfortunately it does not offer direct conversions between most QC packages' file formats, the writers can only take the Gaussian .fch as inputs, and the readers can only overwrite the coefficients of an already existing .fch file for the system.

So as of now, you would first need to run Gaussian with the same basis set/charge/multiplicity to get a correctly structured .fch file, then use the MOKIT tools to overwrite its innards with your PySCF results, then finally convert it to a format that Molpro can use.

The MOKIT project is open source, and I think this is definitely an area where patches would be welcome.

$\endgroup$
1
  • $\begingroup$ Hi, recently a contributor of MOKIT has written a module named py2fch_direct, which can generate a .fch file from scratch, after a PySCF calculation (i.e. the user does not need to provide a .fch file in advance). You can try this at examples/utilities/07-OH_writefch.py in the package. $\endgroup$
    – jxzou
    Commented Aug 7, 2022 at 15:12
3
$\begingroup$

So what I originally wanted is possible, with a little python scripting.

To achieve this, a fcidump file containing h1 and h2 needs to be created by moplro.

This entails running an SCF in molpro calculation prior, in my case a HF calculation.

From this SCF, the orbitals have to be stored.

Now in pyscf there is the "tools.fcidump.to_scf" function, which can be used to read in the h1 and h2 and parse them correctly. They will however be given in terms of the Hartree Fock orbitals.

The output of the function "tools.fcidump.to_scf" is a "scf" object. Use its method ".run()" and you will rediagonalize the HF hamiltonian. This generates all the data you need in order to run the FCI algorithm of pyscf with respect to the same integrals as molpro. Now from the fcivectors obtained using pySCFs FCI method, density matrices can be generated.

These density matrices are incompatible if read into molpro. This is because molpro expects density matrices to be given with respect to the integrals that would be generated within the basis set indicated in the molpro input (i.e. sto-3g, aug-cc-pvdz or similar).

To resolve this issue transform the density matrix back into the AO basis using the orbitals and hence generate density matrices that will be identical to molpros density matrices.

I wrote a short Pythonscript that does all this, of course you will need molpro input data, as described, the fcidump file, the orbitals and alos pySCF.

At this point it will probably only function for atoms. I tested this so far for Be sto-3g.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .