Added mode halbach, firt implemention of mode wiggler for spec output, inserted some helping functions