Ejemplo n.º 1
0
for i in ids:
    if i > 26470:
        print('Processing: {0}'.format(i))
        launch = launchpad.get_fw_by_id(i)
        atoms = encode_to_atoms(launch.spec['_tasks'][0]['args'][0])[0]

        try:
            metal = launch.name['metal']
            print(metal)
            if '2' in metal:
                a, b, _ = metal.split('2')
            elif '3' in metal:
                a, b = metal.split('3')
            else:
                continue
        except KeyError:
            continue

        pol_metal = ['Fe', 'Co', 'Ni', 'Mn']

        if a in pol_metal or b in pol_metal:
            if atoms.info['spinpol'] == True:
                atoms.set_initial_magnetic_moments(
                    [2.0 if atom.symbol in pol_metal else 0 for atom in atoms])

                atoms._calc = None
                encoding = atoms_to_encode(atoms)

                launchpad.update_spec(
                    [i], spec_document={'_tasks.0.args.0': encoding})
Ejemplo n.º 2
0
launchpad = LaunchPad(host=host,
                      name=name,
                      username=username,
                      password=password)

db = connect('missing.db')

for i, d in enumerate(db.select()):

    #if i != 0:
    #    continue
    slab = d.toatoms()
    kvp = d.key_value_pairs
    kvp['metal'] = slab.get_chemical_symbols()[0]
    param = d.data
    slab.info = param

    # Encode the atoms
    encoding = atoms_to_encode(slab)

    # Two steps - write the input structure to an input file, then relax
    t0 = PyTask(func='qescripts.fwio.encode_to_atoms', args=[encoding])
    t1 = PyTask(func='qescripts.fwespresso.get_potential_energy',
                stored_data_varname='trajectory')

    # Package the tasks into a firework, the fireworks into a workflow,
    # and submit the workflow to the launchpad
    firework = Firework([t0, t1], spec={'_priority': 1}, name=search_keys)
    workflow = Workflow([firework])
    launchpad.add_wf(workflow)