Class Avogadro::Core::Cube#

class Avogadro::Core::Cube#

Provide a data structure for regularly spaced 3D grids.

Author

Marcus D. Hanwell

Public Types

enum Type#

Different Cube types relating to the data

Values:

enumerator VdW#
enumerator ESP#
enumerator ElectronDensity#
enumerator MO#
enumerator FromFile#
enumerator None#

Public Functions

Cube()#
~Cube()#
inline Vector3 min() const#
Returns

The minimum point in the cube.

inline Vector3 max() const#
Returns

The maximum point in the cube.

inline Vector3 spacing() const#
Returns

The spacing of the grid.

inline Vector3i dimensions() const#
Returns

The x, y and z dimensions of the cube.

bool setLimits(const Vector3 &min, const Vector3 &max, const Vector3i &points)#

Set the limits of the cube.

Parameters
  • min – The minimum point in the cube.

  • max – The maximum point in the cube.

  • points – The number of (integer) points in the cube.

bool setLimits(const Vector3 &min, const Vector3 &max, double spacing)#

Set the limits of the cube.

Parameters
  • min – The minimum point in the cube.

  • max – The maximum point in the cube.

  • spacing – The interval between points in the cube.

bool setLimits(const Vector3 &min, const Vector3i &dim, double spacing)#

Set the limits of the cube.

Parameters
  • min – The minimum point in the cube.

  • dim – The integer dimensions of the cube in x, y and z.

  • spacing – The interval between points in the cube.

bool setLimits(const Vector3 &min, const Vector3i &dim, const Vector3 &spacing)#

Set the limits of the cube.

Parameters
  • min – The minimum point in the cube.

  • dim – The integer dimensions of the cube in x, y and z.

  • spacing – The interval between points in the cube.

bool setLimits(const Cube &cube)#

Set the limits of the cube - copy the limits of an existing Cube.

Parameters

cube – Existing Cube to copy the limits from.

bool setLimits(const Molecule &mol, double spacing, double padding)#

Set the limits of the cube.

Parameters
  • molMolecule to take limits from

  • spacing – The spacing of the regular grid

  • padding – Padding around the molecule

std::vector<double> *data()#
Returns

Vector containing all the data in a one-dimensional array.

const std::vector<double> *data() const#
bool setData(const std::vector<double> &values)#

Set the values in the cube to those passed in the vector.

bool addData(const std::vector<double> &values)#

Adds the values in the cube to those passed in the vector.

unsigned int closestIndex(const Vector3 &pos) const#
Parameters

pos – Position to get closest index for.

Returns

Index of the point closest to the position supplied.

Vector3i indexVector(const Vector3 &pos) const#
Parameters

pos – Position to get closest index for.

Returns

The i, j, k index closest to the position supplied.

Vector3 position(unsigned int index) const#
Parameters

index – Index to be translated to a position.

Returns

Position of the given index.

double value(int i, int j, int k) const#

This function is very quick as it just returns the value at the point.

Returns

Cube value at the integer point i, j, k.

double value(const Vector3i &pos) const#

This function is very quick as it just returns the value at the point.

Returns

Cube value at the integer point pos.

float valuef(const Vector3f &pos) const#

This function uses trilinear interpolation to find the value at points between those specified in the cube.

Warning

This function is quite computationally expensive and should be avoided where possible.

Returns

Cube value at the specified position.

double value(const Vector3 &pos) const#

This function uses trilinear interpolation to find the value at points between those specified in the cube.

Warning

This function is quite computationally expensive and should be avoided where possible.

Returns

Cube value at the specified position.

bool setValue(int i, int j, int k, double value)#

Sets the value at the specified point in the cube.

Parameters
  • i – x component of the position.

  • j – y component of the position.

  • k – z component of the position.

  • value – Value at the specified position.

inline bool setValue(unsigned int i, double value)#

Sets the value at the specified index in the cube.

Parameters

i – 1-dimensional index of the point to set in the cube.

inline double minValue() const#
Returns

The minimum value at any point in the Cube.

inline double maxValue() const#
Returns

The maximum value at any point in the Cube.

inline void setName(const std::string &name_)#
inline std::string name() const#
inline void setCubeType(Type type)#
inline Type cubeType() const#
inline Mutex *lock() const#

Provides locking.

Protected Attributes

std::vector<double> m_data#
Vector3 m_min#
Vector3 m_max#
Vector3 m_spacing#
Vector3i m_points#
double m_minValue#
double m_maxValue#
std::string m_name#
Type m_cubeType#
Mutex *m_lock#