Example #1
0
    def _run(self):
        self._set_best_arguments_of_vectors_and_supercell()
        max_num_op = 0
        best_cells = []
        points_on_sphere = []
        for i, point in enumerate(self._get_all_points_on_sphere()):
            modcell = self._get_cell_with_modulation(
                self._get_modulation(point))
            symmetry = get_symmetry_dataset(modcell,
                                            tolerance=self._symmetry_tolerance)

            if self._store_all:
                self._all_cells.append(modcell)

            refined_cell = get_crystallographic_cell(
                modcell, tolerance=self._symmetry_tolerance)
            num_op = len(symmetry['rotations'])
            if num_op > max_num_op:
                max_num_op = num_op
                best_cells = [refined_cell]
                points_on_sphere = [point.copy()]
            if num_op == max_num_op:
                is_found = True
                for bc in best_cells:
                    if xtal_compare(bc,
                                    refined_cell,
                                    tolerance=self._symmetry_tolerance,
                                    angle_tolerance=1.0):
                        is_found = False
                        break
                if is_found:
                    best_cells.append(refined_cell)
                    points_on_sphere.append(point.copy())

        self._points_on_sphere = points_on_sphere
Example #2
0
    def _set_phonon(self):
        if self._supercell_matrix is None:
            cell = sort_cell_by_symbols(
                get_crystallographic_cell(self.get_cell()))
            self._supercell_matrix = estimate_supercell_matrix(
                cell,
                max_num_atoms=self._max_num_atoms)
        else:
            cell = self.get_cell()

        phonopy_cell = cell2atoms(cell)
        self._phonon = Phonopy(phonopy_cell,
                               self._supercell_matrix,
                               primitive_matrix=self._primitive_matrix,
                               dynamical_matrix_decimals=14,
                               force_constants_decimals=14,
                               symprec=self._symmetry_tolerance)
        self._phonon.generate_displacements(
            distance=self._distance,
            is_plusminus=self._displace_plusminus,
            is_diagonal=self._displace_diagonal)
        supercell = self._phonon.get_supercell()
        displacements = self._phonon.get_displacements()

        write_poscar(cell, filename="POSCAR-unitcell")
        write_poscar_yaml(cell, filename="POSCAR-unitcell.yaml")
        write_disp_yaml(displacements, supercell)
Example #3
0
def get_primitive(cell, tolerance=1e-5):
    # spglib returns R-centred lattice for Rhombohedrals
    brv_cell = get_crystallographic_cell(cell, tolerance)
    sym_dataset = get_symmetry_dataset(brv_cell)
    spg_symbol = sym_dataset['international'][0]
    if spg_symbol == 'F':
        brv_cell = _fc2prim(brv_cell)
    elif spg_symbol == 'I':
        brv_cell = _bc2prim(brv_cell)
    elif spg_symbol == 'A':
        brv_cell = _abc2prim(brv_cell)
    elif spg_symbol == 'B':
        brv_cell = _bbc2prim(brv_cell)
    elif spg_symbol == 'C':
        brv_cell = _cbc2prim(brv_cell)
    return brv_cell
Example #4
0
def get_primitive(cell, tolerance=1e-5):
    # spglib returns R-centred lattice for Rhombohedrals
    std_cell = get_crystallographic_cell(cell, tolerance)
    sym_dataset = get_symmetry_dataset(std_cell)
    spg_symbol = sym_dataset['international'][0]
    if spg_symbol == 'F':
        std_cell = _fc2prim(std_cell)
    elif spg_symbol == 'I':
        std_cell = _bc2prim(std_cell)
    elif spg_symbol == 'A':
        std_cell = _abc2prim(std_cell)
    elif spg_symbol == 'B':
        std_cell = _bbc2prim(std_cell)
    elif spg_symbol == 'C':
        std_cell = _cbc2prim(std_cell)
    return std_cell
Example #5
0
    def _run(self):
        self._set_best_arguments_of_vectors_and_supercell()
        max_num_op = 0
        best_cells = []
        points_on_sphere = []
        for i, point in enumerate(self._get_all_points_on_sphere()):
            modcell = self._get_cell_with_modulation(
                self._get_modulation(point))
            symmetry = get_symmetry_dataset(
                modcell, tolerance=self._symmetry_tolerance)

            if self._store_all:
                self._all_cells.append(modcell)

            refined_cell = get_crystallographic_cell(
                modcell,
                tolerance=self._symmetry_tolerance)
            num_op = len(symmetry['rotations'])
            if num_op > max_num_op:
                max_num_op = num_op
                best_cells = [refined_cell]
                points_on_sphere = [point.copy()]
            if num_op == max_num_op:
                is_found = True
                for bc in best_cells:
                    if xtal_compare(bc,
                                    refined_cell,
                                    tolerance=self._symmetry_tolerance,
                                    angle_tolerance=1.0):
                        is_found = False
                        break
                if is_found:
                    best_cells.append(refined_cell)
                    points_on_sphere.append(point.copy())

        self._points_on_sphere = points_on_sphere
Example #6
0
                 'icsd_ids': get_icsd_ids,
                 'e_above_hull': get_e_above_hull,
                 'pretty_formula': get_pretty_formula,
                 'created_at': get_created_at,
                 'is_hubbard': get_is_hubbard,
                 'nsites': get_nsites,
                 'elasticity': get_elasticity,
                 'final_structure': get_final_structure,
                 'initial_structure': get_initial_structure,
                 'icsd_id': get_icsd_id,
                 'spacegroup': get_spacegroup,
                 'magnetic_type': get_magnetic_type,
                 'exp_lattice': get_exp_lattice}

functions = {'band_gap': get_band_gap,
             'e_above_hull': get_e_above_hull,
             'is_hubbard': get_is_hubbard,
             'final_structure': get_final_structure,
             'initial_structure': get_initial_structure,
             'magnetic_type': get_magnetic_type}

mid = sys.argv[2]
for line in open(sys.argv[1]):
    words = line.partition(':')
    key = words[0].strip()
    if key in functions:
        if key == 'final_structure':
            retval = functions[key](words[2].strip(), show=False)
            brv_cell = get_crystallographic_cell(retval, tolerance=1e-1)
            write_poscar(brv_cell, filename="BPOSCAR-%s" % mid)