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.
Files changed (48) hide show
  1. imdclient/IMDClient.py +43 -12
  2. imdclient/IMDProtocol.py +1 -0
  3. imdclient/__init__.py +0 -5
  4. imdclient/data/gromacs/md/gromacs_v3_nst1.mdp +3 -3
  5. imdclient/data/namd/md/namd3 +0 -0
  6. imdclient/data/namd/md/namd_v3_nst_1.namd +1 -1
  7. imdclient/tests/base.py +108 -83
  8. imdclient/tests/conftest.py +0 -39
  9. imdclient/tests/datafiles.py +16 -1
  10. imdclient/tests/docker_testing/docker.md +1 -1
  11. imdclient/tests/hpc_testing/gromacs/README.md +112 -0
  12. imdclient/tests/hpc_testing/gromacs/gmx_gpu_test.mdp +58 -0
  13. imdclient/tests/hpc_testing/gromacs/gmx_gpu_test.top +11764 -0
  14. imdclient/tests/hpc_testing/gromacs/struct.gro +21151 -0
  15. imdclient/tests/hpc_testing/gromacs/validate_gmx.sh +90 -0
  16. imdclient/tests/hpc_testing/lammps/README.md +62 -0
  17. imdclient/tests/hpc_testing/lammps/lammps_v3_nst_1.in +71 -0
  18. imdclient/tests/hpc_testing/lammps/topology_after_min.data +8022 -0
  19. imdclient/tests/hpc_testing/lammps/validate_lmp.sh +66 -0
  20. imdclient/tests/hpc_testing/namd/README.md +147 -0
  21. imdclient/tests/hpc_testing/namd/alanin.params +402 -0
  22. imdclient/tests/hpc_testing/namd/alanin.pdb +77 -0
  23. imdclient/tests/hpc_testing/namd/alanin.psf +206 -0
  24. imdclient/tests/hpc_testing/namd/namd_v3_nst_1.namd +59 -0
  25. imdclient/tests/hpc_testing/namd/validate_namd.sh +71 -0
  26. imdclient/tests/minimalreader.py +86 -0
  27. imdclient/tests/server.py +6 -14
  28. imdclient/tests/test_gromacs.py +15 -3
  29. imdclient/tests/test_imdclient.py +26 -7
  30. imdclient/tests/test_lammps.py +22 -19
  31. imdclient/tests/test_manual.py +224 -66
  32. imdclient/tests/test_namd.py +39 -16
  33. imdclient/tests/test_utils.py +31 -0
  34. imdclient/utils.py +50 -17
  35. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/METADATA +60 -39
  36. imdclient-0.2.0b0.dist-info/RECORD +53 -0
  37. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/WHEEL +1 -1
  38. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info/licenses}/AUTHORS.md +4 -1
  39. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info/licenses}/LICENSE +3 -1
  40. imdclient/IMD.py +0 -130
  41. imdclient/backends.py +0 -352
  42. imdclient/results.py +0 -332
  43. imdclient/streamanalysis.py +0 -1056
  44. imdclient/streambase.py +0 -199
  45. imdclient/tests/test_imdreader.py +0 -658
  46. imdclient/tests/test_stream_analysis.py +0 -61
  47. imdclient-0.1.3.dist-info/RECORD +0 -42
  48. {imdclient-0.1.3.dist-info → imdclient-0.2.0b0.dist-info}/top_level.txt +0 -0
imdclient/IMDClient.py CHANGED
@@ -1,18 +1,27 @@
1
1
  """
2
-
3
- IMDClient
4
- ^^^^^^^^^
2
+ IMDClient module
3
+ ================
5
4
 
6
5
  .. autoclass:: IMDClient
7
6
  :members:
8
7
 
8
+ .. autoclass:: BaseIMDProducer
9
+ :members:
10
+ :inherited-members:
11
+
12
+ .. autoclass:: IMDProducerV2
13
+ :members:
14
+ :inherited-members:
15
+
9
16
  .. autoclass:: IMDProducerV3
10
17
  :members:
11
18
  :inherited-members:
12
19
 
13
20
  .. autoclass:: IMDFrameBuffer
14
21
  :members:
15
-
22
+
23
+ .. autoclass:: IMDFrame
24
+ :members:
16
25
  """
