示例#1
0
def set_up_g0w0(root_path: str):

    # Material
    species = ['zr', 'o']
    l_max = {'zr': 6, 'o': 5}

    # GW root and exciting input file
    gw_root = write_input_file_with_gw_settings(
        root_path, A1_gs_input,
        GWInput(taskname="g0w0",
                nempty=2000,
                ngridq=[2, 2, 2],
                skipgnd=False,
                n_omega=32))

    # Default basis settings
    default_linear_energies = parse_lo_linear_energies(root_path +
                                                       "/groundstate")
    default_los = {
        'zr': DefaultLOs(default_linear_energies['zr'], energy_tol=0.8),
        'o': DefaultLOs(default_linear_energies['o'], energy_tol=0.8)
    }

    # Default basis strings with .format tags
    default_basis_string = {
        'zr': parse_basis_as_string(root_path + "/groundstate/Zr.xml"),
        'o': parse_basis_as_string(root_path + "/groundstate/O.xml")
    }

    # LO recommendation energies
    lorecommendations = parse_lorecommendations(
        root_path + '/lorecommendations.dat', species)

    # Optimised LO energy cutoffs
    energy_cutoffs = {
        'zr': {
            0: [60, 80, 100, 120, 140, 160, 180, 200],
            1: [60, 80, 100, 120, 140, 160, 180, 200],
            2: [60, 80, 100, 120, 140, 160, 180, 200],
            3: [60, 80, 100, 120, 140, 160, 180, 200],
            4: [60, 80, 100, 120, 140, 160, 180, 200],
            5: [60, 80, 100, 120, 140, 160, 180, 200],
            6: [60, 80, 100, 120, 140, 160, 180, 200]
        },
        'o': {
            0: [60, 80, 100, 120, 140, 160, 180, 200],
            1: [60, 80, 100, 120, 140, 160, 180, 200],
            2: [60, 80, 100, 120, 140, 160, 180, 200],
            3: [60, 80, 100, 120, 140, 160, 180, 200],
            4: [60, 80, 100, 120, 140, 160, 180, 200],
            5: [60, 80, 100, 120, 140, 160, 180, 200]
        }
    }

    # Slurm script settings
    env_vars = OrderedDict([
        ('EXE', '/users/sol/abuccheri/exciting/bin/excitingmpismp'),
        ('OUT', 'terminal.out')
    ])
    module_envs = ['intel/2019']
    slurm_directives = slurm.set_slurm_directives(time=[0, 23, 0, 0],
                                                  partition='all',
                                                  exclusive=True,
                                                  nodes=8,
                                                  ntasks_per_node=2,
                                                  cpus_per_task=18,
                                                  hint='nomultithread')

    species_basis_string = ''
    for s in species:
        species_basis_string += s.capitalize() + str(l_max[s]) + '_'

    for energy_cutoff in restructure_energy_cutoffs(energy_cutoffs):
        # Copy groundstate directory to GW directory
        max_energy_per_species = [
            max(energy_per_l_channel.values())
            for energy_per_l_channel in energy_cutoff.values()
        ]

        job_dir = gw_root + '/max_energy_' + str(
            int(max(max_energy_per_species)))
        print(
            'Creating directory, with input.xml, run.sh and optimised basis:',
            job_dir)
        copy_tree(root_path + '/groundstate', job_dir)

        # Copy input.xml with GW settings
        shutil.copy(gw_root + "/input.xml", job_dir + "/input.xml")

        # New Slurm script
        slurm_directives[
            'job-name'] = "gw_A1_lmax_" + species_basis_string + str(
                int(max(max_energy_per_species))) + 'loEcutoff'
        write_file(
            job_dir + '/run.sh',
            slurm.set_slurm_script(slurm_directives, env_vars, module_envs))

        # Write optimised basis
        write_optimised_lo_basis('zr', l_max['zr'], energy_cutoff['zr'],
                                 lorecommendations['zr'],
                                 default_basis_string['zr'], default_los['zr'],
                                 job_dir)
        write_optimised_lo_basis('o', l_max['o'], energy_cutoff['o'],
                                 lorecommendations['o'],
                                 default_basis_string['o'], default_los['o'],
                                 job_dir)

    return
示例#2
0
def input_for_lmax_pair(root_path: str, species: list, l_max: dict):
    """
    Given an l_max pair, create G0W0 inputs for a specifid range of LO cut-offs per channel,
    as defined in set8/basis.py

    :param str root_path: Top level path to calculations
    :param List[str] species: List of species
    :param dict l_max: l_max associated with each species
    :return:
    """

    # Notes:
    # Ignore queue name and have HAWK assign the correct one.
    # omplace caused issues on test queue, so ignore it for now.

    omp = 16
    directives = set_pbs_pro_directives(time=[24, 00, 0],
                                        nodes=1,
                                        mpi_ranks_per_node=8,
                                        omp_threads_per_process=omp,
                                        cores_per_node=128,
                                        node_type='rome',
                                        job_name='GW_gs')

    env_vars = OrderedDict([(
        'EXE',
        '/zhome/academic/HLRS/pri/ipralbuc/exciting-oxygen_release/bin/exciting_mpismp'
    ), ('OUT', 'terminal.out')])
    module_envs = ['intel/19.1.0', 'mkl/19.1.0', 'impi/19.1.0']
    # mpi_options = ['omplace -nt ' + str(omp)]
    mpi_options = []

    # Need some excessively large number for nempty => exciting takes upper bound
    gw_root = write_input_file(
        root_path, A1_gs_input,
        GWInput(taskname="g0w0",
                nempty=2000,
                ngridq=[2, 2, 2],
                skipgnd=False,
                n_omega=32,
                freqmax=1.0))
    # Default basis settings
    default_linear_energies = parse_lo_linear_energies(root_path +
                                                       "/groundstate")
    default_los = {
        'zr': DefaultLOs(default_linear_energies['zr'], energy_tol=0.8),
        'o': DefaultLOs(default_linear_energies['o'], energy_tol=0.8)
    }

    # Default basis strings with .format tags
    default_basis_string = {
        'zr': parse_basis_as_string(root_path + "/groundstate/Zr.xml"),
        'o': parse_basis_as_string(root_path + "/groundstate/O.xml")
    }

    # LO energies
    lorecommendations = parse_lorecommendations(
        root_path + '/lorecommendations.dat', species)
    energy_cutoffs = set_lo_channel_cutoffs(l_max)

    species_basis_string = "_".join(s.capitalize() + str(l_max[s])
                                    for s in species)

    for ie in range(4, 6):
        energy_cutoff = energy_cutoffs[ie]

        # Copy ground state directory to GW directory
        job_dir = gw_root + '/max_energy_i' + str(ie)
        print(
            'Creating directory, with input.xml, run.sh and optimised basis:',
            job_dir)
        print(root_path)
        copy_tree(root_path + '/groundstate', job_dir)

        # Copy input.xml with GW settings
        shutil.copy(gw_root + "/input.xml", job_dir + "/input.xml")

        # New Slurm script
        directives['N'] = "gw_A1_lmax_" + species_basis_string + str(ie)
        write_file(job_dir + '/run.sh',
                   set_pbs_pro(directives, env_vars, module_envs, mpi_options))

        # Write optimised basis
        write_optimised_lo_bases(species, l_max, energy_cutoff,
                                 lorecommendations, default_basis_string,
                                 default_los, job_dir)