Constructor for the TotalEnergy object.
Configuration with a calculator that supports total energy calculations
Type: A DeviceConfiguration, BulkConfiguration, or MoleculeConfiguration
Default:
None
A TotalEnergy object provides the following methods:
components(): Return dict with the energy components of the total energy.
evaluate(): Return the total energy as a physical quantity.
nlprint(stream): Print a string with the value of the total energy and its components.
Calculate the total energy of a hydrogen Molecule
#setup H-H geometry
elements = [ Hydrogen, Hydrogen]
cartesian_coordinates = [[ 0.0,0.0,0.0],
[ 0.0,0.0,0.75]]*Angstrom
molecule_configuration = MoleculeConfiguration(
elements=elements,
cartesian_coordinates=cartesian_coordinates
)
#define calculator
calculator = LCAOCalculator()
molecule_configuration.setCalculator(calculator)
#calculate total energy
total_energy = TotalEnergy(molecule_configuration)
components = total_energy.components()
for term in components.keys():
print '%-30s = %12.4f eV' % (term,components[term].inUnitsOf(eV))
print '----------------------------------------'
energy = total_energy.evaluate().inUnitsOf(eV)
print 'Total energy = %12.4f eV' % energy
Script for Calculating the equilibrium bond length and dissociation energy of a hydrogen molecule
#define calculator
calculator = LCAOCalculator()
#initialize arrays
energies = numpy.array([])
old_configuration = None
#setup distances where h2 energy is evaluated
distances = numpy.linspace(0.7,0.8,6)
#calculate total energy as function of distance
for d in distances:
#setup H-H geometry
elements = [ Hydrogen, Hydrogen]
cartesian_coordinates = [[ 0.0,0.0,0.0],
[ 0.0,0.0,d]]*Angstrom
molecule_configuration = MoleculeConfiguration(
elements=elements,
cartesian_coordinates=cartesian_coordinates
)
# set the calculator
if old_configuration == None:
molecule_configuration.setCalculator(calculator())
else:
molecule_configuration.setCalculator(calculator(),
initial_state=old_configuration)
#store the scf state
old_configuration = molecule_configuration
#calculate total energy
total_energy = TotalEnergy(molecule_configuration)
#append the total energy to energies
energies = numpy.append(energies,total_energy.evaluate().inUnitsOf(eV))
#get the energy of atomic hydrogen
elements = [ Hydrogen]
cartesian_coordinates = [[ 0.0,0.0,0.0]]*Ang
molecule_configuration = MoleculeConfiguration(
elements=elements,
cartesian_coordinates=cartesian_coordinates
)
molecule_configuration.setCalculator(calculator())
h_energy = TotalEnergy(molecule_configuration)
#calculate energies relative to atomic hydrogen
energies = energies - 2.*h_energy.evaluate().inUnitsOf(eV)
#fit polynomium to data
(a,b,c) = numpy.polyfit(distances,energies,2)
#print out the results
print 'distance(Angstrom) Energy (eV) polynomial_fit (eV)'
for i in range(len(distances)):
d=distances[i]
energy_fit = a*d*d+b*d+c
print ' %8.2f %8.4f %8.4f '% (d,energies[i],energy_fit)
#calculate the bonding distance (experimental 0.742* Angstrom)
d_min = -b/(2.*a)
print 'bonding distance = %8.3f Angstrom'% d_min
# calculate vibrational frequency (experimental 4395 cm-1)
k = 2.*a*eV/(Ang*Ang)
effective_mass = Hydrogen.atomicMass()/math.sqrt(2)
omega = (k/effective_mass)**(0.5)
wave_number = (omega/speed_of_light/2./math.pi).inUnitsOf(Meter**-1)/100.
print 'vibrational frequency = %8.f cm-1 '% (wave_number)
#calculate H-H bond dissociation energy (experimental 436 kJ/mol)
e_min = (a*d_min*d_min+b*d_min+c)*eV
#add zero point energy
e_min = e_min + 0.5 * hbar * omega
#convert to kj/mol
e_min_kjmol = (e_min*avogadro_number).inUnitsOf(Joule/Units.Mol)/1000.
print 'dissociation energy = %8.f kJ/mol'% e_min_kjmol
|
|
Note |
|---|---|
| To obtain a more accurate dissociation energy of the hydrogen molecule, we must perform a spin polarized calculation of the reference energy of the hydrogen atom |
In ATK-DFT, the TotalEnergy object returns the free energy given by
where
is the electron density
The terms in this equation are
is the kinetic energy of the Kohn-Sham orbitals and obtained with
the method E.components()['Kinetic']
is the exchange-correlation energy and obtained with the method E.components()['Exchange-Correlation']
is all the electro-static terms, i.e. the Hartree energy and the interaction energy with the pseudo
potential ions. The sum of these terms is obtained with the method E.components()['Electrostatic']
is the interaction energy with an external field. The value
of this term is obtained with the method E.components()['External-Field']
is the Mermin free energy term, where
is
the Boltzmann constant,
is the electron temperature, and
is the electronic entropy, given
by the eigenstate occupation factors,
. The value of this term is obtained with the method E.components()['Entropy-Term']
To print the data of the total energy, use the method nlprint.
For a device configuration, the TotalEnergy object will in a DFT calculation contain the free energy functional given by
where
is the electron density. Compared to the bulk system the
electronic entropy term is missing,
. The entropy term is not included since it is usually very insignificant, and it is very difficult and
time consuming to calculate for a DeviceConfiguration.
The last two terms in the above equation
arise from charge flow between the central region and the electrode
reservoirs[22]. The symbol
(
) is
the electro-chemical potential of the left (right) electrode and
is the excess number of electrons from the electrode. If the
central region is charge neutral, we will have
. As
detailed below, for finite bias systems, these reservoir terms are calculated
approximately, and the use of the total energy object is therefore approximate for
DeviceConfigurations at finite bias, and the calculated force may in this case not be
fully consistent with the derivative of the total energy.
The terms in the equation are
is the kinetic energy of the Kohn-Sham orbitals and obtained with
the method E.components()['Kinetic']
is the exchange-correlation energy and obtained with the method E.components()['Exchange-Correlation']
is all the electro-static terms, i.e. the Hartree energy and the interaction energy with the pseudo
potential ions. The sum of these terms is obtained with the method E.components()['Electrostatic']
is the interaction energy with an external field. This term is obtained with the method E.components()['External-Field']
is the energy of the electrons which have entered the
central region from the left reservoir. The number of electrons
is
calculated approximately as the Mulliken charge of the atoms closest to the left
electrode. This term is obtained with the method E.components()['Reservoir-Left']
is the energy of the electrons which have entered the
central region from the right reservoir. The number of electrons
is
calculated approximately as the Mulliken charge of the atoms closest to the right
electrode. This term is obtained with the method E.components()['Reservoir-Right']
To print the data of the total energy, use the method nlprint.
In ATK-SE, the TotalEnergy object returns a free energy containing only attractive total energy terms
where
is the electron density. The total energy is missing a repulsive
pair potential term. The energy can therefore only be used to compare the total energy
of systems with the same distances between atoms. This, is for instance the case for
the calculation of charging energies, i.e. the difference in the total energy as
function of the charge on a molecule[24].
The terms in the equation are
is the
one-electron energy, subtracted electro-static double counting terms. The term may
also be written as
, where
is
the non-self-consistent part of the Huckel Hamiltonian and
is the
density matrix. The value of the term is obtained with the method
E.components()['One-Electron']
is the Hartree energy and obtained with the method
E.components()['Hartree']
is the interaction energy with an external field. The value
of this term is obtained with the method
E.components()['External-Field']
is the Mermin free energy term[21], and the value of this term is obtained with the method E.components()['Entropy-Term']
To print the data of the total energy, use the method nlprint.
For a device configuration, the TotalEnergy object will in a Huckel calculation contain the terms
where
is the electron density. Compared to the bulk system the
DeviceConfiguration total energy object is missing the
electronic free energy term,
. This term
is omitted for convenience, since it is very difficult and
time consuming to calculate for a DeviceConfiguration. For most systems this term is insignificant.
There are two new terms arising from charge flow between the central region and the electrode reservoirs. The reservoir terms are calculated approximately, and the use of the total energy object is therefore approximate for DeviceConfigurations.
The terms in the equation are
is the
one-electron energy, subtracted electro-static double counting terms. The term may
also be written as
, where
is the non-self-consistent part of the Huckel Hamiltonian and
is the
density matrix. The value of the term is obtained with the method E.components()['One-Electron']
is the Hartree energy and obtained with the method E.components()['Hartree']
is the interaction energy with an external field. The value
of this term is obtained with the method E.components()['External-Field']
is the energy of the electrons which have entered the
central region from the left reservoir. The number of electrons
is
calculated approximately as the Mulliken charge of the atoms closest to the left
electrode. This term is obtained with the method E.components()['Reservoir-Left']
is the energy of the electrons which have entered the
central region from the right reservoir. The number of electrons
is
calculated approximately as the Mulliken charge of the atoms closest to the right
electrode. This term is obtained with the method E.components()['Reservoir-Right']
To print the data of the total energy, use the method nlprint.