17
26
 
18
27
  import socket
@@ -43,9 +52,13 @@ class IMDClient:
43
52
  socket_bufsize : int, (optional)
44
53
  Size of the socket buffer in bytes. Default is to use the system default
45
54
  buffer_size : int (optional)
46
- IMDFramebuffer will be filled with as many :class:`IMDFrame` fit in `buffer_size` bytes [``10MB``]
55
+ :class:`IMDFrameBuffer` will be filled with as many :class:`IMDFrame` fit in `buffer_size` bytes [``10MB``]
47
56
  timeout : int, optional
48
57
  Timeout for the socket in seconds [``5``]
58
+ continue_after_disconnect : bool, optional [``None``]
59
+ If True, the client will attempt to change the simulation engine's waiting behavior to
60
+ non-blocking after the client disconnects. If False, the client will attempt to change it
61
+ to blocking. If None, the client will not attempt to change the simulation engine's behavior.
49
62
  **kwargs : dict (optional)
50
63
  Additional keyword arguments to pass to the :class:`BaseIMDProducer` and :class:`IMDFrameBuffer`
51
64
  """
@@ -57,6 +70,7 @@ class IMDClient:
57
70
  n_atoms,
58
71
  socket_bufsize=None,
59
72
  multithreaded=True,
73
+ continue_after_disconnect=None,
60
74
  **kwargs,
61
75
  ):
62
76
 
@@ -64,6 +78,7 @@ class IMDClient:
64
78
  self._conn = self._connect_to_server(host, port, socket_bufsize)
65
79
  self._imdsinfo = self._await_IMD_handshake()
66
80
  self._multithreaded = multithreaded
81
+ self._continue_after_disconnect = continue_after_disconnect
67
82
 
68
83
  if self._multithreaded:
69
84
  self._buf = IMDFrameBuffer(
@@ -132,10 +147,11 @@ class IMDClient:
132
147
 
133
148
  self._producer.start()
134
149
 
135
- def signal_handler(self, sig, frame):
136
- """Catch SIGINT to allow clean shutdown on CTRL+C
150
+ def signal_handler(self):
151
+ """Catch SIGINT to allow clean shutdown on CTRL+C.
152
+
137
153
  This also ensures that main thread execution doesn't get stuck
138
- waiting in buf.pop_full_imdframe()"""
154
+ waiting in ``buf.pop_full_imdframe()``"""
139
155
  logger.debug("Intercepted signal")
140
156
  self.stop()
141
157
  logger.debug("Shutdown success")
@@ -292,6 +308,17 @@ class IMDClient:
292
308
  self._conn.sendall(go)
293
309
  logger.debug("IMDClient: Sent go packet to server")
294
310
 
311
+ if self._continue_after_disconnect is not None:
312
+ wait_behavior = (int)(not self._continue_after_disconnect)
313
+ wait_packet = create_header_bytes(
314
+ IMDHeaderType.IMD_WAIT, wait_behavior
315
+ )
316
+ self._conn.sendall(wait_packet)
317
+ logger.debug(
318
+ "IMDClient: Attempted to change wait behavior to %s",
319
+ not self._continue_after_disconnect,
320
+ )
321
+
295
322
  def _disconnect(self):
296
323
  # MUST disconnect before stopping execution
297
324
  # if simulation already ended, this method will do nothing
@@ -499,7 +526,14 @@ class BaseIMDProducer(threading.Thread):
499
526
 
500
527
  class IMDProducerV2(BaseIMDProducer):
501
528
  def __init__(
502
- self, conn, buffer, sinfo, n_atoms, multithreaded, error_queue, **kwargs
529
+ self,
530
+ conn,
531
+ buffer,
532
+ sinfo,
533
+ n_atoms,
534
+ multithreaded,
535
+ error_queue,
536
+ **kwargs,
503
537
  ):
504
538
  super(IMDProducerV2, self).__init__(
505
539
  conn, buffer, sinfo, n_atoms, multithreaded, error_queue, **kwargs
@@ -713,9 +747,6 @@ class IMDProducerV3(BaseIMDProducer):
713
747
  ).reshape((self._n_atoms, 3)),
714
748
  )
715
749
 
716
- def __del__(self):
717
- logger.debug("IMDProducer: I am being deleted")
718
-
719
750
 
720
751
  class IMDFrameBuffer:
721
752
  """
