adaptivemd.engine package

Submodules

adaptivemd.engine.engine module

class adaptivemd.engine.engine.Engine[source]

Bases: adaptivemd.generator.TaskGenerator

An generator for trajectory simulation tasks

classmethod from_dict(dct)[source]

Reconstruct an object from a dictionary representation

Parameters:dct (dict) – the dictionary containing a state representation of the class.
Returns:the reconstructed storable object
Return type:StorableMixin
to_dict()[source]

Convert object into a dictionary representation

Used to convert the dictionary into JSON string for serialization

Returns:the dictionary representing the (immutable) state of the object
Return type:dict
run(target)[source]

Create a task that returns a trajectory given in the input

Parameters:target (Trajectory) – location of the created target trajectory
Returns:the task object containing the job description
Return type:Task
extend(target, length)[source]

Create a task that extends a trajectory given in the input

Parameters:
  • target (Trajectory) – location of the target trajectory to be extended
  • length (int) – number of additional frames to be computed
Returns:

the task object containing the job description

Return type:

Task

add_output_type(name, filename=None, stride=1, selection=None)[source]

Add an output type for a trajectory kind to be generated by this engine

Parameters:
  • name (str) – the name to call the output type by
  • filename (str) – a filename to be used for this output type
  • stride (int) – the stride used by this particular trajectory relative to the native steps of the engine.
  • selection (str) – an mdtraj.Topology.select type filter string to store only a subset of atoms
native_stride

The least common multiple stride of all generated trajectories.

If you want consistent trajectory length your simulation length need to be multiples of this number. The number is relative to the native time steps

Returns:the lcm stride relative to the engines timesteps
Return type:int
full_strides

list of strides for trajectories that have full coordinates

this is useful to figure out from which frames you can restart a new trajectory. Usually you only have a single one with full frames.

Returns:the list of strides for full trajectories
Return type:list of int
adaptivemd.engine.engine.gcd(a, b)[source]

Return greatest common divisor using Euclid’s Algorithm.

adaptivemd.engine.engine.lcm(a, b)[source]

Return lowest common multiple.

adaptivemd.engine.engine.lcmm(*args)[source]

Return lcm of args.

class adaptivemd.engine.engine.Trajectory(location, frame, length, engine=None)[source]

Bases: adaptivemd.file.File

Represents a trajectory File on the cluster

Variables:
  • location (str or File) – the File location
  • frame (Frame or File) – the initial frame used for the trajectory
  • length (int) – the length of the trajectory in frames
  • engine (Engine) – the engine used to create the trajectory
engine
clone()[source]

create a cloned object with equal attributes

Returns:the same type as this object
Return type:Location
pick()[source]

Return a random frame from all possible full frames

Returns:the frame you can restart from
Return type:Frame
is_folder
file(f)[source]

Return a file location to a file inside the trajectory folder

Parameters:f (str or OutputTypeDescription) – the filename to be appended to the trajectories directory
Returns:the object containing the location
Return type:File
run()[source]

Return a task to run this engine

Returns:the task object that can be submitted to the queue
Return type:Task
extend(length)[source]

Get a task to extend this trajectory if the engine is set

Parameters:length (int or list of int) – the length to extend by as a single int or a list of ints
Returns:the task object to extend the trajectory
Return type:Task
outputs(outtype)[source]

Get a location to the file containing the output by given name

Parameters:outtype (str or OutputTypeDescription) – the name of the outputtype as str or the full description object
Returns:a file location that points to the concrete file that contains the data for a particular output type
Return type:File
types

Return the OutputTypeDescriptions for this trajectory

Returns:dict str – the output description dict of the engine
Return type:OutputTypeDescription
existing_frames
Returns:a sorted list of frame indices with full coordinates that can be used for restart. relative to the engines timesteps
Return type:list of int
class adaptivemd.engine.engine.Frame(trajectory, index)[source]

Bases: adaptivemd.mongodb.base.StorableMixin

Represents a frame of a trajectory

Variables:
  • trajectory (Trajectory) – the origin trajectory
  • index (int) – the frame index staring from zero
index_in_outputs

Return output type and effective frame index for this frame

Returns:
  • str – the name of the output type
  • int – the effective index within this trajectory obeying the trajectories own stride
exists
Returns:if True there is a concrete trajectory file with full coordinates for this frame
Return type:bool
class adaptivemd.engine.engine.TrajectoryGenerationTask(generator=None, trajectory=None)[source]

Bases: adaptivemd.task.Task

A task that will generate a trajectory

extend(length)[source]

Extend the trajectory that was generated by this task

Parameters:length (int) – the number of frames resp to native engine timesteps
Returns:a task to extend the current trajectory
Return type:Task
class adaptivemd.engine.engine.TrajectoryExtensionTask(generator=None, trajectory=None, source=None)[source]

Bases: adaptivemd.engine.engine.TrajectoryGenerationTask

A task that generates a trajectory out of a source trajectory

ready
class adaptivemd.engine.engine.OutputTypeDescription(filename=None, stride=1, selection=None)[source]

Bases: adaptivemd.mongodb.base.StorableMixin

A description of a general trajectory type

Variables:
  • filename (str) – a filename to store these type of trajectory in
  • stride (int) – the stride to be used relative to native engine timesteps
  • selection (str) – a mdtraj.Topolopgy.select() like selection of an atom subset

Module contents