ergo
Stream Class Reference

Streamlined, abstract grid generation class. More...

List of all members.

Public Member Functions

bool saveToFile (const char *fname, int noOfThreads)
 Generates the grid and saves it to the file with given name.
 Stream (ActiveBfShells &abs, RadialScheme *rs, real radint, int angmin, int angmax, real boxSize, bool forceCubic)
 The Stream constructor.
 ~Stream ()
unsigned getPointCount () const

Public Attributes

real boxSize
Dft::SparsePattern * sparsePattern

Protected Member Functions

bool saveAtomsRecursively (StreamSaveContext &ssc, const Box &box, unsigned cnt, const unsigned atoms[], int depth) const
 This is a recursive procedure that generates the grid points that lie in the specified bounding box.
unsigned saveAtomGridInBox (unsigned iAtom, const Box &box, BoxPartitioner &partitioner, unsigned cnt, const unsigned atoms[], int(*shlBlocks)[2], FILE *stream) const
 Method saves all grid points associated with specified atom, located in the specified box.
unsigned noOfAtoms () const
const AtomicGridgetAtomicGrid (unsigned i) const
void addAtom (const real coor[3], int charge, int atomNo)
void addAtom (const Atom &at, int atomNo)
unsigned saveBatch (unsigned batchLength, real(*coor)[3], real *weight, unsigned nBlocks, int(*shlBlocks)[2], FILE *f) const
 Saves a batch of grid points to given file.

Static Protected Member Functions

static void * saveThread (void *data)

Protected Attributes

bool forceCubic

Private Attributes

std::vector< RadialGrid * > atomTypes
 We store just one entry per atom type - there is no reason to have thousands identical copies.
std::vector< AtomicGridatoms
ActiveBfShellsactiveShells
RadialSchemeradialScheme
real radialThreshold
int angularMin
int angularMax
unsigned savedPoints
unsigned expectedPoints
int noOfThreads

Static Private Attributes

static pthread_mutex_t fileSaveMutex = PTHREAD_MUTEX_INITIALIZER

Detailed Description

Streamlined, abstract grid generation class.

This class does not depend explicitly on the representation of the basis set and molecule. All such dependence is abstracted away in case the grid generator is to be used with another program.


Constructor & Destructor Documentation

Stream::Stream ( ActiveBfShells abs,
RadialScheme rs,
real  radint,
int  angmin,
int  angmax,
real  boxSize_,
bool  forceCubic_ 
)

The Stream constructor.

Takes over the radial scheme object, which has to be allocated dynamically.


Member Function Documentation

void Stream::addAtom ( const Atom at,
int  atomNo 
) [inline, protected]

References addAtom(), Atom::coords, and Atom::charge.

const AtomicGrid & Stream::getAtomicGrid ( unsigned  i) const [protected]

Referenced by saveAtomsRecursively().

unsigned Stream::getPointCount ( ) const [inline]

References savedPoints.

unsigned Stream::noOfAtoms ( ) const [inline, protected]

Referenced by saveToFile().

unsigned Stream::saveAtomGridInBox ( unsigned  iAtom,
const Box box,
BoxPartitioner partitioner,
unsigned  cnt,
const unsigned  relevantAtoms[],
int(*)  shlBlocks[2],
FILE *  stream 
) const [protected]

Method saves all grid points associated with specified atom, located in the specified box.

It will also save the associated auxiliary information (usually a list of active orbitals) - this is why we pass an atom list. FIXME: this probably needs to be thought through: what factor decides the atom radius, really? Is it max(auxiliaryRadius, gridRadius)?

References Box::getDistanceTo(), AtomicGrid::center, Vector3D::v, AtomicGrid::getRadialGrid(), RadialGrid::noOfRadPoints, RadialGrid::rad, savedPoints, activeShells, ActiveBfShells::setForBox(), Box::lo, Box::hi, RadialGrid::nAngular, RadialGrid::weights, ll_sphere(), Box::contains(), BoxPartitioner::process(), and saveBatch().

Referenced by saveAtomsRecursively().

bool Stream::saveAtomsRecursively ( StreamSaveContext ssc,
const Box box,
unsigned  atomCount,
const unsigned  atomIndices[],
int  depth 
) const [protected]

This is a recursive procedure that generates the grid points that lie in the specified bounding box.

As an optimization, a list of atoms that may overlap with given grid is passed so that linear scaling can be achieved. This goal is achieved by recursive division of the bounding box until there are no atoms that can overlap with it, or the minimal size is achieved. In the latter case, all atoms are iterated over and the grid points associated with them that lie in the bounding box are saved. An associated auxiliary information is saved as well.

An atom is considered relevant for given box, if its Voronoi polyhedra (+safety margin) overlaps with the box.

Parameters:
sscthe saving context containing information about selected partitioner and other grid generation specifics.
boxsave only the points within the box.
atomCountthe number of potentially relevant atoms that have grids overlapping with the box in question..
atomIndices... and their indices in the global array.
depththe recursion depth for logging purposes.

randomly chosen parameter. We need in general a better way to determing whether the voronoi polyhedra associated with a given atom overlaps with the box in question...

References Box::getMaxDim(), Box::size(), Box::lo, Box::hi, boxSize, getAtomicGrid(), Box::overlapsWith(), AtomicGrid::center, Vector3D::v, AtomicGrid::radius(), StreamSaveContext::boxCount, noOfThreads, StreamSaveContext::myRank, StreamSaveContext::savedPoints, saveAtomGridInBox(), StreamSaveContext::partitioner, StreamSaveContext::shlBlocks, StreamSaveContext::stream, and savedPoints.

Referenced by saveThread(), and saveToFile().

unsigned Stream::saveBatch ( unsigned  batchLength,
real(*)  coor[3],
real weight,
unsigned  nBlocks,
int(*)  shlBlocks[2],
FILE *  f 
) const [protected]

Saves a batch of grid points to given file.

References fileSaveMutex, and sparsePattern.

Referenced by saveAtomGridInBox().

bool Stream::saveToFile ( const char *  fname,
int  noOfThreads 
)

Generates the grid and saves it to the file with given name.

Returns:
Number of saved grid points.

References noOfAtoms(), getBoundingBox(), forceCubic, Box::lo, Box::hi, boxSize, noOfThreads, activeShells, ActiveBfShells::getMaxShells(), saveAtomsRecursively(), savedPoints, and saveThread().


Member Data Documentation

int Stream::angularMax [private]

Referenced by addAtom().

int Stream::angularMin [private]

Referenced by addAtom().

std::vector<AtomicGrid> Stream::atoms [private]
std::vector<RadialGrid*> Stream::atomTypes [private]

We store just one entry per atom type - there is no reason to have thousands identical copies.

Referenced by addAtom(), and ~Stream().

unsigned Stream::expectedPoints [private]

Referenced by addAtom(), and ~Stream().

pthread_mutex_t Stream::fileSaveMutex = PTHREAD_MUTEX_INITIALIZER [static, private]

Referenced by saveBatch().

bool Stream::forceCubic [protected]

Referenced by saveToFile().

int Stream::noOfThreads [private]

Referenced by saveAtomsRecursively(), and saveToFile().

Referenced by addAtom(), and ~Stream().

Referenced by addAtom().

Dft::SparsePattern* Stream::sparsePattern

Referenced by saveBatch().


The documentation for this class was generated from the following file: