Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)