def check_symmetry(input_cell, primitive_axis=None, symprec=1e-5, phonopy_version=None): if primitive_axis is None: cell = get_primitive(input_cell, np.eye(3), symprec=symprec) else: cell = get_primitive(input_cell, primitive_axis, symprec=symprec) symmetry = Symmetry(cell, symprec) print get_symmetry_yaml(cell, symmetry, phonopy_version), if input_cell.get_magnetic_moments() == None: primitive = find_primitive(cell, symprec) if not primitive==None: print "# Primitive cell was found. It is written into PPOSCAR." write_vasp('PPOSCAR', primitive) # Overwrite symmetry and cell symmetry = Symmetry(primitive, symprec) cell = primitive bravais_lattice, bravais_pos, bravais_numbers = \ spg.refine_cell(cell, symprec) bravais = Atoms(numbers=bravais_numbers, scaled_positions=bravais_pos, cell=bravais_lattice, pbc=True) print "# Bravais lattice is written into BPOSCAR." write_vasp('BPOSCAR', bravais)
def check_symmetry(input_cell, primitive_axis=None, symprec=1e-5, distance_to_A=1.0, phonopy_version=None): if primitive_axis is None: cell = get_primitive(input_cell, np.eye(3), symprec=symprec) else: cell = get_primitive(input_cell, primitive_axis, symprec=symprec) lattice = cell.get_cell() * distance_to_A cell.set_cell(lattice) symmetry = Symmetry(cell, symprec) print(_get_symmetry_yaml(cell, symmetry, phonopy_version)) if input_cell.get_magnetic_moments() is None: primitive = find_primitive(cell, symprec) if primitive is not None: print("# Primitive cell was found. It is written into PPOSCAR.") write_vasp('PPOSCAR', primitive) # Overwrite symmetry and cell symmetry = Symmetry(primitive, symprec) cell = primitive (bravais_lattice, bravais_pos, bravais_numbers) = spg.refine_cell(cell, symprec) bravais = Atoms(numbers=bravais_numbers, scaled_positions=bravais_pos, cell=bravais_lattice, pbc=True) print("# Bravais lattice is written into BPOSCAR.") write_vasp('BPOSCAR', bravais)
def check_symmetry(input_cell, primitive_axis=None, symprec=1e-5, distance_to_A=1.0, phonopy_version=None): if primitive_axis is None: cell = get_primitive(input_cell, np.eye(3), symprec=symprec) else: cell = get_primitive(input_cell, primitive_axis, symprec=symprec) lattice = cell.get_cell() * distance_to_A cell.set_cell(lattice) symmetry = Symmetry(cell, symprec) print(_get_symmetry_yaml(cell, symmetry, phonopy_version)) if input_cell.get_magnetic_moments() is None: primitive = find_primitive(cell, symprec) if primitive is not None: print("# Primitive cell was found. It is written into PPOSCAR.") write_vasp('PPOSCAR', primitive) # Overwrite symmetry and cell symmetry = Symmetry(primitive, symprec) cell = primitive (bravais_lattice, bravais_pos, bravais_numbers) = spg.refine_cell(cell, symprec) bravais = Atoms(numbers=bravais_numbers, scaled_positions=bravais_pos, cell=bravais_lattice, pbc=True) print("# Bravais lattice is written into BPOSCAR.") write_vasp('BPOSCAR', bravais)
def check_symmetry(phonon, optional_structure_info): # Assumed that supercell is unit cell. print(_get_symmetry_yaml(phonon.supercell, phonon.symmetry, phonon.version)) if phonon.unitcell.magnetic_moments is None: base_fname = get_default_cell_filename(phonon.calculator) symprec = phonon.symmetry.get_symmetry_tolerance() (bravais_lattice, bravais_pos, bravais_numbers) = spg.refine_cell(phonon.unitcell, symprec) bravais = PhonopyAtoms(numbers=bravais_numbers, scaled_positions=bravais_pos, cell=bravais_lattice) filename = 'B' + base_fname print("# Symmetrized conventional unit cell is written into %s." % filename) trans_mat = guess_primitive_matrix(bravais, symprec=symprec) primitive = get_primitive(bravais, trans_mat, symprec=symprec) write_crystal_structure( filename, bravais, interface_mode=phonon.calculator, optional_structure_info=optional_structure_info) filename = 'P' + base_fname print("# Symmetrized primitive is written into %s." % filename) write_crystal_structure( filename, primitive, interface_mode=phonon.calculator, optional_structure_info=optional_structure_info)
def check_symmetry(input_cell, primitive_axis=np.eye(3, dtype=float), symprec=1e-5, phonopy_version=None): cell = Primitive(input_cell, primitive_axis, symprec) symmetry = Symmetry(cell, symprec) print get_symmetry_yaml(cell, symmetry, phonopy_version), if input_cell.get_magnetic_moments() == None: primitive = find_primitive(cell, symprec) if not primitive == None: print "# Primitive cell was found. It is written into PPOSCAR." write_vasp('PPOSCAR', primitive) # Overwrite symmetry and cell symmetry = Symmetry(primitive, symprec) cell = primitive bravais_lattice, bravais_pos, bravais_numbers = \ spg.refine_cell(cell, symprec) bravais = Atoms(numbers=bravais_numbers, scaled_positions=bravais_pos, cell=bravais_lattice, pbc=True) print "# Bravais lattice is written into BPOSCAR." write_vasp('BPOSCAR', bravais)