Beispiel #1
0
def _create_phono3py_phonon_fc2(phono3py, energy_to_eV, distance_to_A,
                                tsym_type, symmetrize_fc2, input_filename,
                                log_level):
    if input_filename is None:
        filename = 'disp_fc2.yaml'
    else:
        filename = 'disp_fc2.' + input_filename + '.yaml'
    if log_level:
        print("Displacement dataset is read from %s." % filename)
    file_exists(filename, log_level)
    disp_dataset = parse_disp_fc2_yaml(filename=filename)
    num_atom = phono3py.get_phonon_supercell().get_number_of_atoms()
    if disp_dataset['natom'] != num_atom:
        print("Number of atoms in supercell is not consistent with %s" %
              filename)
        if log_level:
            print_error()
        sys.exit(1)
    _convert_displacement_unit(disp_dataset, distance_to_A, is_fc2=True)

    if log_level:
        print("Sets of supercell forces are read from %s." % "FORCES_FC2")
    file_exists("FORCES_FC2", log_level)
    forces_fc2 = parse_FORCES_FC2(disp_dataset)
    if not forces_fc2:
        return False

    _convert_force_unit(forces_fc2, energy_to_eV, distance_to_A)

    phono3py.produce_fc2(forces_fc2,
                         displacement_dataset=disp_dataset,
                         translational_symmetry_type=tsym_type,
                         is_permutation_symmetry=symmetrize_fc2)

    return True
Beispiel #2
0
def _create_phono3py_phonon_fc2(phono3py, tsym_type, symmetrize_fc2,
                                input_filename, log_level):
    if input_filename is None:
        filename = 'disp_fc2.yaml'
    else:
        filename = 'disp_fc2.' + input_filename + '.yaml'
    if log_level:
        print("Displacement dataset is read from %s." % filename)
    file_exists(filename, log_level)
    disp_dataset = parse_disp_fc2_yaml(filename=filename)
    if log_level:
        print("Sets of supercell forces are read from %s." % "FORCES_FC2")
    file_exists("FORCES_FC2", log_level)
    forces_fc2 = parse_FORCES_FC2(disp_dataset)
    phono3py.produce_fc2(forces_fc2,
                         displacement_dataset=disp_dataset,
                         translational_symmetry_type=tsym_type,
                         is_permutation_symmetry=symmetrize_fc2)
def _create_phono3py_phonon_fc2(phono3py,
                                energy_to_eV,
                                distance_to_A,
                                tsym_type,
                                symmetrize_fc2,
                                input_filename,
                                log_level):
    if input_filename is None:
        filename = 'disp_fc2.yaml'
    else:
        filename = 'disp_fc2.' + input_filename + '.yaml'
    if log_level:
        print("Displacement dataset is read from %s." % filename)
    file_exists(filename, log_level)
    disp_dataset = parse_disp_fc2_yaml(filename=filename)
    num_atom = phono3py.get_phonon_supercell().get_number_of_atoms()
    if disp_dataset['natom'] != num_atom:
        print("Number of atoms in supercell is not consistent with %s" %
              filename)
        if log_level:
            print_error()
        sys.exit(1)
    _convert_displacement_unit(disp_dataset, distance_to_A, is_fc2=True)

    if log_level:
        print("Sets of supercell forces are read from %s." %
              "FORCES_FC2")
    file_exists("FORCES_FC2", log_level)
    forces_fc2 = parse_FORCES_FC2(disp_dataset)
    if not forces_fc2:
        return False

    _convert_force_unit(forces_fc2, energy_to_eV, distance_to_A)

    phono3py.produce_fc2(
        forces_fc2,
        displacement_dataset=disp_dataset,
        translational_symmetry_type=tsym_type,
        is_permutation_symmetry=symmetrize_fc2)

    return True