# MolDerivatives Library

### part of TexMol, CVC, The University of Texas, Austin

Dependency: Also uses the UsefulMath Library.

### Usage:

Main object:

SumOfGaussiansCurvature

Functions:

> SumOfGaussiansCurvature( int numberOfGaussians, double* gaussianCenters, int numberOfGridDivisions, double maxFunctionError, double blobbiness,
> int numberOfPoints, float* points, double* HandK, double* normals, double* k1Vector, double* k2Vector)

> Parameters:

> - numberOfGaussians: Input the number of Gaussians in the molecule
> - gaussianCenters: A double array containing the description of the position of the atoms and its radius as: [x1,y1,z1,r1, x2,y2,z2,r2, x3,y3,z3,r3 ...... xn,yn,zn,rn], where
>   n is equal to numberOfGaussians
> - numberOfGridDivisions: The number of divisions in the mesh in which the atoms are embedded to get a space partitioning. This parameter should depend on the memory
>   available, but generally, just set it to 10. (Higher = more memory, faster)
> - maxFunctionError: Since the Gaussian is theoretically of infinite extent, we need to chop it somewhere. Use this parameter for controlling the accuracy. For example, set it to
>   0.01 or 0.001
> - blobbiness: Rate of decay for the Gaussians. Say -2.3 to -0.1
> - numberOfPoints: Number of output points where derivatives are required
> - points: The set of output positions, (note these are floats) in the form [x1,y1,z1, x2,y2,z2, x3,y3,z3 ... xm,ym,zm], m=numberOfPoints
> - HandK: Array of size numberOfPoints*2
> - normals: Array of size numberOfPoints*3
> - k1Vector, k2Vector: Arrays of size numberOfPoints*3

> bool initialize( )

> bool getCurvatures( )

> Call initialize( ) before calling this function. If this function returns true, then the arrays HandK, normals, k1Vector, k2Vector will be filled with the
> [m1,g1, m2,g2, .... mm,gm], [nx1,ny1,nz1, nx2,ny2,nz2, nxm,nym,nzm], [k1x1,k1y1,k1z1, k1x2,k1y2,k1z2, k1xm,k1ym,k1zm], [k2x1,k2y1,k2z1, k2x2,k2y2,k2z2, k2xm,k2ym,k2zm]

> Important: if the surface is flat, we return [0,0,0],[0,0,0] for the 2 curvature vectors. You can create any 2 vectors perpendicular to the normal and use them.

Miscellaneous functions:

> bool write(const char* curvfilename)

> Parameters:

> - curvfilename: Name of file which will be created and the mean, gaussian, normals and curvature vectors will be written to.

> bool read( const char* filename, int* numberOfPoints, double** HandK, double** normals, double** k1Vector, double** k2Vector);

> Parameters:

> - filename: Name of curvature file to read in
> - numberOfPoints: The number of points described in the file is returned
> - HandK, normals, k1Vector, k2Vector: These arrays will be allocated and filled if the read is successful. If any dataset was not present, that pointer will return 0.

Files in library:

> Curvature.cpp
> CurvaturesGridVoxel.cpp
> SumOfGaussiansCurvature.cpp
> Curvature.h
> CurvaturesGridVoxel.h
> SumOfGaussiansCurvature.h

Files in required UsefulMath library :

UsefulMath::LinearAlgebra.cpp
UsefulMath::LinearAlgebra.h

Note: If you have your own eigenvector solver, you can use it in place of this library.

Visualizing curvature and normal vectors:

The .curv file can be visualized in TexMol. If you create a surface file (type .raw / .rawc / .rawn / .rawnc / .obj ), say a.rawnc and keep the corresponding a.rawnc.curv file in the same directory as the surface file, load up the surface file in TexMol, it will read in the vectors and display them.

Example: For an example showing how to use this, please look at

CVC :: TexMol :: Blurmaps :: BlurMapsDataManager :: getCurvatures( )

- Vinay Siddavanahalli (skvinay@cs.utexas.edu)