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})
'spinpol': False, 'mixing_beta': 0.2, 'electron_maxstep': 2000} formula = set(atoms.get_chemical_symbols()) if np.array([a in pol_metal for a in formula]).any(): atoms.set_initial_magnetic_moments([3 if atom.symbol == 'Fe' else 2 if atom.symbol == 'Co' else 1 if atom.symbol == 'Ni' else 3 if atom.symbol == 'Mn' else 0 for atom in atoms]) atoms.info['calculator_parameters'].update({'spinpol': True, 'mixing_beta': 0.1, 'electron_maxstep': 4000}) print(atoms.info) atoms._calc = None encoding = atoms_to_encode(atoms) print('Submitting job ....') launchpad.rerun_fw(i) launchpad.update_spec([i], spec_document={'_tasks.0.args.0': encoding, '_tasks.0.func': 'catkit.flow.fwio.encode_to_atoms', '_tasks.1.args': ['decaf.Espresso'], '_tasks.1.func': 'catkit.flow.fwase.get_potential_energy'}) if os.path.exists('input.traj'): os.remove('input.traj')
launch.name['calc']['facet'] = '(1, 1, 1)' launch.name['calc']['layer'] = 3 launch.name['calc']['crystal'] = 'fcc' launch.name['calc']['vacuum'] = 10 launch.name['calc']['SBS_symbol'] = 'L12' launch.name['calc']['PS_symbol'] = 'cP4' site_id, a, c, BID = get_info(atoms) launch.name['calc']['site_id'] = site_id launch.name['calc']['a'] = a launch.name['calc']['c'] = c launchpad.update_spec( [i], spec_document={ 'calc': { 'symbol': symbol, 'adsorbate': ads, 'facet': '(1, 1, 1)', 'layer': 3, 'crystal': 'fcc', 'vacuum': 10, 'SBS_symbol': 'L12', 'PS_symbol': 'cP4', 'site_id': site_id, 'a': a, 'c': c, 'bulk_id': BID } }) #launchpad.rerun_fw(i)
#!/usr/bin/env python from fireworks import LaunchPad, Firework, Workflow, PyTask from ase.io import read from catkit.flow.fwio import atoms_to_encode, encode_to_atoms from ase.db import connect from ase.visualize import view host = 'suncatls2.slac.stanford.edu' username, name, password = netrc().authenticators(host) launchpad = LaunchPad( host=host, name=name, username=username, password=password) IDS = launchpad.get_fw_ids(query={'state': 'READY'}) IDS = [i for i in IDS if i != 52118] #IDS = [31032] for i in IDS: print('Processing: {0}'.format(i)) launch = launchpad.get_fw_by_id(i) launchpad.update_spec([i], spec_document={'_tasks.0.func': 'catkit.flow.fwio.encode_to_atoms'}) launchpad.update_spec([i], spec_document={'_tasks.1.func': 'catkit.flow.fwase.get_potential_energy'})