Exemplo n.º 1
0
def show_num_triplets(primitive, mesh, mesh_divs, grid_points,
                      coarse_mesh_shifts, is_kappa_star, symprec, log_level):
    print("-" * 76)

    ir_grid_points, _, grid_address, _ = get_coarse_ir_grid_points(
        primitive,
        mesh,
        mesh_divs,
        coarse_mesh_shifts,
        is_kappa_star=is_kappa_star,
        symprec=symprec)

    if grid_points:
        _grid_points = grid_points
    else:
        _grid_points = ir_grid_points

    print("Grid point        q-point        No. of triplets")
    for gp in _grid_points:
        num_triplets = get_number_of_triplets(primitive,
                                              mesh,
                                              gp,
                                              symprec=symprec)
        q = grid_address[gp] / np.array(mesh, dtype='double')
        print("  %5d     (%5.2f %5.2f %5.2f)  %8d" %
              (gp, q[0], q[1], q[2], num_triplets))
Exemplo n.º 2
0
def write_grid_points(primitive,
                      mesh,
                      mesh_divs=None,
                      band_indices=None,
                      sigmas=None,
                      temperatures=None,
                      coarse_mesh_shifts=None,
                      is_kappa_star=True,
                      is_lbte=False,
                      symprec=1e-5):
    print("-" * 76)
    if mesh is None:
        print("To write grid points, mesh numbers have to be specified.")
    else:
        (ir_grid_points, grid_weights, bz_grid_address,
         grid_mapping_table) = get_coarse_ir_grid_points(
             primitive,
             mesh,
             mesh_divs,
             coarse_mesh_shifts,
             is_kappa_star=is_kappa_star,
             symprec=symprec)
        write_ir_grid_points(mesh, mesh_divs, ir_grid_points, grid_weights,
                             bz_grid_address,
                             np.linalg.inv(primitive.get_cell()))
        gadrs_hdf5_fname = write_grid_address_to_hdf5(bz_grid_address, mesh,
                                                      grid_mapping_table)

        print("Ir-grid points are written into \"ir_grid_points.yaml\".")
        print("Grid addresses are written into \"%s\"." % gadrs_hdf5_fname)

        if is_lbte and temperatures is not None:
            num_temp = len(temperatures)
            num_sigma = len(sigmas)
            num_ir_gp = len(ir_grid_points)
            num_band = primitive.get_number_of_atoms() * 3
            num_gp = len(bz_grid_address)
            if band_indices is None:
                num_band0 = num_band
            else:
                num_band0 = len(band_indices)
            print("Memory requirements:")
            size = (num_band0 * 3 * num_ir_gp * num_band * 3) * 8 / 1.0e9
            print("- Piece of collision matrix at each grid point, temp and "
                  "sigma: %.2f Gb" % size)
            size = (num_ir_gp * num_band * 3)**2 * 8 / 1.0e9
            print("- Full collision matrix at each temp and sigma: %.2f Gb" %
                  size)
            size = num_gp * (num_band**2 * 16 + num_band * 8 + 1) / 1.0e9
            print("- Phonons: %.2f Gb" % size)
            size = num_gp * 5 * 4 / 1.0e9
            print("- Grid point information: %.2f Gb" % size)
            size = (num_ir_gp * num_band0 *
                    (3 + 6 + num_temp * 2 + num_sigma * num_temp * 15 + 2) *
                    8 / 1.0e9)
            print("- Phonon properties: %.2f Gb" % size)
