def is_dihedral(self): """ Whether or not the reflection is a sigma_d """ if self.principal_reflection: return False for atom in self.molecule: # If there's an atom in the plane, it's a sigma_v. If there's an atom in the direction of the normal (or it's negative), # it's sigma_v. Otherwise, it's a sigma_d. If the atom is at the origin, ignore it. if atom.pos.is_zero(): continue elif SymmetryOperation.is_same_axis(self.axis, atom.pos): return False elif SymmetryOperation.is_perpendicular(self.axis, atom.pos): return False return True
def _get_name(self): """ Get the name of the point group """ # Using a flow charts from http://www.mineralatlas.com/fga/image007.gif and # http://capsicum.me.utexas.edu/ChE386K/html/flowchart_point_groups.htm # If two or more C_n with n > 2... if len( [rot for rot in self.rotations if rot.n > 2 and rot.exponent == 1 ]) >= 2: # 12 C5 axes? if self.num_C_n_axes(5) == 12: if self.inversion is None: self.name = 'I' return else: self.name = 'I_h' return # 6 C4s? elif self.num_C_n_axes(4) == 6: if self.inversion is None: self.name = 'O' return else: self.name = 'O_h' return # 4 C3s? elif self.num_C_n_axes(3) == 4: # 8 C3s? if self.inversion is None: if len(self.reflections) == 6: self.name = 'T_d' return else: self.name = 'T' return else: self.name = 'T_h' return else: raise GroupTheoryError( "Don't know the name of group with classes: " + str(self.classes) + ". (Perhaps adjust tolerances?)") elif len(self.rotations) > 0: highest_Cn = self.rotations[0] highest_n = highest_Cn.n highest_axis = highest_Cn.axis count = 0 for rot in self.rotations: if rot.n == 2 and SymmetryOperation.is_perpendicular( highest_axis, rot.axis): count += 1 if count == highest_n: if any(ref.is_principal_reflection() for ref in self.reflections): self.name = 'D_' + str(highest_n) + 'h' return elif len(self.reflections) == highest_n: self.name = 'D_' + str(highest_n) + 'd' return elif len(self.reflections) == 0: self.name = 'D_' + str(highest_n) else: raise GroupTheoryError( "Don't know the name of group with classes: " + str(self.classes) + ". (Perhaps adjust tolerances?)") else: if any(ref.is_principal_reflection() for ref in self.reflections): self.name = 'C_' + str(highest_n) + 'h' return elif len(self.reflections) == highest_n: self.name = 'C_' + str(highest_n) + 'v' return elif any(irot.n == 2 * highest_n for irot in self.improper_rotations): self.name = 'S_' + str(2 * highest_n) return else: self.name = 'C_' + str(highest_n) return else: if len(self.reflections) == 1: self.name = 'C_s' return elif not self.inversion is None: self.name = 'C_i' return elif len(self) == 1: self.name = 'C_1' else: raise GroupTheoryError( "Don't know the name of group with classes: " + str(self.classes) + ". (Perhaps adjust tolerances?)")
def _get_name(self): """ Get the name of the point group """ # Using a flow charts from http://www.mineralatlas.com/fga/image007.gif and # http://capsicum.me.utexas.edu/ChE386K/html/flowchart_point_groups.htm # If two or more C_n with n > 2... if len([rot for rot in self.rotations if rot.n > 2 and rot.exponent == 1 ]) >= 2: # 12 C5 axes? if self.num_C_n_axes(5) == 12: if self.inversion is None: self.name = 'I' return else: self.name = 'I_h' return # 6 C4s? elif self.num_C_n_axes(4) == 6: if self.inversion is None: self.name = 'O' return else: self.name = 'O_h' return # 4 C3s? elif self.num_C_n_axes(3) == 4: # 8 C3s? if self.inversion is None: if len(self.reflections) == 6: self.name = 'T_d' return else: self.name = 'T' return else: self.name = 'T_h' return else: raise GroupTheoryError("Don't know the name of group with classes: " + str(self.classes) + ". (Perhaps adjust tolerances?)") elif len(self.rotations) > 0: highest_Cn = self.rotations[0] highest_n = highest_Cn.n highest_axis = highest_Cn.axis count = 0 for rot in self.rotations: if rot.n == 2 and SymmetryOperation.is_perpendicular(highest_axis, rot.axis): count += 1 if count == highest_n: if any(ref.is_principal_reflection() for ref in self.reflections): self.name = 'D_' + str(highest_n) + 'h' return elif len(self.reflections) == highest_n: self.name = 'D_' + str(highest_n) + 'd' return elif len(self.reflections) == 0: self.name = 'D_' + str(highest_n) else: raise GroupTheoryError("Don't know the name of group with classes: " + str(self.classes) + ". (Perhaps adjust tolerances?)") else: if any(ref.is_principal_reflection() for ref in self.reflections): self.name = 'C_' + str(highest_n) + 'h' return elif len(self.reflections) == highest_n: self.name = 'C_' + str(highest_n) + 'v' return elif any(irot.n == 2*highest_n for irot in self.improper_rotations): self.name = 'S_' + str(2*highest_n) return else: self.name = 'C_' + str(highest_n) return else: if len(self.reflections) == 1: self.name = 'C_s' return elif not self.inversion is None: self.name = 'C_i' return elif len(self) == 1: self.name = 'C_1' else: raise GroupTheoryError("Don't know the name of group with classes: " + str(self.classes) + ". (Perhaps adjust tolerances?)")