A class for calculating the electron density for a configuration.
The configuration for which the density should be calculated.
Type: MoleculeConfiguration | BulkConfiguration | DeviceConfiguration
The spin for which the density should be calculated.
Type: Spin.Sum | Spin.Up | Spin.Down
Default:
Spin.Sum
A ElectronDensity 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): Method for printing an ASCII table with the electron density.
scale(scale): Scale the field with a double.
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.
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)
For examples on how to average and handle 3-d grids, see the examples for ElectronDifferenceDensity and ElectrostaticDifferencePotential.
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.