struct Chem::Spatial::CoordinatesProxy
- Chem::Spatial::CoordinatesProxy
- Struct
- Value
- Object
Included Modules
- Enumerable(Chem::Spatial::Vector)
- Iterable(Chem::Spatial::Vector)
Defined in:
chem/spatial/coordinates_proxy.crConstructors
Instance Method Summary
- #==(rhs : Enumerable(Vector)) : Bool
- #bounds : Bounds
- #center : Vector
-
#center_along(vec : Vector) : self
Translates coordinates so that the center is at the middle of vec.
-
#center_at(vec : Vector) : self
Translates coordinates so that the center is at vec.
-
#center_at_cell : self
Translates coordinates so that they are centered at the primary unit cell.
-
#center_at_origin : self
Translates coordinates so that the center is at the origin.
-
#com : Vector
Returns the center of mass.
-
#each(fractional : Bool = false) : Iterator(Vector)
Must return an
Iterator
over the elements in this collection. -
#each(fractional : Bool = false, &block : Vector -> )
Must yield this collection's elements to the block.
- #each_with_atom(fractional : Bool = false, &block : Vector, Atom -> )
-
#map(fractional : Bool = false, &block : Vector -> Vector) : Array(Vector)
Returns an
Array
with the results of running the block against each element of the collection. - #map!(fractional : Bool = false, &block : Vector -> Vector) : self
- #map_with_atom(fractional : Bool = false, &block : Vector, Atom -> Vector) : Array(Vector)
- #map_with_atom!(fractional : Bool = false, &block : Vector, Atom -> Vector) : self
-
#to_a(fractional : Bool = false) : Array(Vector)
Returns an
Array
with all the elements in the collection. - #to_cartesian! : self
- #to_fractional! : self
- #transform(transform : AffineTransform) : Array(Vector)
- #transform!(transform : AffineTransform) : self
- #translate(by offset : Vector) : Array(Vector)
- #translate!(by offset : Vector) : self
- #wrap(around center : Vector | Nil = nil) : self
- #wrap(lattice : Lattice, around center : Vector | Nil = nil) : self
Constructor Detail
Instance Method Detail
Translates coordinates so that the center is at the middle of vec.
structure = Structure.read "path/to/file"
structure.coords.center # => [1.5 2.0 3.2]
structure.coords.center_along Vector[0, 10, 0]
structure.coords.center # => [1.5 5.0 3.2]
Translates coordinates so that the center is at vec.
structure = Structure.read "path/to/file"
structure.coords.center # => [1.0 2.0 3.0]
structure.coords.center_at Vector[10, 20, 30]
structure.coords.center # => [10 20 30]
Translates coordinates so that they are centered at the primary unit cell.
Raises NotPeriodicError if coordinates are not periodic.
structure = Structure.read "path/to/file"
structure.lattice # => [[1.0 0.0 0.0] [0.0 25.0 0.0] [0.0 0.0 213]]
structure.coords.center # => [1.0 2.0 3.0]
structure.coords.center_at_cell
structure.coords.center # => [0.5 12.5 106.5]
structure = Structure.read "path/to/non_periodic_file"
structure.coords.center_at_cell # raises NotPeriodicError
Translates coordinates so that the center is at the origin.
structure = Structure.read "path/to/file"
structure.coords.center # => [1.0 2.0 3.0]
structure.coords.center_at_origin
structure.coords.center # => [0.0 0.0 0.0]
Returns the center of mass.
structure = Chem::Structure.build do
atom :O, Vector[1, 2, 3]
atom :H, Vector[4, 5, 6]
atom :H, Vector[7, 8, 9]
end
structure.coords.center # => [4.0 5.0 6.0]
structure.coords.com # => [1.5035248 2.5035248 3.5035248]
Must return an Iterator
over the elements in this collection.
Must yield this collection's elements to the block.
Returns an Array
with the results of running the block against each element of the collection.
[1, 2, 3].map { |i| i * 10 } # => [10, 20, 30]
Returns an Array
with all the elements in the collection.
(1..5).to_a # => [1, 2, 3, 4, 5]