# htmd.simlist module¶

HTMD can handle a large amount of simulations. Simulation lists allow to create a simple list containing all relevant information about the simulations to later perform any type of analysis.

class htmd.simlist.Frame(sim, piece, frame)

Bases: object

Class used for referencing a specific frame of a Sim object object.

Parameters
• sim (Sim object) – The simulation.

• piece (int) – Which trajectory piece the frame corresponds to.

• frame (int) – The frame of the specific trajectory piece.

frame
piece
sim
class htmd.simlist.Sim(simid, parent, input, trajectory, molfile, numframes=None)

Bases: object

Information class for a single simulation.

Do not use directly. Objects of this class are constructed by the simlist() and simfilter() functions. This class is used for storing information on simulations. This information includes the path to the simulation, the path to a structure file (pdb) which corresponds to the simulation, the folder containing the input files used to generate the simulation (useful for adaptive), the parent of the simulation (if it was filtered it will point to the original simulation) and a unique simulation id.

simid

A unique simulation ID

Type

int

parent

The parent of the simulations

Type

Sim object

input

The path to the input folder which generated this simulation

Type

str

trajectory

A list of trajectory files

Type

list

molfile

The path to the structural information about the simulation. Usually a PDB file

Type

str

numframes

Number of frames in trajectories

Type

list

copy()
htmd.simlist.simfilter(sims, outfolder, filtersel, njobs=None)

Filters a list of simulations generated by simlist()

This function takes as input a list of simulations produced by simList and writes new trajectories containing only the desired atoms in a new directory.

Parameters
• sims (list) – A simulation list produced by the simList function

• outfolder (str) – The folder in which to write the modified trajectories

• filtersel (str) – Atom selection string describing the atoms we want to keep. See more here

• njobs (int) – Number of parallel jobs to spawn for filtering of trajectories. If None it will use the default from htmd.config.

Returns

fsims – A list of filtered simulations

Return type

np.ndarray of Sim objects

Example

>>> sims  = simlist(glob('data/*/'), glob('input/*/structure.pdb'))
>>> fsims = simfilter(sims, 'filtered', filtersel='not water')

htmd.simlist.simlist(datafolders, topologies, inputfolders=None)

Creates a list of simulations

Parameters
• datafolders (str list) – A list of directories, each containing a single trajectory

• topologies (str list) – A list of topology files or folders containing a topology file corresponding to the trajectories in dataFolders. Can also be a single string to a single structure which corresponds to all trajectories.

• inputfolders (optional, str list) – A list of directories, each containing the input files used to produce the trajectories in dataFolders

Returns

sims – A list of simulations

Return type

np.ndarray of Sim objects

Examples

>>> simlist(glob('./test/data/*/'), glob('./test/input/*/'), glob('./test/input/*/'))
>>> simlist(glob('./test/data/*/'), glob('./test/input/*/*.pdb'), glob('./test/input/*/'))

htmd.simlist.simmerge(simlist1, simlist2)

Merges two simlists by updating their simid fields

Parameters
Returns

newlist – A new list containing all simulations

Return type

np.ndarray of Sim objects