struct Chem::Spatial::CoordinatesProxy
- Chem::Spatial::CoordinatesProxy
 - Struct
 - Value
 - Object
 
Included Modules
- Enumerable(Chem::Spatial::Vec3)
 - Iterable(Chem::Spatial::Vec3)
 
Defined in:
chem/spatial/coordinates_proxy.crConstructors
Instance Method Summary
- #==(rhs : Enumerable(Vec3)) : Bool
 - 
        #align_to(other : self) : self
        
          
Superimposes the coordinates onto other.
 - #bounds : Parallelepiped
 - #center : Vec3
 - 
        #center_along(vec : Vec3) : self
        
          
Translates coordinates so that the center is at the middle of vec.
 - 
        #center_at(vec : Vec3) : 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 : Vec3
        
          
Returns the center of mass.
 - 
        #each(fractional : Bool = false) : Iterator(Vec3)
        
          
Must return an
Iteratorover the elements in this collection. - 
        #each(fractional : Bool = false, &block : Vec3 -> )
        
          
Must yield this collection's elements to the block.
 - #each_with_atom(fractional : Bool = false, &block : Vec3, Atom -> )
 - #map!(fractional : Bool = false, &block : Vec3 -> Vec3) : self
 - #map_with_atom!(fractional : Bool = false, &block : Vec3, Atom -> Vec3) : self
 - 
        #rmsd(other : self, weights : Indexable(Float64), minimize : Bool = false) : Float64
        
          
Returns the weighted root mean square deviation (RMSD) in Å between the coordinates and other.
 - 
        #rmsd(other : CoordinatesProxy, minimize : Bool = false) : Float64
        
          
Returns the root mean square deviation (RMSD) in Å between the coordinates and other.
 - 
        #rotate(x : Number, y : Number, z : Number, pivot : Vec3 = center) : self
        
          
Rotates the coordinates by the given Euler angles in degrees.
 - 
        #rotate(about rotaxis : Vec3, by angle : Number, pivot : Vec3 = center) : self
        
          
Rotates the coordinates about rotaxis by angle degrees.
 - 
        #rotate(quat : Quat, pivot : Vec3 = center) : self
        
          
Rotates the coordinates by the given quaternion.
 - 
        #to_a(fractional : Bool = false) : Array(Vec3)
        
          
Returns an
Arraywith all the elements in the collection. - #to_cart! : self
 - #to_fract! : self
 - 
        #transform(transform : Transform) : self
        
          
Transforms the coordinates by the given transformation.
 - 
        #translate(by offset : Vec3) : self
        
          
Translates the coordinates by the given offset.
 - #unwrap : self
 - #wrap(around center : Vec3 | Nil = nil) : self
 - #wrap(cell : Parallelepiped, around center : Vec3 | Nil = nil) : self
 
Instance methods inherited from module Enumerable(Chem::Spatial::Vec3)
  
  
    
      average(weights : Indexable(Number))average(weights : Indexable(Number), & : T -> _) average, mean
mean(& : T -> _) mean
Constructor Detail
Instance Method Detail
Superimposes the coordinates onto other. Raises ArgumentError
if the two coordinate sets are of different size.
conformers = Array(Structure).read "E20_conformers.mol2"
ref_pos = conformers[0].coords
pos = conformers[1].coords
Spatial.rmsd(pos, ref_pos)   # => 7.933736
pos.center == ref_pos.center # => false
pos.align_to(res_pos)
Spatial.rmsd(pos, ref_pos)   # => 3.463298
pos.center == ref_pos.center # => true
The transformation is obtained via the
Transform.aligning(pos, ref_pos) method, which computes
the optimal rotation matrix by minimizing the root mean square
deviation (RMSD) using the QCP method (refer to Spatial.qcp for
details).
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 Vec3[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 Vec3[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.cell          # => [[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, Vec3[1, 2, 3]
  atom :H, Vec3[4, 5, 6]
  atom :H, Vec3[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 the weighted root mean square deviation (RMSD) in Å between the coordinates and other.
The RMSD is defined as the weighted average Euclidean distance between the two coordinates sets A and B. The weights (e.g., atom masses) determine the relative weights of each coordinate when calculating the RMSD.
If the minimum RMSD is desired (minimize is true), the RMSD
will be computed using the quaternion-based characteristic
polynomial (QCP) method (refer to .qcp). This method superimpose
the coordinates onto other by computing the optimal rotation
between the two coordinate sets before calculating the RMSD.
Returns the root mean square deviation (RMSD) in Å between the coordinates and other.
The RMSD is defined as the average Euclidean distance between the two coordinates sets A and B.
If the minimum RMSD is desired (minimize is true), the RMSD
will be computed using the quaternion-based characteristic
polynomial (QCP) method (refer to .qcp). This method superimpose
the coordinates onto other by computing the optimal rotation
between the two coordinate sets before calculating the RMSD.
Rotates the coordinates by the given Euler angles in degrees. The rotation will be centered at pivot, which defaults to the coordinates' center.
Delegates to Quat.rotation for computing the rotation.
Rotates the coordinates about rotaxis by angle degrees. The rotation will be centered at pivot, which defaults to the coordinates' center.
Delegates to Quat.rotation for computing the rotation.
Rotates the coordinates by the given quaternion. The rotation will be centered at pivot, which defaults to the coordinates' center.
Returns an Array with all the elements in the collection.
(1..5).to_a # => [1, 2, 3, 4, 5]
        Transforms the coordinates by the given transformation.
Translates the coordinates by the given offset.