A class for calculating the external potential for a configuration.
The configuration for which the external potential should be calculated.
Type: Either a MoleculeConfiguration, BulkConfiguration, or a DeviceConfiguration.
A ExternalPotential object provides the following methods:
derivatives(x, y, z): Calculate the derivative in the point x,y,z.
evaluate(x, y, z): Evaluate in the point x,y,z
gridCoordinate(i, j, k): Return the coordinate for a given grid index.
nlprint(stream): Print a string containing an ASCII table useful for plotting the external
potential.
scale(scale): Scale the field with a double.
shape(): Query function for getting the shape of the data.
toArray(): Return the values of the grid as a numpy array slicing off any units.
unit(): Get the unit of the data in the grid.
unitCell(): Return the unit cell for the grid.
volumeElement(): Get the volume element of the grid.
Calculate the external potential and save it to a file
# Set up configuration
molecule_configuration = MoleculeConfiguration(
elements=[Nitrogen, Hydrogen, Hydrogen, Hydrogen],
cartesian_coordinates=[[ 6.13508 , 5.790587, 2.75 ],
[ 6.13508 , 6.73176 , 2.336663],
[ 6.95016 , 5.32 , 2.336663],
[ 5.32 , 5.32 , 2.336663]]*Angstrom
)
# Add metallic regions (without them the external potential would be constant)
metallic_region_0 = BoxRegion(
0*Volt,
xmin = 0*Angstrom, xmax = 12*Angstrom,
ymin = 0*Angstrom, ymax = 12*Angstrom,
zmin = 0*Angstrom, zmax = 1*Angstrom
)
metallic_region_1 = BoxRegion(
1*Volt,
xmin = 0*Angstrom, xmax = 12*Angstrom,
ymin = 0*Angstrom, ymax = 12*Angstrom,
zmin = 5*Angstrom, zmax = 6*Angstrom
)
metallic_regions = [metallic_region_0, metallic_region_1]
molecule_configuration.setMetallicRegions(metallic_regions)
# Define the calculator
calculator = HuckelCalculator()
molecule_configuration.setCalculator(calculator)
# Calculate and save the effective potential
external_potential = ExternalPotential(molecule_configuration)
nlsave('results.nc', molecule_configuration)
nlsave('results.nc', external_potential)
For examples on how to average and handle 3-d grids, see the examples for ElectronDifferenceDensity and ElectrostaticDifferencePotential.
ExternalPotential, returns the electrostatic potential due
to the electrodes and gates in the system.
To export the grid data of an external potential, use the method nlprint.