molden¶
- psi4.driver.molden(wfn, filename=None, density_a=None, density_b=None, dovirtual=None)[source]¶
Function to write wavefunction information in wfn to filename in molden format. Will write natural orbitals from density (MO basis) if supplied. Warning! Most post-SCF Wavefunctions do not build the density as this is often much more costly than the energy. In addition, the Wavefunction density attributes (Da and Db) return the SO density and must be transformed to the MO basis to use with this function.
New in version 0.5: wfn parameter passed explicitly
- Returns:
None
- Parameters:
wfn (
Wavefunction
) – set of molecule, basis, orbitals from which to generate cube filesfilename (str) – destination file name for MOLDEN file (optional)
density_a (
Matrix
) – density in the MO basis to build alpha NO’s from (optional)density_b (
Matrix
) – density in the MO basis to build beta NO’s from, assumes restricted if not supplied (optional)dovirtual (bool) – do write all the MOs to the MOLDEN file (true) or discard the unoccupied MOs, not valid for NO’s (false) (optional)
- Examples:
Molden file with the Kohn-Sham orbitals of a DFT calculation.
>>> E, wfn = energy('b3lyp', return_wfn=True) >>> molden(wfn, 'mycalc.molden')
Molden file for CI/MCSCF computation using NO roots. Any method returning a
CIWavefunction
object will work:detci
,fci
,casscf
, etc. The first two arguments ofget_opdm
can be set ton, n
where n => 0 selects the root to write out, provided these roots were computed, see NUM_ROOTS. The third argument controls the spin ("A"
,"B"
or"SUM"
) and the final boolean option determines whether inactive orbitals are included.>>> E, wfn = energy('detci', return_wfn=True) >>> molden(wfn, 'no_root1.molden', density_a=wfn.get_opdm(0, 0, "A", True))
The following produces an INCORRECT Molden file, because the
molden
function needs orbitals in the MO basis (which are internally converted and written to the Molden file in the AO basis). The correct usage is given in the next point.>>> E, wfn = energy('ccsd', return_wfn=True) >>> molden(wfn, 'ccsd_no.molden', density_a=wfn.Da())
Molden file with the natural orbitals of the ground-state 1RDM of a Post-HF calculation. Note the required transformation of Da (SO->MO).
>>> E, wfn = properties('ccsd', return_wfn=True) >>> Da_so = wfn.Da() >>> SCa = core.doublet(wfn.S(), wfn.Ca(), False, False) >>> Da_mo = core.triplet(SCa, Da_so, SCa, True, False, False) >>> molden(wfn, 'ccsd_no.molden', density_a=Da_mo)