obutil.cpp File Reference

Various utility methods. More...

#include "babelconfig.h"
#include "math/matrix3x3.h"
#include "math/vector3.h"
#include "mol.h"
#include "obutil.h"

Namespaces

namespace  OpenBabel

Defines

#define ApproxZero   1E-7
#define IsZero(x)   ((double)fabs(x)<ApproxZero)
#define OneThird   (1.0/3.0)
#define FourThirdsPI   (4.0*PI/3.0)
#define TwoThirdsPI   (2.0*PI/3.0)
#define MAX_SWEEPS   50

Functions

void ThrowError (char *str)
void ThrowError (std::string &str)
bool OBCompareInt (const int &, const int &)
 Comparison -- returns true if first parameter less than second.
bool OBCompareUnsigned (const unsigned int &, const unsigned int &)
 Comparison -- returns true if first parameter less than second.
bool IsNear (const double &, const double &, const double epsilon=2e-6)
 Safe comparison for floats/doubles: true if a and b are closer than epsilon.
bool IsNearZero (const double &, const double epsilon=2e-6)
 Safe comparison for floats/doubles: true if a is less than epsilon.
std::string NewExtension (string &src, char *ext)
 Utility function: replace the last extension in string &src with new extension char *ext.
vector3 center_coords (double *c, unsigned int size)
void rotate_coords (double *c, double m[3][3], unsigned int size)
double calc_rms (double *r, double *f, unsigned int N)
 Calculate the RMS deviation between the first N coordinates of *r and *f.
void SetRotorToAngle (double *c, vector< int > &tor, double ang, vector< int > &atoms)
bool SafeOpen (ifstream &fs, char *filename)
bool SafeOpen (ofstream &fs, char *filename)
bool SafeOpen (ifstream &fs, string &filename)
bool SafeOpen (ofstream &fs, string &filename)
void InternalToCartesian (std::vector< OBInternalCoord * > &, OBMol &)
void CartesianToInternal (std::vector< OBInternalCoord * > &, OBMol &)
void qtrfit (double *r, double *f, int size, double u[3][3])
void ob_make_rmat (double mat[3][3], double rmat[9])
static int get_roots_3_3 (double mat[3][3], double roots[3])
double superimpose (double *, double *, int)
void get_rmat (double *, double *, double *, int)
String conversion utilities
void ToUpper (std::string &s)
 Shift the supplied string to uppercase.
void ToUpper (char *cptr)
 Shift the supplied char* to uppercase.
void ToLower (std::string &s)
 Shift the supplied string to lowercase.
void ToLower (char *cptr)
 Shift the supplied char* to lowercase.
void CleanAtomType (char *)
 "Clean" the supplied atom type

Variables

static double Roots [4]


Detailed Description

Various utility methods.


Define Documentation

#define ApproxZero   1E-7

#define IsZero (  )     ((double)fabs(x)<ApproxZero)

#define OneThird   (1.0/3.0)

#define FourThirdsPI   (4.0*PI/3.0)

#define TwoThirdsPI   (2.0*PI/3.0)

#define MAX_SWEEPS   50