-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.chpl
113 lines (95 loc) · 2.74 KB
/
main.chpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
use Time;
use List;
use Legion.Forge.FileParser;
use Legion.Forge.SystemBuilder;
use Legion.Types.TupleCore as LinAlg;
use Legion.SIn.Parameters as SIn;
use Legion.Dynamics.Lamia as Lamia;
record aTest {
var coords: [1..3] real;
}
operator +=(ref a: aTest, b: int) {
a.coords[1..3] += b;
}
proc main {
var b = new owned systemBuilder.Build();
var s = b.build();
writeln(s);
// go like potential or something.
var bonded : SIn.distance = new SIn.distance(coefficients = new list([0.1]));
var nonBonded : SIn.brownianFakeDistance = new SIn.brownianFakeDistance(coefficients = new list([0.1]));
var lamia = new Lamia.SingleCore(0.002, s);
writeln(lamia.system.molecules[0].atoms[0].pos);
writeln("STARTING RUN!");
lamia.run(2000, nonBonded : SIn.forceParameters);
//writeln(lamia.system);
writeln(lamia.system.molecules[0].atoms[0].pos);
}
proc oldTests {
var b = new owned systemBuilder.Build();
var s = b.build();
writeln(s);
var n: int = 500000;
var basicArray: [1..n,1..3] real;
var testArray: [1..n,1..3] real;
var atomArray: [1..n] aTest;
var it: real;
var ft: real;
writeln("testing basic write");
it = getCurrentTime();
forall i in 1..n {
basicArray[i,1..3] += i;
}
ft = getCurrentTime() - it;
writeln("basic write took ", ft);
writeln("testing record write");
it = getCurrentTime();
forall i in 1..n {
atomArray[i] += 1;
}
ft = getCurrentTime() - it;
writeln("atom write took ", ft);
writeln("testing vector write");
it = getCurrentTime();
// almost never going to do this, however
testArray[1..n,1..3] += basicArray;
ft = getCurrentTime() - it;
writeln("vector write took ", ft);
writeln("NEW TEST!");
var x: vector = new vector();
var y: vector = new vector();
x.data = [1.0,2.0,3.0];
y.data = [4.0,5.0,6.0];
writeln(x+y);
var j: matrix = new matrix();
var k: matrix = new matrix();
j.data = 1;
k.data = 2;
writeln(j+k);
var newArray: matrix = new matrix(shape = (n, 3));
var twoArray: matrix = new matrix(shape = (n, 3));
twoArray.data += 12;
twoArray.data[10,..] = 4;
twoArray.data[100..10000,1] = 5;
writeln("testing matrix write");
it = getCurrentTime();
// almost never going to do this, however
newArray += basicArray;
ft = getCurrentTime() - it;
writeln("vector write took ", ft);
writeln("testing matrix write");
it = getCurrentTime();
// almost never going to do this, however
basicArray += basicArray;
ft = getCurrentTime() - it;
writeln("vector write took ", ft);
writeln(basicArray.size);
writeln(x[1]);
//var vec = Vector(3, eltType=int) + 1;
//var mat = Matrix(3, 3, eltType=int) + 2;
//writeln(vec);
//writeln("Mat!");
//writeln(mat);
//writeln(dot(mat, vec));
//writeln(dot(j.data, x.data));
}