class CrystalCell::Cell

Public Instance Methods

to_ficell(frame_atom_ids = nil) click to toggle source

frame_atom_ids で 骨格原子になるべき原子の indices を与える。 frame_atom_ids が与えなければ、全ての原子が FrameAtom になる。 全ての原子を InterstitialAtom にするには、空配列を与えれば良い。

# File lib/crysna/frameinterstitialcell.rb, line 283
def to_ficell(frame_atom_ids = nil)
  result = FrameInterstitialCell.new(@axes)
  result.comment = self.comment
  if frame_atom_ids
    @atoms.each_with_index do |atom, i|
      if frame_atom_ids.include?(i)
        added_atom = FrameAtom.new(
          atom.element, atom.position, atom.name, atom.movable_flags
        )
      else
        added_atom = InterstitialAtom.new(
          atom.element, atom.position, atom.name, atom.movable_flags
        )
      end
      result.add_atom(added_atom)
    end
  else
    @atoms.each_with_index do |atom, i|
      added_atom = FrameAtom.new(
        atom.element, atom.position, atom.name, atom.movable_flags
      )
      result.add_atom(added_atom)
    end
  end
  return result
end
to_snlcell(sites) click to toggle source

CrystalCell::Cell クラスインスタンスを SiteNameLabeledCell クラスインスタンスに 変換したものを返す。 細かい挙動は SiteNameLabeledCell.initialize を参照のこと。 sites には サイト名を鍵、内部座標を値としたハッシュを渡す。

# File lib/crysna/sitenamelabeledcell.rb, line 214
def to_snlcell(sites)
  result = SiteNameLabeledCell.new(@axes, @atoms, sites)
  result.comment = self.comment
  return result
end