asyncmd 0.3.2__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.
- asyncmd/__init__.py +18 -0
- asyncmd/_config.py +26 -0
- asyncmd/_version.py +75 -0
- asyncmd/config.py +203 -0
- asyncmd/gromacs/__init__.py +16 -0
- asyncmd/gromacs/mdconfig.py +351 -0
- asyncmd/gromacs/mdengine.py +1127 -0
- asyncmd/gromacs/utils.py +197 -0
- asyncmd/mdconfig.py +440 -0
- asyncmd/mdengine.py +100 -0
- asyncmd/slurm.py +1199 -0
- asyncmd/tools.py +86 -0
- asyncmd/trajectory/__init__.py +25 -0
- asyncmd/trajectory/convert.py +577 -0
- asyncmd/trajectory/functionwrapper.py +556 -0
- asyncmd/trajectory/propagate.py +937 -0
- asyncmd/trajectory/trajectory.py +1103 -0
- asyncmd/utils.py +148 -0
- asyncmd-0.3.2.dist-info/LICENSE +232 -0
- asyncmd-0.3.2.dist-info/METADATA +179 -0
- asyncmd-0.3.2.dist-info/RECORD +23 -0
- asyncmd-0.3.2.dist-info/WHEEL +5 -0
- asyncmd-0.3.2.dist-info/top_level.txt +1 -0
asyncmd/mdengine.py
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# This file is part of asyncmd.
|
2
|
+
#
|
3
|
+
# asyncmd is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# asyncmd is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License
|
14
|
+
# along with asyncmd. If not, see <https://www.gnu.org/licenses/>.
|
15
|
+
import abc
|
16
|
+
from .trajectory.trajectory import Trajectory
|
17
|
+
|
18
|
+
|
19
|
+
class EngineError(Exception):
|
20
|
+
"""Exception raised when something goes wrong with the (MD)-Engine."""
|
21
|
+
pass
|
22
|
+
|
23
|
+
|
24
|
+
class EngineCrashedError(EngineError):
|
25
|
+
"""Exception raised when the (MD)-Engine crashes during a run."""
|
26
|
+
pass
|
27
|
+
|
28
|
+
|
29
|
+
class MDEngine(abc.ABC):
|
30
|
+
"""
|
31
|
+
Abstract base class to define a common interface for all :class:`MDEngine`.
|
32
|
+
"""
|
33
|
+
@abc.abstractmethod
|
34
|
+
async def apply_constraints(self, conf_in: Trajectory,
|
35
|
+
conf_out_name: str) -> Trajectory:
|
36
|
+
# apply constraints to given conf_in, write conf_out_name and return it
|
37
|
+
raise NotImplementedError
|
38
|
+
|
39
|
+
@abc.abstractmethod
|
40
|
+
# TODO: think about the most general interface!
|
41
|
+
# NOTE: We assume that we do not change the system for/in one engine,
|
42
|
+
# i.e. .top, .ndx, mdp-object, ...?! should go into __init__
|
43
|
+
async def prepare(self, starting_configuration: Trajectory, workdir: str,
|
44
|
+
deffnm: str) -> None:
|
45
|
+
raise NotImplementedError
|
46
|
+
|
47
|
+
@abc.abstractmethod
|
48
|
+
# TODO: should this be a classmethod?
|
49
|
+
#@classmethod
|
50
|
+
async def prepare_from_files(self, workdir: str, deffnm: str) -> None:
|
51
|
+
# this should prepare the engine to continue a previously stopped simulation
|
52
|
+
# starting with the last trajectory part in workdir that is compatible with deffnm
|
53
|
+
raise NotImplementedError
|
54
|
+
|
55
|
+
@abc.abstractmethod
|
56
|
+
async def run_walltime(self, walltime: float) -> Trajectory:
|
57
|
+
# run for specified walltime
|
58
|
+
# NOTE: must be possible to run this multiple times after preparing once!
|
59
|
+
raise NotImplementedError
|
60
|
+
|
61
|
+
@abc.abstractmethod
|
62
|
+
async def run_steps(self, nsteps: int,
|
63
|
+
steps_per_part: bool = False) -> Trajectory:
|
64
|
+
# run for specified number of steps
|
65
|
+
# NOTE: not sure if we need it, but could be useful
|
66
|
+
# NOTE: make sure we can run multiple times after preparing once!
|
67
|
+
raise NotImplementedError
|
68
|
+
|
69
|
+
@abc.abstractproperty
|
70
|
+
def current_trajectory(self) -> Trajectory:
|
71
|
+
# return current trajectory: Trajectory or None
|
72
|
+
# if we retun a Trajectory it is either what we are working on atm
|
73
|
+
# or the trajectory we finished last
|
74
|
+
raise NotImplementedError
|
75
|
+
|
76
|
+
@abc.abstractproperty
|
77
|
+
def output_traj_type(self) -> str:
|
78
|
+
# return a string with the ending (without ".") of the trajectory
|
79
|
+
# type this engine uses
|
80
|
+
# NOTE: this should not be implemented as a property in subclasses
|
81
|
+
# as it must be available at the classlevel too
|
82
|
+
# so cls.output_traj_type must also be the string
|
83
|
+
# If you want/need to check the values (i.e. you would like to
|
84
|
+
# execute code like in a property) have a look at the descriptor
|
85
|
+
# implementation in gromacs/mdengine.py which checks for allowed
|
86
|
+
# values (at least when set on an instance) but is accesible from
|
87
|
+
# the class level too, e.g. like a 'classproperty' (which is not
|
88
|
+
# a thing in python)
|
89
|
+
raise NotImplementedError
|
90
|
+
|
91
|
+
# TODO/FIXME: remove this function?
|
92
|
+
# NOTE: I think we wont really need/use this anyway since the run_ funcs
|
93
|
+
# are all awaitable
|
94
|
+
@abc.abstractproperty
|
95
|
+
def running(self) -> bool:
|
96
|
+
raise NotImplementedError
|
97
|
+
|
98
|
+
@abc.abstractproperty
|
99
|
+
def steps_done(self) -> int:
|
100
|
+
raise NotImplementedError
|