Exemplo n.º 1
0
def main(pot_family, import_from, queue, code, computer, no_import):
    load_dbenv_if_not_loaded()
    from aiida.orm import WorkflowFactory, Code
    from aiida.work import submit

    if not no_import:
        click.echo('importing POTCAR files...')
        with cli_spinner():
            import_pots(import_from, pot_family)

    code = Code.get_from_string('{}@{}'.format(code, computer))
    workflow = WorkflowFactory('vasp.relax')

    inputs = AttributeDict()
    inputs.structure = create_structure_perturbed()
    inputs.kpoints = AttributeDict()
    inputs.kpoints.distance = get_data_node('float', 0.2)
    inputs.relax = AttributeDict()
    inputs.convergence = AttributeDict()
    inputs.convergence.shape = AttributeDict()
    inputs.convergence.on = get_data_node('bool', True)
    inputs.convergence.positions = get_data_node('float', 0.1)
    inputs.incar_add = get_data_node('parameter', dict={
        'nsw': 1, 'ediffg': -0.0001, 'encut': 240, 'ismear': 0, 'sigma': 0.1, 'system': 'test-case:test_relax_wf',
    })  # yapf: disable
    inputs.restart = AttributeDict()
    inputs.code = code
    inputs.potcar_family = get_data_node('str', pot_family)
    inputs.potcar_mapping = get_data_node('parameter', dict={'Si': 'Si'})
    options = AttributeDict()
    options.queue_name = queue
    options.resources = {'num_machines': 1, 'num_mpiprocs_per_machine': 4}
    inputs.options = get_data_node('parameter', dict=options)

    submit(workflow, **inputs)
Exemplo n.º 2
0
def main(pot_family, import_from, queue, code, computer, no_import):
    load_dbenv_if_not_loaded()
    from aiida.orm import WorkflowFactory, Code
    from aiida.work import submit

    if not no_import:
        click.echo('importing POTCAR files...')
        with cli_spinner():
            import_pots(import_from, pot_family)

    code = Code.get_from_string('{}@{}'.format(code, computer))
    workflow = WorkflowFactory('vasp.base')

    inputs = AttributeDict()
    inputs.structure = create_structure_Si()
    inputs.kpoints = create_kpoints()
    inputs.incar = create_params_simple()
    inputs.code = code
    inputs.potcar_family = get_data_node('str', pot_family)
    inputs.potcar_mapping = get_data_node('parameter', dict={'Si': 'Si'})
    options = AttributeDict()
    options.queue_name = queue
    options.resources = {'num_machines': 1, 'num_mpiprocs_per_machine': 4}
    inputs.options = get_data_node('parameter', dict=options)

    submit(workflow, **inputs)
Exemplo n.º 3
0
def simple(pot_family, import_from, queue, code, computer, no_import):
    load_dbenv_if_not_loaded()
    from aiida.orm import CalculationFactory, Code
    if not no_import:
        click.echo('importing POTCAR files...')
        with cli_spinner():
            import_pots(import_from, pot_family)
    pot_cls = get_data_cls('vasp.potcar')
    pot_si = pot_cls.find_one(family=pot_family, full_name='Si')

    vasp_calc = CalculationFactory('vasp.vasp')()
    vasp_calc.use_structure(create_structure_Si())
    vasp_calc.use_kpoints(create_kpoints())
    vasp_calc.use_parameters(create_params_simple())
    code = Code.get_from_string('{}@{}'.format(code, computer))
    vasp_calc.use_code(code)
    vasp_calc.use_potential(pot_si, 'Si')
    vasp_calc.set_computer(code.get_computer())
    vasp_calc.set_queue_name(queue)
    vasp_calc.set_resources({
        'num_machines': 1,
        'num_mpiprocs_per_machine': 20
    })
    vasp_calc.label = 'Test VASP run'
    vasp_calc.store_all()
    vasp_calc.submit()
