struct Chem::Spatial::Vector
- Chem::Spatial::Vector
- Struct
- Value
- Object
Defined in:
chem/spatial/vector.crConstructors
- .[](x : NumberType, y : NumberType, z : NumberType) : self
- .new(x : Float64, y : Float64, z : Float64)
- .new(x : NumberType, y : NumberType, z : NumberType)
- .origin : self
- .x : self
- .y : self
- .z : self
- .zero : self
Instance Method Summary
- #*(other : Number) : self
- #*(other : Vector) : self
- #*(other : Tuple(NumberType, NumberType, NumberType)) : self
- #*(rhs : AffineTransform) : self
- #+(other : Number) : self
- #+(other : Vector) : self
- #+(other : Tuple(NumberType, NumberType, NumberType)) : self
- #+(rhs : Size) : self
- #-(other : Number) : self
- #-(other : Vector) : self
- #-(other : Tuple(NumberType, NumberType, NumberType)) : self
- #-(rhs : Size) : self
- #- : self
- #/(other : Number) : self
- #/(other : Vector) : self
- #/(other : Tuple(NumberType, NumberType, NumberType)) : self
- #[](index : Int32) : Float64
- #abs : self
- #clamp(min : Number, max : Number) : self
- #clamp(range : Range) : self
- #cross(other : Vector) : self
- #dot(other : Vector) : Float64
- #floor : self
-
#image(lattice : Lattice, i : Int, j : Int, k : Int) : self
Returns vector's PBC image with respect to
lattice
-
#image(i : Int, j : Int, k : Int) : self
Returns vector's PBC image in fractional coordinates
- #inspect(io : ::IO)
- #inv : self
- #map(&block : Float64 -> Number::Primitive) : self
- #map_with_index(&block : Float64, Int32 -> Number::Primitive) : self
- #normalize : self
- #origin? : Bool
- #pad(padding : Number) : self
- #resize(new_size : Number) : self
- #rotate(about rotaxis : Vector, by theta : Float64) : self
- #round : self
- #size : Float64
- #to_a : Array(Float64)
- #to_cartesian(basis : Basis) : self
- #to_cartesian(lattice : Lattice) : self
- #to_fractional(basis : Basis) : self
- #to_fractional(lattice : Lattice) : self
- #to_m : Linalg::Matrix
- #to_s(io : ::IO)
- #to_t : Tuple(Float64, Float64, Float64)
- #wrap(lattice : Lattice, around center : self) : self
- #wrap(around center : self) : self
- #wrap(lattice : Lattice) : self
- #wrap : self
- #x : Float64
- #x? : Bool
- #y : Float64
- #y? : Bool
- #z : Float64
- #z? : Bool
- #zero? : Bool
Constructor Detail
Instance Method Detail
Returns vector's PBC image with respect to lattice
lat = Lattice.new S[2, 2, 3], 90, 90, 120
lat.i # => Vector[2.0, 0.0, 0.0]
lat.j # => Vector[-1, 1.732, 0.0]
lat.k # => Vector[0.0, 0.0, 3.0]
vec = Vector[1, 1, 1.5]
vec.image(lat, 1, 0, 0) # => Vector[3.0, 1.0, 1.5]
vec.image(lat, 0, 1, 0) # => Vector[0.0, 2.732, 1.5]
vec.image(lat, 0, 0, 1) # => Vector[1.0, 1.0, 4.5]
vec.image(lat, 1, 0, 1) # => Vector[3.0, 1.0, 4.5]
vec.image(lat, 1, 1, 1) # => Vector[2.0, 2.732, 4.5]
Returns vector's PBC image in fractional coordinates
vec = Vector[0.456, 0.1, 0.8]
vec.image 1, 0, 0 # => Vector[1.456, 0.1, 0.8]
vec.image -1, 0, 0 # => Vector[-0.544, 0.1, 0.8]
vec.image -1, 1, -5 # => Vector[-0.544, 1.1, -4.2]