Skip to content

Commit

Permalink
Added torchann tests for gromacs and namd (only when libtorch is linked)
Browse files Browse the repository at this point in the history
  • Loading branch information
zwpku committed Nov 17, 2023
1 parent 2c9fba1 commit 035eaff
Show file tree
Hide file tree
Showing 30 changed files with 1,544 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
configuration {
step 20
dt 1.000000e+00
}

colvar {
name nn_0
x 6.03538539863789e+01
extended_x 6.26159423550291e+01
extended_v -4.64883428844749e-02
}

abf {
configuration {
step 20
name abf1
}

samples
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
20 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

gradient
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
1.19750139469934e-01 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00

z_samples
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
20 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

z_gradient
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
1.19750139469934e-01 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
}

22 changes: 22 additions & 0 deletions gromacs/tests/library/000_torchann/AutoDiff/test.colvars.traj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# step nn_0 r_nn_0
0 6.31130238170796e+01 6.31130238170796e+01
1 6.30692207219584e+01 6.31103055487865e+01
2 6.30026510544997e+01 6.31145652672958e+01
3 6.29122658126667e+01 6.31279014363497e+01
4 6.27979982328700e+01 6.31463462507593e+01
5 6.26608441340553e+01 6.31464114293509e+01
6 6.25028927161892e+01 6.31374917809058e+01
7 6.23270124548684e+01 6.31290244149094e+01
8 6.21368405065849e+01 6.31152122612220e+01
9 6.19366261709763e+01 6.30984888738241e+01
10 6.17312232538928e+01 6.30713761744902e+01
11 6.15256129789802e+01 6.30390581222685e+01
12 6.13248044923109e+01 6.29968474159424e+01
13 6.11335974330228e+01 6.29494142362253e+01
14 6.09564260691254e+01 6.29054838029509e+01
15 6.07972632043814e+01 6.28561201349972e+01
16 6.06594294961042e+01 6.28061845870334e+01
17 6.05451890967560e+01 6.27545701777074e+01
18 6.04559317846983e+01 6.27052300275928e+01
19 6.03922475420111e+01 6.26624306979136e+01
20 6.03538539863789e+01 6.26159423550291e+01
75 changes: 75 additions & 0 deletions gromacs/tests/library/000_torchann/AutoDiff/test.pmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 1
# -1.82500000000000e+02 5.00000000000000e+00 72 1

-1.80000000000000e+02 3.99167131566445e-01
-1.75000000000000e+02 3.90851149658811e-01
-1.70000000000000e+02 3.82535167751177e-01
-1.65000000000000e+02 3.74219185843542e-01
-1.60000000000000e+02 3.65903203935908e-01
-1.55000000000000e+02 3.57587222028274e-01
-1.50000000000000e+02 3.49271240120640e-01
-1.45000000000000e+02 3.40955258213005e-01
-1.40000000000000e+02 3.32639276305371e-01
-1.35000000000000e+02 3.24323294397737e-01
-1.30000000000000e+02 3.16007312490102e-01
-1.25000000000000e+02 3.07691330582468e-01
-1.20000000000000e+02 2.99375348674834e-01
-1.15000000000000e+02 2.91059366767200e-01
-1.10000000000000e+02 2.82743384859565e-01
-1.05000000000000e+02 2.74427402951931e-01
-1.00000000000000e+02 2.66111421044297e-01
-9.50000000000000e+01 2.57795439136662e-01
-9.00000000000000e+01 2.49479457229028e-01
-8.50000000000000e+01 2.41163475321394e-01
-8.00000000000000e+01 2.32847493413760e-01
-7.50000000000000e+01 2.24531511506125e-01
-7.00000000000000e+01 2.16215529598491e-01
-6.50000000000000e+01 2.07899547690857e-01
-6.00000000000000e+01 1.99583565783223e-01
-5.50000000000000e+01 1.91267583875588e-01
-5.00000000000000e+01 1.82951601967954e-01
-4.50000000000000e+01 1.74635620060320e-01
-4.00000000000000e+01 1.66319638152685e-01
-3.50000000000000e+01 1.58003656245051e-01
-3.00000000000000e+01 1.49687674337417e-01
-2.50000000000000e+01 1.41371692429783e-01
-2.00000000000000e+01 1.33055710522148e-01
-1.50000000000000e+01 1.24739728614514e-01
-1.00000000000000e+01 1.16423746706880e-01
-5.00000000000000e+00 1.08107764799246e-01
0.00000000000000e+00 9.97917828916113e-02
5.00000000000000e+00 9.14758009839770e-02
1.00000000000000e+01 8.31598190763427e-02
1.50000000000000e+01 7.48438371687085e-02
2.00000000000000e+01 6.65278552610742e-02
2.50000000000000e+01 5.82118733534399e-02
3.00000000000000e+01 4.98958914458056e-02
3.50000000000000e+01 4.15799095381714e-02
4.00000000000000e+01 3.32639276305371e-02
4.50000000000000e+01 2.49479457229028e-02
5.00000000000000e+01 1.66319638152685e-02
5.50000000000000e+01 8.31598190763427e-03
6.00000000000000e+01 0.00000000000000e+00
6.50000000000000e+01 5.90434715442034e-01
7.00000000000000e+01 5.82118733534400e-01
7.50000000000000e+01 5.73802751626766e-01
8.00000000000000e+01 5.65486769719131e-01
8.50000000000000e+01 5.57170787811497e-01
9.00000000000000e+01 5.48854805903863e-01
9.50000000000000e+01 5.40538823996228e-01
1.00000000000000e+02 5.32222842088594e-01
1.05000000000000e+02 5.23906860180960e-01
1.10000000000000e+02 5.15590878273326e-01
1.15000000000000e+02 5.07274896365691e-01
1.20000000000000e+02 4.98958914458057e-01
1.25000000000000e+02 4.90642932550423e-01
1.30000000000000e+02 4.82326950642788e-01
1.35000000000000e+02 4.74010968735154e-01
1.40000000000000e+02 4.65694986827520e-01
1.45000000000000e+02 4.57379004919886e-01
1.50000000000000e+02 4.49063023012251e-01
1.55000000000000e+02 4.40747041104617e-01
1.60000000000000e+02 4.32431059196983e-01
1.65000000000000e+02 4.24115077289348e-01
1.70000000000000e+02 4.15799095381714e-01
1.75000000000000e+02 4.07483113474080e-01
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
configuration {
step 40
dt 1.000000e+00
}

