OrbitalThread Class Reference

#include <orbitalthread.h>

List of all members.


Detailed Description

This class calculates Hydrogen orbitals for visualisation in 3D in a thread.

It uses increased precision (double, long double) only when needed. They are, however, not implemented yet so the limit for 'n' (the main quantum number) lies somewhere around 15 depending on the values of the other quantum numbers.

Definition at line 40 of file orbitalthread.h.

Public Types

enum  Types {
  IsoProbability = 0, Density, AngularPart, AccumulatedProbability,
  RadialPart
}

Public Member Functions

 OrbitalThread (QWidget *parentWidget, QMutex *sharedMutex, std::vector< Point3D< float > > *coordinates, const unsigned int type, const unsigned int atom, const unsigned int n, const unsigned int l, const int m, const float res, const float prob, const unsigned int dots)
 The default constructor.
 ~OrbitalThread ()
 The default destructor.
void stop ()
 Requests the thread to stop.
double boundingSphereRadius ()
 Returns the radius of the sphere encompassing the calculated orbital.

Private Types

enum  Precision { PRECISION_UNKNOWN, PRECISION_FLOAT, PRECISION_DOUBLE, PRECISION_LONG_DOUBLE }

Private Member Functions

virtual void run ()
 Dispatches the work to the proper calculating routine.
void calcIsoProbability ()
 Calculates the points having the given probability ( |psi|^2 ).
void calcAccumulatedProbability ()
 Calculates the points having the given accumulated probability ( |psi|^2 ).
void calcRandomDots ()
 Calculates random points according to the probability at a random point.
void calcRadialPart ()
 Draws the radial part of the orbital.
void calcAngularPart ()
 Calculates the angular part of the orbital.
void updateList (std::vector< Point3D< float > > &newCoords, bool final=false)
 Updates the shared coordinate list with a set of newly calculated points.
float associatedLegendre (const float x, const int m, const unsigned int l)
 Calculates the associated Legendre polynomial P ^m _l (x).
float associatedLaguerre (const float x, const int m, const unsigned int n)
 Calculates the associated Laguerre polynomial L ^m _n (x).
template<class T>
factorial (const unsigned int number)
 Calculates the factorial function of the given number.
float random (const float min, const float max)
 Returns a random floating point number between min and max.
template<class T>
largestResult (const unsigned int n, const unsigned int l, const int m, const unsigned int Z)
 Returns an approximation to the largest possible result for the given quantum numbers.

Private Attributes

QWidget * receiver
 The widget that receives any sent events.
QMutex * mutex
 A mutex to lock the access to the vector of calculated points.
std::vector< Point3D< float > > * coords
 Coordinates of calculated probability points.
unsigned int atomNumber
 The atom type for which the orbital is to be shown.
unsigned int qnPrincipal
 Principal quantum number (n) (1 - x).
unsigned int qnOrbital
 Orbital quantum number (l) (0 - n-1).
int qnMomentum
 Angular momentum quantum number (m) (-l - +l).
unsigned int calculationType
 The type of calculation to be done.
float probability
 The iso or accumulated probability.
float resolution
 The desired resolution.
unsigned int numDots
 The number of dots to calculate for random dots.
bool stopRequested
 Is set to true if the thread should be stopped.
float maximumRadius
 Holds the maximum encountered value of r during the calculation.
unsigned int progress
 Holds the progress of the calculation.

Static Private Attributes

static const float abohr = 1.0f
 The Bohr radius.
static const unsigned int updateSize = 1000


Member Enumeration Documentation

enum OrbitalThread::Types
 

Enumerator:
IsoProbability 
Density 
AngularPart 
AccumulatedProbability 
RadialPart 

Definition at line 48 of file orbitalthread.h.

enum OrbitalThread::Precision [private]
 

Enumerator:
PRECISION_UNKNOWN 
PRECISION_FLOAT 
PRECISION_DOUBLE 
PRECISION_LONG_DOUBLE 

Definition at line 56 of file orbitalthread.h.


Constructor & Destructor Documentation

OrbitalThread::OrbitalThread QWidget *  parentWidget,
QMutex *  sharedMutex,
std::vector< Point3D< float > > *  coordinates,
const unsigned int  type,
const unsigned int  atom,
const unsigned int  n,
const unsigned int  l,
const int  m,
const float  res,
const float  prob,
const unsigned int  dots
 

The default constructor.

All needed parameters are passed upon creation of the thread as it is one-shot. Using multiple threads is easily accomplished by further providing start and end values for the angle Phi.

Definition at line 49 of file orbitalthread.cpp.

OrbitalThread::~OrbitalThread  ) 
 

The default destructor.

Definition at line 89 of file orbitalthread.cpp.


Member Function Documentation

void OrbitalThread::stop  ) 
 

Requests the thread to stop.

Definition at line 96 of file orbitalthread.cpp.

double OrbitalThread::boundingSphereRadius  ) 
 

Returns the radius of the sphere encompassing the calculated orbital.

Definition at line 103 of file orbitalthread.cpp.