imdclient/IMDProtocol.py CHANGED
@@ -34,6 +34,7 @@ class IMDHeaderType(Enum):
34
34
  IMD_BOX = 13
35
35
  IMD_VELOCITIES = 14
36
36
  IMD_FORCES = 15
37
+ IMD_WAIT = 16
37
38
 
38
39
 
39
40
  def parse_energy_bytes(data, endianness):
imdclient/__init__.py CHANGED
@@ -6,9 +6,4 @@ IMDClient
6
6
  from .IMDClient import IMDClient
7
7
  from importlib.metadata import version
8
8
 
9
- from .streamanalysis import AnalysisBase, StackableAnalysis
10
- from MDAnalysis.analysis import base
11
-
12
- base.AnalysisBase = AnalysisBase
13
-
14
9
  __version__ = version("imdclient")
@@ -1,5 +1,5 @@
1
1
  title = PRODUCTION IN NPT
2
- ld-seed = 1
2
+ ld-seed = 1
3
3
  ; Run parameters
4
4
  integrator = md ; leap-frog integrator
5
5
  nsteps = 100 ; 1 * 1000 = 1 ps
@@ -7,9 +7,9 @@ dt = 0.001 ; 1 fs
7
7
  ; Output control
8
8
  nstxout = 1 ; save coordinates every 1 fs
9
9
  nstvout = 1 ; save velocities every 1 fs
10
- nstfout = 1
10
+ nstfout = 1 ; save forces every 1 fs
11
11
  nstenergy = 1 ; save energies every 1 fs
12
- nstlog = 10 ; update log file every 1 ps
12
+ nstlog = 10
13
13
  ; Center of mass (COM) motion
14
14
  nstcomm = 10 ; remove COM motion every 10 steps
15
15
  comm-mode = Linear ; remove only COM translation (liquids in PBC)
Binary file
@@ -1,7 +1,7 @@
1
1
  # This is a test namd configuration file
2
2
 
3
3
  timestep 0.5
4
- numsteps 10
4
+ numsteps 100
5
5
  structure alanin.psf
6
6
  parameters alanin.params
7
7
  coordinates alanin.pdb
imdclient/tests/base.py CHANGED
@@ -1,20 +1,17 @@
1
- from imdclient.IMDClient import IMDClient
2
- from imdclient.IMD import IMDReader
3
- import pytest
4
- from pathlib import Path
5
- import os
6
- import signal
7
- import subprocess
8
1
  import time
2
+ import logging
3
+ import shutil
4
+
5
+ import pytest
6
+ import numpy as np
9
7
  from numpy.testing import (
10
8
  assert_allclose,
11
9
  )
12
- import numpy as np
13
10
  import docker
14
- import logging
15
- import shutil
16
11
  import MDAnalysis as mda
12
+
17
13
  from .utils import get_free_port
14
+ from .minimalreader import MinimalReader
18
15
 
19
16
  logger = logging.getLogger("imdclient.IMDClient")
20
17
 
