public int PARTSIZE;
- public global double[] epot;
- public global double[] vir;
- public global double[] ek;
+ public DoubleWrapper[] epot;
+ public DoubleWrapper[] vir;
+ public DoubleWrapper[] ek;
int size,mm;
int[] datasizes;
public int interactions;
- public int[] interacts;
+ public IntWrapper[] interacts;
- public global int nthreads;
- public global JGFInstrumentor instr;
+ public int nthreads;
+ public JGFInstrumentor instr;
- public JGFMolDynBench(int nthreads, JGFInstrumentor instr) {
+ public JGFMolDynBench(int nthreads) {
this.nthreads=nthreads;
- this.instr = instr;
}
public void JGFsetsize(int size){
public void JGFinitialise(){
interactions = 0;
- datasizes = new int[2];
+ datasizes = global new int[2];
datasizes[0] = 8;
datasizes[1] = 13;
kb = 1.38066e-23;
TSIM = 50;
deltat = 5e-16;
-
- //initialise();
}
public static void JGFapplication(JGFMolDynBench mold) {
// Create new arrays
- atomic {
- mold.epot = global new double [mold.nthreads];
- mold.vir = global new double [mold.nthreads];
- mold.ek = global new double [mold.nthreads];
- mold.interacts = global new int [mold.nthreads];
- }
-
+ BarrierServer mybarr;
+ int[] mid = new int[8];
+ mid[0] = (128<<24)|(195<<16)|(136<<8)|162; //dw-10
+ mid[1] = (128<<24)|(195<<16)|(136<<8)|163; //dw-11
+ mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dw-12
+ mid[3] = (128<<24)|(195<<16)|(136<<8)|165; //dw-13
+ mid[4] = (128<<24)|(195<<16)|(136<<8)|166; //dw-14
+ mid[5] = (128<<24)|(195<<16)|(136<<8)|167; //dw-15
+ mid[6] = (128<<24)|(195<<16)|(136<<8)|168; //dw-16
+ mid[7] = (128<<24)|(195<<16)|(136<<8)|169; //dw-17
+
+ double sh_force [][];
+ double sh_force2 [][][];
int partsize, numthreads;
atomic {
partsize = mold.PARTSIZE;
numthreads = mold.nthreads;
+ mybarr = global new BarrierServer(numthreads);
}
-
- double sh_force [][] = new double[3][partsize];
- double sh_force2 [][][] = new double[3][numthreads][partsize];
-
- // spawn threads
- //Thread thobjects[] = new Thread [nthreads];
- mdRunner[] thobjects;
- TournamentBarrier br;
+ mybarr.start(mid[0]);
+
atomic {
- thobjects = global new mdRunner[numthreads];
- br= global new TournamentBarrier(numthreads);
- }
-
- int mid = (128<<24)|(195<<16)|(175<<8)|73;
- mdRunner tmp;
-
- for(int i=1;i<numthreads;i++) {
- atomic {
- thobjects[i] = global new mdRunner(i,mold.mm,sh_force,sh_force2,br,mold.instr,mold.nthreads,mold);
- tmp = thobjects[i];
+ sh_force = global new double[3][partsize];
+ sh_force2 = global new double[3][numthreads][partsize];
+ mold.epot = global new DoubleWrapper[numthreads];
+ mold.vir = global new DoubleWrapper[numthreads];
+ mold.ek = global new DoubleWrapper[numthreads];
+ mold.interacts = global new IntWrapper[numthreads];
+ for(int i=0;i<numthreads;i++) {
+ mold.epot[i]=global new DoubleWrapper();
+ mold.vir[i]=global new DoubleWrapper();
+ mold.ek[i]=global new DoubleWrapper();
+ mold.interacts[i]=global new IntWrapper();
}
- tmp.start(mid);
}
-
+
+ // spawn threads
+ MDWrap[] thobjects = new MDWrap[numthreads];
+
atomic {
- thobjects[0] = new mdRunner(0,mold.mm,sh_force,sh_force2,br,mold.instr,mold.nthreads,mold);
- thobjects[0].run();
+ for(int i=0;i<numthreads;i++) {
+ thobjects[i] = new MDWrap(global new mdRunner(i,mold.mm,sh_force,sh_force2,mold.nthreads,mold));
+ }
}
-
- for(int i=1;i<numthreads;i++) {
- atomic {
- tmp = thobjects[i];
+
+ boolean waitfordone=true;
+ while(waitfordone) {
+ atomic{
+ if (mybarr.done)
+ waitfordone=false;
}
- tmp.join();
}
- }
+
+ for(int i=0;i<numthreads;i++) {
+ thobjects[i].md.start(mid[i]);
+ }
+
+ for(int i=0;i<numthreads;i++) {
+ thobjects[i].md.join();
+ }
+ }
public void JGFvalidate(){
double[] refval = new double[2];
refval[0] = 1731.4306625334357;
refval[1] = 7397.392307839352;
- double dev = Math.fabs(ek[0] - refval[size]);
+ double dev = Math.fabs(ek[0].d - refval[size]);
if (dev > 1.0e-10 ){
- //System.printString("Validation failed");
- //System.printString("Kinetic Energy = " + (long)ek[0] + " " + (long)dev + " " + size);
+ //System.printString("Validation failed\n");
+ //System.printString("Kinetic Energy = " + (long)ek[0] + " " + (long)dev + " " + size + "\n");
}
}
}
class mdRunner extends Thread {
double count;
- int id,i,j,k,lg,mdsize,move,mm;
+ int id,i,j,k,lg,mm;
double l,rcoff,rcoffs,side,sideh,hsq,hsq2,vel,velt;
double a,r,sum,tscale,sc,ekin,ts,sp;
double den;
double h;
double vaver,vaverh,rand;
double etot,temp,pres,rp;
- double u1,u2,v1,v2,s, xx, yy, zz;
+ double u1, u2, s, xx, yy, zz;
double xvelocity, yvelocity, zvelocity;
double [][] sh_force;
int irep;
int istop;
int iprint;
- int movemx;
- TournamentBarrier br;
- random randnum;
- global JGFInstrumentor instr;
- global JGFMolDynBench mymd;
+ JGFMolDynBench mymd;
int nthreads;
- particle[] one;
-
- public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,TournamentBarrier br,
- JGFInstrumentor instr, int nthreads, JGFMolDynBench mymd) {
+ public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,
+ int nthreads, JGFMolDynBench mymd) {
this.id=id;
this.mm=mm;
this.sh_force=sh_force;
this.sh_force2=sh_force2;
- this.br=br;
- this.instr = instr;
this.nthreads = nthreads;
this.mymd = mymd;
count = 0.0;
irep = 10;
istop = 19;
iprint = 10;
- movemx = 50;
}
- public void run() {
-
- /* Parameter determination */
-
- atomic {
- mdsize = mymd.PARTSIZE;
- }
- one = new particle [mdsize];
- atomic {
- l = mymd.LENGTH;
- }
-
- side = Math.pow((mdsize/den),0.3333333);
- rcoff = mm/4.0;
-
- a = side/mm;
- sideh = side*0.5;
- hsq = h*h;
- hsq2 = hsq*0.5;
- npartm = mdsize - 1;
- rcoffs = rcoff * rcoff;
- tscale = 16.0 / (1.0 * mdsize - 1.0);
- vaver = 1.13 * Math.sqrt(tref / 24.0);
- vaverh = vaver * h;
-
- /* Particle Generation */
-
- xvelocity = 0.0;
- yvelocity = 0.0;
- zvelocity = 0.0;
-
- ijk = 0;
- atomic {
- for (lg=0; lg<=1; lg++) {
- for (i=0; i<mm; i++) {
- for (j=0; j<mm; j++) {
- for (k=0; k<mm; k++) {
+ public void init(particle[] one, int mdsize) {
+ int id=this.id;
+ for (int lg=0; lg<=1; lg++) {
+ for (int i=0; i<mm; i++) {
+ for (int j=0; j<mm; j++) {
+ for (int k=0; k<mm; k++) {
one[ijk] = new particle((i*a+lg*a*0.5),(j*a+lg*a*0.5),(k*a),
- xvelocity,yvelocity,zvelocity,sh_force,sh_force2,id,this);
+ xvelocity,yvelocity,zvelocity,sh_force,sh_force2,id,one);
ijk = ijk + 1;
}
}
}
}
- }
- atomic {
- for (lg=1; lg<=2; lg++) {
- for (i=0; i<mm; i++) {
- for (j=0; j<mm; j++) {
- for (k=0; k<mm; k++) {
+
+ for (int lg=1; lg<=2; lg++) {
+ for (int i=0; i<mm; i++) {
+ for (int j=0; j<mm; j++) {
+ for (int k=0; k<mm; k++) {
one[ijk] = new particle((i*a+(2-lg)*a*0.5),(j*a+(lg-1)*a*0.5),
- (k*a+a*0.5),xvelocity,yvelocity,zvelocity,sh_force,sh_force2,id,this);
+ (k*a+a*0.5),xvelocity,yvelocity,zvelocity,sh_force,sh_force2,id,one);
ijk = ijk + 1;
}
}
}
}
- }
+ /* Initialise velocities */
+
+ iseed = 0;
+ double v1 = 0.0;
+ double v2 = 0.0;
+ random randnum = new random(iseed,v1,v2);
+
+
+ for (int i=0; i<mdsize; i+=2) {
+ r = randnum.seed();
+ one[i].xvelocity = r*randnum.v1;
+ one[i+1].xvelocity = r*randnum.v2;
+ }
- /* Initialise velocities */
+ for (int i=0; i<mdsize; i+=2) {
+ r = randnum.seed();
+ one[i].yvelocity = r*randnum.v1;
+ one[i+1].yvelocity = r*randnum.v2;
+ }
- iseed = 0;
- v1 = 0.0;
- v2 = 0.0;
+ for (int i=0; i<mdsize; i+=2) {
+ r = randnum.seed();
+ one[i].zvelocity = r*randnum.v1;
+ one[i+1].zvelocity = r*randnum.v2;
+ }
- randnum = new random(iseed,v1,v2);
- for (i=0; i<mdsize; i+=2) {
- r = randnum.seed();
- one[i].xvelocity = r*randnum.v1;
- one[i+1].xvelocity = r*randnum.v2;
- }
+ /* velocity scaling */
- for (i=0; i<mdsize; i+=2) {
- r = randnum.seed();
- one[i].yvelocity = r*randnum.v1;
- one[i+1].yvelocity = r*randnum.v2;
- }
+ ekin = 0.0;
+ sp = 0.0;
- for (i=0; i<mdsize; i+=2) {
- r = randnum.seed();
- one[i].zvelocity = r*randnum.v1;
- one[i+1].zvelocity = r*randnum.v2;
- }
+ for(int i=0;i<mdsize;i++) {
+ sp = sp + one[i].xvelocity;
+ }
+ sp = sp / mdsize;
+ for(int i=0;i<mdsize;i++) {
+ one[i].xvelocity = one[i].xvelocity - sp;
+ ekin = ekin + one[i].xvelocity*one[i].xvelocity;
+ }
- /* velocity scaling */
+ sp = 0.0;
+ for(int i=0;i<mdsize;i++) {
+ sp = sp + one[i].yvelocity;
+ }
+ sp = sp / mdsize;
- ekin = 0.0;
- sp = 0.0;
+ for(int i=0;i<mdsize;i++) {
+ one[i].yvelocity = one[i].yvelocity - sp;
+ ekin = ekin + one[i].yvelocity*one[i].yvelocity;
+ }
- for(i=0;i<mdsize;i++) {
- sp = sp + one[i].xvelocity;
- }
- sp = sp / mdsize;
- for(i=0;i<mdsize;i++) {
- one[i].xvelocity = one[i].xvelocity - sp;
- ekin = ekin + one[i].xvelocity*one[i].xvelocity;
- }
+ sp = 0.0;
+ for(int i=0;i<mdsize;i++) {
+ sp = sp + one[i].zvelocity;
+ }
+ sp = sp / mdsize;
- sp = 0.0;
- for(i=0;i<mdsize;i++) {
- sp = sp + one[i].yvelocity;
- }
- sp = sp / mdsize;
+ for(int i=0;i<mdsize;i++) {
+ one[i].zvelocity = one[i].zvelocity - sp;
+ ekin = ekin + one[i].zvelocity*one[i].zvelocity;
+ }
- for(i=0;i<mdsize;i++) {
- one[i].yvelocity = one[i].yvelocity - sp;
- ekin = ekin + one[i].yvelocity*one[i].yvelocity;
- }
+ ts = tscale * ekin;
+ sc = h * Math.sqrt(tref/ts);
- sp = 0.0;
- for(i=0;i<mdsize;i++) {
- sp = sp + one[i].zvelocity;
- }
- sp = sp / mdsize;
+ for(int i=0;i<mdsize;i++) {
- for(i=0;i<mdsize;i++) {
- one[i].zvelocity = one[i].zvelocity - sp;
- ekin = ekin + one[i].zvelocity*one[i].zvelocity;
- }
+ one[i].xvelocity = one[i].xvelocity * sc;
+ one[i].yvelocity = one[i].yvelocity * sc;
+ one[i].zvelocity = one[i].zvelocity * sc;
- ts = tscale * ekin;
- sc = h * Math.sqrt(tref/ts);
+ }
+ }
- for(i=0;i<mdsize;i++) {
+ public void doinit(int mdsize) {
+ for(int j=0;j<3;j++) {
+ double[] sh=sh_force[j];
+ for (int i=0;i<mdsize;i++) {
+ sh[i] = 0.0;
+ }
+ }
+ }
- one[i].xvelocity = one[i].xvelocity * sc;
- one[i].yvelocity = one[i].yvelocity * sc;
- one[i].zvelocity = one[i].zvelocity * sc;
- }
+ public void doinit2(int mdsize) {
+ for(int k=0;k<3;k++) {
+ double[] sh=sh_force[k];
+ double [][] sha=sh_force2[k];
+ for(int j=0;j<nthreads;j++) {
+ double[] sha2=sha[j];
+ for(int i=0;i<mdsize;i++) {
+ sh[i] += sha2[i];
+ }
+ }
+ }
+
+ for(int k=0;k<3;k++) {
+ double [][] sh1=sh_force2[k];
+ for(int j=0;j<nthreads;j++) {
+ double[] sh2=sh1[j];
+ for(int i=0;i<mdsize;i++) {
+
+
+ sh2[i] = 0.0;
+ }
+ }
+ }
+ for(int j=1;j<nthreads;j++) {
+ mymd.epot[0].d += mymd.epot[j].d;
+ mymd.vir[0].d += mymd.vir[j].d;
+ }
+ for(int j=1;j<nthreads;j++) {
+ mymd.epot[j].d = mymd.epot[0].d;
+ mymd.vir[j].d = mymd.vir[0].d;
+ }
+ for(int j=0;j<nthreads;j++) {
+ mymd.interactions += mymd.interacts[j].i;
+ }
- /* Synchronise threads and start timer before MD simulation */
+ for (int j=0;j<3;j++) {
+ double sh[]=sh_force[j];
+ for (int i=0;i<mdsize;i++) {
+ sh[i] = sh[i] * hsq2;
+ }
+ }
+}
+ public void run() {
+ /* Parameter determination */
+
+ int mdsize;
+ double tmpden;
+ int movemx=50;
+ Barrier barr=new Barrier("128.195.136.162");
+ particle[] one;
+ int id;
atomic {
- br.DoBarrier(id);
- }
- if (id == 0) JGFInstrumentor.startTimer("Section3:MolDyn:Run", instr.timers);
- atomic {
- br.DoBarrier(id);
- }
+ id=this.id;
+ mdsize = mymd.PARTSIZE;
+ one=new particle[mdsize];
+ l = mymd.LENGTH;
+ tmpden = den;
+ side = Math.pow((mdsize/tmpden),0.3333333);
+ rcoff = mm/4.0;
+
+ a = side/mm;
+ sideh = side*0.5;
+ hsq = h*h;
+ hsq2 = hsq*0.5;
+ npartm = mdsize - 1;
+ rcoffs = rcoff * rcoff;
+ tscale = 16.0 / (1.0 * mdsize - 1.0);
+ vaver = 1.13 * Math.sqrt(tref / 24.0);
+ vaverh = vaver * h;
+
+ /* Particle Generation */
+
+ xvelocity = 0.0;
+ yvelocity = 0.0;
+ zvelocity = 0.0;
+ ijk = 0;
+ init(one, mdsize);
+ }
- /* MD simulation */
+ /* Synchronise threads and start timer before MD simulation */
- move = 0;
- for (move=0;move<movemx;move++) {
+ Barrier.enterBarrier(barr);
- /* move the particles and update velocities */
+ /* MD simulation */
- for (i=0;i<mdsize;i++) {
- one[i].domove(side,i);
+ for (int move=0;move<movemx;move++) {
+ atomic {
+ /* move the particles and update velocities */
+ for (int i=0;i<mdsize;i++) {
+ one[i].domove(side,i);
+ }
}
/* Barrier */
- br.DoBarrier(id);
+ Barrier.enterBarrier(barr);
- if(id==0) {
- for(j=0;j<3;j++) {
- for (i=0;i<mdsize;i++) {
- sh_force[j][i] = 0.0;
- }
+ atomic {
+ if(id==0) {
+ doinit(mdsize);
}
+
+ mymd.epot[id].d = 0.0;
+ mymd.vir[id].d = 0.0;
+ mymd.interacts[id].i = 0;
}
- mymd.epot[id] = 0.0;
- mymd.vir[id] = 0.0;
- mymd.interacts[id] = 0;
/* Barrier */
- br.DoBarrier(id);
-
-
-
- /* compute forces */
-
- for (i=0+id;i<mdsize;i+=nthreads) {
- one[i].force(side,rcoff,mdsize,i,xx,yy,zz,mymd);
+ Barrier.enterBarrier(barr);
+
+ atomic {
+ /* compute forces */
+
+ for (int i=0+id;i<mdsize;i+=nthreads) {
+ one[i].force(side,rcoff,mdsize,i,xx,yy,zz,mymd);
+ }
}
/* Barrier */
- br.DoBarrier(id);
+ Barrier.enterBarrier(barr);
/* update force arrays */
-
- if(id == 0) {
- for(int k=0;k<3;k++) {
- for(i=0;i<mdsize;i++) {
- for(j=0;j<nthreads;j++) {
- sh_force[k][i] += sh_force2[k][j][i];
- }
- }
- }
- }
-
- if(id == 0) {
- for(int k=0;k<3;k++) {
- for(i=0;i<mdsize;i++) {
- for(j=0;j<nthreads;j++) {
- sh_force2[k][j][i] = 0.0;
- }
- }
- }
- }
-
- if(id==0) {
- for(j=1;j<nthreads;j++) {
- mymd.epot[0] += mymd.epot[j];
- mymd.vir[0] += mymd.vir[j];
- }
- for(j=1;j<nthreads;j++) {
- mymd.epot[j] = mymd.epot[0];
- mymd.vir[j] = mymd.vir[0];
- }
- for(j=0;j<nthreads;j++) {
- mymd.interactions += mymd.interacts[j];
- }
+ atomic {
+ if(id == 0) {
+ doinit2(mdsize);
+ }
}
/* Barrier */
- br.DoBarrier(id);
+ Barrier.enterBarrier(barr);
- if(id == 0) {
- for (j=0;j<3;j++) {
- for (i=0;i<mdsize;i++) {
- sh_force[j][i] = sh_force[j][i] * hsq2;
- }
+ atomic {
+ /*scale forces, update velocities */
+ sum = 0.0;
+ for (int i=0;i<mdsize;i++) {
+ sum = sum + one[i].mkekin(hsq2,i);
}
- }
-
- sum = 0.0;
- /* Barrier */
- br.DoBarrier(id);
-
- /*scale forces, update velocities */
-
- for (i=0;i<mdsize;i++) {
- sum = sum + one[i].mkekin(hsq2,i);
- }
-
- ekin = sum/hsq;
+ ekin = sum/hsq;
- vel = 0.0;
- count = 0.0;
+ vel = 0.0;
+ count = 0.0;
- /* average velocity */
+ /* average velocity */
- for (i=0;i<mdsize;i++) {
- velt = one[i].velavg(vaverh,h);
- if(velt > vaverh) { count = count + 1.0; }
- vel = vel + velt;
- }
+ for (int i=0;i<mdsize;i++) {
+ velt = one[i].velavg(vaverh,h);
+ if(velt > vaverh) { count = count + 1.0; }
+ vel = vel + velt;
+ }
- vel = vel / h;
+ vel = vel / h;
- /* temperature scale if required */
+ /* temperature scale if required */
- if((move < istop) && (((move+1) % irep) == 0)) {
- sc = Math.sqrt(tref / (tscale*ekin));
- for (i=0;i<mdsize;i++) {
- one[i].dscal(sc,1);
+ if((move < istop) && (((move+1) % irep) == 0)) {
+ sc = Math.sqrt(tref / (tscale*ekin));
+ for (int i=0;i<mdsize;i++) {
+ one[i].dscal(sc,1);
+ }
+ ekin = tref / tscale;
}
- ekin = tref / tscale;
- }
- /* sum to get full potential energy and virial */
+ /* sum to get full potential energy and virial */
- if(((move+1) % iprint) == 0) {
- mymd.ek[id] = 24.0*ekin;
- mymd.epot[id] = 4.0*mymd.epot[id];
- etot = mymd.ek[id] + mymd.epot[id];
- temp = tscale * ekin;
- pres = den * 16.0 * (ekin - mymd.vir[id]) / mdsize;
- vel = vel / mdsize;
- rp = (count / mdsize) * 100.0;
+ if(((move+1) % iprint) == 0) {
+ mymd.ek[id].d = 24.0*ekin;
+ mymd.epot[id].d = 4.0*mymd.epot[id].d;
+ etot = mymd.ek[id].d + mymd.epot[id].d;
+ temp = tscale * ekin;
+ pres = tmpden * 16.0 * (ekin - mymd.vir[id].d) / mdsize;
+ vel = vel / mdsize;
+ rp = (count / mdsize) * 100.0;
+ }
}
-
- br.DoBarrier(id);
+ Barrier.enterBarrier(barr);
}
-
- br.DoBarrier(id);
- if (id == 0) JGFInstrumentor.stopTimer("Section3:MolDyn:Run", instr.timers);
-
+ //if (id == 0) JGFInstrumentor.stopTimer("Section3:MolDyn:Run", instr.timers);
}
}
-
-
-
class particle {
public double xcoord, ycoord, zcoord;
public double xvelocity,yvelocity,zvelocity;
int part_id;
int id;
- double [][] sh_force;
- double [][][] sh_force2;
- mdRunner runner;
-
+ global double [][] sh_force;
+ global double [][][] sh_force2;
+ particle[] one;
+
public particle(double xcoord, double ycoord, double zcoord, double xvelocity,
- double yvelocity,double zvelocity,double [][] sh_force,
- double [][][] sh_force2,int id,mdRunner runner) {
+ double yvelocity,double zvelocity, double [][] sh_force,
+ double [][][] sh_force2,int id, particle[] one) {
this.xcoord = xcoord;
this.ycoord = ycoord;
this.sh_force = sh_force;
this.sh_force2 = sh_force2;
this.id=id;
- this.runner=runner;
+ this.one=one;
}
public void domove(double side,int part_id) {
double fxi,fyi,fzi;
double rd,rrd,rrd2,rrd3,rrd4,rrd6,rrd7,r148;
double forcex,forcey,forcez;
-
+ int id=this.id;
sideh = 0.5*side;
rcoffs = rcoff*rcoff;
fzi = 0.0;
for (int i=x+1;i<mdsize;i++) {
- xx = this.xcoord - runner.one[i].xcoord;
- yy = this.ycoord - runner.one[i].ycoord;
- zz = this.zcoord - runner.one[i].zcoord;
+ xx = this.xcoord - one[i].xcoord;
+ yy = this.ycoord - one[i].ycoord;
+ zz = this.zcoord - one[i].zcoord;
if(xx < (-sideh)) { xx = xx + side; }
if(xx > (sideh)) { xx = xx - side; }
rrd4 = rrd2*rrd2;
rrd6 = rrd2*rrd4;
rrd7 = rrd6*rrd;
- mymd.epot[id] = mymd.epot[id] + (rrd6 - rrd3);
+ mymd.epot[id].d += (rrd6 - rrd3);
r148 = rrd7 - 0.5*rrd4;
- mymd.vir[id] = mymd.vir[id] - rd*r148;
+ mymd.vir[id].d += - rd*r148;
forcex = xx * r148;
fxi = fxi + forcex;
sh_force2[2][id][i] = sh_force2[2][id][i] - forcez;
- mymd.interacts[id]++;
+ mymd.interacts[id].i++;
}
}
}
public void dscal(double sc,int incx) {
-
xvelocity = xvelocity * sc;
yvelocity = yvelocity * sc;
zvelocity = zvelocity * sc;
-
-
-
}
-
}
class random {