class Crysna::TransitionFinder::Edge

Attributes

nodes[R]

attr_reader :nodes, :atom_id, :to_site, :global_vector, :operation, :weight

note[R]

attr_reader :nodes, :atom_id, :to_site, :global_vector, :operation, :weight

weight[R]

attr_reader :nodes, :atom_id, :to_site, :global_vector, :operation, :weight

Public Class Methods

new(nodes, weight, note) click to toggle source

‘nodes’ is assumed to be an array of 2 items which have indices of cells.

E.g., [0, 3]

‘migration’ indicates an array of 2 items which have source and destination sites as String. E.g., [“A”, “C”] ‘operation’ indicates an index of symmetry_operations in model.yaml. ‘weight’ indicates a weight of the edge. def initialize(nodes, atom_id, to_site, global_vector, operation, weight)

# File lib/crysna/transitionfinder/edge.rb, line 18
def initialize(nodes, weight, note)
  if nodes.size != 2
    raise InitializeError, nodes.to_s
  end
  @nodes = nodes
  #@atom_id = atom_id
  #@to_site = to_site
  #@global_vector = global_vector
  #@operation = operation
  @weight = weight
  @note = note
end

Public Instance Methods

==(other) click to toggle source

Return true if @nodes, @migrations, @operation, @weight are the same as others’, respectively. Inverse edge will return false. E.g., e00 = Crysna::TransitionFinder::Edge.new([0, 1], [“A”, “B”], 0, -1.0) e01 = Crysna::TransitionFinder::Edge.new([1, 0], [“B”, “A”], 0, -1.0) e00 == e01 #=> false

# File lib/crysna/transitionfinder/edge.rb, line 37
def ==(other)
  result = true
  result = false if @nodes         != other.nodes
  #result = false if @atom_id != other.atom_id
  #result = false if @to_site != other.to_site
  #result = false if @global_vector != other.global_vector
  #result = false if @operation != other.operation
  result = false if @weight        != other.weight
  result = false if @note      != other.note
  return result
end