Lemina
A molecular dynamics package for network, granular material and point particles with a range of interaction potential.
 
Loading...
Searching...
No Matches
VelocityVerletStep.c File Reference
#include <stdio.h>
#include <math.h>
#include "global.h"
+ Include dependency graph for VelocityVerletStep.c:

Go to the source code of this file.

Functions

void VelocityVerletStep (int icode)
 

Function Documentation

◆ VelocityVerletStep()

void VelocityVerletStep ( int icode)

Definition at line 26 of file VelocityVerletStep.c.

26 {
27int n;
28double atomMassi;
29
30 if(icode == 1){
31 for (n= 1; n <= nAtom; n++) {
32 if(atomType[n] != freezeAtomType){
33 atomMassi = 1./atomMass[n];
34 ax[n] = fx[n] * atomMassi; ay[n] = fy[n] * atomMassi;
35 vx[n] += ax[n] * 0.5 * deltaT;
36 vy[n] += ay[n] * 0.5 * deltaT;
37 rx[n] += vx[n] * deltaT;
38 ry[n] += vy[n] * deltaT;
39 }
40 //Calculating the image flags here
41 if (rx[n] >= regionH[1]) {
42 rx[n] -= region[1];
43 ImageX[n]++;
44 } else if (rx[n] < -regionH[1]) {
45 rx[n] += region[1];
46 ImageX[n]--;
47 }
48 if (ry[n] >= regionH[2]) {
49 ry[n] -= region[2];
50 ImageY[n]++;
51 } else if (ry[n] < -regionH[2]) {
52 ry[n] += region[2];
53 ImageY[n]--;
54 } } }
55 else if(icode == 2){
56 for(n = 1; n <= nAtom; n++) {
57 if(atomType[n] != freezeAtomType){
58 atomMassi = 1./atomMass[n];
59 ax[n] = fx[n] * atomMassi; ay[n] = fy[n] * atomMassi;
60 vx[n] += ax[n] * 0.5 * deltaT;
61 vy[n] += ay[n] * 0.5 * deltaT;
62} } } }
int nAtom
Definition global.h:24
double * atomMass
double region[2+1]
double * ay
Definition global.h:17
double * vx
Definition global.h:17
int * ImageX
int * ImageY
Definition global.h:50
int freezeAtomType
double deltaT
Definition global.h:20
double * rx
double * ax
Definition global.h:17
double * fy
Definition global.h:17
int * atomType
double * vy
Definition global.h:17
double regionH[2+1]
Definition global.h:20
double * fx
Definition global.h:17
double * ry
Definition global.h:17

References atomMass, atomType, ax, ay, deltaT, freezeAtomType, fx, fy, ImageX, ImageY, nAtom, region, regionH, rx, ry, vx, and vy.

Referenced by main().

+ Here is the caller graph for this function: