In [1]:
import exatomic
from exatomic.base import resource # Easy access to static files
from exatomic import UniverseWidget as UW # The visualization system
Quantum chemistry codes don't always make it easy to get all the necessary information but provided the outputs have the data and the parser is implemented to handle the print-out from a specific code, this is what the API looks like for orbital viewing.
ed = exatomic.myqmcode.Output('/path/to/my/output')
ed.basis_set # houses primitive exponents, coefficients
ed.momatrix # contains the basis function coefficients
ed.basis_set_order # indices specifying full basis set order
ed is an Editor, an object that makes parsing files fun!ed must be converted to a universe for the magic to happenuni = ed.to_universe()
uni.add_molecular_orbitals? # to see all keyword arguments
uni.add_molecular_orbitals() # tries to guess smart defaults
In [2]:
from exatomic import gaussian
uni = gaussian.Output(resource('g09-ch3nh2-631g.out')).to_universe()
fni = gaussian.Fchk(resource('g09-ch3nh2-631g.fchk')).to_universe()
In [3]:
uni.atom # Inspect the geometry
Out[3]:
In [4]:
uni.basis_set_order.head() # And the first few basis functions
Out[4]:
In [5]:
# Let's add the first 10 molecular orbitals
uni.add_molecular_orbitals(vector=range(10))
fni.add_molecular_orbitals(vector=range(10))
In [6]:
UW(uni, fni)
In [7]:
uo2 = gaussian.Output(resource('g09-uo2.out')).to_universe()
uo2.add_molecular_orbitals()
UW(uo2)
In [8]:
from exatomic import molcas
mol = molcas.Output(resource('mol-uo2-anomb.out'))
orb = molcas.Orb(resource('mol-uo2-anomb.scforb'))
# Just attach it to the universe
# mol.momatrix = orb.momatrix
# mol.orbital = orb.orbital
# Alternatively there's a convenience method on molcas.Output
mol.add_orb(resource('mol-uo2-anomb.scforb')) # adds momatrix and orbital
uni = mol.to_universe()
In [9]:
uni.add_molecular_orbitals(vector=range(40, 60))
In [10]:
UW(uni)
In [11]:
from exatomic import nwchem
nw = nwchem.Output(resource('nw-ch3nh2-631g.out')).to_universe()
In [12]:
nw.add_molecular_orbitals(vector=range(20))
UW(nw)
If you are interested in helping, that's great!
The Editor objects deal with file IO and contain parse_methods specific to each dataframe.
In order to add_molecular_orbitals, the Editor must parse the Atom, BasisSet, BasisSetOrder and MOMatrix dataframes.
The requirements for these dataframes are specified in their docstrings.
The actual interface with the widget occurs on the Universe object, so the Editor must be converted to a Universe.
Therefore, it makes sense to subclass the exatomic.Editor to gain access to the .to_universe() method.
Keep parse_dataframe methods modular if possible to isolate problems when they arise.
In [ ]: