require 'pntgrp' class MagneticPointGroup < PointGroup def point() return PointGroup::new(@string.gsub(/'/){""}) end def rotation() return point.rotation end def gen_matrix() g=[] for e in generator() inv=1 inv=-1 if e=~/^\-/ tim=1 tim=-1 if e=~/'/ g.push(TimeInv::new(inv*Element[e.gsub(/[\-']/){""}],tim)) end return g end def element() return position(TimeInv::new(Element["1z"])) end end # class class TimeInv def initialize(s,t=1) @space=s @time=t end def ==(other) return false unless TimeInv === other @space == other.space and @time == other.time end alias eql? == def *(n) # n is case(n) when Matrix return TimeInv::new(@space*n,@time) when TimeInv return TimeInv::new(@space*n.space,@time*n.time) else return 1 end end def inverse return TimeInv::new(@space.inverse,1/@time) end alias inv inverse attr_reader :space attr_reader :time def to_xyz s=@space.to_xyz s+=["'"] if @time==-1 return s end end #class