void OrbitalThread::run  )  [private, virtual]
 

Dispatches the work to the proper calculating routine.

It is run with a call to start().

Definition at line 114 of file orbitalthread.cpp.

void OrbitalThread::calcIsoProbability  )  [private]
 

Calculates the points having the given probability ( |psi|^2 ).

(between 0.0 and 1.0 by definition)

Definition at line 190 of file orbitalthread.cpp.

void OrbitalThread::calcAccumulatedProbability  )  [private]
 

Calculates the points having the given accumulated probability ( |psi|^2 ).

(between 0.0 and 1.0 by definition);

Definition at line 337 of file orbitalthread.cpp.

void OrbitalThread::calcRandomDots  )  [private]
 

Calculates random points according to the probability at a random point.

Definition at line 440 of file orbitalthread.cpp.

void OrbitalThread::calcRadialPart  )  [private]
 

Draws the radial part of the orbital.

Definition at line 559 of file orbitalthread.cpp.

void OrbitalThread::calcAngularPart  )  [private]
 

Calculates the angular part of the orbital.

Definition at line 626 of file orbitalthread.cpp.

void OrbitalThread::updateList std::vector< Point3D< float > > &  newCoords,
bool  final = false
[private]
 

Updates the shared coordinate list with a set of newly calculated points.

If final is true, the update is forces, even if less than updateSize values are present.

Definition at line 703 of file orbitalthread.cpp.

float OrbitalThread::associatedLegendre const float  x,
const int  m,
const unsigned int  l
[private]
 

Calculates the associated Legendre polynomial P ^m _l (x).

Definition at line 718 of file orbitalthread.cpp.

float OrbitalThread::associatedLaguerre const float  x,
const int  m,
const unsigned int  n
[private]
 

Calculates the associated Laguerre polynomial L ^m _n (x).

Definition at line 740 of file orbitalthread.cpp.

template<class T>
T OrbitalThread::factorial const unsigned int  number  )  [private]
 

Calculates the factorial function of the given number.

Not too efficient but does the job. Converted to template because the limits of unsigned int's are reached for n+l=13 (for unsigned long int's it's n+l=21).

Definition at line 753 of file orbitalthread.cpp.

float OrbitalThread::random const float  min,
const float  max
[private]
 

Returns a random floating point number between min and max.

Definition at line 772 of file orbitalthread.cpp.

template<class T>
T OrbitalThread::largestResult const unsigned int  n,
const unsigned int  l,
const int  m,
const unsigned int  Z
[private]
 

Returns an approximation to the largest possible result for the given quantum numbers.

Definition at line 779 of file orbitalthread.cpp.


Member Data Documentation

QWidget* OrbitalThread::receiver [private]
 

The widget that receives any sent events.

Definition at line 73 of file orbitalthread.h.

QMutex* OrbitalThread::mutex [private]
 

A mutex to lock the access to the vector of calculated points.

Definition at line 74 of file orbitalthread.h.

std::vector<Point3D<float> >* OrbitalThread::coords [private]
 

Coordinates of calculated probability points.

Definition at line 75 of file orbitalthread.h.

unsigned int OrbitalThread::atomNumber [private]
 

The atom type for which the orbital is to be shown.

Definition at line 76 of file orbitalthread.h.

unsigned int OrbitalThread::qnPrincipal [private]
 

Principal quantum number (n) (1 - x).

Definition at line 77 of file orbitalthread.h.

unsigned int OrbitalThread::qnOrbital [private]
 

Orbital quantum number (l) (0 - n-1).

Definition at line 78 of file orbitalthread.h.

int OrbitalThread::qnMomentum [private]
 

Angular momentum quantum number (m) (-l - +l).

Definition at line 79 of file orbitalthread.h.

unsigned int OrbitalThread::calculationType [private]
 

The type of calculation to be done.

Definition at line 80 of file orbitalthread.h.

float OrbitalThread::probability [private]
 

The iso or accumulated probability.

Definition at line 81 of file orbitalthread.h.

float OrbitalThread::resolution [private]
 

The desired resolution.

Definition at line 82 of file orbitalthread.h.

unsigned int OrbitalThread::numDots [private]
 

The number of dots to calculate for random dots.

Definition at line 83 of file orbitalthread.h.

bool OrbitalThread::stopRequested [private]
 

Is set to true if the thread should be stopped.

Definition at line 84 of file orbitalthread.h.

float OrbitalThread::maximumRadius [private]
 

Holds the maximum encountered value of r during the calculation.

Definition at line 85 of file orbitalthread.h.

unsigned int OrbitalThread::progress [private]
 

Holds the progress of the calculation.

Definition at line 86 of file orbitalthread.h.

const float OrbitalThread::abohr = 1.0f [static, private]
 

The Bohr radius.

Definition at line 89 of file orbitalthread.h.

const unsigned int OrbitalThread::updateSize = 1000 [static, private]
 

Definition at line 90 of file orbitalthread.h.


Generated on Fri May 19 14:31:58 2006 for Brabosphere by  doxygen 1.4.6-NO