imdclient 0.1.3__py3-none-any.whl → 0.2.0b0__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/IMDClient.py +43 -12
- imdclient/IMDProtocol.py +1 -0
- imdclient/__init__.py +0 -5
- imdclient/data/gromacs/md/gromacs_v3_nst1.mdp +3 -3
- imdclient/data/namd/md/namd3 +0 -0
- imdclient/data/namd/md/namd_v3_nst_1.namd +1 -1
- imdclient/tests/base.py +108 -83
- imdclient/tests/conftest.py +0 -39
- imdclient/tests/datafiles.py +16 -1
- imdclient/tests/docker_testing/docker.md +1 -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 +147 -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/minimalreader.py +86 -0
- imdclient/tests/server.py +6 -14
- imdclient/tests/test_gromacs.py +15 -3
- imdclient/tests/test_imdclient.py +26 -7
- imdclient/tests/test_lammps.py +22 -19
- imdclient/tests/test_manual.py +224 -66
- imdclient/tests/test_namd.py +39 -16
- imdclient/tests/test_utils.py +31 -0
- imdclient/utils.py +50 -17
- {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/METADATA +60 -39
- imdclient-0.2.0b0.dist-info/RECORD +53 -0
- {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/WHEEL +1 -1
- {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info/licenses}/AUTHORS.md +4 -1
- {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info/licenses}/LICENSE +3 -1
- imdclient/IMD.py +0 -130
- imdclient/backends.py +0 -352
- imdclient/results.py +0 -332
- imdclient/streamanalysis.py +0 -1056
- imdclient/streambase.py +0 -199
- imdclient/tests/test_imdreader.py +0 -658
- imdclient/tests/test_stream_analysis.py +0 -61
- imdclient-0.1.3.dist-info/RECORD +0 -42
- {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/top_level.txt +0 -0
imdclient/streambase.py
DELETED
@@ -1,199 +0,0 @@
|
|
1
|
-
from MDAnalysis.coordinates.base import (
|
2
|
-
ReaderBase,
|
3
|
-
FrameIteratorBase,
|
4
|
-
FrameIteratorAll,
|
5
|
-
)
|
6
|
-
import numbers
|
7
|
-
import warnings
|
8
|
-
|
9
|
-
|
10
|
-
class StreamReaderBase(ReaderBase):
|
11
|
-
|
12
|
-
def __init__(self, filename, convert_units=True, **kwargs):
|
13
|
-
super(StreamReaderBase, self).__init__(
|
14
|
-
filename, convert_units=convert_units, **kwargs
|
15
|
-
)
|
16
|
-
self._init_scope = True
|
17
|
-
self._reopen_called = False
|
18
|
-
self._first_ts = None
|
19
|
-
|
20
|
-
def _read_next_timestep(self):
|
21
|
-
# No rewinding- to both load the first frame after __init__
|
22
|
-
# and access it again during iteration, we need to store first ts in mem
|
23
|
-
if not self._init_scope and self._frame == -1:
|
24
|
-
self._frame += 1
|
25
|
-
# can't simply return the same ts again- transformations would be applied twice
|
26
|
-
# instead, return the pre-transformed copy
|
27
|
-
return self._first_ts
|
28
|
-
|
29
|
-
ts = self._read_frame(self._frame + 1)
|
30
|
-
|
31
|
-
if self._init_scope:
|
32
|
-
self._first_ts = self.ts.copy()
|
33
|
-
self._init_scope = False
|
34
|
-
|
35
|
-
return ts
|
36
|
-
|
37
|
-
@property
|
38
|
-
def n_frames(self):
|
39
|
-
"""Changes as stream is processed unlike other readers"""
|
40
|
-
raise RuntimeError(
|
41
|
-
"{}: n_frames is unknown".format(self.__class__.__name__)
|
42
|
-
)
|
43
|
-
|
44
|
-
def __len__(self):
|
45
|
-
raise RuntimeError(
|
46
|
-
"{} has unknown length".format(self.__class__.__name__)
|
47
|
-
)
|
48
|
-
|
49
|
-
def next(self):
|
50
|
-
"""Don't rewind after iteration. When _reopen() is called,
|
51
|
-
an error will be raised
|
52
|
-
"""
|
53
|
-
try:
|
54
|
-
ts = self._read_next_timestep()
|
55
|
-
except (EOFError, IOError):
|
56
|
-
# Don't rewind here like we normally would
|
57
|
-
raise StopIteration from None
|
58
|
-
else:
|
59
|
-
for auxname, reader in self._auxs.items():
|
60
|
-
ts = self._auxs[auxname].update_ts(ts)
|
61
|
-
|
62
|
-
ts = self._apply_transformations(ts)
|
63
|
-
|
64
|
-
return ts
|
65
|
-
|
66
|
-
def rewind(self):
|
67
|
-
"""Raise error on rewind"""
|
68
|
-
raise RuntimeError(
|
69
|
-
"{}: Stream-based readers can't be rewound".format(
|
70
|
-
self.__class__.__name__
|
71
|
-
)
|
72
|
-
)
|
73
|
-
|
74
|
-
# Incompatible methods
|
75
|
-
def copy(self):
|
76
|
-
raise NotImplementedError(
|
77
|
-
"{} does not support copying".format(self.__class__.__name__)
|
78
|
-
)
|
79
|
-
|
80
|
-
def _reopen(self):
|
81
|
-
if self._reopen_called:
|
82
|
-
raise RuntimeError(
|
83
|
-
"{}: Cannot reopen stream".format(self.__class__.__name__)
|
84
|
-
)
|
85
|
-
self._frame = -1
|
86
|
-
self._reopen_called = True
|
87
|
-
|
88
|
-
def __getitem__(self, frame):
|
89
|
-
"""Return the Timestep corresponding to *frame*.
|
90
|
-
|
91
|
-
If `frame` is a integer then the corresponding frame is
|
92
|
-
returned. Negative numbers are counted from the end.
|
93
|
-
|
94
|
-
If frame is a :class:`slice` then an iterator is returned that
|
95
|
-
allows iteration over that part of the trajectory.
|
96
|
-
|
97
|
-
Note
|
98
|
-
----
|
99
|
-
*frame* is a 0-based frame index.
|
100
|
-
"""
|
101
|
-
if isinstance(frame, slice):
|
102
|
-
_, _, step = self.check_slice_indices(
|
103
|
-
frame.start, frame.stop, frame.step
|
104
|
-
)
|
105
|
-
if step is None:
|
106
|
-
return FrameIteratorAll(self)
|
107
|
-
else:
|
108
|
-
return StreamFrameIteratorSliced(self, step)
|
109
|
-
else:
|
110
|
-
raise TypeError(
|
111
|
-
"Streamed trajectories must be an indexed using a slice"
|
112
|
-
)
|
113
|
-
|
114
|
-
def check_slice_indices(self, start, stop, step):
|
115
|
-
if start is not None:
|
116
|
-
raise ValueError(
|
117
|
-
"{}: Cannot expect a start index from a stream, 'start' must be None".format(
|
118
|
-
self.__class__.__name__
|
119
|
-
)
|
120
|
-
)
|
121
|
-
if stop is not None:
|
122
|
-
raise ValueError(
|
123
|
-
"{}: Cannot expect a stop index from a stream, 'stop' must be None".format(
|
124
|
-
self.__class__.__name__
|
125
|
-
)
|
126
|
-
)
|
127
|
-
if step is not None:
|
128
|
-
if isinstance(step, numbers.Integral):
|
129
|
-
if step < 1:
|
130
|
-
raise ValueError(
|
131
|
-
"{}: Cannot go backwards in a stream, 'step' must be > 0".format(
|
132
|
-
self.__class__.__name__
|
133
|
-
)
|
134
|
-
)
|
135
|
-
else:
|
136
|
-
raise ValueError(
|
137
|
-
"{}: 'step' must be an integer".format(
|
138
|
-
self.__class__.__name__
|
139
|
-
)
|
140
|
-
)
|
141
|
-
|
142
|
-
return start, stop, step
|
143
|
-
|
144
|
-
def __getstate__(self):
|
145
|
-
raise NotImplementedError(
|
146
|
-
"{} does not support pickling".format(self.__class__.__name__)
|
147
|
-
)
|
148
|
-
|
149
|
-
def __setstate__(self, state: object):
|
150
|
-
raise NotImplementedError(
|
151
|
-
"{} does not support pickling".format(self.__class__.__name__)
|
152
|
-
)
|
153
|
-
|
154
|
-
def __repr__(self):
|
155
|
-
return (
|
156
|
-
"<{cls} {fname} with continuous stream of {natoms} atoms>"
|
157
|
-
"".format(
|
158
|
-
cls=self.__class__.__name__,
|
159
|
-
fname=self.filename,
|
160
|
-
natoms=self.n_atoms,
|
161
|
-
)
|
162
|
-
)
|
163
|
-
|
164
|
-
|
165
|
-
class StreamFrameIteratorSliced(FrameIteratorBase):
|
166
|
-
|
167
|
-
def __init__(self, trajectory, step):
|
168
|
-
super().__init__(trajectory)
|
169
|
-
self._step = step
|
170
|
-
|
171
|
-
def __iter__(self):
|
172
|
-
# Calling reopen tells reader
|
173
|
-
# it can't be reopened again
|
174
|
-
self.trajectory._reopen()
|
175
|
-
return self
|
176
|
-
|
177
|
-
def __next__(self):
|
178
|
-
try:
|
179
|
-
# Burn the timesteps until we reach the desired step
|
180
|
-
# Don't use next() to avoid unnecessary transformations
|
181
|
-
while self.trajectory._frame + 1 % self.step != 0:
|
182
|
-
self.trajectory._read_next_timestep()
|
183
|
-
except (EOFError, IOError):
|
184
|
-
# Don't rewind here like we normally would
|
185
|
-
raise StopIteration from None
|
186
|
-
|
187
|
-
return self.trajectory.next()
|
188
|
-
|
189
|
-
def __len__(self):
|
190
|
-
raise RuntimeError(
|
191
|
-
"{} has unknown length".format(self.__class__.__name__)
|
192
|
-
)
|
193
|
-
|
194
|
-
def __getitem__(self, frame):
|
195
|
-
raise RuntimeError("Sliced iterator does not support indexing")
|
196
|
-
|
197
|
-
@property
|
198
|
-
def step(self):
|
199
|
-
return self._step
|