Name

ElectronDensity — Class for calculating the electron density

Synopsis

Namespace: NanoLanguage
ElectronDensity(
configuration,
spin
)

Description

A class for calculating the electron density for a configuration.

ElectronDensity Arguments

configuration

The configuration for which the density should be calculated.

Type: MoleculeConfiguration | BulkConfiguration | DeviceConfiguration

spin

The spin for which the density should be calculated.

Type: Spin.Sum | Spin.Up | Spin.Down

Default: Spin.Sum

ElectronDensity Methods

A ElectronDensity 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): Method for printing an ASCII table with the electron density.

    stream

    The stream the electron density 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.

  • spin(): Query method for getting the spin

  • 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 electron density and save it to a file

# Set up configuration
molecule_configuration = MoleculeConfiguration(
    elements=[Nitrogen, Hydrogen, Hydrogen, Hydrogen],
    cartesian_coordinates=[[ 0.     ,  0.      ,  0.124001],
                           [ 0.     ,  0.941173, -0.289336],
                           [ 0.81508, -0.470587, -0.289336],
                           [-0.81508, -0.470587, -0.289336]]*Angstrom 
    )

# Define the calculator
calculator = LCAOCalculator()
molecule_configuration.setCalculator(calculator)

# Calculate and save the electron density
electron_density = ElectronDensity(molecule_configuration)
nlsave('results.nc', electron_density)

nh3_electron_density.py

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

Notes

  • ElectronDensity, returns the valence electron density.

  • To export the grid data of an electron density, use the method nlprint.

  • Calculation of the electron density is not supported for the HuckelCalculator.