CrystalFp
 All Classes Namespaces Files Functions Enumerations Enumerator Pages
Public Types | Public Member Functions | List of all members
cfp::CrystalFpScatterplot Class Reference

Computes the 2D projection of the multidimensional CrystalFp object. More...

#include <CrystalFpScatterplot.h>

Public Types

enum  ValueType {
  VAL_TOTAL_ENERGY, VAL_PER_ATOM_ENERGY, VAL_STRESS, VAL_GROUP,
  VAL_STEP
}
 Type of value associated to the points. More...
 
enum  DiagnosticType { DIAG_DISTANCES, DIAG_BINNED_DISTANCES, DIAG_DO_NOTHING }
 Type of diagnostic requested. More...
 

Public Member Functions

 CrystalFpScatterplot ()
 Constructor.
 
 ~CrystalFpScatterplot ()
 Destructor.
 
void setNamedParam (const std::string &aName, const std::string &aValue)
 Set the parameter identified by the name.
 
size_t initScatterplot (const CrystalFp *aCfp)
 Initialize the scatterplot computation for the given CrystalFp object.
 
void getPoints (float *aCoords) const
 Get the points coordinates.
 
void getValues (float *aValues, ValueType aValueType) const
 Return the values associated to the points.
 
float stepScatterplot (float aTimestep)
 Move the points one step ahead.
 
void perturbPositions (void)
 Check if the current solution is the best.
 
size_t initDiagnostic (DiagnosticType aDiagnostic)
 Compute scatterplot diagnostic chart.
 
void getDiagnosticValues (float *aCoords, float *aValues) const
 Return the diagnostic chart points.
 
void dumpParams (void) const
 Prints the params values (the one set with setNamedParam()).
 

Detailed Description

Computes the 2D projection of the multidimensional CrystalFp object.

The points are projected in 2D trying to preserve the original distances. Normal usage is:

npoints = sp.initScatterplot(&cfp);
allocate npoints*2 float for cooordinates (coords) and for values (vals)
sp.getPoints(coords);
for(num. retries) {
for(num. iterations) {
energy = sp.stepScatterplot(timestep);
sp.getPoints(coords);
if(energy < min_energy) break;
}
sp.perturbPositions();
sp.getPoints(coords);
}
sp.getPoints(coords);
Author
Mario Valle - Swiss National Supercomputing Centre (CSCS)
Date
2011-06-01 (initial version)
Version
1.0

Definition at line 42 of file CrystalFpScatterplot.h.

Member Enumeration Documentation

Type of diagnostic requested.

Enumerator:
DIAG_DISTANCES 

Return all inter-point distances.

DIAG_BINNED_DISTANCES 

Bin the interpoint distances.

DIAG_DO_NOTHING 

To simplify visualization of the scatterplot only.

Definition at line 126 of file CrystalFpScatterplot.h.

Type of value associated to the points.

Enumerator:
VAL_TOTAL_ENERGY 

The total energy associated to the structure.

VAL_PER_ATOM_ENERGY 

Per atom energy associated to the structure.

VAL_STRESS 

The stress computed by the multidimensional scaling algorithm.

VAL_GROUP 

Group to which the point pertains.

VAL_STEP 

The step value.

Definition at line 83 of file CrystalFpScatterplot.h.

Constructor & Destructor Documentation

cfp::CrystalFpScatterplot::CrystalFpScatterplot ( )

Constructor.

cfp::CrystalFpScatterplot::~CrystalFpScatterplot ( )

Destructor.

Member Function Documentation

void cfp::CrystalFpScatterplot::dumpParams ( void  ) const

Prints the params values (the one set with setNamedParam()).

The print is on cerr

void cfp::CrystalFpScatterplot::getDiagnosticValues ( float *  aCoords,
float *  aValues 
) const

Return the diagnostic chart points.

Parameters
[out]aCoordsA preallocated array that will be filled by the point coordinates (x, y)
[out]aValuesA preallocated array that will be filled with the point's values
void cfp::CrystalFpScatterplot::getPoints ( float *  aCoords) const

Get the points coordinates.

If no points, then do nothing.

Parameters
[out]aCoordsArray of x,y coordinates filled on output.
void cfp::CrystalFpScatterplot::getValues ( float *  aValues,
ValueType  aValueType 
) const

Return the values associated to the points.

It is an independent routine so you can change the visualized value without redisplaying the points.

Parameters
[out]aValuesAn array where the values will be stored.
[in]aValueTypeThe value to be returned.
Exceptions
CrystalFpFatalIf aValueType is invalid.
size_t cfp::CrystalFpScatterplot::initDiagnostic ( DiagnosticType  aDiagnostic)

Compute scatterplot diagnostic chart.

The chart shows distances on the scatterplot vs. distances in real space (both distances are normalized between 0 and 1).

Parameters
[in]aDiagnosticThe diagnostic to be computed
Returns
The number of points
Exceptions
CrystalFpFatalIf aDiagnostic is invalid.
size_t cfp::CrystalFpScatterplot::initScatterplot ( const CrystalFp aCfp)

Initialize the scatterplot computation for the given CrystalFp object.

The method used is the ball and spring simple method.

Parameters
[in]aCfpPointer to the already computed CrystalFp structure.
Exceptions
CrystalFpFatalIf CrystalFp has no distances available.
void cfp::CrystalFpScatterplot::perturbPositions ( void  )

Check if the current solution is the best.

If the current solution is not an improvement, then reload the previous optimum solution. Perturb the point positions to escape a local minima. The perturbation is proportional to the point stress and is slowly reduced every restart.

void cfp::CrystalFpScatterplot::setNamedParam ( const std::string &  aName,
const std::string &  aValue 
)

Set the parameter identified by the name.

Mainly used to set parameters from the command line. The accepted codes are:

  • retry Number of retries (used only here to compute the decay coefficient)
  • mass Ball mass
  • stiffness Of the spring
  • damping Damping factor for the movement
  • perturb Perturb scale for the retries (it perturb the initial position of the masses)
  • bins Number of bins for the binned distances diagnostics
  • wobble Wobble scale for the position of the binned points
Parameters
aNameName of the parameter to be set (see above)
aValueString representation of the value to be set (internally it is converted to the needed data type)
Exceptions
CrystalFpFatalIf the param name is invalid
float cfp::CrystalFpScatterplot::stepScatterplot ( float  aTimestep)

Move the points one step ahead.

Parameters
[in]aTimestepThe time from the previous step.
Returns
The cinetic energy of the points (to decide when they are sufficiently "calm")

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