Interface to Molden — molden()

Code author: Justin M. Turney

Section author: C. David Sherrill

PSI4 contains an interface to the Molden program. Molden is a visualization program for electronic structure developed by Gijs Schaftenaar at the University of of Nijmegen, Netherlands. It is available at http://www.cmbi.ru.nl/molden/. Molden can plot atomic orbitals, densities, electrostatic potentials (ESP’s), etc. PSI4 can create a file containing atomic coordinates, basis set, and SCF orbital coefficients in the so-called Molden format. This file is written by the SCF module (see Section SCF) if the user sets the MOLDEN_WRITE keyword to true. This Molden file is also used to pass information between PSI4 and WebMO, if PSI4 computations are invoked using the WebMO GUI. The filename of the Molden file ends in ”.molden”, and the prefix is determined by WRITER_FILE_LABEL (if set), or else by the name of the output file plus the name of the current molecule. If |scf__molden_with_virtual| is set to false, the unoccupied orbitals are not written to the Molden file.

psi4.molden(wfn, filename)[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 files
  • filename (string) – 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:
1
2
3
>>> # [1] Molden file for DFT calculation
>>> E, wfn = energy('b3lyp', return_wfn=True)
>>> molden(wfn, 'mycalc.molden')
1
2
3
>>> # [2] Molden file for CI/MCSCF computation using NO roots
>>> E, wfn = energy('ci', return_wfn=True)
>>> molden(wfn, 'no_root1.molden', density_a=wfn.opdm(0, 0, "A", True))
1
2
3
>>> # [3] The following does NOT work, please see below
>>> E, wfn = energy('ccsd', return_wfn=True)
>>> molden(wfn, 'ccsd_no.molden', density_a=wfn.Da())
1
2
3
4
5
>>> # [4] This WILL work, note the transformation of Da (SO->MO)
>>> E, wfn = property('ccsd', properties=['dipole'], return_wfn=True)
>>> Da_so = wfn.Da()
>>> Da_mo = Matrix.triplet(wfn.Ca(), Da_so, wfn.Ca(), True, False, False)
>>> molden(wfn, 'ccsd_no.molden', density_a=Da_mo)

Options

MOLDEN_WRITE

Do write a MOLDEN output file? If so, the filename will end in .molden, and the prefix is determined by WRITER_FILE_LABEL (if set), or else by the name of the output file plus the name of the current molecule.

WRITER_FILE_LABEL

Base filename for text files written by PSI, such as the MOLDEN output file, the Hessian file, the internal coordinate file, etc. Use the add_str_i function to make this string case sensitive.

  • Type: string
  • Default: No Default