Name

ExternalPotential — Class for calculating the Hartree potential corresponding to a density.

Synopsis

Namespace: NanoLanguage
ExternalPotential(configuration)

Description

A class for calculating the external potential for a configuration.

ExternalPotential Arguments

configuration

The configuration for which the external potential should be calculated.

Type: Either a MoleculeConfiguration, BulkConfiguration, or a DeviceConfiguration.

ExternalPotential Methods

A ExternalPotential object provides the following methods:

  • derivatives(x, y, z): Calculate the derivative in the point x,y,z.

    x

    The cartesian x coordinate.

    Type: physical quantity with type length.

    y

    The cartesian y coordinate.

    Type: physical quantity with type length.

    z

    The cartesian z coordinate.

    Type: physical quantity with type length.

  • evaluate(x, y, z): Evaluate in the point x,y,z

    x

    The cartesian x coordinate.

    Type: physical quantity with type length.

    y

    The cartesian y coordinate.

    Type: physical quantity with type length.

    z

    The cartesian z coordinate.

    Type: physical quantity with type length.

  • gridCoordinate(i, j, k): Return the coordinate for a given grid index.

    i

    The grid index in the A direction.

    Type: integer

    j

    The grid index in the B direction.

    Type: integer

    k

    The grid index in the C direction.

    Type: integer

  • nlprint(stream): Print a string containing an ASCII table useful for plotting the external potential.

    stream

    The stream the external potential should be written to.

    Type: A stream that supports strings being written to using 'write'.

    Default: sys.stdout
  • scale(scale): Scale the field with a double.

    scale

    The parameter to scale with.

    Type: float

  • 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.

Usage Examples

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)

nh3_external_potential.py

For examples on how to average and handle 3-d grids, see the examples for ElectronDifferenceDensity and ElectrostaticDifferencePotential.

Notes

  • 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.