from pyxyz import Confpool, KC2H p = Confpool() p.include_from_file("initial_set.xyz") # <--- Set the filename print(f"Initial number of conformers = {p.size}") n_del = 0 p["Energy"] = lambda m: float(m.descr.strip()) p.sort("Energy") n_del += p.upper_cutoff("Energy", 10.0 * KC2H) # <--- Energies >10.0 kcal/mol relative to minimal are discarded p.generate_connectivity(0, mult=1.3, ignore_elements=[], sdf_name='connectivity_check.sdf') niso = p.generate_isomorphisms() print(f"Number of isomorphisms = {niso}") rmsd_status = p.rmsd_filter(0.2, energy_threshold=1.0 * KC2H, energy_key='Energy', mirror_match=True, print_status=False) n_del += rmsd_status['DelCount'] print(f"{n_del} conformers were filtered in total") newp = Confpool() newp.include_subset(p, [rmsd_status["MinRMSD_pairA"], rmsd_status["MinRMSD_pairB"]]) newp.save("rmsd_value_test.xyz") print(f"The minimal accepted rmsd was {rmsd_status['MinRMSD']}") print(f"Number of conformers after filtering = {p.size}") p.save('full_set.xyz') # <--- Set the filename # What input file do you need? gjftemplate = """\ %nprocs=24 %chk=conf_{idx}.chk # opt=(tight,maxcycle=300) freq=noraman def2tzvp empiricaldispersion=gd3bj rpbe1pbe scrf=(cpcm,solvent=water) Conformation 0 1 {xyz} """ atom_symbols = p.atom_symbols for i, m in enumerate(p): xyz = m.xyz xyzlines = [] for j, symbol in enumerate(atom_symbols): xyzlines.append("%2s %14.6f %14.6f %14.6f" % (symbol, *xyz[j])) with open(f"conf_{i}.gjf", 'w') as f: # <--- Set the template for filename f.write(gjftemplate.format(xyz="\n".join(xyzlines), idx=i))