Esempio n. 1
0
def sssp(aiida_profile, generate_upf_data):
    """Create an SSSP pseudo potential family from scratch."""
    from aiida.common.constants import elements
    from aiida.plugins import GroupFactory

    aiida_profile.reset_db()

    SsspFamily = GroupFactory('pseudo.family.sssp')

    cutoffs = {}
    stringency = 'standard'

    with tempfile.TemporaryDirectory() as dirpath:
        for values in elements.values():

            element = values['symbol']
            upf = generate_upf_data(element)
            filename = os.path.join(dirpath, f'{element}.upf')

            with open(filename, 'w+b') as handle:
                with upf.open(mode='rb') as source:
                    handle.write(source.read())
                    handle.flush()

            cutoffs[element] = {
                'cutoff_wfc': 30.0,
                'cutoff_rho': 240.0,
            }

        label = 'SSSP/1.1/PBE/efficiency'
        family = SsspFamily.create_from_folder(dirpath, label)

    family.set_cutoffs(cutoffs, stringency, unit='Ry')

    return family
Esempio n. 2
0
def sssp(generate_upf_data):
    """Create an SSSP pseudo potential family from scratch."""
    from aiida.plugins import GroupFactory

    SsspFamily = GroupFactory('pseudo.family.sssp')  # pylint: disable=invalid-name
    label = 'SSSP/1.1/PBE/efficiency'

    try:
        family = SsspFamily.objects.get(label=label)
    except exceptions.NotExistent:
        pass
    else:
        return family

    cutoffs_dict = {'normal': {}}

    with tempfile.TemporaryDirectory() as dirpath:
        for values in elements.values():

            element = values['symbol']
            upf = generate_upf_data(element)
            filename = os.path.join(dirpath, f'{element}.upf')

            with open(filename, 'w+b') as handle:
                with upf.open(mode='rb') as source:
                    handle.write(source.read())
                    handle.flush()

            cutoffs_dict['normal'][element] = {'cutoff_wfc': 30., 'cutoff_rho': 240.}

        family = SsspFamily.create_from_folder(dirpath, label)

    for stringency, cutoffs in cutoffs_dict.items():
        family.set_cutoffs(cutoffs, stringency, unit='Ry')

    return family
Esempio n. 3
0
def pseudo_dojo(aiida_profile, generate_psp8_data):
    """Create an PseudoDojo pseudo potential family from scratch."""
    from aiida.common.constants import elements
    from aiida.plugins import GroupFactory, DataFactory

    aiida_profile.reset_db()

    PseudoDojo = GroupFactory('pseudo.family.pseudo_dojo')  # pylint: disable=invalid-name
    Psp8Data = DataFactory('pseudo.psp8')

    cutoffs = {}
    stringency = 'standard'

    with tempfile.TemporaryDirectory() as dirpath:
        for values in elements.values():

            element = values['symbol']
            psp8 = generate_psp8_data(element)
            filename = os.path.join(dirpath, f'{element}.psp8')

            with open(filename, 'w+b') as handle:
                with psp8.open(mode='rb') as source:
                    handle.write(source.read())
                    handle.flush()

            cutoffs[element] = {
                'cutoff_wfc': 36.0,
                'cutoff_rho': 144.0,
            }

        label = 'PseudoDojo/0.4/PBE/SR/standard/psp8'
        family = PseudoDojo.create_from_folder(dirpath, label, pseudo_type=Psp8Data)

    family.set_cutoffs(cutoffs, stringency, unit='Ry')

    return family