adaptivemd.engine package


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]

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

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

the task object containing the job description

Return type:


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

  • 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 type filter string to store only a subset of atoms

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

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.


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

  • 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

Return a random frame from all possible full frames

Returns:the frame you can restart from
Return type:Frame

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

Return a task to run this engine

Returns:the task object that can be submitted to the queue
Return type:Task

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

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

Return the OutputTypeDescriptions for this trajectory

Returns:dict str – the output description dict of the engine
Return type:OutputTypeDescription
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

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

Return output type and effective frame index for this frame

  • str – the name of the output type
  • int – the effective index within this trajectory obeying the trajectories own stride
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 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

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

Bases: adaptivemd.mongodb.base.StorableMixin

A description of a general trajectory type

  • 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 like selection of an atom subset

Module contents