The RigidCLL library


testRigidCLL.cpp File Reference

Example of how to use the RigidCLL library. More...

#include "RigidCLL.h"
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <unistd.h>
#include <sys/resource.h>
Include dependency graph for testRigidCLL.cpp:

Go to the source code of this file.

Defines

#define RAND_DOUBLE(s)   (((double)rand()*2*s)/(double)RAND_MAX-s)
 A random real number.
#define N_EXPERIMENTS   50
 Number of experiments.
#define REPETITIONS   10000
 Times we repeat the interaction detection to get statistically valid times.

Functions

double getTime ()
 Miliseconds used in the current process.
void RandomTranslation (double sx, double sy, double sz, RigidTransform *t)
 Defines a random translation.
void PrintInteractions (const string &label, list< AtomPair > *interactions)
 Display a list of interactions.
bool CmpInteractions (list< AtomPair > *interactions1, list< AtomPair > *interactions2)
 Compares vectors of interacting atoms.
int main (int argc, char **arg)
 Main body of the RigidCLL test application.

Detailed Description

Simple example of how to use the functionalities implemented in the RigidCLL library.

Definition in file testRigidCLL.cpp.


Define Documentation

#define RAND_DOUBLE (  )     (((double)rand()*2*s)/(double)RAND_MAX-s)

Returns a random real number with uniform distribution in the range [-s,s]

Parameters:
s The range.

Definition at line 25 of file testRigidCLL.cpp.

Referenced by RandomTranslation().

#define N_EXPERIMENTS   50

Number of random perturbations when computing the execution times. By generating random perturbations we collect more realistic data.

Definition at line 33 of file testRigidCLL.cpp.

Referenced by main().

#define REPETITIONS   10000

The interaction detection is so fast that we have to repeat it many times to get accurate (averaged) statistics on its execution cost (i.e., execution time).

Definition at line 41 of file testRigidCLL.cpp.

Referenced by main().


Function Documentation

double getTime (  ) 

Returns the miliseconds used since the process started.

Definition at line 99 of file testRigidCLL.cpp.

Referenced by main().

Here is the caller graph for this function:

void RandomTranslation ( double  sx,
double  sy,
double  sz,
RigidTransform t 
)

Defines a random translation with the given noise values. The noise is generated uniformly in the range [-s,s], where 's' is the given noise level.

The random transforms are used to randomly move the rigids during the test.

Parameters:
sx Noise level in the X axis.
sy Noise level in the Y axis.
sz Noise level in the Z axis.
t The transform to define.

Definition at line 110 of file testRigidCLL.cpp.

References RAND_DOUBLE.

Referenced by main().

Here is the caller graph for this function:

void PrintInteractions ( const string &  label,
list< AtomPair > *  interactions 
)

Prints the interactions detected with RigidCLL::StericClash, RigidCLL::CLLStericClash, or RigidCLL::BruteForceStericClash.

Note that if there are many interactions (more than 20) only the first and the last five are displayed.

Parameters:
label Algorithm used to detect the interactions.
interactions The list to display.

Definition at line 118 of file testRigidCLL.cpp.

Referenced by main().

Here is the caller graph for this function:

bool CmpInteractions ( list< AtomPair > *  interactions1,
list< AtomPair > *  interactions2 
)

Compares vectors of interacting atoms resulting fom call to RigidCLL::Interactions RigidCLL::CLLInteractions, or RigidCLL::BruteForceInteractions. This is used to verify the outputs.

Parameters:
interactions1 The first vector of interactions to compare.
interactions2 The second vector of interactions to compare.
Returns:
true if the two vectors are equal.

Definition at line 154 of file testRigidCLL.cpp.

Referenced by main().

Here is the caller graph for this function:

int main ( int  argc,
char **  arg 
)

Main body of the RigidCLL test application.

Use:

where filename is the name of the file from where to read the atom/rigid information and cutoff is the threshold to use when detecting interacting atoms. The value for the cutoff is optional and if not given 2 is used.

Parameters:
argc Number of elements in the command line that starts the application (i.e., the testRigidCLL command itself and its arguments).
arg Strings with the arguments.
Returns:
EXIT_SUCCESS (0) if the execution worked out fine and EXIT_FAILURE (1) if not.

Definition at line 194 of file testRigidCLL.cpp.

References RigidCLL::BruteForceInteractions(), RigidCLL::BruteForceStericClash(), RigidCLL::CLLInteractions(), RigidCLL::CLLStericClash(), CmpInteractions(), RigidCLL::GetBBSize(), RigidCLL::GetCutOff(), RigidCLL::GetNumRigids(), getTime(), RigidCLL::Interactions(), N_EXPERIMENTS, PrintInteractions(), RandomTranslation(), REPETITIONS, RigidCLL::SetCutOff(), RigidCLL::StericClash(), and RigidCLL::WarmUp().

Here is the call graph for this function: