asyncmd 0.3.2__py3-none-any.whl → 0.4.0__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,179 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: asyncmd
3
- Version: 0.3.2
4
- Summary: asyncmd is a library to write concurrent code to run and analyze molecular dynamics simulations using pythons async/await synthax.
5
- Author-email: Hendrik Jung <hendrik.jung@biophys.mpg.de>
6
- Maintainer-email: Hendrik Jung <hendrik.jung@biophys.mpg.de>
7
- Project-URL: Repository, https://github.com/bio-phys/asyncmd.git
8
- Project-URL: Issues, https://github.com/bio-phys/asyncmd/issues
9
- Keywords: molecular dynamics,molecular-dynamics,MD,high performance computing,HPC,slurm,SLURM,gromacs,GROMACS
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Science/Research
12
- Classifier: Natural Language :: English
13
- Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Topic :: Scientific/Engineering
18
- Classifier: Topic :: Scientific/Engineering :: Chemistry
19
- Classifier: Topic :: Scientific/Engineering :: Physics
20
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Requires-Python: >=3.10
22
- Description-Content-Type: text/markdown
23
- License-File: LICENSE
24
- Requires-Dist: aiofiles
25
- Requires-Dist: mdanalysis
26
- Requires-Dist: numpy
27
- Provides-Extra: docs
28
- Requires-Dist: sphinx; extra == "docs"
29
- Provides-Extra: tests
30
- Requires-Dist: pytest; extra == "tests"
31
- Requires-Dist: pytest-asyncio; extra == "tests"
32
- Provides-Extra: tests-all
33
- Requires-Dist: asyncmd[tests]; extra == "tests-all"
34
- Requires-Dist: h5py; extra == "tests-all"
35
- Requires-Dist: coverage; extra == "tests-all"
36
- Requires-Dist: pytest-cov; extra == "tests-all"
37
- Provides-Extra: dev
38
- Requires-Dist: asyncmd[docs,tests-all]; extra == "dev"
39
-
40
- # asyncmd
41
-
42
- ## Synopsis
43
-
44
- asyncmd is a library to write **concurrent** code to run and analyze molecular dynamics simulations using pythons **async/await** synthax.
45
-
46
- ## Motivation
47
-
48
- Molecular dynamics simulations are fun and we can learn a lot about the simulated system. Running many molecular dynamics simulations of the same system concurrently is tedious, error-prone and boring but we can learn even more about the simulated system and are more efficient in doing so.
49
- This library addresses the tedious, error-prone and boring part of setting up many similar simulations, but it leaves you with the fun part of understanding the simulated system.
50
-
51
- ## Code Example
52
-
53
- Run `N` gromacs engines concurently from configurations randomly picked up along a trajectory (`traj.trr`) for `n_steps` integration steps each, drawing random Maxwell-Boltzmann velocities for each configuration on the way. Finally turn the python function `func` (which acts on `Trajectory` objects) into an asyncronous and cached function by wrapping it and apply it on all generated trajectories concurrently:
54
-
55
- ```python
56
- import asyncio
57
- import numpy as np
58
- import asyncmd
59
- import asyncmd.gromacs as asyncgmx
60
-
61
- in_traj = asyncmd.Trajectory(trajectory_files="traj.trr", structure_file="conf.gro")
62
- # get a random number generator and draw N random frames (with replacement)
63
- rng = np.default_rng()
64
- frame_idxs = rng.choice(len(in_traj), size=N)
65
- # use the RandomVelocitiesFrameExtractor to directly get the frames with MB-vels
66
- extractor = asyncmd.trajectory.convert.RandomVelocitiesFrameExtractor(T=303)
67
- mdps = [asyncgmx.MDP("config.mdp") for _ in range(N)]
68
- # MDConfig objects (like MDP) behave like dictionaries and are easy to modify
69
- for i, mdp in enumerate(mdps):
70
- # here we just modify the output frequency for every engine separately
71
- # but you can set any mdp option like this
72
- # Note how the values are in the correct types? I.e. that they are ints?
73
- mdp["nstxout"] *= (i + 1)
74
- mdp["nstvout"] *= (i + 1)
75
- # create N gromacs engines
76
- engines = [asyncgmx.GmxEngine(mdp=mdp, gro_file="conf.gro", top_file="topol.top",
77
- # optional (can be omited or None), however naturally without an index file
78
- # you can not reference custom groups in the .mdp-file or MDP object
79
- ndx_file="index.ndx",
80
- )
81
- for mdp in mdps]
82
- # extract starting configurations with MB-vels and save them to current directory
83
- start_confs = await asyncio.gather(*(extractor.extract_async(
84
- outfile=f"start_conf{i}.trr",
85
- traj_in=in_traj, idx=idx)
86
- for i, idx in enumerate(frame_idxs)))
87
- # prepare the MD (for gromacs this is essentially a `grompp` call)
88
- await asyncio.gather(*(e.prepare(starting_configuration=conf,
89
- workdir=".", deffnm=f"engine{i}")
90
- for i, (conf, e) in enumerate(zip(start_confs, engines))
91
- )
92
- )
93
- # and run the molecular dynamics
94
- out_trajs = await asyncio.gather(*(e.run_steps(nsteps=n_steps) for e in engines))
95
- # wrapp `func` and apply it on all output trajectories concurrently
96
- wrapped_func = asyncmd.trajectory.PyTrajectoryFunctionWrapper(function=func)
97
- cv_vals = await asyncio.gather(*(wrapped_func(traj) for traj in out_trajs))
98
- ```
99
-
100
- Note that running via the [SLURM] queueing system is as easy as replacing the `GmxEngine` with a `SlurmGmxEngine` and the `PyTrajectoryFunctionWrapper` with a `SlurmTrajectoryFunctionWrapper` (and suppling them both with sbatch script skeletons).
101
-
102
- For an in-depth introduction see also the `examples` folder in this repository which contains jupyter notebooks on various topics.
103
-
104
- ## Installation
105
-
106
- ### pip install directly from the repository
107
-
108
- Please note that you need to have [git-lfs] (an open source git extension) setup to get all input files needed to run the notebooks in the `examples` folder. However, no [git-lfs] is needed to get a working version of the library.
109
-
110
- ```bash
111
- git clone https://github.com/bio-phys/asyncmd.git
112
- cd asyncmd
113
- pip install .
114
- ```
115
-
116
- ## API Reference
117
-
118
- The documentation can be build with [sphinx], use e.g. the following to build it in html format:
119
-
120
- ```bash
121
- cd asyncmd # Need to be at the top folder of the repository for the next line to work
122
- sphinx-build -b html docs/source docs/build/html
123
- ```
124
-
125
- Use ```pip install .\[docs\]``` to install the requirements needed to build the documentation.
126
-
127
- ## Tests
128
-
129
- Tests use [pytest]. To run them just install asycmd with the test requirements
130
-
131
- ```bash
132
- git clone https://github.com/bio-phys/asyncmd.git
133
- cd asyncmd
134
- pip install .\[tests\]
135
- ```
136
-
137
- And then run the tests (against the installed version) as
138
-
139
- ```bash
140
- pytest
141
- ```
142
-
143
- ## Contribute
144
-
145
- If you discover any issues or want to propose a new feature please feel free to open an [issue](https://github.com/bio-phys/asyncmd/issues) or a [pull request](https://github.com/bio-phys/asyncmd/pulls)!
146
-
147
- ### Developer install
148
-
149
- For the developer install I recommend:
150
-
151
- ```bash
152
- git clone https://github.com/bio-phys/asyncmd.git
153
- cd asyncmd
154
- pip install -e .\[dev\]
155
- ```
156
-
157
- This will in addition to the requirements to run the tests and to build the documentation install [coverage] and its [pytest-cov] plugin such that you have an idea of the test coverage for your newly added code. To get a nice html coverage report you can run the tests as
158
-
159
- ```bash
160
- pytest --cov=asyncmd --cov-report=html
161
- ```
162
-
163
- ### Contributors
164
-
165
- This project was originally conceived and started by Hendrik Jung in 2021/2022. For more check the `pyproject.toml` file. When you contribute code dont forget to add your name there to claim the credit for your work!
166
-
167
- ## License
168
-
169
- asyncmd is under the terms of the GNU general public license version 3 or later, i.e. SPDX identifier "GPL-3.0-or-later".
170
-
171
- ---
172
- <sub>This README.md is printed from 100% recycled electrons.</sub>
173
-
174
- [coverage]: https://pypi.org/project/coverage/
175
- [git-lfs]: https://git-lfs.com/
176
- [pytest]: https://docs.pytest.org/en/latest/
177
- [pytest-cov]: https://pypi.org/project/pytest-cov/
178
- [SLURM]: https://slurm.schedmd.com/documentation.html
179
- [sphinx]: https://www.sphinx-doc.org/en/master/index.html
@@ -1,23 +0,0 @@
1
- asyncmd/__init__.py,sha256=0xkOmcT5JP7emeGl9ixPSPsdHylHtiWqvZGnzDC2GqM,768
2
- asyncmd/_config.py,sha256=PpPYgsZyPmC5uybMc0pdAMj_6jUcm8AfME1hAvYy3DE,1140
3
- asyncmd/_version.py,sha256=14Lpt2lrPMrGonuCi12MdigFAFaEhXYlip7X18BJQwc,2981
4
- asyncmd/config.py,sha256=Jf_XTvXPkWdefuB9xVfCUzW4Fe3zGaUB-ZifC-oZ-yQ,7701
5
- asyncmd/mdconfig.py,sha256=07TL4EJs-d_34PBSINUas3creopJX8VHfcgmuW-Wd-E,17485
6
- asyncmd/mdengine.py,sha256=PPWphMBSkIoinbUpLHxbEn1yI02VHrCHGKzJlSOhYq4,4127
7
- asyncmd/slurm.py,sha256=IgnWv6Jhu-PSdHTy0GB3AIlwkFcHZ12bBZy2VggSmKs,54642
8
- asyncmd/tools.py,sha256=JS4Cn2Elm6miJmPf88ZDTaUIIFqb9bhHLlZKmJOOpC0,2554
9
- asyncmd/utils.py,sha256=cVWgZlAa3I4eE3EacIfz82HIBznldqoxyUZ7M36hMXs,5331
10
- asyncmd/gromacs/__init__.py,sha256=Rp_FQq_ftynX1561oD1X2Rby3Y4EBtXkgNgqa4jQk2o,726
11
- asyncmd/gromacs/mdconfig.py,sha256=rxhp5W3Cc0KuLN_P43ItlXI_xnAiJeh3DLeTjHp57kc,18224
12
- asyncmd/gromacs/mdengine.py,sha256=JZA3c0i2I1SK2iivNavqg_i3QFdtOOuUHbcKNlKJFho,53164
13
- asyncmd/gromacs/utils.py,sha256=TCQ3OAtUNN7cVGjJGkEdmhZF2QvnnmazvklbQrW0AB8,6716
14
- asyncmd/trajectory/__init__.py,sha256=m2mP6YxMpXTpU_NQ-wID4UVEgZd7e0mkSaCCLLeo75Q,1195
15
- asyncmd/trajectory/convert.py,sha256=3DYpt7w_AIryShT59dTPM1s9s7ND3AMqgF5z8pfUViM,26036
16
- asyncmd/trajectory/functionwrapper.py,sha256=6Oeoqi8IiffNO6egh1aRX6QSy4RyIPEYi3j64pbg-4I,24785
17
- asyncmd/trajectory/propagate.py,sha256=TSpMw4dYodRowltdPWf5styZtUBkQJ5HlSKaV38yUuw,45335
18
- asyncmd/trajectory/trajectory.py,sha256=HSPwEIdRZuxteRmxEi8lC4ZjCMxbPVy7QjpGBkSAKBI,50699
19
- asyncmd-0.3.2.dist-info/LICENSE,sha256=tqi_Y64slbCqJW7ndGgNe9GPIfRX2nVGb3YQs7FqzE4,34670
20
- asyncmd-0.3.2.dist-info/METADATA,sha256=4SlYWFxOj9lsGDF12HtYwgt8-kr2fJ9aKdwnDwX79zQ,8014
21
- asyncmd-0.3.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
22
- asyncmd-0.3.2.dist-info/top_level.txt,sha256=YG6cpLOyBjjelv7a8p2xYEHNVBgXSW8PvM8-9S9hMb8,8
23
- asyncmd-0.3.2.dist-info/RECORD,,