add the JGF MolDyn benchmark
[IRC.git] / Robust / src / Benchmarks / Scheduling / JGFMolDyn / MDRunner.java
1 public class MDRunner {
2     flag wait;
3     flag run;
4     flag update;
5     flag scale;
6     
7     public int id;  
8     int mm;
9     int mdsize;
10     public int group;
11     public int ilow, iupper;
12     //float l;
13     float rcoff;
14     //rcoffs,
15     float side/*sideh,*/;
16     //float rand;
17     public float [][] sh_force2;
18     public float epot;
19     public float vir;
20     public float ek;
21     //int npartm,tint;
22     //int iprint = 10;
23     MD md;
24     Particle[] one;
25
26     public MDRunner(int id, MD m) {
27         this.id=id;
28         this.md = m;
29         this.mm=this.md.mm;
30         //this.l = 50e-10;
31         this.mdsize = this.md.mdsize;
32         this.group = this.md.group;
33         this.side = this.md.side;
34         this.rcoff = this.mm/(float)4.0;
35 //      this.rcoffs = this.rcoff * this.rcoff;
36         //this.sideh = this.side * 0.5;
37         //this.npartm = this.mdsize - 1;
38         //this.iprint = 10;
39         int slice = (this.mdsize - 1) / this.group + 1; 
40         this.ilow = this.id * slice; 
41         this.iupper = (this.id+1) * slice; 
42         if (this.iupper > this.mdsize )  {
43             iupper = this.mdsize; 
44         }
45         sh_force2 = new float[3][this.mdsize];
46         
47         this.one = this.md.one;
48         this.epot = (float)0.0;//this.md.epot[id+1];
49         this.vir = (float)0.0;//this.md.vir[id+1];
50         this.ek = (float)0.0;//this.md.ek[id+1];
51     }
52     
53     public void init() {
54         this.epot = (float)0.0;
55         this.vir = (float)0.0;
56         for(int i = 0; i < this.mdsize; i++) {
57             for(int j = 0; j < 3; j++) {
58                 this.sh_force2[j][i] = (float)0.0;
59             }
60         }
61     }
62
63     public void run() {
64         /* compute forces */
65         //System.printString("here 1: " + this.id + "\n");
66         for (int i = this.ilow; i < this.iupper; i++) {
67             one[i].force(side,rcoff,mdsize,i,this); 
68         }
69         //System.printString("here 2: " + this.id + "\n");
70     }
71
72 }