xmolecule provides a API to call and control xmolecule from python. API reference.
Load the interface using
from pyxmol import xmol
and then initialize an xmol object using
xm = xmol("input.in")
where "input.in" is a path to an input file specifiying a molecular geometry and basic calculation parameters (such as basis set). An example input file is the following:
O 0.00000 0.00000 0.00000
H -0.00000 0.78516 0.53415
H 0.00000 -0.78516 0.53415
unit=angstrom
gto=6-31G
HF=yes
Next, you have to initialize the calculations using
xm.init()
You may retriece the current energy via
energy = xm.energy
obtain the current geometry using
geom = xm.get_geom()
and update the geometry to new coordinates via
xm.set_geom(new_geom)
The current energy of the molecule
Initializes the xmolecule calculation. This has to be done before any other computation
returns the atomic masses as list of floats (len= 3 * number of atoms)
returns the atom labels as list of strings (len= 3 * number of atoms)
returns the atomic orbital labels as list of strings (len=number of basis functions)
returns basis function overlap matrix of shape (number of basis functions, number of basis functions)
returns the molecular geometry as list of floats len=3 * number of atoms
sets the molecular geometry to new_geom, where geom is a list of floats, length 3 * number of atoms OR an array of shape (3 * number of atoms)
returns the occupation number as list of integers 0, 1, or 2
sets the occupation number to new_occ. new_occ is a list of integers of values 0,1, or 2
returns a 2-dimensional numpy array of shape (number of basis functions, number of molecular orbitals) with molecular orbital coefficients
sets the molecular orbital coefficients to the values provided by the 2-dimensional numpy array coef with shape (number of basis functions, number of molecular orbitals)
returns a string describing the nao basis configuration when using numerical atomic orbitals
returns a list of orbital energies
returns the a list of floats (len=number of atoms) containing the Mulliken charge of each atom
returns the a list of floats (len=number of atoms) containing the Loewdin charge of each atom
returns 2-dimensional numpy array of shape (number of atoms, number of atoms) containing bondorder values.
returns 2-dimensional numpy array of shape (number of orbitals, number of atoms) containing populations of each molecular orbital on respective atoms.
returns oscillator strengths. Returns (osc, tdip).
returns fluorescence rates. Returns a 2-dimensional numpy array with calculated fluorescence rates for the fluorescence transitions between orbital pairs (assuming independent electrons).
returns a list or process data. Each member of the list is a tuple (process_label, final_occ, value, energy_eV),
returns the gradient as array of shape (3 * number of atoms)
writes a molden file "xmolecule.molden"
writes a cube file "xmolecule.molden" with the electronic density
writes a cube file "mo.cube" showing the molecule orbital with integer index norb.
This method returns properties assuming a vacancy otherwise closed shell configuration in a valence orbital assuming Koopmann's theorem. The method returns a tuple (occ, energy, gradient, nacs).
This method returns properties assuming an additional electron in a virtual orbital assuming Koopmann's theorem. Returns the same as xmol.hole_properties()
returns list of CIS excited state energies
returns mulliken charge analysis for cis. state is an integer specifying the state index type is either "F", "H", "P", for full, hole, and particle analysis
returns Loewdin charge analysis for CIS. Works the same way as xmol.cis_mullikenpop(state, type)
returns CIS oscillator strength for a given state. state specifies the state index. Returns (osc, tdip), where osc is a numpy array with oscillator strength and tdip is an array with transition dipole matrix elements shape=(number of states, 3)
returns gradients as numpy array of shape (3 * number of atoms) for a specific CIS state with state index state.
returns gradients & nacs for a specific CIS state with state index state as (energy, gradient, nacs):
returns transition density for CIS state with state index state as numpy arrau of shape (number of basis functions, number of basis functions).
returns hole state efields
returns list of CI energies
returns matrix of CI state overlaps to previous geometry
returns Auger decay rates of CI state
returns a random state index based on probabilities from the weight on occupation number
returns the occupation number of the dominant csf
sets the spin multiplicity to integer value multp
sets the index of the irreducible representation to integer value irrep