def main(): """ Reads a structure from a Gaussian Log file and other parameters from a Gaussian Com file and creates a new Gaussian Com. """ args = get_args() gaulog = GaussianLog(args.log) gaucom = GaussianCom(args.template_com) atoms_log_coords = gaulog.read_geometry(args.opt_step, args.scan_step) for no, atom in enumerate(gaucom.atoms_list): atom.SetVector(atoms_log_coords[no].GetVector()) gaucom.write_to_file(args.new_com)
if len(sys.argv) == 1 or sys.argv[1] in ["-h", "--help"]: print("Como usar: {0} file.log ").format(sys.argv[0]) sys.exit() #ficheiro entrada (output do gaussian) global filein filein = sys.argv[1] #transformar o ficheiro log aberto numa variavel global (ler com o GaussianLog) ############## INICIO ############## main() #ler os bytes de todo o ficheiro e fazer todos os atributos d gaussianlog = GaussianLog(filein) for i, scan_step in enumerate( gaussianlog.grep_bytes['Step number'] ): print( "Scan", i, ": ", len(gaussianlog.grep_bytes['Step number'][i]), "opt steps" ) scan_step = input('Type "scan_step" that you which to extract. Options: scan_step="all": ') opt_step = input('Type "opt_step" that you which to extract. Options: opt_step="all": ') #verificar se existe o ficheiro output = input('Type the name of the output file: ') if path.exists(str(output) + '.pdb'): raise RuntimeError('%s already exists' %(str(output)+".pdb")) open_output = open(str(output) + ".pdb", "w") #casos em que extraio todos os scans if str(scan_step) == 'all': print(len(gaussianlog.grep_bytes['orientation:']))