def returnMolecule(self): lisPos = Find_XYZ(self.targetFile, self.base).gaussian_style() for elementPos in lisPos: rawAtom = elementPos.split() atomType = rawAtom[0] atomX = float(rawAtom[1]) atomY = float(rawAtom[2]) atomZ = float(rawAtom[3]) self.molecule.addAtom(Atom(atomType, atomX, atomY, atomZ)) return self.molecule
'squaraine-OH-OMe-OH': 34, 'squaraine-OMe-NMe2-H': 40, 'squaraine-OMe-NMe2-O': 41, 'squaraine-OMe-NMe2-OH': 41, 'squaraine-OMe-OMe-H': 36, 'squaraine-OMe-OMe-O': 37, 'squaraine-OMe-OMe-OH': 37, 'stilbene-NMe2-OMe-H': 54, 'stilbene-NMe2-OMe-O': 55, 'stilbene-NMe2-OMe-OH': 55 } # Description: main function of the script if (__name__ == "__main__"): for molecule in list(molecules.keys()): geomFile = dirGeom + "pre_opt_" + molecule nameFile = dirOpt + "opt_" + molecule geom = Find_XYZ(geomFile + ".log", molecules[molecule]).gaussian_style() fileToWrite = open(nameFile + ".com", "w") copyfile(geomFile + ".chk", nameFile + ".chk") fileToWrite.write( '{}chk={}.chk \n{}nprocshared=6 \n{}mem=30000mb \n'.format( "%", nameFile.split("/")[-1], "%", "%")) fileToWrite.write( '#p opt=(ReadFC, gdiis) nosymm output=wfn wb97x/6-31++G**\n\nOptimization of the {}\n\n0 1\n' .format(nameFile)) for atomCoord in geom: fileToWrite.write(atomCoord + "\n") fileToWrite.write("\n\n")
from find_xyz_from_a_log import Find_XYZ base_name = "BTD-QN" solvents = {"gas":" ", "water":"scrf=(iefpcm, solvent=Water)"} methods = ["B3LYP", "CAM-B3LYP", "M062X", "PBE1PBE", "wB97XD"] td_text = "td=nstates=12" basis_set = "6-311+G(2d,p)" text_add_work = "density=current NoSymm" proc_line = "%nprocshared=6" mem_line = "%mem=30000MB" mult = "1" charge = "0" text_base = "Calculo TD da " dir_home = os.getcwd() for solvent in list(solvents.keys()): geom_orig = dir_home+"/opt/"+base_name+"_"+solvent+".log" geom_list = Find_XYZ(geom_orig, 30).gaussian_style() os.chdir(dir_home+"/"+solvent) for method in methods: checkpoint_line = "%chk="+base_name+"_"+solvent+"_"+method+".chk" file_name=base_name+"_"+solvent+"_"+method+".com" text = text_base+file_name file_to_write = open(file_name, "w") file_to_write.write("{}\n{}\n{}\n".format(checkpoint_line, mem_line, proc_line)) file_to_write.write("#p {}/{} {} {} {}\n\n{}\n\n{} {}\n".format(method, basis_set, td_text, text_add_work, solvents[solvent], text, charge, mult)) for element in geom_list: file_to_write.write("{}\n".format(element)) file_to_write.write("\n\n")