gridValues(data, cell=None, cell_vectors=None, cell_origin=None, unit=None)¶
Routine to convert a grid of values contained in a numpy array to a GridValues object that can be stored in a NetCDF file and opened in QuantumATK. The grid data values can be given either as a physical quantity array or as a plain values (no unit) numpy array.
- data (PhysicalQuantity array or numpy.array) – Either a PhysicalQuantity array or a plain (no unit) numpy.array containing the data set as a 3D grid. If a plain numpy array is passed, the unit parameter must be specified.
- cell (BravaisLattice) – A unit cell object describing the cell dimension and origin. This option is mutually exclusive with a specification made through the arguments cell_vectors and cell_origin. The cell must be specified either through this argument or cell_vectors/cell_origin.
- cell_vectors (list) – Unit cell vectors, as a list of three vectors. This option is mutually exclusive with a specification through the cell argument.
- cell_origin (PhysicalQuantity array) – Cell origin. If not specified, the default is (0.0,0.0,0.0)*Bohr, but only if the cell_vectors argument was specified. If the cell argument was specified instead, an error will be raised. Default: (0.0,0.0,0.0)*Bohr
- unit (
Unit) – The unit to assign the grid. This parameter is only evaluated, and becomes mandatory, if the data parameter contains a plain (no unit) array. If the data parameter already has a unit, this parameter is ignored.
# Setup generic grid values object with random data. data = numpy.random.random([30, 30, 30]) * Angstrom**-3 cell = SimpleCubic(4.0*Angstrom) grid_values = gridValues(data, cell)