if found: if re.search(atom + '1', line): magline = line break if re.search('atomic species magnetization', line): found = True mag = magline.split(' ')[-1].split('(')[0].strip(' ') return mag for ID in IDS[::-1]: launch = launchpad.get_fw_dict_by_id(ID) encoding = launch['launches'][-1]['action']['stored_data']['trajectory'] atoms = encode_to_atoms(encoding) formula = atoms[-1].get_chemical_formula() if 'Fe' in formula or 'Mn' in formula or 'Co' in formula or 'Ni' in formula: if 'Fe' in formula: atom = 'Fe' elif 'Mn' in formula: atom = 'Mn' elif 'Co' in formula: atom = 'Co' elif 'Ni' in formula: atom = 'Ni' imag = atoms[-1].get_initial_magnetic_moments() if imag is not None: if np.all(np.array(imag) == 0.0):
host = 'suncatls2.slac.stanford.edu' username, name, password = netrc().authenticators(host) launchpad = LaunchPad(host=host, name=name, username=username, password=password) #IDS = sorted(launchpad.get_fw_ids(query={"state": 'COMPLETED'})) IDS = [i for i in range(29700, 30700)] rs = 0 for ID in IDS: print('Processing: {0}'.format(ID)) launch = launchpad.get_fw_by_id(ID) atoms = encode_to_atoms(launch.spec['_tasks'][0]['args'][0])[0] if len(atoms) > 10 and len(atoms.constraints[0].get_indices()) < 8: print(len(atoms)) print(atoms.constraints[0].get_indices()) constraint = FixAtoms(indices=[i for i in range(8)]) atoms.set_constraint(constraint) rs += 1 print(atoms.constraints[0].get_indices()) atoms._calc = None encoding = atoms_to_encode(atoms) print(encoding) launchpad.update_spec([ID], spec_document={'_tasks.0.args.0': encoding}) launchpad.rerun_fw(ID) if os.path.exists('input.traj'):