imdclient 0.1.2__py3-none-any.whl → 0.1.3__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.
@@ -1,11 +1,21 @@
1
1
  import MDAnalysis as mda
2
2
  import pytest
3
3
  import logging
4
- from .base import IMDv3IntegrationTest
5
- from .datafiles import NAMD_TOPOL, NAMD_CONF, NAMD_TRAJ, NAMD_PARAMS, NAMD_PSF
4
+ from .base import IMDv3IntegrationTest, assert_allclose_with_logging
5
+ from .datafiles import (
6
+ NAMD_TOPOL,
7
+ NAMD_CONF_NST_1,
8
+ NAMD_CONF_NST_8,
9
+ NAMD_PARAMS,
10
+ NAMD_PSF,
11
+ )
12
+ from pathlib import Path
13
+ from numpy.testing import (
14
+ assert_allclose,
15
+ )
6
16
 
7
17
  logger = logging.getLogger("imdclient.IMDClient")
8
- file_handler = logging.FileHandler("test.log")
18
+ file_handler = logging.FileHandler("namd_test.log")
9
19
  formatter = logging.Formatter(
10
20
  "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
11
21
  )
@@ -16,23 +26,100 @@ logger.setLevel(logging.DEBUG)
16
26
 
17
27
  class TestIMDv3NAMD(IMDv3IntegrationTest):
18
28
 
29
+ @pytest.fixture(params=[NAMD_CONF_NST_1, NAMD_CONF_NST_8])
30
+ def inp(self, request):
31
+ return request.param
32
+
33
+ @pytest.fixture()
34
+ def simulation_command(self, inp):
35
+ return f"namd3 {Path(inp).name}"
36
+
37
+ @pytest.fixture()
38
+ def input_files(self, inp):
39
+ return [NAMD_TOPOL, inp, NAMD_PARAMS, NAMD_PSF]
40
+
41
+ @pytest.fixture()
42
+ def topol(self):
43
+ return Path(NAMD_TOPOL).name
44
+
19
45
  @pytest.fixture()
