ParM  parm
A molecular dynamics library
Functions | Variables
vecrand.cpp File Reference
#include "vecrand.hpp"

Functions

normdistribution mynormaldistribution (0, 1)
 
normgenerator gauss (randengine, mynormaldistribution)
 
lingenerator uniformrand (randengine, mylineardistribution)
 
flt rand01 ()
 Generate a random number between 0 and 1, using the "global" random number generator. More...
 
Vec rand_vec ()
 Generate a random vector from a Gaussian distribution, i.e. More...
 
Vec rand_vec_boxed ()
 Generate a random vector inside a box with sides of length 1. More...
 
unsigned int seed (unsigned int n)
 Seed the global random number generator with a given integer. More...
 
unsigned int seed ()
 Seed the global random number generator with the current time. More...
 
long double to_LD (double e)
 Go to and from Long Doubles. More...
 
double from_LD (long double e)
 Go to and from Long Doubles. More...
 
vector< long double > LDVector (vector< double > dists)
 Go to and from Long Doubles. More...
 
Matrix best_rotation_matrix (Eigen::Matrix< flt, Eigen::Dynamic, NDIM > &from, Eigen::Matrix< flt, Eigen::Dynamic, NDIM > &to)
 

Variables

engine randengine
 
lindistribution mylineardistribution
 

Function Documentation

Matrix best_rotation_matrix ( Eigen::Matrix< flt, Eigen::Dynamic, NDIM > &  from,
Eigen::Matrix< flt, Eigen::Dynamic, NDIM > &  to 
)
double from_LD ( long double  e)

Go to and from Long Doubles.

Useful from Python.

vector<long double> LDVector ( vector< double >  dists)

Go to and from Long Doubles.

Useful from Python.

normdistribution mynormaldistribution ( ,
 
)
flt rand01 ( )

Generate a random number between 0 and 1, using the "global" random number generator.

Vec rand_vec ( )

Generate a random vector from a Gaussian distribution, i.e.

\ \(P(x)=\frac{1}{\sqrt{2 \pi}} e^{\frac{-x^2}{2\pi}}\), and similarly for \(y\) and \(z\).

In terms of spherical coordinates, directionality is uniform on a sphere, and the radial distribution is a Chi Distribution with \(\sigma=1\).

Examples:
LJatoms.cpp.
Vec rand_vec_boxed ( )

Generate a random vector inside a box with sides of length 1.

unsigned int seed ( unsigned int  n)

Seed the global random number generator with a given integer.

Examples:
hardspheres.cpp, LJatoms.cpp, and packer.cpp.
unsigned int seed ( )

Seed the global random number generator with the current time.

Returns
the seed used.
long double to_LD ( double  e)

Go to and from Long Doubles.

Useful from Python.

lingenerator uniformrand ( randengine  ,
mylineardistribution   
)

Variable Documentation

lindistribution mylineardistribution
engine randengine