class

Chem::DCD::Reader

Inherits Chem::FormatReader::Indexable / Chem::FormatReader::MultiEntry / Chem::FormatReader / IO::Wrapper / Reference / Object

Implementation based on Chemfiles C++ library.

Constructors

new(io : IO, structure : Structure, reuse : Bool = false, sync_close : Bool = false)
Source
new(path : Path | String, structure : Structure, reuse : Bool = false) : self

Creates a new object from the given path. Positional and named arguments are forwarded to the designated constructor.

An IO object will be created and open from the given path, which will be closed when closing this object (sync_close = true). The file open mode is specified by the FILE_MODE constant.

Class methods

open(io : IO, structure : Structure, reuse : Bool = false, sync_close : Bool = false, & : self -> )

Creates a new object from the given io, yields it to the given block, and closes it at the end. Positional and named arguments are forwarded to the constructor.

open(path : Path | String, structure : Structure, reuse : Bool = false, & : self -> )

Creates a new object from the given path yields it to the given block, and closes it at the end. Positional and named arguments are forwarded to the constructor.

An IO object will be created and open from the given path, which will be closed when closing this object (sync_close = true). The file open mode is specified by the FILE_MODE constant.

Instance methods

entry_index

Returns the index of the current entry.

Source
n_entries

Returns the number of entries in the IO.

Source
skip_to_entry(index : Int) : Nil

Discards the entries (without parsing) up until the given index. Raises IndexError if the index is invalid.

Source