***,h2o matrop examples
geometry={o;h1,o,r;h2,o,r,h1,theta} !Z-matrix geometry input
r=1 ang !bond length
theta=104 !bond angle
hf !do scf calculation
{multi
natorb
canonical}
{matrop
load,D_ao,DEN,2140.2 !load mcscf density matrix
load,Cnat,ORB,2140.2,natural !load mcscf natural orbitals
load,Ccan,ORB,2140.2,canonical !load mcscf canonical orbitals
load,Dscf,DEN,2100.2 !load scf density matrix
load,S !load overlap matrix
prio,Cnat,4,1,2 !prints occupied casscf orbitals
elem,d11,Dscf,1.1,1.1 !print element D(1,1)
elem,d21,Dscf,2.1,1.1 !print element D(2,1)
elem,d12,Dscf,1.1,2.1 !print element D(1,2)
tran,S_mo,s,Cnat !transform s into MO basis (same as above)
print,S_mo !print result - should be unit matrix
trace,Nao,S_mo !trace of S_MO = number of basis functions
trace,Nel,D_ao,S !form trace(DS) = number of electrons
mult,SC,S,Cnat !form SC=S*Cnat
tran,D_nat,D_ao,SC !transform density to natural MO (could also be done using dmo)
prid,D_nat !print diagonal elements (occupation numbers)
dmo,D_can,D_ao,Ccan !transform D_ao to canonical MO basis. Same as above simplified
add,D_neg,-1,D_can !multiply d_can by -1
diag,U,EIG,D_neg !diagonalizes density D_can
mult,Cnat1,Ccan,U !transforms canonical orbitals to natural orbitals
prio,Cnat1,4,1,2 !prints new natural orbitals
natorb,Cnat2,D_ao !make natural orbitals using MCSCF density D_ao directly
prio,Cnat2,4,1,2 !prints new natural orbitals (should be the same as above)
add,diffden,D_ao,-1,Dscf !form mcscf-scf difference density
natorb,C_diff,diffden !make natural orbitals for difference density
write,diffden,denfile !write difference density to ASCII file denfile
save,C_diff,2500.2 !store natural orbitals for difference density in dump record 2500.2
}