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'}) 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']
halar_po = [] slac_id = [] for i in ids: print('Processing: {0}'.format(i)) launch = launchpad.get_fw_dict_by_id(i) launchdir = launch['launches'][-1]['launch_dir'] cluster = launch['launches'][-1]['fworker']['name'] print(cluster) if cluster == 'SLAC': print('Dis calculation was done in SLAC cluster!') slac_id += [i] continue encoding = launch['launches'][-1]['action']['stored_data']['trajectory'] atoms = encode_to_atoms(encoding) if len(atoms[-1]) != 13: continue if len(set(atoms[-1].get_chemical_symbols()[-5:-1])) == 1: m1, m2 = atoms[-1].get_chemical_symbols()[-1], None if len(set(atoms[-1].get_chemical_symbols()[-5:-1])) == 2: m1, m2 = set(atoms[-1].get_chemical_symbols()[-5:-1]) print(m1, m2) pol_metal = ['Fe', 'Co', 'Ni', 'Mn'] if m1 in pol_metal or m2 in pol_metal: if atoms[-1].info['spinpol'] == False:
IDS = launchpad.get_fw_ids(query={'state': 'COMPLETED'}) IDS = [i for i in IDS if i > 4610] IDS = IDS[::-1] pol_metal = ['Fe', 'Co', 'Ni', 'Mn'] weak_pol = ['Co'] strong_pol = ['Fe', 'Ni', 'Mn'] count = 0 j = 1 for ID in IDS: #print ID #for db in db_error.select(): #ID = db.fw_id launch = launchpad.get_fw_dict_by_id(ID) #atoms = encode_to_atoms(launch['spec']['_tasks'][0]['args'][0])[-1] atoms = encode_to_atoms( launch['launches'][-1]['action']['stored_data']['trajectory'])[-1] formula = atoms.get_chemical_formula() if not np.any([p in formula for p in pol_metal]): continue data = atoms.info if not data['spinpol']: data['spinpol'] = True if not np.all(atoms.get_initial_magnetic_moments() == 0): continue atoms.info = data atoms.set_initial_magnetic_moments([ 2.2 if atom.symbol == 'Fe' else 1.7 if atom.symbol == 'Co' else
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': 'COMPLETED'}) for i in ids: print('Processing: {0}'.format(i)) launch = launchpad.get_fw_by_id(i) atoms = encode_to_atoms(launch.spec['_tasks'][0]['args'][0])[0] try: launch2 = launchpad.get_fw_dict_by_id(i) atoms = encode_to_atoms( launch2['launches'][-1]['action']['stored_data']['trajectory'])[-1] continue except KeyError: pass pol_metal = ['Fe', 'Co', 'Ni', 'Mn'] if metal in pol_metal: if atoms.info['spinpol'] == True: launchpad.defuse_fw(i) atoms.set_initial_magnetic_moments(
IDS = launchpad.get_fw_ids(query={'state': 'COMPLETED'}) IDS_A = [i for i in IDS if i < 700] IDS_A = sorted(IDS_A) if os.path.exists('All_ads_slab.db'): os.remove('All_ads_slab.db') db = connect('All_ads_slab.db') #Processing A calculations for ID in IDS_A: print('Processing id: {0}'.format(ID)) launch = launchpad.get_fw_dict_by_id(ID) launch2 = launchpad.get_fw_by_id(ID) atoms0 = encode_to_atoms(launch2.spec['_tasks'][0]['args'][0])[0] encoding = launch['launches'][-1]['action']['stored_data']['trajectory'] atoms = encode_to_atoms(encoding) try: keys['metal'] = launch['name']['calc']['metal'] keys['unique_slab_formula'] = keys['metal'] keys['adsorbate'] = launch['name']['calc']['adsorbate'] keys['site'] = launch['name']['calc']['site'] keys['SBS_symbol'] = 'A1' except KeyError: continue db.write(atoms0, key_value_pairs=keys, data=parameters) db.write(atoms[-1], key_value_pairs=keys, data=parameters)