imdclient 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- imdclient/IMD.py +3 -1
- imdclient/IMDClient.py +37 -8
- imdclient/IMDProtocol.py +1 -0
- imdclient/data/gromacs/md/gromacs_v3_nst1.mdp +3 -3
- imdclient/tests/base.py +46 -0
- imdclient/tests/conftest.py +0 -39
- imdclient/tests/datafiles.py +16 -1
- imdclient/tests/hpc_testing/gromacs/README.md +112 -0
- imdclient/tests/hpc_testing/gromacs/gmx_gpu_test.mdp +58 -0
- imdclient/tests/hpc_testing/gromacs/gmx_gpu_test.top +11764 -0
- imdclient/tests/hpc_testing/gromacs/struct.gro +21151 -0
- imdclient/tests/hpc_testing/gromacs/validate_gmx.sh +90 -0
- imdclient/tests/hpc_testing/lammps/README.md +62 -0
- imdclient/tests/hpc_testing/lammps/lammps_v3_nst_1.in +71 -0
- imdclient/tests/hpc_testing/lammps/topology_after_min.data +8022 -0
- imdclient/tests/hpc_testing/lammps/validate_lmp.sh +66 -0
- imdclient/tests/hpc_testing/namd/README.md +73 -0
- imdclient/tests/hpc_testing/namd/alanin.params +402 -0
- imdclient/tests/hpc_testing/namd/alanin.pdb +77 -0
- imdclient/tests/hpc_testing/namd/alanin.psf +206 -0
- imdclient/tests/hpc_testing/namd/namd_v3_nst_1.namd +59 -0
- imdclient/tests/hpc_testing/namd/validate_namd.sh +71 -0
- imdclient/tests/server.py +2 -11
- imdclient/tests/test_imdclient.py +18 -0
- imdclient/tests/test_imdreader.py +60 -1
- imdclient/tests/test_manual.py +221 -65
- {imdclient-0.1.3.dist-info → imdclient-0.1.4.dist-info}/METADATA +1 -1
- imdclient-0.1.4.dist-info/RECORD +57 -0
- imdclient-0.1.3.dist-info/RECORD +0 -42
- {imdclient-0.1.3.dist-info → imdclient-0.1.4.dist-info}/AUTHORS.md +0 -0
- {imdclient-0.1.3.dist-info → imdclient-0.1.4.dist-info}/LICENSE +0 -0
- {imdclient-0.1.3.dist-info → imdclient-0.1.4.dist-info}/WHEEL +0 -0
- {imdclient-0.1.3.dist-info → imdclient-0.1.4.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,206 @@
|
|
1
|
+
PSF
|
2
|
+
|
3
|
+
11 !NTITLE
|
4
|
+
REMARKS FILENAME="/usr/people/nonella/xplor/benchmark1/ALANIN.PSF"
|
5
|
+
REMARKS PARAM11.PRO ( from PARAM6A )
|
6
|
+
REMARKS ===========
|
7
|
+
REMARKS PROTEIN PARAMETERS:
|
8
|
+
REMARKS PEPTIDE GEOMETRY FROM RAMACHANDRAN ET AL BBA 359:298 (1974)
|
9
|
+
REMARKS TORSIONS FROM HAGLER ET AL JACS 98:4600 (1976)
|
10
|
+
REMARKS LENNARD-JONES NONBONDED PARAMETERS WITH SPECIAL TREATMENT OF 1:4
|
11
|
+
REMARKS CARBON-CARBON INTERACTIONS: JORGENSON ET. AL.
|
12
|
+
REMARKS JACS 103:3976-3985 WITH 1-4 RC=1.80/0.1
|
13
|
+
REMARKS
|
14
|
+
REMARKS DATE:16-Feb-89 11:21:29 created by user: nonella
|
15
|
+
|
16
|
+
66 !NATOM
|
17
|
+
1 MAIN 1 ACE CA CH3E 0.000000E+00 15.0350 0
|
18
|
+
2 MAIN 1 ACE C C 0.450000 12.0110 0
|
19
|
+
3 MAIN 1 ACE O O -0.450000 15.9994 0
|
20
|
+
4 MAIN 2 ALA N NH1 -0.350000 14.0067 0
|
21
|
+
5 MAIN 2 ALA H H 0.250000 1.00800 0
|
22
|
+
6 MAIN 2 ALA CA CH1E 0.100000 13.0190 0
|
23
|
+
7 MAIN 2 ALA CB CH3E 0.000000E+00 15.0350 0
|
24
|
+
8 MAIN 2 ALA C C 0.450000 12.0110 0
|
25
|
+
9 MAIN 2 ALA O O -0.450000 15.9994 0
|
26
|
+
10 MAIN 3 ALA N NH1 -0.350000 14.0067 0
|
27
|
+
11 MAIN 3 ALA H H 0.250000 1.00800 0
|
28
|
+
12 MAIN 3 ALA CA CH1E 0.100000 13.0190 0
|
29
|
+
13 MAIN 3 ALA CB CH3E 0.000000E+00 15.0350 0
|
30
|
+
14 MAIN 3 ALA C C 0.450000 12.0110 0
|
31
|
+
15 MAIN 3 ALA O O -0.450000 15.9994 0
|
32
|
+
16 MAIN 4 ALA N NH1 -0.350000 14.0067 0
|
33
|
+
17 MAIN 4 ALA H H 0.250000 1.00800 0
|
34
|
+
18 MAIN 4 ALA CA CH1E 0.100000 13.0190 0
|
35
|
+
19 MAIN 4 ALA CB CH3E 0.000000E+00 15.0350 0
|
36
|
+
20 MAIN 4 ALA C C 0.450000 12.0110 0
|
37
|
+
21 MAIN 4 ALA O O -0.450000 15.9994 0
|
38
|
+
22 MAIN 5 ALA N NH1 -0.350000 14.0067 0
|
39
|
+
23 MAIN 5 ALA H H 0.250000 1.00800 0
|
40
|
+
24 MAIN 5 ALA CA CH1E 0.100000 13.0190 0
|
41
|
+
25 MAIN 5 ALA CB CH3E 0.000000E+00 15.0350 0
|
42
|
+
26 MAIN 5 ALA C C 0.450000 12.0110 0
|
43
|
+
27 MAIN 5 ALA O O -0.450000 15.9994 0
|
44
|
+
28 MAIN 6 ALA N NH1 -0.350000 14.0067 0
|
45
|
+
29 MAIN 6 ALA H H 0.250000 1.00800 0
|
46
|
+
30 MAIN 6 ALA CA CH1E 0.100000 13.0190 0
|
47
|
+
31 MAIN 6 ALA CB CH3E 0.000000E+00 15.0350 0
|
48
|
+
32 MAIN 6 ALA C C 0.450000 12.0110 0
|
49
|
+
33 MAIN 6 ALA O O -0.450000 15.9994 0
|
50
|
+
34 MAIN 7 ALA N NH1 -0.350000 14.0067 0
|
51
|
+
35 MAIN 7 ALA H H 0.250000 1.00800 0
|
52
|
+
36 MAIN 7 ALA CA CH1E 0.100000 13.0190 0
|
53
|
+
37 MAIN 7 ALA CB CH3E 0.000000E+00 15.0350 0
|
54
|
+
38 MAIN 7 ALA C C 0.450000 12.0110 0
|
55
|
+
39 MAIN 7 ALA O O -0.450000 15.9994 0
|
56
|
+
40 MAIN 8 ALA N NH1 -0.350000 14.0067 0
|
57
|
+
41 MAIN 8 ALA H H 0.250000 1.00800 0
|
58
|
+
42 MAIN 8 ALA CA CH1E 0.100000 13.0190 0
|
59
|
+
43 MAIN 8 ALA CB CH3E 0.000000E+00 15.0350 0
|
60
|
+
44 MAIN 8 ALA C C 0.450000 12.0110 0
|
61
|
+
45 MAIN 8 ALA O O -0.450000 15.9994 0
|
62
|
+
46 MAIN 9 ALA N NH1 -0.350000 14.0067 0
|
63
|
+
47 MAIN 9 ALA H H 0.250000 1.00800 0
|
64
|
+
48 MAIN 9 ALA CA CH1E 0.100000 13.0190 0
|
65
|
+
49 MAIN 9 ALA CB CH3E 0.000000E+00 15.0350 0
|
66
|
+
50 MAIN 9 ALA C C 0.450000 12.0110 0
|
67
|
+
51 MAIN 9 ALA O O -0.450000 15.9994 0
|
68
|
+
52 MAIN 10 ALA N NH1 -0.350000 14.0067 0
|
69
|
+
53 MAIN 10 ALA H H 0.250000 1.00800 0
|
70
|
+
54 MAIN 10 ALA CA CH1E 0.100000 13.0190 0
|
71
|
+
55 MAIN 10 ALA CB CH3E 0.000000E+00 15.0350 0
|
72
|
+
56 MAIN 10 ALA C C 0.450000 12.0110 0
|
73
|
+
57 MAIN 10 ALA O O -0.450000 15.9994 0
|
74
|
+
58 MAIN 11 ALA N NH1 -0.350000 14.0067 0
|
75
|
+
59 MAIN 11 ALA H H 0.250000 1.00800 0
|
76
|
+
60 MAIN 11 ALA CA CH1E 0.100000 13.0190 0
|
77
|
+
61 MAIN 11 ALA CB CH3E 0.000000E+00 15.0350 0
|
78
|
+
62 MAIN 11 ALA C C 0.450000 12.0110 0
|
79
|
+
63 MAIN 11 ALA O O -0.450000 15.9994 0
|
80
|
+
64 MAIN 12 CBX N NH1 -0.350000 14.0067 0
|
81
|
+
65 MAIN 12 CBX H H 0.250000 1.00800 0
|
82
|
+
66 MAIN 12 CBX CA CH3E 0.100000 15.0350 0
|
83
|
+
|
84
|
+
65 !NBOND: bonds
|
85
|
+
1 2 2 3 4 6 6 8
|
86
|
+
8 9 4 5 6 7 2 4
|
87
|
+
10 12 12 14 14 15 10 11
|
88
|
+
12 13 8 10 16 18 18 20
|
89
|
+
20 21 16 17 18 19 14 16
|
90
|
+
22 24 24 26 26 27 22 23
|
91
|
+
24 25 20 22 28 30 30 32
|
92
|
+
32 33 28 29 30 31 26 28
|
93
|
+
34 36 36 38 38 39 34 35
|
94
|
+
36 37 32 34 40 42 42 44
|
95
|
+
44 45 40 41 42 43 38 40
|
96
|
+
46 48 48 50 50 51 46 47
|
97
|
+
48 49 44 46 52 54 54 56
|
98
|
+
56 57 52 53 54 55 50 52
|
99
|
+
58 60 60 62 62 63 58 59
|
100
|
+
60 61 56 58 64 66 64 65
|
101
|
+
62 64
|
102
|
+
|
103
|
+
96 !NTHETA: angles
|
104
|
+
1 2 3 4 6 8 6 4 5
|
105
|
+
4 6 7 6 8 9 8 6 7
|
106
|
+
1 2 4 3 2 4 2 4 6
|
107
|
+
2 4 5 10 12 14 12 10 11
|
108
|
+
10 12 13 12 14 15 14 12 13
|
109
|
+
6 8 10 9 8 10 8 10 12
|
110
|
+
8 10 11 16 18 20 18 16 17
|
111
|
+
16 18 19 18 20 21 20 18 19
|
112
|
+
12 14 16 15 14 16 14 16 18
|
113
|
+
14 16 17 22 24 26 24 22 23
|
114
|
+
22 24 25 24 26 27 26 24 25
|
115
|
+
18 20 22 21 20 22 20 22 24
|
116
|
+
20 22 23 28 30 32 30 28 29
|
117
|
+
28 30 31 30 32 33 32 30 31
|
118
|
+
24 26 28 27 26 28 26 28 30
|
119
|
+
26 28 29 34 36 38 36 34 35
|
120
|
+
34 36 37 36 38 39 38 36 37
|
121
|
+
30 32 34 33 32 34 32 34 36
|
122
|
+
32 34 35 40 42 44 42 40 41
|
123
|
+
40 42 43 42 44 45 44 42 43
|
124
|
+
36 38 40 39 38 40 38 40 42
|
125
|
+
38 40 41 46 48 50 48 46 47
|
126
|
+
46 48 49 48 50 51 50 48 49
|
127
|
+
42 44 46 45 44 46 44 46 48
|
128
|
+
44 46 47 52 54 56 54 52 53
|
129
|
+
52 54 55 54 56 57 56 54 55
|
130
|
+
48 50 52 51 50 52 50 52 54
|
131
|
+
50 52 53 58 60 62 60 58 59
|
132
|
+
58 60 61 60 62 63 62 60 61
|
133
|
+
54 56 58 57 56 58 56 58 60
|
134
|
+
56 58 59 66 64 65 60 62 64
|
135
|
+
63 62 64 62 64 66 62 64 65
|
136
|
+
|
137
|
+
31 !NPHI: dihedrals
|
138
|
+
2 4 6 8 1 2 4 6
|
139
|
+
8 10 12 14 4 6 8 10
|
140
|
+
6 8 10 12 14 16 18 20
|
141
|
+
10 12 14 16 12 14 16 18
|
142
|
+
20 22 24 26 16 18 20 22
|
143
|
+
18 20 22 24 26 28 30 32
|
144
|
+
22 24 26 28 24 26 28 30
|
145
|
+
32 34 36 38 28 30 32 34
|
146
|
+
30 32 34 36 38 40 42 44
|
147
|
+
34 36 38 40 36 38 40 42
|
148
|
+
44 46 48 50 40 42 44 46
|
149
|
+
42 44 46 48 50 52 54 56
|
150
|
+
46 48 50 52 48 50 52 54
|
151
|
+
56 58 60 62 52 54 56 58
|
152
|
+
54 56 58 60 58 60 62 64
|
153
|
+
60 62 64 66
|
154
|
+
|
155
|
+
32 !NIMPHI: impropers
|
156
|
+
6 4 8 7 2 1 4 3
|
157
|
+
4 2 6 5 12 10 14 13
|
158
|
+
8 6 10 9 10 8 12 11
|
159
|
+
18 16 20 19 14 12 16 15
|
160
|
+
16 14 18 17 24 22 26 25
|
161
|
+
20 18 22 21 22 20 24 23
|
162
|
+
30 28 32 31 26 24 28 27
|
163
|
+
28 26 30 29 36 34 38 37
|
164
|
+
32 30 34 33 34 32 36 35
|
165
|
+
42 40 44 43 38 36 40 39
|
166
|
+
40 38 42 41 48 46 50 49
|
167
|
+
44 42 46 45 46 44 48 47
|
168
|
+
54 52 56 55 50 48 52 51
|
169
|
+
52 50 54 53 60 58 62 61
|
170
|
+
56 54 58 57 58 56 60 59
|
171
|
+
62 60 64 63 64 62 66 65
|
172
|
+
|
173
|
+
11 !NDON: donors
|
174
|
+
4 5 10 11 16 17 22 23
|
175
|
+
28 29 34 35 40 41 46 47
|
176
|
+
52 53 58 59 64 65
|
177
|
+
|
178
|
+
11 !NACC: acceptors
|
179
|
+
3 2 9 8 15 14 21 20
|
180
|
+
27 26 33 32 39 38 45 44
|
181
|
+
51 50 57 56 63 62
|
182
|
+
|
183
|
+
0 !NNB
|
184
|
+
|
185
|
+
0 0 0 0 0 0 0 0
|
186
|
+
0 0 0 0 0 0 0 0
|
187
|
+
0 0 0 0 0 0 0 0
|
188
|
+
0 0 0 0 0 0 0 0
|
189
|
+
0 0 0 0 0 0 0 0
|
190
|
+
0 0 0 0 0 0 0 0
|
191
|
+
0 0 0 0 0 0 0 0
|
192
|
+
0 0 0 0 0 0 0 0
|
193
|
+
0 0
|
194
|
+
|
195
|
+
33 0 !NGRP
|
196
|
+
0 0 0 1 0 0 3 0 0
|
197
|
+
6 0 0 7 0 0 9 0 0
|
198
|
+
12 0 0 13 0 0 15 0 0
|
199
|
+
18 0 0 19 0 0 21 0 0
|
200
|
+
24 0 0 25 0 0 27 0 0
|
201
|
+
30 0 0 31 0 0 33 0 0
|
202
|
+
36 0 0 37 0 0 39 0 0
|
203
|
+
42 0 0 43 0 0 45 0 0
|
204
|
+
48 0 0 49 0 0 51 0 0
|
205
|
+
54 0 0 55 0 0 57 0 0
|
206
|
+
60 0 0 61 0 0 63 0 0
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# This is a test namd configuration file
|
2
|
+
|
3
|
+
timestep 0.5
|
4
|
+
numsteps 10
|
5
|
+
structure alanin.psf
|
6
|
+
parameters alanin.params
|
7
|
+
coordinates alanin.pdb
|
8
|
+
exclude scaled1-4
|
9
|
+
1-4scaling 0.4
|
10
|
+
outputname output[myReplica]
|
11
|
+
margin 1.0
|
12
|
+
stepspercycle 3
|
13
|
+
temperature 0
|
14
|
+
|
15
|
+
switching on
|
16
|
+
switchdist 7.0
|
17
|
+
cutoff 8.0
|
18
|
+
pairlistdist 9.0
|
19
|
+
|
20
|
+
# Add box dimensions
|
21
|
+
cellBasisVector1 32.76 0.0 0.0
|
22
|
+
cellBasisVector2 0.0 31.66 0.0
|
23
|
+
cellBasisVector3 0.0 0.0 32.89
|
24
|
+
|
25
|
+
DCDfile alanin.dcd
|
26
|
+
DCDfreq 1
|
27
|
+
DCDUnitCell yes
|
28
|
+
velDcdFile alanin.vel.dcd
|
29
|
+
velDcdFreq 1
|
30
|
+
forceDcdFile alanin.force.dcd
|
31
|
+
forceDcdFreq 1
|
32
|
+
XSTFile alanin.xst
|
33
|
+
xstFreq 1
|
34
|
+
|
35
|
+
#restartname alanin.restart
|
36
|
+
#restartfreq 10
|
37
|
+
|
38
|
+
#langevin on
|
39
|
+
#langevinTemp 300.0
|
40
|
+
#langevincol O
|
41
|
+
|
42
|
+
#constraints on
|
43
|
+
|
44
|
+
#fma on
|
45
|
+
|
46
|
+
seed 12345
|
47
|
+
|
48
|
+
IMDon yes
|
49
|
+
IMDport 8888
|
50
|
+
IMDfreq 1
|
51
|
+
IMDwait on
|
52
|
+
IMDversion 3
|
53
|
+
IMDsendPositions yes
|
54
|
+
IMDsendEnergies yes
|
55
|
+
IMDsendTime yes
|
56
|
+
IMDsendBoxDimensions yes
|
57
|
+
IMDsendVelocities yes
|
58
|
+
IMDsendForces yes
|
59
|
+
IMDwrapPositions yes
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
NAMD_BINARY="namd3"
|
4
|
+
CONFIG_FILE="namd_v3_nst_1.namd"
|
5
|
+
OUTPUT_FILE="namd_output.log"
|
6
|
+
TOPOL_PATH="alanin.pdb"
|
7
|
+
TRAJ_PATH="alanin.dcd"
|
8
|
+
VEL_PATH="alanin.vel.dcd"
|
9
|
+
FORCE_PATH="alanin.force.dcd"
|
10
|
+
|
11
|
+
# Parse args
|
12
|
+
while [[ $# -gt 0 ]]; do
|
13
|
+
case $1 in
|
14
|
+
--namd_binary)
|
15
|
+
NAMD_BINARY="$2"
|
16
|
+
shift 2
|
17
|
+
;;
|
18
|
+
--config_file)
|
19
|
+
CONFIG_FILE="$2"
|
20
|
+
shift 2
|
21
|
+
;;
|
22
|
+
--topol_path)
|
23
|
+
TOPOL_PATH="$2"
|
24
|
+
shift 2
|
25
|
+
;;
|
26
|
+
--traj_path)
|
27
|
+
TRAJ_PATH="$2"
|
28
|
+
shift 2
|
29
|
+
;;
|
30
|
+
--vel_path)
|
31
|
+
VEL_PATH="$2"
|
32
|
+
shift 2
|
33
|
+
;;
|
34
|
+
--force_path)
|
35
|
+
FORCE_PATH="$2"
|
36
|
+
shift 2
|
37
|
+
;;
|
38
|
+
*)
|
39
|
+
echo "Unknown argument: $1"
|
40
|
+
exit 1
|
41
|
+
;;
|
42
|
+
esac
|
43
|
+
done
|
44
|
+
|
45
|
+
# Start the simulation
|
46
|
+
$NAMD_BINARY $CONFIG_FILE &> "$OUTPUT_FILE" &
|
47
|
+
|
48
|
+
# Wait for the simulation to be ready
|
49
|
+
await_namd_imd() {
|
50
|
+
grep -q "INTERACTIVE MD AWAITING CONNECTION" $OUTPUT_FILE
|
51
|
+
}
|
52
|
+
|
53
|
+
while ! await_namd_imd; do
|
54
|
+
echo "Waiting for NAMD IMD readiness in $OUTPUT_FILE..."
|
55
|
+
sleep 5
|
56
|
+
done
|
57
|
+
|
58
|
+
# Run the test
|
59
|
+
|
60
|
+
echo "Running test with the following parameters:"
|
61
|
+
echo " Topology file: $TOPOL_PATH"
|
62
|
+
echo " Trajectory file: $TRAJ_PATH"
|
63
|
+
echo " Velocity file: $VEL_PATH"
|
64
|
+
echo " Force file: $FORCE_PATH"
|
65
|
+
|
66
|
+
python ../../test_manual.py \
|
67
|
+
--topol_path "$TOPOL_PATH" \
|
68
|
+
--traj_path "$TRAJ_PATH" \
|
69
|
+
--vel_path "$VEL_PATH" \
|
70
|
+
--force_path "$FORCE_PATH" \
|
71
|
+
--first_frame 0
|
imdclient/tests/server.py
CHANGED
@@ -93,7 +93,7 @@ class InThreadIMDServer:
|
|
93
93
|
positions,
|
94
94
|
wrapped_coords,
|
95
95
|
velocities,
|
96
|
-
forces
|
96
|
+
forces,
|
97
97
|
)
|
98
98
|
logger.debug(f"InThreadIMDServer: Sending session info")
|
99
99
|
self.conn.sendall(sinfo)
|
@@ -101,14 +101,6 @@ class InThreadIMDServer:
|
|
101
101
|
def join_accept_thread(self):
|
102
102
|
self.accept_thread.join()
|
103
103
|
|
104
|
-
def _expect_go(self):
|
105
|
-
logger.debug(f"InThreadIMDServer: Waiting for go")
|
106
|
-
head_buf = bytearray(IMDHEADERSIZE)
|
107
|
-
read_into_buf(self.conn, head_buf)
|
108
|
-
header = IMDHeader(head_buf)
|
109
|
-
if header.type != IMDHeaderType.IMD_GO:
|
110
|
-
raise ValueError("Expected IMD_GO packet, got something else")
|
111
|
-
|
112
104
|
def send_frames(self, start, end):
|
113
105
|
for i in range(start, end):
|
114
106
|
self.send_frame(i)
|
@@ -126,7 +118,7 @@ class InThreadIMDServer:
|
|
126
118
|
)
|
127
119
|
|
128
120
|
self.conn.sendall(time_header + time)
|
129
|
-
|
121
|
+
|
130
122
|
if self.imdsinfo.energies:
|
131
123
|
energy_header = create_header_bytes(IMDHeaderType.IMD_ENERGIES, 1)
|
132
124
|
energies = create_energy_bytes(
|
@@ -183,7 +175,6 @@ class InThreadIMDServer:
|
|
183
175
|
|
184
176
|
self.conn.sendall(force_header + force)
|
185
177
|
|
186
|
-
|
187
178
|
def expect_packet(self, packet_type, expected_length=None):
|
188
179
|
head_buf = bytearray(IMDHEADERSIZE)
|
189
180
|
read_into_buf(self.conn, head_buf)
|
@@ -69,6 +69,7 @@ class TestIMDClientV3:
|
|
69
69
|
buffer_size=imdframe_memsize(universe.trajectory.n_atoms, imdsinfo)
|
70
70
|
* 2,
|
71
71
|
)
|
72
|
+
server.join_accept_thread()
|
72
73
|
yield server, client
|
73
74
|
client.stop()
|
74
75
|
server.cleanup()
|
@@ -84,6 +85,7 @@ class TestIMDClientV3:
|
|
84
85
|
port,
|
85
86
|
universe.trajectory.n_atoms,
|
86
87
|
)
|
88
|
+
server.join_accept_thread()
|
87
89
|
yield server, client
|
88
90
|
client.stop()
|
89
91
|
server.cleanup()
|
@@ -149,6 +151,22 @@ class TestIMDClientV3:
|
|
149
151
|
# server should receive disconnect from client (though it doesn't have to do anything)
|
150
152
|
server.expect_packet(IMDHeaderType.IMD_DISCONNECT)
|
151
153
|
|
154
|
+
@pytest.mark.parametrize("cont", [True, False])
|
155
|
+
def test_continue_after_disconnect(self, universe, imdsinfo, port, cont):
|
156
|
+
server = InThreadIMDServer(universe.trajectory)
|
157
|
+
server.set_imdsessioninfo(imdsinfo)
|
158
|
+
server.handshake_sequence("localhost", port, first_frame=False)
|
159
|
+
client = IMDClient(
|
160
|
+
f"localhost",
|
161
|
+
port,
|
162
|
+
universe.trajectory.n_atoms,
|
163
|
+
continue_after_disconnect=cont,
|
164
|
+
)
|
165
|
+
server.join_accept_thread()
|
166
|
+
server.expect_packet(
|
167
|
+
IMDHeaderType.IMD_WAIT, expected_length=(int)(not cont)
|
168
|
+
)
|
169
|
+
|
152
170
|
|
153
171
|
class TestIMDClientV3ContextManager:
|
154
172
|
@pytest.fixture
|
@@ -171,7 +171,9 @@ class TestIMDReaderBaseAPI(MultiframeReaderTest):
|
|
171
171
|
decimal=ref.prec,
|
172
172
|
)
|
173
173
|
|
174
|
-
@pytest.mark.skip(
|
174
|
+
@pytest.mark.skip(
|
175
|
+
reason="Stream-based reader can only be read iteratively"
|
176
|
+
)
|
175
177
|
def test_changing_dimensions(self, ref, reader):
|
176
178
|
if ref.changing_dimensions:
|
177
179
|
reader.rewind()
|
@@ -656,3 +658,60 @@ def test_n_atoms_mismatch():
|
|
656
658
|
f"imd://localhost:{port}",
|
657
659
|
n_atoms=universe.trajectory.n_atoms + 1,
|
658
660
|
)
|
661
|
+
|
662
|
+
# raise errors for incompatible methods
|
663
|
+
class TestIMDReaderBaseAPIExceptions():
|
664
|
+
|
665
|
+
@pytest.fixture
|
666
|
+
def reader(self):
|
667
|
+
universe = mda.Universe(COORDINATES_TOPOLOGY, COORDINATES_H5MD)
|
668
|
+
imdsinfo = create_default_imdsinfo_v3()
|
669
|
+
port = get_free_port()
|
670
|
+
server = InThreadIMDServer(universe.trajectory)
|
671
|
+
server.set_imdsessioninfo(imdsinfo)
|
672
|
+
server.handshake_sequence("localhost", port, first_frame=True)
|
673
|
+
|
674
|
+
reader = IMDReader(
|
675
|
+
f"imd://localhost:{port}", n_atoms=universe.trajectory.n_atoms
|
676
|
+
)
|
677
|
+
server.send_frames(1, 5)
|
678
|
+
yield reader
|
679
|
+
server.cleanup()
|
680
|
+
|
681
|
+
# test copy method
|
682
|
+
def test_copy_raises_notimplemented_error(self, reader):
|
683
|
+
with pytest.raises(NotImplementedError):
|
684
|
+
reader.copy()
|
685
|
+
|
686
|
+
# test _reopen method
|
687
|
+
def test_reopen_raises_runtime_error_on_second_call(self, reader):
|
688
|
+
# First call should be fine
|
689
|
+
reader._reopen()
|
690
|
+
# Second call should raise RuntimeError
|
691
|
+
with pytest.raises(RuntimeError):
|
692
|
+
reader._reopen()
|
693
|
+
|
694
|
+
# test n_frames
|
695
|
+
def test_n_frames_raises_runtime_error(self, reader):
|
696
|
+
with pytest.raises(RuntimeError):
|
697
|
+
reader.n_frames()
|
698
|
+
|
699
|
+
# test __len__
|
700
|
+
def test_len_raises_runtime_error(self, reader):
|
701
|
+
with pytest.raises(RuntimeError):
|
702
|
+
reader.__len__()
|
703
|
+
|
704
|
+
# test rewind method
|
705
|
+
def test_rewind_raises_error(self, reader):
|
706
|
+
with pytest.raises(RuntimeError):
|
707
|
+
reader.rewind()
|
708
|
+
|
709
|
+
# Test __getstate__ method
|
710
|
+
def test_getstate_raises_notimplemented_error(self, reader):
|
711
|
+
with pytest.raises(NotImplementedError):
|
712
|
+
reader.__getstate__()
|
713
|
+
|
714
|
+
# Test __setstate__ method
|
715
|
+
def test_setstate_raises_notimplemented_error(self, reader):
|
716
|
+
with pytest.raises(NotImplementedError):
|
717
|
+
reader.__setstate__(None)
|