mdtraj.open

mdtraj.open(filename, mode='r', force_overwrite=True, **kwargs)

Open a trajectory file-like object

This factor function returns an instance of an open file-like object capable of reading/writing the trajectory (depending on ‘mode’). It does not actually load the trajectory from disk or write anything.

Parameters:
filenamepath-like

Path to the trajectory file on disk

mode{‘r’, ‘w’}

The mode in which to open the file, either ‘r’ for read or ‘w’ for write.

force_overwritebool

If opened in write mode, and a file by the name of filename already exists on disk, should we overwrite it?

Returns:
fileobjectobject

Open trajectory file, whose type is determined by the filename extension

Other Parameters:
kwargsdict

Other keyword parameters are passed directly to the file object

See also

load, ArcTrajectoryFile, BINPOSTrajectoryFile, DCDTrajectoryFile
HDF5TrajectoryFile, LH5TrajectoryFile, MDCRDTrajectoryFile
NetCDFTrajectoryFile, PDBTrajectoryFile, TRRTrajectoryFile
XTCTrajectoryFile, TNGTrajectoryFile