# Discrete3DFunction¶

class OpenMM::Discrete3DFunction

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.

Methods

 Discrete3DFunction() Create a Discrete3DFunction() f(x,y,z) based on a set of tabulated values. getFunctionParameters() Get the parameters for the tabulated function. setFunctionParameters() Set the parameters for the tabulated function. Copy() Create a deep copy of the tabulated function
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.

• 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.

• 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.

• 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.
Discrete3DFunction *Copy() const

Create a deep copy of the tabulated function