2 # -*- mode: python; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
6 # Copyright (c) Erik Lindahl, David van der Spoel 2003-2007.
7 # Coordinate compression (c) by Frans van Hoesel.
8 # Python wrapper (c) by Roland Schulz
10 # IN contrast to the rest of Gromacs, XDRFILE is distributed under the
11 # BSD license, so you can use it any way you wish, including closed source:
13 # Permission is hereby granted, free of charge, to any person obtaining a
14 # copy of this software and associated documentation files (the "Software"),
15 # to deal in the Software without restriction, including without limitation
16 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 # and/or sell copies of the Software, and to permit persons to whom the
18 # Software is furnished to do so, subject to the following conditions:
20 # The above copyright notice and this permission notice shall be included in
21 # all copies or substantial portions of the Software.
23 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 # DEALINGS IN THE SOFTWARE.
34 #you have to compile with --enable-shared
35 #and have libxdrfile.so in the LD_LIBRARY_PATH
36 #it expect the test.xtc/test.trr file generated by xdrfile_c_test
44 box1
=[[(i
+1)*3.7 + (j
+1) for j
in range(DIM
)] for i
in range(DIM
)]
49 if x
.natoms
!= natoms1
: print "natoms != natoms1",x
.natoms
,natoms1
50 for k
,f
in enumerate(x
):
51 if f
.step
!= step1
+k
: print "incorrect step",f
.step
,step1
+k
,k
52 if fabs(f
.time
-time1
-k
) > toler
: print "incorrect time",f
.time
,time1
+k
53 if not x
.mode
&mTrr
and fabs(f
.prec
-prec1
) > toler
: print "incorrect precision",f
.prec
,prec1
54 if x
.mode
&mTrr
and fabs(f
.lam
-lam1
) > toler
: print "incorrect lambda",f
.lam
,lam1
57 if fabs(f
.box
[i
][j
] - box1
[i
][j
]) > toler
: print "box incorrect",f
.box
[i
][j
],box1
[i
][j
]
58 for i
in range(x
.natoms
):
60 target
= (i
+1)*3.7 + (j
+1)
61 if f
.x
[i
][j
] - target
> toler
: print "x incorrect"