C. QC Calculations

Quantum Chemical Calculations

pDynamo allows a wide range of QC approaches to be employed in simulations, either via its in-built algorithms or by coupling to external programs. Its in-built modules implement ab initio density functional theory (DFT) and Hartree-Fock (HF) methods using Gaussian basis sets, and semi-empirical methods of the MNDO family. 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.WithOptions ( hamiltonian = "am1" ) ,

QCModelMNDO.WithOptions ( hamiltonian = "mndo" ) ,

QCModelMNDO.WithOptions ( hamiltonian = "pm3" ) ]


# . Get the filename.

fileName = os.path.join ( xyzPath, "water.xyz" )


# . Loop over the energy models.

results = []

for model in energyModels:

molecule = ImportSystem ( fileName )

molecule.DefineQCModel ( model )

molecule.Summary ( )

energy = molecule.Energy ( )

charges = molecule.AtomicCharges ( )

dipole = molecule.DipoleMoment ( )

results.append ( ( model.hamiltonian.upper ( ), 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, align = Align.Left )

table.Entry ( "{:.1f}".format ( energy ) )

for charge in charges: table.Entry ( "{:.3f}".format ( charge ) )

table.Entry ( "{:.3f}".format ( 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

    1. Modify the example program to use DFT and HF methods in addition to the semi-empirical ones. See the wiki for full details of how to do this. How much longer do DFT calculations take to run compared to semi-empirical ones?

    2. Carry out calculations for different charge and multiplicity states of a molecular system. How reliable are the calculations?

    3. Compute the dissociation curve for a system (e.g. dihydrogen or ethane) as a function of a bond length. How do the results of spin-restricted and spin-unrestricted calculations compare?