In GNU C/C++, and FORTRAN, the usage of RNG:
srand(time(NULL)); /* Initialization */
int m = rand(); /* Function call */
time (NULL) is the seed number. rand() will generate an integer number from a range of 0 to RAND_MAX. m/RAND_MAX will return the numbers between 0 and 1.
In MT19937 RNG, the usage is as follows:
init_genrand(time(NULL)); /* Initiation */
double m = genrand_real2(); /* Function call */
m is the random number of type double between 0 and 1.
5.4. Potential Energy Function: In section 5.2, we have done the integration of a function, which describes potential energy as a function of radial distance. In molecular simulation, as we know, we have two distinct steps: molecular modeling and followed by molecular simulation. Molecular modeling refers to the modeling of the potential energy (PE) function,
, which should include all possible interaction between molecules. Molecular simulation refers to the estimation of various thermodynamic and structural quantities using the above PE function. U ( r ) can be derived theoretically wherever possible; otherwise, empirical or semi-empirical relations can be used. r refers to the distance between molecule i and j , given by r ij .
Potential Cut-off : In most of the cases U(r) follows an inverse power law with r , U(r) ~ 1/rm, where m is > 0.
Hence, U(r) is a declining function of r and it goes to zero as r
∞. In actual calculation, it is not possible to achieve r = ∞ and at the same time, U(r)
0 at a finite value of r, u(r)
very close to 0. Hence, a cut-off value of r is chosen such that, u(r) is very small at that r ( rcut or rc) . All the calculation of potential energies is based on rc.
Potential energy function can be of any form such as 6-12 L-J potential. In many cases, a truncated and shifted L-J potential is used.
rij must have a minimum value and a maximum value (max is rc), minimum value is rij =
where
is the molecular diameter. For dissimilar molecules,
is
. If rijis less than
, there is no need of calculation.