Exemplo n.º 3
0
def write_grid_points(primitive,
                      mesh,
                      mesh_divs=None,
                      band_indices=None,
                      sigmas=None,
                      temperatures=None,
                      coarse_mesh_shifts=None,
                      is_kappa_star=True,
                      write_collision=False,
                      symprec=1e-5):
    print("-" * 76)
    if mesh is None:
        print("To write grid points, mesh numbers have to be specified.")
    else:
        (ir_grid_points, grid_weights, bz_grid_address,
         grid_mapping_table) = get_coarse_ir_grid_points(
             primitive,
             mesh,
             mesh_divs,
             coarse_mesh_shifts,
             is_kappa_star=is_kappa_star,
             symprec=symprec)
        write_ir_grid_points(mesh, mesh_divs, ir_grid_points, grid_weights,
                             bz_grid_address,
                             np.linalg.inv(primitive.get_cell()))
        gadrs_hdf5_fname = write_grid_address_to_hdf5(bz_grid_address, mesh,
                                                      grid_mapping_table)

        print("Ir-grid points are written into \"ir_grid_points.yaml\".")
        print("Grid addresses are written into \"%s\"." % gadrs_hdf5_fname)

        if write_collision and temperatures is not None:
            num_temp = len(temperatures)
            num_sigma = len(sigmas)
            num_ir_grid_points = len(ir_grid_points)
            num_band = primitive.get_number_of_atoms() * 3
            if band_indices is None:
                num_band0 = num_band
            else:
                num_band0 = len(band_indices)
            size = (num_sigma * num_temp * num_band0 * 3 * num_ir_grid_points *
                    num_band * 3) * 8 / 1e9
            print(
                "Memory size needed for collision matrix at each grid point: "
                "%.2f Gb" % size)
            size = (num_ir_grid_points * num_band * 3)**2 * 8 / 1e9
            print("Memory size needed for one full collision matrix: %.2f Gb" %
                  size)
Exemplo n.º 4
0
def show_num_triplets(primitive,
                      mesh,
                      mesh_divs=None,
                      band_indices=None,
                      grid_points=None,
                      coarse_mesh_shifts=None,
                      is_kappa_star=True,
                      symprec=1e-5):
    print("-" * 76)

    ir_grid_points, _, grid_address, _ = get_coarse_ir_grid_points(
        primitive,
        mesh,
        mesh_divs,
        coarse_mesh_shifts,
        is_kappa_star=is_kappa_star,
        symprec=symprec)

    if grid_points:
        _grid_points = grid_points
    else:
        _grid_points = ir_grid_points

    num_band = primitive.get_number_of_atoms() * 3
    if band_indices is None:
        num_band0 = num_band
    else:
        num_band0 = len(band_indices)

    print("Grid point        q-point        No. of triplets     Memory size")
    for gp in _grid_points:
        num_triplets = get_number_of_triplets(primitive,
                                              mesh,
                                              gp,
                                              swappable=True,
                                              symprec=symprec)
        q = grid_address[gp] / np.array(mesh, dtype='double')
        size = num_triplets * num_band0 * num_band ** 2 * 8 / 1e6
        print("  %5d     (%5.2f %5.2f %5.2f)  %8d              %d Mb" %
              (gp, q[0], q[1], q[2], num_triplets, size))
Exemplo n.º 5
0
def write_grid_points(primitive, mesh, mesh_divs, coarse_mesh_shifts,
                      is_kappa_star, symprec, log_level):
    print("-" * 76)
    if mesh is None:
        print("To write grid points, mesh numbers have to be specified.")
    else:
        (ir_grid_points, grid_weights, bz_grid_address,
         grid_mapping_table) = get_coarse_ir_grid_points(
             primitive,
             mesh,
             mesh_divs,
             coarse_mesh_shifts,
             is_kappa_star=is_kappa_star,
             symprec=symprec)
        write_ir_grid_points(mesh, mesh_divs, ir_grid_points, grid_weights,
                             bz_grid_address,
                             np.linalg.inv(primitive.get_cell()))
        gadrs_hdf5_fname = write_grid_address_to_hdf5(bz_grid_address, mesh,
                                                      grid_mapping_table)

        print("Ir-grid points are written into \"ir_grid_points.yaml\".")
        print("Grid addresses are written into \"%s\"." % gadrs_hdf5_fname)