# `Discrete3DFunction`¶

class Discrete3DFunction : public OpenMM::TabulatedFunction

This is a TabulatedFunction that computes a discrete three dimensional function f(x,y,z). To evaluate it, x, y, and z are each rounded to the nearest integer and the table element with those indices is returned. If any index is outside the range [0, size), the result is undefined.

Public Functions

Discrete3DFunction(int xsize, int ysize, int zsize, const std::vector<double> &values)

Create a Discrete3DFunction f(x,y,z) based on a set of tabulated values.

Parameters
• xsize – the number of table elements along the x direction

• ysize – the number of table elements along the y direction

• zsize – the number of table elements along the z direction

• values – the tabulated values of the function f(x,y,z), ordered so that values[i+xsize*j+xsize*ysize*k] = f(i,j,k). This must be of length xsize*ysize*zsize.

void getFunctionParameters(int &xsize, int &ysize, int &zsize, std::vector<double> &values) const

Get the parameters for the tabulated function.

Parameters
• xsize[out] the number of table elements along the x direction

• ysize[out] the number of table elements along the y direction

• zsize[out] the number of table elements along the z direction

• values[out] the tabulated values of the function f(x,y,z), ordered so that values[i+xsize*j+xsize*ysize*k] = f(i,j,k). This must be of length xsize*ysize*zsize.

void setFunctionParameters(int xsize, int ysize, int zsize, const std::vector<double> &values)

Set the parameters for the tabulated function.

Parameters
• xsize – the number of table elements along the x direction

• ysize – the number of table elements along the y direction

• zsize – the number of table elements along the z direction

• values – the tabulated values of the function f(x,y,z), ordered so that values[i+xsize*j+xsize*ysize*k] = f(i,j,k). This must be of length xsize*ysize*zsize.

virtual Discrete3DFunction *Copy() const

Create a deep copy of the tabulated function

Deprecated:

This will be removed in a future release.