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)
#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:'])) #falta meter aqui a opcao opt_step =='all' , mas neste caso nao faz muito sentido #if opt_step == 'all': opt_step = int(opt_step) print(len(gaussianlog.grep_bytes['orientation:'])) for i in range(len(gaussianlog.grep_bytes['orientation:'])): atoms_structure = gaussianlog.read_geometry(opt_step, i) for j,atom in enumerate(atoms_structure): pdb_obj = atoms.PDBinfo('ATOM', j+1 ) #res_obj = atoms.RESinfo(atom.element,'',0,'') #quando nao ha info pdb #atom.set_resinfo(res_obj) atom.set_pdbinfo(pdb_obj) atom.pdbinfo.altloc = atom.oniom.layer open_output.write(iolines.atom2pdb(atom)) open_output.write("END\n") #casos em que so extraio de um scan else: scan_step = int(scan_step) #todos os opt if opt_step == 'all': for i in range(len(gaussianlog.grep_bytes['orientation:'][scan_step])):