colvar {
name nn_0
x 6.10577081001537e+01
extended_x 6.12326787537942e+01
extended_v -7.64933582675692e-02
}

abf {
configuration {
step 40
name abf1
}

samples
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
40 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

gradient
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
1.23322505371639e-01 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00

z_samples
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
40 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

z_gradient
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
1.23322505371639e-01 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# step nn_0 r_nn_0
20 6.03538539863789e+01 6.26159423550291e+01
21 6.03394199000649e+01 6.25657182892968e+01
22 6.03469130195905e+01 6.25215807958270e+01
23 6.03737331637029e+01 6.24857731835032e+01
24 6.04169780688734e+01 6.24545000633623e+01
25 6.04736795563434e+01 6.24044696773953e+01
26 6.05405838303321e+01 6.23452941559831e+01
27 6.06145771892489e+01 6.22866468149313e+01
28 6.06928040110311e+01 6.22229802645926e+01
29 6.07723235837283e+01 6.21569845550235e+01
30 6.08504394068528e+01 6.20814386281919e+01
31 6.09245772778030e+01 6.20017773532615e+01
32 6.09923221651223e+01 6.19135522605127e+01
33 6.10512406065109e+01 6.18216541601304e+01
34 6.10991723784603e+01 6.17350050975856e+01
35 6.11339144715032e+01 6.16448369487280e+01
36 6.11535560781633e+01 6.15561449408341e+01
37 6.11568203679531e+01 6.14679183430866e+01
38 6.11424277581402e+01 6.13841667490349e+01
39 6.11096449104203e+01 6.13091721120618e+01
40 6.10577081001537e+01 6.12326787537942e+01
75 changes: 75 additions & 0 deletions gromacs/tests/library/000_torchann/AutoDiff/test.restart.pmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 1
# -1.82500000000000e+02 5.00000000000000e+00 72 1

-1.80000000000000e+02 4.11075017905465e-01
-1.75000000000000e+02 4.02510955032434e-01
-1.70000000000000e+02 3.93946892159404e-01
-1.65000000000000e+02 3.85382829286373e-01
-1.60000000000000e+02 3.76818766413343e-01
-1.55000000000000e+02 3.68254703540312e-01
-1.50000000000000e+02 3.59690640667282e-01
-1.45000000000000e+02 3.51126577794251e-01
-1.40000000000000e+02 3.42562514921221e-01
-1.35000000000000e+02 3.33998452048190e-01
-1.30000000000000e+02 3.25434389175160e-01
-1.25000000000000e+02 3.16870326302129e-01
-1.20000000000000e+02 3.08306263429099e-01
-1.15000000000000e+02 2.99742200556068e-01
-1.10000000000000e+02 2.91178137683038e-01
-1.05000000000000e+02 2.82614074810007e-01
-1.00000000000000e+02 2.74050011936977e-01
-9.50000000000000e+01 2.65485949063946e-01
-9.00000000000000e+01 2.56921886190916e-01
-8.50000000000000e+01 2.48357823317885e-01
-8.00000000000000e+01 2.39793760444855e-01
-7.50000000000000e+01 2.31229697571824e-01
-7.00000000000000e+01 2.22665634698794e-01
-6.50000000000000e+01 2.14101571825763e-01
-6.00000000000000e+01 2.05537508952732e-01
-5.50000000000000e+01 1.96973446079702e-01
-5.00000000000000e+01 1.88409383206671e-01
-4.50000000000000e+01 1.79845320333641e-01
-4.00000000000000e+01 1.71281257460610e-01
-3.50000000000000e+01 1.62717194587580e-01
-3.00000000000000e+01 1.54153131714549e-01
-2.50000000000000e+01 1.45589068841519e-01
-2.00000000000000e+01 1.37025005968488e-01
-1.50000000000000e+01 1.28460943095458e-01
-1.00000000000000e+01 1.19896880222427e-01
-5.00000000000000e+00 1.11332817349397e-01
0.00000000000000e+00 1.02768754476366e-01
5.00000000000000e+00 9.42046916033357e-02
1.00000000000000e+01 8.56406287303052e-02
1.50000000000000e+01 7.70765658572747e-02
2.00000000000000e+01 6.85125029842442e-02
2.50000000000000e+01 5.99484401112136e-02
3.00000000000000e+01 5.13843772381831e-02
3.50000000000000e+01 4.28203143651526e-02
4.00000000000000e+01 3.42562514921221e-02
4.50000000000000e+01 2.56921886190916e-02
5.00000000000000e+01 1.71281257460610e-02
5.50000000000000e+01 8.56406287303052e-03
6.00000000000000e+01 0.00000000000000e+00
6.50000000000000e+01 6.08048463985166e-01
7.00000000000000e+01 5.99484401112136e-01
7.50000000000000e+01 5.90920338239105e-01
8.00000000000000e+01 5.82356275366075e-01
8.50000000000000e+01 5.73792212493044e-01
9.00000000000000e+01 5.65228149620014e-01
9.50000000000000e+01 5.56664086746983e-01
1.00000000000000e+02 5.48100023873953e-01
1.05000000000000e+02 5.39535961000922e-01
1.10000000000000e+02 5.30971898127892e-01
1.15000000000000e+02 5.22407835254861e-01
1.20000000000000e+02 5.13843772381831e-01
1.25000000000000e+02 5.05279709508800e-01
1.30000000000000e+02 4.96715646635770e-01
1.35000000000000e+02 4.88151583762739e-01
1.40000000000000e+02 4.79587520889709e-01
1.45000000000000e+02 4.71023458016678e-01
1.50000000000000e+02 4.62459395143647e-01
1.55000000000000e+02 4.53895332270617e-01
1.60000000000000e+02 4.45331269397586e-01
1.65000000000000e+02 4.36767206524556e-01
1.70000000000000e+02 4.28203143651525e-01
1.75000000000000e+02 4.19639080778495e-01
12 changes: 12 additions & 0 deletions gromacs/tests/library/000_torchann/build_torch_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import torch

class MyModel(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return x

model = MyModel()
scripted_cv_filename = f'./identity.pt'
torch.jit.script(model).save(scripted_cv_filename)

3 changes: 3 additions & 0 deletions gromacs/tests/library/000_torchann/gromacs-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:-) GROMACS - gmx mdrun, 2021.6-Colvars-2023-09-07 (-:
colvars: Initializing the collective variables module, version 2023-09-07.
colvars: Using GROMACS interface, version "2023-07-06".
Binary file added gromacs/tests/library/000_torchann/identity.pt
Binary file not shown.
42 changes: 42 additions & 0 deletions gromacs/tests/library/000_torchann/test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
colvarsTrajFrequency 1
colvarsRestartFrequency 10
indexFile index.ndx

colvar {
name nn_0
lowerBoundary -180.0
upperBoundary 180
width 5.0
extendedLagrangian on
extendedFluctuation 5.0
extendedTimeConstant 200
extendedTemp 300

torchann {
modelFile identity.pt
m_output_index 0
period 360
doubleInputTensor on

dihedral {
group1 {
indexGroup group1
}
group2 {
indexGroup group2
}
group3 {
indexGroup group3
}
group4 {
indexGroup group4
}
}
}
}

abf {
colvars nn_0
fullSamples 0
}

Loading

0 comments on commit 035eaff

Please sign in to comment.