@@ -64,6 +61,10 @@ def assert_allclose_with_logging(a, b, rtol=1e-07, atol=0, equal_nan=False):
64
61
 
65
62
  class IMDv3IntegrationTest:
66
63
 
64
+ @pytest.fixture()
65
+ def container_name(self):
66
+ return "ghcr.io/becksteinlab/streaming-md-docker:main-common-cpu"
67
+
67
68
  @pytest.fixture()
68
69
  def setup_command(self):
69
70
  return None
@@ -80,12 +81,13 @@ class IMDv3IntegrationTest:
80
81
  setup_command,
81
82
  simulation_command,
82
83
  port,
84
+ container_name,
83
85
  ):
84
86
  # In CI, container process needs access to tmp_path
85
87
  tmp_path.chmod(0o777)
86
88
  docker_client = docker.from_env()
87
89
  img = docker_client.images.pull(
88
- "ghcr.io/becksteinlab/streaming-md-docker:main-Common-CPU"
90
+ container_name,
89
91
  )
90
92
  # Copy input files into tmp_path
91
93
  for inp in input_files:
@@ -123,13 +125,11 @@ class IMDv3IntegrationTest:
123
125
 
124
126
  @pytest.fixture()
125
127
  def imd_u(self, docker_client, topol, tmp_path, port):
126
- u = mda.Universe((tmp_path / topol), f"imd://localhost:{port}")
127
- with mda.Writer(
128
- (tmp_path / "imd.trr").as_posix(), u.trajectory.n_atoms
129
- ) as w:
130
- for ts in u.trajectory:
131
- w.write(u.atoms)
132
- yield mda.Universe((tmp_path / topol), (tmp_path / "imd.trr"))
128
+ n_atoms = mda.Universe(tmp_path / topol).atoms.n_atoms
129
+ u = MinimalReader(
130
+ f"imd://localhost:{port}", n_atoms=n_atoms, process_stream=True
131
+ )
132
+ yield u
133
133
 
134
134
  @pytest.fixture()
135
135
  def true_u(self, topol, traj, imd_u, tmp_path):
@@ -139,72 +139,97 @@ class IMDv3IntegrationTest:
139
139
  )
140
140
  yield u
141
141
 
142
- @pytest.fixture()
143
- def comp_time(self):
144
- return True
142
+ def test_compare_imd_to_true_traj(self, imd_u, true_u, first_frame, dt):
143
+ for i in range(first_frame, len(true_u.trajectory)):
145
144
 
146
- @pytest.fixture()
147
- def comp_dt(self):
148
- return True
145
+ assert_allclose(
146
+ true_u.trajectory[i].time,
147
+ imd_u.trajectory[i - first_frame].time,
148
+ atol=1e-03,
149
+ )
149
150
 
150
- @pytest.fixture()
151
- def comp_step(self):
152
- return True
151
+ assert_allclose(
152
+ dt,
153
+ imd_u.trajectory[i - first_frame].dt,
154
+ atol=1e-03,
155
+ )
156
+
157
+ assert_allclose(
158
+ true_u.trajectory[i].data["step"],
159
+ imd_u.trajectory[i - first_frame].step,
160
+ )
161
+
162
+ assert_allclose_with_logging(
163
+ true_u.trajectory[i].dimensions,
164
+ imd_u.trajectory[i - first_frame].dimensions,
165
+ atol=1e-03,
166
+ )
167
+
168
+ assert_allclose_with_logging(
169
+ true_u.trajectory[i].positions,
170
+ imd_u.trajectory[i - first_frame].positions,
171
+ atol=1e-03,
172
+ )
173
+
174
+ assert_allclose_with_logging(
175
+ true_u.trajectory[i].velocities,
176
+ imd_u.trajectory[i - first_frame].velocities,
177
+ atol=1e-03,
178
+ )
179
+
180
+ assert_allclose_with_logging(
181
+ true_u.trajectory[i].forces,
182
+ imd_u.trajectory[i - first_frame].forces,
183
+ atol=1e-03,
184
+ )
153
185
 