Exemplo n.º 4
0
def load_dbenv_if_not_loaded(**kwargs):
    """
    load dbenv if necessary, run spinner meanwhile to show command hasn't crashed
    """
    from aiida.backends.utils import load_dbenv, is_dbenv_loaded
    if not is_dbenv_loaded():
        with cli_spinner():
            load_dbenv(**kwargs)
Exemplo n.º 5
0
def createpredefined():
    """Create predefined basis families"""
    basis_family_cls = get_data_class('crystal_dft.basis_family')
    with cli_spinner():
        created = basis_family_cls.create_predefined()
    msg = 'Created {} predefined basis families'.format(len(created))
    if created:
        msg += ':\n{}'.format(', '.join(created))
    click.echo(msg)
Exemplo n.º 6
0
def uploadfamily(path, name, description, stop_if_existing, dry_run):
    """Upload a family of VASP potcar files."""

    potcar_data_cls = get_data_class('vasp.potcar')
    with cli_spinner():
        num_found, num_added, num_uploaded = potcar_data_cls.upload_potcar_family(
            path, name, description, stop_if_existing=stop_if_existing, dry_run=dry_run)

    click.echo('POTCAR files found: {}. New files uploaded: {}, Added to Family: {}'.format(num_found, num_uploaded, num_added))
    if dry_run:
        click.echo('No files were uploaded due to --dry-run.')
Exemplo n.º 7
0
def uploadfamily(path, ext, name, description):
    """Upload a family of CRYSTAL Basis Set files."""
    basis_family_cls = get_data_class('crystal_dft.basis_family')
    with cli_spinner():
        nfiles, created, uploaded = basis_family_cls.upload(
            name,
            path,
            extension=".{}".format(ext),
            description=description
            )

    msg = 'Basis set files found: {}, out of them uploaded: {}'.format(nfiles, len(uploaded))
    if uploaded:
        msg += ' (for elements: {})'.format(', '.join(sorted(list(uploaded))))
    msg += ' to {}basis family {}'.format('newly created ' if created else '', name)
    click.echo(msg)
Exemplo n.º 8
0
def noncol(pot_family, import_from, queue, code, computer, no_import):
    load_dbenv_if_not_loaded()
    from aiida.orm import CalculationFactory, Code
    from aiida.work import submit
    if not no_import:
        click.echo('importing POTCAR files...')
        with cli_spinner():
            import_pots(import_from, pot_family)
    code = Code.get_from_string('{}@{}'.format(code, computer))
    calc_cls = CalculationFactory('vasp.vasp')

    if builder_interface(calc_cls):
        proc, inputs = noncol_builder(pot_family, queue, code, calc_cls)
    else:
        proc, inputs = noncol_inputs_template(pot_family, queue, code, calc_cls)

    submit(proc, **inputs)
Exemplo n.º 9
0
def uploadfamily(path, ext, name, description, stop_if_existing, dry_run):
    """Upload a family of CRYSTAL Basis Set files."""
    from aiida_crystal17.data.basis_set import BasisSetData

    with cli_spinner():
        nfiles, num_uploaded = BasisSetData.upload_basisset_family(
            path,
            name,
            description,
            stop_if_existing=stop_if_existing,
            extension=".{}".format(ext),
            dry_run=dry_run,
        )

    click.echo("Basis Set files found and added to family: {}, of those {} "
               "were newly uploaded".format(nfiles, num_uploaded))
    if dry_run:
        click.echo("No files were uploaded due to --dry-run.")
Exemplo n.º 10
0
def uploadfamily(path, ext, name, description, stop_if_existing, dry_run):
    """Upload a family of CRYSTAL Basis Set files."""

    basis_data_cls = get_data_class('crystal17.basisset')
    with cli_spinner():
        nfiles, num_uploaded = basis_data_cls.upload_basisset_family(
            path,
            name,
            description,
            stop_if_existing=stop_if_existing,
            extension=".{}".format(ext),
            dry_run=dry_run)

    click.echo(
        'Basis Set files found and added to family: {}, of those {} were newly uploaded'
        .format(nfiles, num_uploaded))
    if dry_run:
        click.echo('No files were uploaded due to --dry-run.')