20
- def command(self):
21
- return (
22
- f"cp {NAMD_PARAMS} {NAMD_PSF} {NAMD_TOPOL} . && namd3 {NAMD_CONF}"
46
+ def true_u(self, topol, imd_u, tmp_path):
47
+ u = mda.Universe(
48
+ (tmp_path / topol),
49
+ (tmp_path / "alanin.dcd"),
23
50
  )
51
+ yield u
24
52
 
25
53
  @pytest.fixture()
26
- def match_string(self):
27
- return "INTERACTIVE MD AWAITING CONNECTION"
54
+ def true_u_vel(self, topol, imd_u, tmp_path):
55
+ u = mda.Universe(
56
+ (tmp_path / topol),
57
+ (tmp_path / "alanin.vel.dcd"),
58
+ )
59
+ yield u
60
+
61
+ @pytest.fixture()
62
+ def true_u_force(self, topol, imd_u, tmp_path):
63
+ u = mda.Universe(
64
+ (tmp_path / topol),
65
+ (tmp_path / "alanin.force.dcd"),
66
+ )
67
+ yield u
68
+
69
+ # @pytest.fixture()
70
+ # def match_string(self):
71
+ # return "INTERACTIVE MD AWAITING CONNECTION"
28
72
 
29
73
  @pytest.fixture()
30
74
  def first_frame(self):
31
75
  return 0
32
76
 
33
- @pytest.fixture()
34
- def universe(self):
35
- return mda.Universe(
36
- NAMD_TOPOL,
37
- NAMD_TRAJ,
38
- )
77
+ # Compare coords, box, time, dt, step
78
+ def test_compare_imd_to_true_traj(self, imd_u, true_u, first_frame):
79
+ for i in range(first_frame, len(true_u.trajectory)):
80
+ assert_allclose(
81
+ true_u.trajectory[i].time,
82
+ imd_u.trajectory[i - first_frame].time,
83
+ atol=1e-03,
84
+ )
85
+ assert_allclose(
86
+ true_u.trajectory[i].dt,
87
+ imd_u.trajectory[i - first_frame].dt,
88
+ atol=1e-03,
89
+ )
90
+ assert_allclose(
91
+ true_u.trajectory[i].data["step"],
92
+ imd_u.trajectory[i - first_frame].data["step"],
93
+ )
94
+ assert_allclose_with_logging(
95
+ true_u.trajectory[i].dimensions,
96
+ imd_u.trajectory[i - first_frame].dimensions,
97
+ atol=1e-03,
98
+ )
99
+ assert_allclose_with_logging(
100
+ true_u.trajectory[i].positions,
101
+ imd_u.trajectory[i - first_frame].positions,
102
+ atol=1e-03,
103
+ )
104
+
105
+ # Compare velocities
106
+ def test_compare_imd_to_true_traj_vel(
107
+ self, imd_u, true_u_vel, first_frame
108
+ ):
109
+ for i in range(first_frame, len(true_u_vel.trajectory)):
110
+ assert_allclose_with_logging(
111
+ true_u_vel.trajectory[i].positions,
112
+ imd_u.trajectory[i - first_frame].velocities,
113
+ atol=1e-03,
114
+ )
115
+
116
+ # Compare forces
117
+ def test_compare_imd_to_true_traj_forces(
118
+ self, imd_u, true_u_force, first_frame
119
+ ):
120
+ for i in range(first_frame, len(true_u_force.trajectory)):
121
+ assert_allclose_with_logging(
122
+ true_u_force.trajectory[i].positions,
123
+ imd_u.trajectory[i - first_frame].forces,
124
+ atol=1e-03,
125
+ )
@@ -15,7 +15,7 @@ from numpy.testing import (
15
15
  )
16
16
  import numpy as np
17
17
  import pytest
18
- from imdclient.IMDREADER import IMDReader
18
+ from imdclient.IMD import IMDReader
19
19
 
20
20
 
21
21
  class TestStreamAnalysis:
imdclient/tests/utils.py CHANGED
@@ -1,6 +1,5 @@
1
1
  from imdclient.IMDProtocol import *
2
2
  import socket
3
- from imdclient.IMDProtocol import *
4
3
  import logging
5
4
 
6
5
 
@@ -0,0 +1,5 @@
1
+ Copyright 2024 Lawson Woods
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.1
2
+ Name: imdclient
3
+ Version: 0.1.3
4
+ Summary: Receiver for IMD v2 and v3 data from simulation engines like Gromacs, LAMMPS, and NAMD
5
+ Author-email: Lawson <ljwoods2@asu.edu>
6
+ Maintainer-email: Lawson <ljwoods2@asu.edu>
7
+ License: Copyright 2024 Lawson Woods
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+ Keywords: molecular simulations
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ License-File: AUTHORS.md
17
+ Requires-Dist: MDAnalysis>=2.7.0
18
+ Provides-Extra: test
19
+ Requires-Dist: pytest>=6.0; extra == "test"
20
+ Requires-Dist: pytest-xdist>=2.5; extra == "test"
21
+ Requires-Dist: pytest-cov>=3.0; extra == "test"
22
+ Requires-Dist: MDAnalysisTests>=2.7.0; extra == "test"
23
+ Requires-Dist: docker-py; extra == "test"
24
+ Provides-Extra: doc
25
+ Requires-Dist: sphinx; extra == "doc"
26
+ Requires-Dist: sphinx_rtd_theme; extra == "doc"
27
+
28
+ IMDClient
29
+ ==============================
30
+ [//]: # (Badges)
31
+
32
+ | **Latest release** | [![Last release tag][badge_release]][url_latest_release] ![GitHub commits since latest release (by date) for a branch][badge_commits_since] [![Documentation Status][badge_docs]][url_docs]|
33
+ | :----------------- | :------- |
34
+ | **Status** | [![GH Actions Status][badge_actions]][url_actions] [![codecov][badge_codecov]][url_codecov] |
35
+ | **Community** | [![License: MIT][badge_license]][url_license] [![Powered by MDAnalysis][badge_mda]][url_mda]|
36
+
37
+ [badge_actions]: https://github.com/becksteinlab/imdclient/actions/workflows/gh-ci.yaml/badge.svg
38
+ [badge_codecov]: https://codecov.io/gh/becksteinlab/imdclient/branch/main/graph/badge.svg
39
+ [badge_commits_since]: https://img.shields.io/github/commits-since/becksteinlab/imdclient/latest
40
+ [badge_docs]: https://readthedocs.org/projects/imdclient/badge/?version=latest
41
+ [badge_license]: https://img.shields.io/badge/License-MIT-blue.svg
42
+ [badge_mda]: https://img.shields.io/badge/powered%20by-MDAnalysis-orange.svg?logoWidth=16&logo=data:image/x-icon;base64,AAABAAEAEBAAAAEAIAAoBAAAFgAAACgAAAAQAAAAIAA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AhQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADkUFBSuZ2dn/3V1df8uLi7bAAAATgBGfyQAAAA2AAAAMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0AAADoAAAA/wAAAP8AAAD/AAAAWgC3/2AAnv3eAJ/+dgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA9AAAA/wAAAP8AAAD/AAAA/wAKDzEAnP3WAKn//wCS/OgAf/8MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIQAAANwAAADtAAAA7QAAAMAAABUMAJn9gwCe/e0Aj/2LAP//AQAAAAAAAAAA
43
+ [badge_release]: https://img.shields.io/github/release-pre/becksteinlab/imdclient.svg
44
+ [url_actions]: https://github.com/becksteinlab/imdclient/actions?query=branch%3Amain+workflow%3Agh-ci
45
+ [url_codecov]: https://codecov.io/gh/becksteinlab/imdclient/branch/main
46
+ [url_docs]: https://imdclient.readthedocs.io/en/latest/?badge=latest
47
+ [url_latest_release]: https://github.com/becksteinlab/imdclient/releases
48
+ [url_license]: https://opensource.org/license/mit
49
+ [url_mda]: https://www.mdanalysis.org
50
+
51
+ Receiver for [IMDv3 protocol](https://imdclient.readthedocs.io/en/latest/protocol_v3.html) from simulation engines like Gromacs, LAMMPS, and NAMD.
52
+
53
+ IMDClient is bound by a [Code of Conduct](https://github.com/becksteinlab/imdreader/blob/main/CODE_OF_CONDUCT.md).
54
+
55
+ ### Installation
56
+
57
+ IMDClient is available via PyPi and can be installed with pip:
58
+ ```bash
59
+ pip install imdclient
60
+ ```
61
+
62
+ To build IMDClient from source,
63
+ we highly recommend using virtual environments.
64
+ If possible, we strongly recommend that you use
65
+ [Anaconda](https://docs.conda.io/en/latest/) as your package manager.
66
+ Below we provide instructions both for `conda` and
67
+ for `pip`.
68
+
69
+ #### With conda
70
+
71
+ Ensure that you have [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) installed.
72
+
73
+ Create a virtual environment and activate it:
74
+
75
+ ```
76
+ conda create --name imdclient
77
+ conda activate imdclient
78
+ ```
79
+
80
+ <!-- Install the development and documentation dependencies:
81
+
82
+ ```
83
+ conda env update --name imdreader --file devtools/conda-envs/test_env.yaml
84
+ conda env update --name imdreader --file docs/requirements.yaml
85
+ ``` -->
86
+
87
+ Build this package from source:
88
+
89
+ ```
90
+ pip install -e .
91
+ ```
92
+
93
+ If you want to update your dependencies (which can be risky!), run:
94
+
95
+ ```
96
+ conda update --all
97
+ ```
98
+
99
+ And when you are finished, you can exit the virtual environment with:
100
+
101
+ ```
102
+ conda deactivate
103
+ ```
104
+
105
+ #### With pip
106
+
107
+ To build the package from source, run:
108
+
109
+ ```
110
+ pip install .
111
+ ```
112
+
113
+ If you want to create a development environment, install
114
+ the dependencies required for tests and docs with:
115
+
116
+ ```
117
+ pip install ".[test,doc]"
118
+ ```
119
+
120
+ ### Copyright
121
+
122
+ The IMDClient source code is hosted at https://github.com/becksteinlab/imdclient
123
+ and is available under the MIT license (see the file [LICENSE](https://github.com/becksteinlab/imdclient/blob/main/LICENSE)).
124
+
125
+ Copyright (c) 2024, Lawson
126
+
127
+
128
+ #### Acknowledgements
129
+
130
+ Project based on the
131
+ [MDAnalysis Cookiecutter](https://github.com/MDAnalysis/cookiecutter-mda) version 0.1.
132
+ <!-- Please cite [MDAnalysis](https://github.com/MDAnalysis/mdanalysis#citation) when using IMDReader in published work. -->
@@ -0,0 +1,42 @@
1
+ imdclient/IMD.py,sha256=-ySUiRBumVEKyZU3UXXNywajtVnERQhtP4ama3guCR4,3767
2
+ imdclient/IMDClient.py,sha256=6p8nLe70d-eUdsJ6QNcpc8V1Mp-ozD7mhB35_p6Owuc,33330
3
+ imdclient/IMDProtocol.py,sha256=jm7ehwfDCcs-zWHjZ2V2KpAWdGhD4JSy7RVtCSF0818,4045
4
+ imdclient/__init__.py,sha256=Pa5h6Fjyvyxf3ECzO43pcmLm3Vk-vOuEb5Gi6TDWhds,339
5
+ imdclient/backends.py,sha256=QmHjwYbmvFVHz-uFgpSOA0UmZTZqiMGqWMO7B8wr1zs,10368
6
+ imdclient/results.py,sha256=2MyjFdQMW7BfiHhG5X6wQwMVrF_0mKYFnv907lgLMas,9920
7
+ imdclient/streamanalysis.py,sha256=Qq0h_WPO-wb0_lP8jTRHe0HX7UDZNgJFA6C4PZdUmK8,38385
8
+ imdclient/streambase.py,sha256=rwhdyC2V3_9pSz_6rNwjSc4MNToI9S318OH7AH0arHA,6176
9
+ imdclient/utils.py,sha256=VWxk4vQ6hzxoYRu-8Ge8fJG-EitJwgJR93wOWCvzY-0,3308
10
+ imdclient/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ imdclient/data/gromacs/md/gromacs_struct.gro,sha256=kt4vE10iF_1RbeyTogmYmIY9yKJacofrzNT-hPHGyL8,1459301
12
+ imdclient/data/gromacs/md/gromacs_v3.top,sha256=AXFEDjvz5Qqq-VECffimdeEvhD6L-H0SFPILW-6Sums,348329
13
+ imdclient/data/gromacs/md/gromacs_v3_nst1.mdp,sha256=3ZStLxoeQo7k5R3C6EY2oRxet_FAccDEIwVsymbN8f4,3053
14
+ imdclient/data/gromacs/md/gromacs_v3_nst8.mdp,sha256=CYz5gKFApeJMrJyCmd3kgPFzRjahgaLRNyIomuVyY0w,3053
15
+ imdclient/data/lammps/md/lammps_topol.data,sha256=u4osSkn7yG9p2Egz9ovLW4eVmdaThPxeZ0L218J3-V0,172948
16
+ imdclient/data/lammps/md/lammps_v3_nst_1.in,sha256=AcvkgNNDtTkB7RlFZwpUEKKp6W_7o_UFgrX_LwC3HXI,2586
17
+ imdclient/data/lammps/md/lammps_v3_nst_8.in,sha256=gpdAp1dDhJbG06wZVDtBGUs6biJNz8EStV341S0uJ2s,2594
18
+ imdclient/data/namd/md/alanin.params,sha256=zWw-UfqYD3-xpdA_8R8T-0OYBbUM6py7jKAq_uyu8HE,17389
19
+ imdclient/data/namd/md/alanin.pdb,sha256=eccDD-ledUXjbB2s1fxY40lmAKWWDpxkxANbsOkqjHc,5615
20
+ imdclient/data/namd/md/alanin.psf,sha256=VhCZeGFhpUa8yN5iEL19zlVjqIJg2JIdPzhazpRForY,12953
21
+ imdclient/data/namd/md/namd_v3_nst_1.namd,sha256=EZU7PGyytZdGixrBnmpAcwonN0n_JTk9U-Q82FoqO7k,983
22
+ imdclient/data/namd/md/namd_v3_nst_8.namd,sha256=WJmwj0E4nJVhYRr_ALBlTax6kyNkdRE1krPsmY-QFLM,984
23
+ imdclient/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ imdclient/tests/base.py,sha256=CoU6oZanTnWrASxY5aRJdICtj4yz5PfYwh9iqQ_o8WE,6461
25
+ imdclient/tests/conftest.py,sha256=ERj5d4roxWGqpXS8-W-LFB_INEkb_4oz5ous92u2yK4,1377
26
+ imdclient/tests/datafiles.py,sha256=NtLuk1P4vk1h4b5Hb71vne2RMmWKGRV9RaIfRvLOfIc,1262
27
+ imdclient/tests/server.py,sha256=7KqzDg74d7Oe617jctB-rDGvEUNSaT9agkp9SiEtiME,6978
28
+ imdclient/tests/test_gromacs.py,sha256=rXkabRB40xX7LRdF2_nrPgeNpfFF9J7m-5LeRNMA5TM,1454
29
+ imdclient/tests/test_imdclient.py,sha256=hhfvI1wGocE5e38tfbsNW9w2uotUXtedhq3FOQC68EM,7030
30
+ imdclient/tests/test_imdreader.py,sha256=bD2we7TBJwM4wcHJh9ob6Ap8hNsGu1KTkc_tQ_5IzrU,23532
31
+ imdclient/tests/test_lammps.py,sha256=hwZBVvhclN1mtPuYLyODUaWjlaZaAkhAFqX-mpQvWk4,2244
32
+ imdclient/tests/test_manual.py,sha256=BR8MCdCUxcaDKSFyR-jLhJ4mk9s9CIS5MIAf5dR4PBE,3557
33
+ imdclient/tests/test_namd.py,sha256=dFOJUQl9ByekuuYgUOIirf6qFj5_qaKfgQq4Qimtotw,3671
34
+ imdclient/tests/test_stream_analysis.py,sha256=qqsm_Bv8qCXyNwgdSKZM8bLyiEO5nlpqJ-XtEn-YKew,1723
35
+ imdclient/tests/utils.py,sha256=_x1gVQ3AmhaMurpcEPLKBG5BTGu4ZMy5EGUpr0P6D6g,854
36
+ imdclient/tests/docker_testing/docker.md,sha256=SxHEpSA1mXAvzYzsxL0EesGqPCVC8qdRMbvxGz5R0Yo,840
37
+ imdclient-0.1.3.dist-info/AUTHORS.md,sha256=R4JTI7mrgL1WYgfyuAv4quw0e0oLQGVjWcMQa-UXJlE,652
38
+ imdclient-0.1.3.dist-info/LICENSE,sha256=28aS5DC2LCwcOVe3VN0g2L-Dooqof34T9TMGJ6jqMig,593
39
+ imdclient-0.1.3.dist-info/METADATA,sha256=6Vl27FFPSTPCa1MDlSDCsk9rrGCdGY6wKGJ1G1pvHJM,6531
40
+ imdclient-0.1.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
41
+ imdclient-0.1.3.dist-info/top_level.txt,sha256=40W62GWiXUT2CbDm-No7GTeJG160wyIMpk1hBNrdkkE,10
42
+ imdclient-0.1.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
Binary file
Binary file