molecule
pDynamo

Quantum Chemical Calculations

pDynamo incorporates both ab initio density functional theory (DFT) and semi-empirical QC methods. The usage of both types of method is similar and they can be employed interchangeably. Example5.py is a program that calculates the potential energy, atomic charges and dipole moment for a molecule with different semi-empirical QC methods. It is:

        # . Define the energy models.
        energymodels = [ QCModelMNDO ( "am1"  ),
                         QCModelMNDO ( "mndo" ),
                         QCModelMNDO ( "pm3"  ) ]

        # . Get the filename.
        filename = os.path.join ( xyzpath, "water.xyz" )

        # . Loop over the energy models.
        results = []
        for model in energymodels:
            molecule = XYZFile_ToSystem ( filename )
            molecule.DefineQCModel ( model )
            molecule.Summary ( )
            energy  = molecule.Energy ( )
            charges = molecule.AtomicCharges ( )
            dipole  = molecule.DipoleMoment  ( )
            results.append ( ( model.label, energy, charges, dipole.Norm2 ( ) ) )

        # . Output the results.
        table = logfile.GetTable ( columns = [ 10, 20, 20, 20, 20, 20 ] )
        table.Start  ( )
        table.Title  ( "Energy Model Results for Water" )
        table.Heading ( "Model"  )
        table.Heading ( "Energy" )
        table.Heading ( "Charges", columnSpan = 3 )
        table.Heading ( "Dipole" )
        for ( label, energy, charges, dipole ) in results:
            table.Entry ( label )
            table.Entry ( "%.1f" % ( energy, ) )
            for charge in charges: table.Entry ( "%.3f" % ( charge, ) )
            table.Entry ( "%.3f" % ( dipole, ) )
        table.Stop ( )
        

The program starts by defining the list of different QC models to use and then loops over them, repeating an identical set of calculations on a water molecule for each model. It is important to note that the QC model is assigned to the system, via the method DefineQCModel of the System class, before determination of the energy and other properties occurs. The program terminates by printing out a table containing the calculated results.

Exercises

Valid XHTML 1.0 Strict
Last modification time (GMT): Tue Jul 13 14:26:25 2010
Copyright © 2007–2010 Martin J. Field