# . Define the energy models.
energyModels = [ QCModelMNDO ( "am1" ),
QCModelMNDO ( "mndo" ),
QCModelMNDO ( "pm3" ) ]
# . Get the file name.
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
class, before determination of the energy and other properties occurs.
The program terminates by printing out a table containing the calculated