struct Chem::Spatial::Positions3

Overview

TODO make compatible with Positions3Proxy

Included Modules

Defined in:

chem/register_format.cr
chem/spatial/positions3.cr

Constructors

Instance Method Summary

Instance methods inherited from module Indexable(Chem::Spatial::Vec3)

[](idxs : Tuple) : Tuple
[](idxs : Enumerable(Int)) : Array(T)
[](*idxs : Int) : Tuple
[]
, sentence(io : IO, separator : String = ", ", *, pair_separator : String = " and ", tail_separator : String = ", and ", & : T, IO -> ) : Nil
sentence(io : IO, separator : String = ", ", *, pair_separator : String = " and ", tail_separator : String = ", and ") : Nil
sentence(separator : String = ", ", *, pair_separator : String = " and ", tail_separator : String = ", and ", & : T -> ) : String
sentence(separator : String = ", ", *, pair_separator : String = " and ", tail_separator : String = ", and ") : String
sentence

Instance methods inherited from module Enumerable(Chem::Spatial::Vec3)

===(atom : Chem::Atom) : Bool
===(chain : Chem::Chain) : Bool
===(residue : Chem::Residue) : Bool
===
, average(weights : Indexable(Number))
average(weights : Indexable(Number), & : T -> _)
average
, find(pattern, if_none default = nil) find, find!(pattern) find!, mean
mean(& : T -> _)
mean

Constructor Detail

def self.from_dcd(input : IO | Path | String) : self #

Returns the positions3 encoded in input using the Chem::DCD file format. Arguments are forwarded to Chem::DCD::Reader.open.

If input contains multiple entries, this method returns the first one only. Use Array#from_dcd or Chem::DCD::Reader#each to get multiple entries instead.


[View source]
def self.new(pos : Slice(Vec3), cell : Parallelepiped | Nil = nil) #

[View source]
def self.read(input : IO | Path | String, format : Chem::Format | String) : self #

Returns the positions3 encoded in the specified file using format. Raises ArgumentError if format has required arguments or cannot read Chem::Spatial::Positions3.

If input contains multiple entries, this method returns the first one only. Use Array.read or Chem::FormatReader::MultiEntry#each (reader can be obtained via Chem::Format.reader) to get multiple entries instead.

The supported file formats are Chem::DCD. Use the .from_* methods to customize how the object is decoded in the corresponding file format if possible.


[View source]
def self.read(path : Path | String) : self #

Returns the positions3 encoded in the specified file. The file format is chosen based on the filename (see Chem::Format#from_filename). Raises ArgumentError if the file format cannot be determined.

If the file contains multiple entries, this method returns the first one only. Use Array.read to get multiple entries instead.

The supported file formats are the following:

Use the .from_* methods to customize how the object is decoded in the corresponding file format if possible.


[View source]

Instance Method Detail

def cell : Parallelepiped | Nil #

[View source]
def cell? : Parallelepiped | Nil | Nil #

[View source]
def size(*args, **options) #

[View source]
def size(*args, **options, &) #

[View source]
def to_dcd(title : String | Nil = nil) : String #

Returns a string representation of the positions3 using the Chem::DCD file format. Arguments are forwarded to Chem::DCD::Writer.open.


[View source]
def to_dcd(output : IO | Path | String, title : String | Nil = nil) : Nil #

Writes the positions3 to output using the Chem::DCD file format. Arguments are forwarded to Chem::DCD::Writer.open.


[View source]
def to_slice : Slice(Vec3) #

Returns a read-only slice of the positions.


[View source]
def unsafe_fetch(*args, **options) #

[View source]
def unsafe_fetch(*args, **options, &) #

[View source]
def write(output : IO | Path | String, format : Chem::Format | String) : Nil #

Writes the positions3 to output using format. Raises ArgumentError if format has required arguments or cannot write Chem::Spatial::Positions3.

The supported file formats are Chem::DCD. Use the #to_* methods to customize how the object is written in the corresponding file format if possible.


[View source]
def write(path : Path | String) : Nil #

Writes the positions3 to the specified file. The file format is chosen based on the filename (see Chem::Format#from_filename). Raises ArgumentError if the file format cannot be determined.

The supported file formats are the following:

Use the #to_* methods to customize how the object is written in the corresponding file format if possible.


[View source]