154
- def test_compare_imd_to_true_traj(
155
- self, imd_u, true_u, first_frame, comp_time, comp_dt, comp_step
186
+ def test_continue_after_disconnect(
187
+ self, docker_client, topol, tmp_path, port
156
188
  ):
157
- for i in range(first_frame, len(true_u.trajectory)):
158
- if comp_time:
159
- assert_allclose(
160
- true_u.trajectory[i].time,
161
- imd_u.trajectory[i - first_frame].time,
162
- atol=1e-03,
163
- )
164
- if comp_dt:
165
- assert_allclose(
166
- true_u.trajectory[i].dt,
167
- imd_u.trajectory[i - first_frame].dt,
168
- atol=1e-03,
169
- )
170
- if comp_step:
171
- assert_allclose(
172
- true_u.trajectory[i].data["step"],
173
- imd_u.trajectory[i - first_frame].data["step"],
174
- )
175
- if (
176
- true_u.trajectory[i].dimensions is not None
177
- and imd_u.trajectory[i - first_frame].dimensions is not None
178
- ):
179
- assert_allclose_with_logging(
180
- true_u.trajectory[i].dimensions,
181
- imd_u.trajectory[i - first_frame].dimensions,
182
- atol=1e-03,
183
- )
184
- if (
185
- true_u.trajectory[i].has_positions
186
- and imd_u.trajectory[i - first_frame].has_positions
187
- ):
188
- assert_allclose_with_logging(
189
- true_u.trajectory[i].positions,
190
- imd_u.trajectory[i - first_frame].positions,
191
- atol=1e-03,
192
- )
193
- if (
194
- true_u.trajectory[i].has_velocities
195
- and imd_u.trajectory[i - first_frame].has_velocities
196
- ):
197
- assert_allclose_with_logging(
198
- true_u.trajectory[i].velocities,
199
- imd_u.trajectory[i - first_frame].velocities,
200
- atol=1e-03,
201
- )
202
- if (
203
- true_u.trajectory[i].has_forces
204
- and imd_u.trajectory[i - first_frame].has_forces
205
- ):
206
- assert_allclose_with_logging(
207
- true_u.trajectory[i].forces,
208
- imd_u.trajectory[i - first_frame].forces,
209
- atol=1e-03,
210
- )
189
+ n_atoms = mda.Universe(
190
+ tmp_path / topol,
191
+ # Make sure LAMMPS topol can be read
192
+ # Does nothing if not LAMMPS
193
+ atom_style="id type x y z",
194
+ ).atoms.n_atoms
195
+ u = MinimalReader(
196
+ f"imd://localhost:{port}",
197
+ n_atoms=n_atoms,
198
+ continue_after_disconnect=True,
199
+ )
200
+ # Though we disconnect here, the simulation should continue
201
+ u.close()
202
+ # Wait for the simulation to finish running
203
+ time.sleep(45)
204
+
205
+ # Now, attempt to reconnect- should fail,
206
+ # since the simulation should have continued
207
+ with pytest.raises(IOError):
208
+ n_atoms = mda.Universe(
209
+ tmp_path / topol,
210
+ atom_style="id type x y z",
211
+ ).atoms.n_atoms
212
+ u = MinimalReader(f"imd://localhost:{port}", n_atoms=n_atoms)
213
+
214
+ def test_wait_after_disconnect(self, docker_client, topol, tmp_path, port):
215
+ n_atoms = mda.Universe(
216
+ tmp_path / topol,
217
+ # Make sure LAMMPS topol can be read
218
+ # Does nothing if not LAMMPS
219
+ atom_style="id type x y z",
220
+ ).atoms.n_atoms
221
+ u = MinimalReader(
222
+ f"imd://localhost:{port}",
223
+ n_atoms=n_atoms,
224
+ continue_after_disconnect=False,
225
+ )
226
+ u.close()
227
+ # Give the simulation engine
228
+ # enough time to finish running (though it shouldn't)
229
+ time.sleep(45)
230
+
231
+ n_atoms = mda.Universe(
232
+ tmp_path / topol,
233
+ atom_style="id type x y z",
234
+ ).atoms.n_atoms
235
+ u = MinimalReader(f"imd://localhost:{port}", n_atoms=n_atoms)
@@ -1,42 +1,3 @@
1
1
  """
2
2
  Global pytest fixtures
3
3
  """
4
-
5
-
6
- # Command line arguments for 'test_manual.py'
7
- def pytest_addoption(parser):
8
- parser.addoption(
9
- "--topol_path_arg",
10
- action="store",
11
- default=None,
12
- )
13
- parser.addoption(
14
- "--traj_path_arg",
15
- action="store",
16
- default=None,
17
- )
18
- parser.addoption(
19
- "--first_frame_arg", action="store", type=int, default=None
20
- )
21
-
22
-
23
- def pytest_generate_tests(metafunc):
24
- # This is called for every test. Only get/set command line arguments
25
- # if the argument is specified in the list of test "fixturenames".
26
- topol = metafunc.config.option.topol_path_arg
27
- traj = metafunc.config.option.traj_path_arg
28
- first_frame = metafunc.config.option.first_frame_arg
29
-
30
- if all(
31
- arg in metafunc.fixturenames
32
- for arg in ["topol_path_arg", "traj_path_arg", "first_frame_arg"]
33
- ):
34
- if topol is None or traj is None or first_frame is None:
35
- raise ValueError(
36
- "Must pass all three of '--topol_path_arg <path/to/topology>', "
37
- + "'--traj_path_arg <path/to/trajectory>', "
38
- + "'--first_frame_arg <first traj frame to compare to IMD>"
39
- )
40
- metafunc.parametrize("topol_path_arg", [topol])
41
- metafunc.parametrize("traj_path_arg", [traj])
42
- metafunc.parametrize("first_frame_arg", [first_frame])
@@ -8,7 +8,22 @@ Use as ::
8
8
 
9
9
  """
10
10
 
11
- __all__ = ["LAMMPS_IN", "LAMMPS_TOPOL", "GROMACS_TRAJ", "GROMACS_MDP"]
11
+ __all__ = [
12
+ "LAMMPS_TOPOL",
13
+ "LAMMPS_IN_NST_1",
14
+ "LAMMPS_IN_NST_8",
15
+ "GROMACS_TRAJ",
16
+ "GROMACS_MDP",
17
+ "GROMACS_TOP",
18
+ "GROMACS_GRO",
19
+ "GROMACS_MDP_NST_1",
20
+ "GROMACS_MDP_NST_8",
21
+ "NAMD_TOPOL",
22
+ "NAMD_CONF_NST_1",
23
+ "NAMD_CONF_NST_8",
24
+ "NAMD_PARAMS",
25
+ "NAMD_PSF",
26
+ ]
12
27
 
13
28
  from importlib import resources
14
29
  from pathlib import Path
@@ -5,7 +5,7 @@ Ensure [docker](https://www.docker.com/) and the [NVIDIA container toolkit](http
5
5
 
6
6
  To run the container:
7
7
  ```bash
8
- docker pull ghcr.io/becksteinlab/streaming-md-docker:main-Common-GPU
8
+ docker pull ghcr.io/becksteinlab/streaming-md-docker:main-common-gpu
9
9
 
10
10
  docker run -v $PWD/imdclient/data:/home/conda:rw -it --runtime=nvidia --gpus=all \
11
11
  ghcr.io/becksteinlab/streaming-md-docker:main-Common-GPU
@@ -0,0 +1,112 @@
1
+ # Manual validation of different compiler options for GROMACS using ASU's SOL
2
+
3
+ ### Running tests
4
+
5
+ To validate all IMDv3 output (time, integration step, dt, box, positions, velocities, and forces)
6
+ against TRR output with a simple sample simulation, first ensure you're using a
7
+ python environment which has the testing requirements of IMDClient installed.
8
+
9
+ If not already installed, do:
10
+ ```bash
11
+ conda env create -n imdclient-test -f devtools/conda-envs/test_env.yaml -y
12
+ conda activate imdclient-test
13
+ ```
14
+
15
+ Equivalently, on ASU's Sol, do:
16
+ ```bash
17
+ module load mamba
18
+ # Only needed for MPI builds
19
+ module load openmpi/4.1.5
20
+ conda env create -n imdclient-test -f devtools/conda-envs/test_env.yaml -y
21
+ source activate imdclient-test
22
+ ```
23
+
24
+ Then, to run the tests, do:
25
+ ```bash
26
+ cd imdclient/tests/hpc_testing/gromacs
27
+ chmod +x validate_gmx.sh
28
+
29
+ ./validate_gmx.sh \
30
+ --gmx_binary /path/to/gmx
31
+ ```
32
+
33
+ Or, for MPI builds,
34
+ ```bash
35
+ ./validate_gmx.sh \
36
+ --gmx_binary /path/to/gmx \
37
+ --mpi
38
+ ```
39
+
40
+ To validate against your own simulation files, see `validate_gmx.sh` for
41
+ command line arguments.
42
+
43
+ ### Compiling on ASU's Sol supercomputer
44
+
45
+ Allocate a GPU node on SOL and clone in https://gitlab.com/ljwoods2/gromacs.git
46
+
47
+ After cloning, do:
48
+ ```bash
49
+ git checkout imd-v3
50
+ module load cmake/3.30.2
51
+ module load gcc-12.1.0-gcc-11.2.0
52
+ moudle load cuda-12.6.1-gcc-12.1.0
53
+ module load openmpi/4.1.5
54
+
55
+ mkdir -p build_gpu
56
+ cd build_gpu
57
+
58
+ cmake .. -DGMX_BUILD_OWN_FFTW=ON -DGMX_GPU=CUDA -DGMX_MPI=ON
59
+ make -j 4
60
+ make install
61
+ source /your/installation/prefix/here/bin/GMXRC
62
+ ```
63
+ <!--
64
+ After GROMACS has been built, change into the directory containing this file.
65
+
66
+ To test on one node, run this in the shell (assuming there are 4 cores available):
67
+ ```bash
68
+ /home/ljwoods2/workspace/gromacs/build_mpi/bin/gmx grompp \
69
+ -f gmx_gpu_test.mdp \
70
+ -c struct.gro \
71
+ -p gmx_gpu_test.top \
72
+ -imd struct_imd.gro \
73
+ -o gmx_gpu_test.tpr \
74
+ -maxwarn 1
75
+
76
+ /home/ljwoods2/workspace/gromacs/build_mpi/bin/gmx mdrun \
77
+ -s gmx_gpu_test.tpr \
78
+ -o gmx_gpu_test.trr \
79
+ -imdwait \
80
+ -ntmpi 2 \
81
+ -ntomp 2
82
+ ```
83
+ To test on multiple nodes, run this in the shell (assuming there are 4 nodes and 16 cores available, with 1 GPU on each node):
84
+
85
+ ```bash
86
+ module load openmpi/4.1.5
87
+
88
+ /home/ljwoods2/workspace/gromacs/build_mpi/bin/mpirun \
89
+ -np 4 \
90
+ gmx_mpi mdrun \
91
+ -s gmx_gpu_test.tpr \
92
+ -o gmx_gpu_test.trr \
93
+ -imdwait \
94
+ -ntomp 4 \
95
+ -gpu_id 0
96
+ ```
97
+
98
+ And in a different shell (from the same directory), run the following commands:
99
+
100
+ ```bash
101
+ module load mamba
102
+ # Environment containing IMDClient
103
+ source activate imdclient-test
104
+
105
+ mkdir tmp_test
106
+
107
+ python imdclient/tests/test_manual.py \
108
+ --topol_arg imdclient/tests/hpc_testing/gromacs/struct.gro \
109
+ --traj_arg imdclient/tests/hpc_testing/gromacs/gmx_gpu_test.trr \
110
+ --first_frame_arg 0 \
111
+ --tmp_path tmp_test
112
+ ``` -->
@@ -0,0 +1,58 @@
1
+ title = PRODUCTION IN NPT
2
+ ld-seed = 1
3
+ ; Run parameters
4
+ integrator = md ; leap-frog integrator
5
+ nsteps = 1000 ; 1 * 1000 = 1 ps
6
+ dt = 0.001 ; 1 fs
7
+ ; Output control
8
+ nstxout = 10 ; save coordinates every 10 fs
9
+ nstvout = 10 ; save velocities every 10 fs
10
+ nstfout = 10
11
+ nstenergy = 10 ; save energies every 10 fs
12
+ nstlog = 10 ; update log file every 10 fs
13
+ ; Center of mass (COM) motion
14
+ nstcomm = 10 ; remove COM motion every 10 steps
15
+ comm-mode = Linear ; remove only COM translation (liquids in PBC)
16
+ ; Bond parameters
17
+ continuation = yes ; first dynamics run
18
+ constraint_algorithm = lincs ; holonomic constraints
19
+ constraints = all-bonds ; all bonds lengths are constrained
20
+ lincs_iter = 1 ; accuracy of LINCS
21
+ lincs_order = 4 ; also related to accuracy
22
+ ; Nonbonded settings
23
+ cutoff-scheme = Verlet ; Buffered neighbor searching
24
+ ns_type = grid ; search neighboring grid cells
25
+ nstlist = 10 ; 10 fs, largely irrelevant with Verlet
26
+ rcoulomb = 1.0 ; short-range electrostatic cutoff (in nm)
27
+ rvdw = 1.0 ; short-range van der Waals cutoff (in nm)
28
+ DispCorr = EnerPres ; account for cut-off vdW scheme
29
+ ; Electrostatics
30
+ coulombtype = PME ; Particle Mesh Ewald for long-range electrostatics
31
+ pme_order = 4 ; cubic interpolation
32
+ fourierspacing = 0.12 ; grid spacing for FFT
33
+ ; Temperature coupling is on
34
+ tcoupl = Nose-Hoover ; good for production, after equilibration
35
+ ; we define separate thermostats for the solute and solvent (need to adapt)
36
+ ; see default groups defined by Gromacs for your system or define your own (make_ndx)
37
+ tc-grps = Protein SOL ; the separate groups for the thermostats
38
+ tau-t = 1.0 1.0 ; time constants for thermostats (ps)
39
+ ref-t = 300 300 ; reference temperature for thermostats (K)
40
+ ; Pressure coupling is off
41
+ pcoupl = Parrinello-Rahman ; good for production, after equilibration
42
+ tau-p = 2.0 ; time constant for barostat (ps)
43
+ compressibility = 4.5e-5 ; compressibility (1/bar) set to water at ~300K
44
+ ref-p = 1.0 ; reference pressure for barostat (bar)
45
+ ; Periodic boundary conditions
46
+ pbc = xyz ; 3-D PBC
47
+ ; Velocity generation
48
+ gen_vel = no
49
+ IMD-group = System
50
+ IMD-nst = 10
51
+ IMD-version = 3
52
+ IMD-time = yes
53
+ IMD-box = yes
54
+ IMD-coords = yes
55
+ IMD-unwrap = no
56
+ IMD-vels = yes
57
+ IMD-forces = yes
58
+ IMD-energies = yes