1#!/usr/bin/python
2#
3#
4#Processing dalton.out-files for calculation of NMR spin-spin couplings.
5#Written by Ola Berg Lutnaes 1999.
6#
7#Usage: spintab options file1 file2...
8#
9import sys, re,string,os
10#
11#DECLARATIONS
12#
13geometry=0
14ac=0
15ps=0
16totalonly=0
17equals=1
18decimals=2
19latex=1
20latex2=0
21plot=0
22cont=0
23fccont=0
24dsocont=0
25psocont=0
26sdcont=0
27inputfiles=[]
28tot=[]
29sd=[]
30pso=[]
31dso=[]
32fc=[]
33geom=[]
34basissets=[]
35couplingatoms=[]
36numberofcouplings=0
37outputfiles=[]
38#
39#READING COMMANDLINE
40#
41try:
42	option=sys.argv[1]
43except:
44	print "Usage: spintab.py options inputfiles\nType \"spintab.py --help\" for help."
45	sys.exit(1)
46while len(sys.argv)>1:
47	option=sys.argv[1]
48	del sys.argv[1]
49	if option=="--help":
50		print """TAKES DALTON OUTPUT FOR CALCULATION OF NMR SPIN-SPIN COUPLING CONSTANTS
51AND MAKES TABLE FILE FOR LATEX CONTAINING THE COUPLING CONSTANTS.
52
53Latex file is named "table.tex"
54
55The program also checks for and removes equal coupling constants
56(it is not checked if this is because of symmetry or not)
57to reduce unnecessary output.
58
59The program can read several outputfiles at once, collecting the
60results in one table, provided that the outputfiles are from
61similar calculations (for example only changing the basis set).
62IMPORTANT: The program assumes in this case that the coupling
63constants are ordered equally in the different outputfiles.
64
65SPINTAB OPTIONS:
66-d n	controls number of decimals in the latextable.
67	Value of n can be from 0 to 4. Default is 2.
68-w	print latex table i "wide" format (can only
69        process one file at a time with this option)
70-e	don't remove equal coupling constants
71-t	give only total coupling constants in output
72-g	print more info on basisset, molecular geometry and
73	energy together with latex table
74-b n n n n	the -b option makes the program sum contributions
75		to the coupling constants from different
76		calculations. -b should be followed by four
77		numbers indicating from what dalton outputfile the
78		different contributions (fc, dso, pso and sd
79		respectively) should be collected.
80		Example: spintab.py -b 1 2 2 2 file1.out file2.out
81		sums fc-contribution from file1.out with dso- pso-
82		and sd-contributions from file2.out.
83***
84The next options are more machine dependent, but some modification of
85the script might make it work on your computer.
86***
87-f 	make postscript of latex table on the fly and show
88	file in ghostview
89-p	makes plot using gnuplot. Useful for basisset
90	convergence testing. Makes plots for total coupling
91	constant and all contributions. Gnuplot data are
92	stored in file "gnuplot.data". Makes
93	psotscript(.eps-files. All files are merged in to
94	an overview-file "merged.eps", using epsmerge. For
95	printing, use "merged.pdf".
96	The name of the dalton dal-file will be used to
97	identify the molecule and used in plot titles etc.
98-pac	same as -p, but plots all contributions to the coupling
99	constant in the same diagram
100-l	don't make latex table.
101***
102
103TROUBLESHOOTING
104---------------
1051. "spintab.py: Command not found." make sure the script look for
106    python in the right place: The result of 'which python' on the
107    commandline shall replace '/usr/bin/python' in the first line of
108    spintab.py.
109"""
110		sys.exit(1)
111	if option=="-d":
112		decimals=sys.argv[1]
113		del sys.argv[1]
114	elif option=="-l":
115		latex=0
116	elif option =="-p":
117		plot=1
118	elif option=="-e":
119		equals=0
120	elif option=="-t":
121		totalonly=1
122	elif option=="-f":
123		ps=1
124	elif option=="-g":
125		geometry=1
126	elif option=="-pac":
127		plot=1
128		ac=1
129	elif option=="-w":
130		latex=0
131		latex2=1
132	elif option=="-b":
133		cont=1
134		fccont=sys.argv[1]
135		del sys.argv[1]
136		dsocont=sys.argv[1]
137		del sys.argv[1]
138		psocont=sys.argv[1]
139		del sys.argv[1]
140		sdcont=sys.argv[1]
141		del sys.argv[1]
142	else:
143		inputfiles.append(option)
144		if not os.path.isfile(option):
145			print "File "+option+" not found"
146			sys.exit(1)
147decimals=int(decimals)
148if not inputfiles:
149	print "No inputfiles specified."
150	sys.exit()
151##
152
153
154
155
156#SUBROUTINES
157
158
159#METHOD READING FILES ONE BY ONE AND STORING DATA
160
161#Data stored:
162#basis set used
163#total coupling constants and induvidual contributions
164#names of the two atoms involved in the coupling
165
166def readfiles(filelist):
167	numberofcouplings=0
168	couplingatoms1=[]
169	basissets1=[]
170	tot1=[]
171	fc1=[]
172	pso1=[]
173	dso1=[]
174	sd1=[]
175	geom=[]
176	files=filelist[:]
177	pattern1="  Basis set used\.*"				#SEARCHPATTERNS
178	pattern2=r"                   ! ABACUS - Final spin-spin couplings !\.*"
179	pattern3="          Indirect spin-spin coupling\.*"
180	pattern4="  Isotropic coupling       \.*"
181	pattern5="  Isotropic DSO contributio\.*"
182	pattern6="  Isotropic PSO contributio\.*"
183	pattern7="  Isotropic SD contribution\.*"
184	pattern8="  Isotropic FC contributi\.*"
185	pattern9=r"\.*  DALTON - An electronic structure program\.*"
186	pattern10="  Threshold fo\.*"
187	pattern11="   Interatomic separatio\.*"
188	pattern12="  Symmetry Orb\.*"
189	pattern13="\.*FINAL RESULTS FROM ABACUS\.*"
190	pattern14="     Total energy     \.*"
191	numberoffiles=len(files)
192	while len(files)>0:
193		totals=[]
194		fcs=[]
195		psos=[]
196		dsos=[]
197		sds=[]
198		couplingatomses=[]
199		infile=open(files[0],'r')
200		del files[0]
201		lines = infile.readlines()
202		test=0
203		for a in lines:				#TESTING INPUTFILES
204			match = re.search(pattern9,a)
205			if match:
206				test=1
207				break
208		if test==0:
209			print "One of the inputfiles is not a dalton output file"
210			sys.exit(1)
211		n=0
212		while lines[n]:					#FINDING BASISSETS
213			match=re.search(pattern1,lines[n])
214			if match:
215				parts=string.split(lines[n],"\"")
216				basissets1.append(parts[1])
217				while lines[n]:
218					geom.append(lines[n])
219					match=re.search(pattern10,lines[n])
220					if match:
221						break
222					n=n+1
223				break
224			n=n+1
225#		while lines[n]:					#STORING GEOMETRY DATA
226#			n=n+1
227#			match =re.search(pattern11,lines[n])
228#			if match:
229#				while lines[n]:
230#					match=re.search(pattern12,lines[n])
231#					if match:
232#						break
233#						break
234#					geom.append(lines[n])
235#					n=n+1
236#				break
237		while lines[n]:					#STORING ENERGY
238			match=re.search(pattern14,lines[n])
239			if match:
240				geom.append(lines[n])
241				break
242			n=n+1
243		geom.append("\n\n"+r"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"+"\n\n")
244		while lines[n]:					#FAST FORWARD
245			match=re.search(pattern2,lines[n])
246			if match:
247				break
248			n=n+1
249		while lines[n]:					#STORING COUPLING CONSTANTS
250			match=re.search(pattern3,lines[n])
251			if match:
252				parts=string.split(lines[n],"between")
253				parts=string.split(parts[1],":")
254				couplingatomses.append(parts[0])
255				numberofcouplings=numberofcouplings+1
256			match=re.search(pattern4,lines[n])
257			if match:
258				parts=string.split(lines[n],":")
259				parts=string.split(parts[1],"Hz")
260				parts=re.sub(" ","",parts[0])
261				totals.append(parts)
262			match=re.search(pattern5,lines[n])
263			if match:
264				parts=string.split(lines[n],":")
265				parts=string.split(parts[1],"Hz")
266				parts=re.sub(" ","",parts[0])
267				dsos.append(parts)
268			match=re.search(pattern6,lines[n])
269			if match:
270				parts=string.split(lines[n],":")
271				parts=string.split(parts[1],"Hz")
272				parts=re.sub(" ","",parts[0])
273				psos.append(parts)
274			match=re.search(pattern7,lines[n])
275			if match:
276				parts=string.split(lines[n],":")
277				parts=string.split(parts[1],"Hz")
278				parts=re.sub(" ","",parts[0])
279				sds.append(parts)
280			match=re.search(pattern8,lines[n])
281			if match:
282				parts=string.split(lines[n],":")
283				parts=string.split(parts[1],"Hz")
284				parts=re.sub(" ","",parts[0])
285				fcs.append(parts)
286			n=n+1
287			try:
288				lines[n]
289			except:
290				break
291		tot1.append(totals)
292		sd1.append(sds)
293		dso1.append(dsos)
294		pso1.append(psos)
295		fc1.append(fcs)
296		couplingatoms1.append(couplingatomses)
297		infile.close()
298	numberofcouplings=numberofcouplings/numberoffiles
299	return(tot1,fc1,dso1,pso1,sd1,couplingatoms1,basissets1,numberofcouplings,geom)
300##
301
302#TESTING INPUT TO BE ADEQUATE
303#IF COUPLINGATOMS HAVE DIFFERENT NAME WARNING WILL BE PRINTED
304
305def checkinput(couplingatoms):
306	if len(couplingatoms)>1:
307		for c in couplingatoms:
308			for d in couplingatoms:
309				if c!=d:
310					print "WARNING!! Your inputfiles may contain different sets of coupling constants."
311##
312
313
314#METHOD ADJUSTING DECIMALS IN OUTPUT
315
316def decimalprint(couplinglist,decimals,n):
317	tablestring=""
318	for a in couplinglist:
319		if decimals==0:
320			tablestring=tablestring+"&"+"%.0f" % float(a[n])
321		elif decimals==1:
322			tablestring=tablestring+"&"+"%.1f" % float(a[n])
323		elif decimals==2:
324			tablestring=tablestring+"&"+"%.2f" % float(a[n])
325		elif decimals==3:
326			tablestring=tablestring+"&"+"%.3f" % float(a[n])
327		elif decimals==4:
328			tablestring=tablestring+"&"+"%.4f" % float(a[n])
329		else:
330			print "Decimal error"
331			sys.exit(3)
332	return tablestring
333##
334
335
336# METHOD THAT DELETES EQUAL COUPLING CONSTANTS
337
338
339def sortcouplings(tot,fc,dso,pso,sd,couplingatoms,numberofcouplings):
340	for a in tot[0]:
341		for b in range (0,len(tot[0]),1):
342			list = tot[0][:]
343			ai=tot[0].index(a)
344			if a==list[b] and ai != b:
345				for n in tot:
346					del n[b]
347				for n in fc:
348					del n[b]
349				for n in pso:
350					del n[b]
351				for n in dso:
352					del n[b]
353				for n in sd:
354					del n[b]
355				for n in couplingatoms:
356					del n[b]
357				numberofcouplings=numberofcouplings-1
358				break
359	return(tot,fc,dso,pso,sd,couplingatoms,numberofcouplings)
360##
361
362
363#MERGING DIFFERENT BASISSET CALCULATIONS INTO ONE TABLE WHERE DIFFERENT CONTRIBUTIONS HAVE BEEN CALCULATED WITH DIFFERENT BASISSETS
364totalitet=[]
365def adjust(fccont,dsocont,psocont,sdcont,fc,dso,pso,sd):
366	tot=[]
367	total=[]
368	a=[]
369	b=[]
370	c=[]
371	d=[]
372	fccont=int(fccont)-1
373	dsocont=int(dsocont)-1
374	psocont=int(psocont)-1
375	sdcont=int(sdcont)-1
376	for n in range (0,len(fc[fccont]),1):
377		totale=float(fc[fccont][n])+float(dso[dsocont][n])+float(pso[psocont][n])+float(sd[sdcont][n])
378		total.append(totale)
379	tot.append(total)
380	bas="?"
381	a.append(fc[fccont])
382	b.append(dso[dsocont])
383	c.append(pso[psocont])
384	d.append(sd[sdcont])
385	return (tot,a,b,c,d,bas)
386##
387
388#WRITING TABLE FILE FOR LATEX
389
390#Writing header
391
392def table(totals,fcs,dsos,psos,sds,basissets,couplingatoms,decimals,inputfiles,totalonly,geom,geometry):
393	ofile=open("table.tex",'w')
394	header=r"Inputfiles: "
395	for n in inputfiles:
396		n=re.sub("_",r"\_",n)
397		header=header+n+" "
398	header=header+r"\\"+"\n"+r"\begin{tabular}{lc"
399	for c in basissets:
400		header=header+"c"
401	header = header+r"}"+"\n"+r"Coupling&Contribution"
402	for c in range(0,len(basissets),1):
403		header=header+r"&"+basissets[c]
404	header=header+r"\\ \hline"+"\n"
405	ofile.write(header)
406
407#Writing coupling constants
408
409	marg="                  "
410	n=0
411	pairs=couplingatoms[0]
412	while n<len(couplingatoms[0]):
413		if totalonly==1:
414			ofile.write(pairs[n]+r"&Total")
415			number=decimalprint(totals,decimals,n)
416			ofile.write(number)
417		else:
418			ofile.write(marg+r"&Total")
419			number=decimalprint(totals,decimals,n)
420			ofile.write(number)
421			ofile.write(r"\\"+"\n"+marg+"&FC   ")
422			number=decimalprint(fcs,decimals,n)
423			ofile.write(number)
424			pairs=couplingatoms[0]
425			ofile.write(r"\\"+"\n"+pairs[n]+"&DSO ")
426			number=decimalprint(dsos,decimals,n)
427			ofile.write(number)
428			ofile.write(r"\\"+"\n"+marg+"&PSO   ")
429			number=decimalprint(psos,decimals,n)
430			ofile.write(number)
431			ofile.write(r"\\"+"\n"+marg+"&SD   ")
432			number=decimalprint(sds,decimals,n)
433			ofile.write(number)
434		ofile.write(r"\\"+"\n")
435		n=n+1
436	ofile.write(r"\end{tabular}")
437#Writing geometry and other data
438	if geometry==1:
439		ofile.write("\n"+r"\begin{verbatim}"+"\n")
440		geometrytext=string.join(geom,"")
441		ofile.write(geometrytext)
442		ofile.write(r"\end{verbatim}")
443	ofile.close()
444	print "\'table.tex\' complete"
445##
446
447
448#WRITING TABLE FILE FOR LATEX IN WIDE FORMAT
449
450#Writing header
451
452def table2(totals,fcs,dsos,psos,sds,basissets,couplingatoms,decimals,inputfiles,totalonly,geom,geometry):
453	couplingatoms=couplingatoms[0]
454	ofile=open("table.tex",'w')
455	header=r"Inputfiles: "
456	for n in inputfiles:
457		n=re.sub("_",r"\_",n)
458		header=header+n+" "
459	header=header+r"\\"+"\n"+r"\begin{tabular}{llrrrrr} \hline\hline"+"\n"
460	header=header+r"Molekyl&Kobling&FC&DSO&PSO&SD&Total \\ \hline"+"\n"
461	ofile.write(header)
462
463#Writing coupling constants
464	b=0
465	while b<len(totals[0]):
466		number=decimalprint(totals,decimals,b)
467#		ofile.write(number)
468		line=r"&"+str(couplingatoms[b])+decimalprint(fcs,decimals,b)+decimalprint(dsos,decimals,b)+decimalprint(psos,decimals,b)+decimalprint(sds,decimals,b)+decimalprint(totals,decimals,b)+"\n"
469#		line=str(couplingatoms[b])+r"&"+str(decimalprint(fcs,decimals,b))+r"&"+str(dsos[b])+r"&"+str(psos[b])+r"&"+str(sds[b])+r"&"+str(totals[b])+r"\\" +"\n"
470		ofile.write(line)
471		b=b+1
472	ofile.write(r"\hline\hline"+"\n"+r"\end{tabular}")
473#Writing geometry and other data
474	if geometry==1:
475		ofile.write("\n"+r"\begin{verbatim}"+"\n")
476		geometrytext=string.join(geom,"")
477		ofile.write(geometrytext)
478		ofile.write(r"\end{verbatim}")
479	ofile.close()
480	print "\'table.tex\' complete"
481##
482
483
484#DATAFILE FOR GNUPLOT
485
486#Header comment
487
488def gnuplotdata(basissets,inputfiles,couplingatoms,tot,fc,dso,pso,sd):
489	ofile=open("gnuplot.data",'w')
490	header=r"#Datafile for GNUPLOT, spin-spin coupling constants"+"\n"+r"#basissets: "
491	for n in basissets:
492		header=header+n+" "
493	header=header+"\n"+r"#inputfiles:"
494	for n in inputfiles:
495		header= header+n+"   "
496	header=header+"\n"+r"#coupling constant:"
497	for n in couplingatoms[0]:
498		header=header+n+r"  ####  "
499	header=header+"\n"
500	ofile.write(header)
501
502
503#Printing data
504
505
506	for n in range (0,len(inputfiles),1):
507		linenumber=n+1
508		ofile.write(str(linenumber)+"	")
509		total1=tot[n]
510		dso1=dso[n]
511		pso1=pso[n]
512		sd1=sd[n]
513		fc1=fc[n]
514		for a in range(0,len(total1),1):
515			ofile.write(total1[a]+"	")
516			ofile.write(fc1[a]+"	")
517			ofile.write(pso1[a]+"	")
518			ofile.write(dso1[a]+"	")
519			ofile.write(sd1[a]+"	")
520		ofile.write("\n")
521	ofile.close()
522	print "\'gnuplot.data\' complete"
523##
524
525
526#MAKING GNUPLOTCOMMAND FOR INDUVIDUAL PLOTS
527
528def gnuplotcommand(inputfiles,couplingatoms,basissets):
529
530	molecule=string.split(inputfiles[0],"_")
531	molecule=molecule[0]
532	outputfiles=[]
533	gnuplotcommands=[]
534	for n in range(0,len(couplingatoms[0]),1):
535		a=1
536		while a<6:
537			plotcolumn=n*5+a+1
538			coupling=couplingatoms[0]
539			title="Spin-spin coupling "+coupling[n]+" in "+molecule+" using basissets"
540			outputname=re.sub(" ","",coupling[n])+molecule+".eps"
541			for b in basissets:
542				title= title+b+" "
543			if a==1:
544				title=title+"Total coupling"
545				outputname="tot"+outputname
546			if a==2:
547				title=title+"FC contribution"
548				outputname="fc"+outputname
549			if a==3:
550				title=title+"DSO contribution"
551				outputname="pso"+outputname
552			if a==4:
553				outputname="dso"+outputname
554				title=title+"PSO contribution"
555			if a==5:
556				outputname="sd"+outputname
557				title=title+"SD contribution"
558			outputfiles.append(outputname)
559			gnuplotcmd="""set terminal postscript eps 14
560set autoscale
561set nokey
562set xlabel '�kende basissett'
563set ylabel 'Hz'
564set title """
565			gnuplotcmd=gnuplotcmd+"\'"+title+r"'"+"\nset output "+r"'"+outputname+r"'"+"\nplot "+r"'"+"gnuplot.data"+"'"+" using 1"+r":"+str(plotcolumn)+" w lp\nquit\n"
566			gnuplotcommands.append(gnuplotcmd)
567			a=a+1
568	return (gnuplotcommands,outputfiles)
569##
570
571
572#MAKING GNUPLOTCOMMAND FOR ALL CONTRIBUTIONS IN ONE PLOT
573def gnuplotcommandac(inputfiles,couplingatoms,basissets):
574
575	molecule=string.split(inputfiles[0],"_")
576	molecule=molecule[0]
577	outputfiles=[]
578	gnuplotcommands=[]
579	for n in range(0,len(couplingatoms[0]),1):
580		theplotcolumns=[]
581		a=1
582		while a<6:
583			plotcolumn=5*n+a+1
584			theplotcolumns.append(plotcolumn)
585			a=a+1
586		coupling=couplingatoms[0]
587		title="Spin-spin coupling "+coupling[n]+" in "+molecule+" using basissets"
588		outputname=re.sub(" ","",coupling[n])+molecule+".eps"
589		for b in basissets:
590			title= title+b+" "
591		title=title+"\\\nAll contributions"
592		outputname="ac"+outputname
593		outputfiles.append(outputname)
594		gnuplotcmd="""set terminal postscript eps 14
595set autoscale
596set xlabel '�kende basissett'
597set ylabel 'Hz'
598set title """
599		gnuplotcmd=gnuplotcmd+"\'"+title+r"'"+"\nset output "+r"'"+outputname+r"'"+"\nplot "
600		for n in range(len(theplotcolumns)):
601			newplot=r"'"+"gnuplot.data"+"'"+" using 1"+r":"+str(theplotcolumns[n])
602			if n==0:
603				newplot=newplot+" title \'Total\' w lp"
604			if n==1:
605				newplot=newplot+" title \'FC\' w lp"
606			if n==2:
607				newplot=newplot+" title \'DSO\' w lp"
608			if n==3:
609				newplot=newplot+" title \'PSO\' w lp"
610			if n==4:
611				newplot=newplot+" title \'SD\' w lp"
612			if n<len(theplotcolumns)-1:
613				newplot=newplot+","
614			gnuplotcmd=gnuplotcmd+newplot
615		gnuplotcmd=gnuplotcmd+"\nquit\n"
616		gnuplotcommands.append(gnuplotcmd)
617	return (gnuplotcommands,outputfiles)
618
619#EXECUTING GNUPLOT
620#
621def gnuplotexecute(gnuplotcommands):
622	for n in gnuplotcommands:
623		ofilename=string.split(n,"set output \'")
624		ofilename=string.split(ofilename[1],"\'")
625		ofilename=ofilename[0]
626		gnuplot=os.popen("gnuplot -persist",'w')
627		gnuplot.write(n)
628		gnuplot.close()
629		print "\'"+ofilename+"\' complete"
630
631##
632
633#MERGING PLOTFILES INTO ONE USING SCRIPT EPSMERGE AND PS2PDF
634
635
636def mergeplots(outputfiles):
637	cmd="epsmerge -o merged.eps"
638	for n in outputfiles:
639		cmd=cmd+" "+n
640	os.system(cmd)
641	print "\'merged.eps\' complete"
642	os.system("ps2pdf merged.eps merged.pdf")
643	print "\'merged.pdf\' complete"
644##
645
646#MAKING POSTSCRIPTFILE FROM LATEXTABLE
647
648def postscript():
649	ofile=open("maintable.tex",'w')
650	start="""\documentclass[12pt,norsk,a4paper]{report}
651\usepackage{a4}
652\usepackage{graphics}
653\usepackage[norsk]{babel}
654\usepackage{babel,varioref}
655\usepackage{psfig}
656\usepackage{epic}
657\usepackage[latin1]{inputenc}
658\usepackage{longtable}
659\usepackage{dcolumn}
660\usepackage{amsmath}
661\usepackage{amssymb}
662\usepackage{supertabular}
663\usepackage{multicol,ftnright}
664\usepackage{wrapfig}
665\usepackage{cite}
666\usepackage{changebar}
667\usepackage{pstricks}
668\usepackage{graphics}
669\usepackage{tabularx}
670\usepackage{multirow}
671\usepackage{rotating}
672\\begin{document}
673\include{table}
674\end{document}
675"""
676	ofile.write(start)
677	ofile.close()
678	cmd="""rm table.ps
679latex maintable.tex
680dvips -f maintable.dvi > table.ps
681ghostview table.ps &
682"""
683	os.system(cmd)
684	print"\'maintable.tex\' complete"
685	print"\'table.ps\' complete"
686##
687
688
689###SCRIPT CONTROL
690
691#Reading files
692[tot,fc,dso,pso,sd,couplingatoms,basissets,numberofcouplings,geom]=readfiles(inputfiles)
693
694print basissets
695#Removing equal constants
696if equals==1:
697	[tot,fc,dso,pso,sd,couplingatoms,numberofcouplings]=sortcouplings(tot,fc,dso,pso,sd,couplingatoms,numberofcouplings)
698
699#ADJUSTING TABLE DATA FOR  CONTRIBUTIONS TO SPINSPIN FROM DIFFERENT BASIS SETS
700
701
702if cont==1:
703#	inputfiles???
704	[tot,fc,dso,pso,sd,basissets]=adjust(fccont,dsocont,psocont,sdcont,fc,dso,pso,sd)
705
706
707#WRITING OUTPUT
708
709#LATEX TABLE
710
711if latex==1:
712	table(tot,fc,dso,pso,sd,basissets,couplingatoms,decimals,inputfiles,totalonly,geom,geometry)
713
714#LATEX TABLE FORMAT  2 (FOR LARGE MOLECULES WITH MANY COUPLINGS)
715
716if latex2==1:
717	table2(tot,fc,dso,pso,sd,basissets,couplingatoms,decimals,inputfiles,totalonly,geom,geometry)
718
719
720
721#PLOTTING
722
723if plot==1:
724	gnuplotdata(basissets,inputfiles,couplingatoms,tot,fc,dso,pso,sd)
725	if ac==1:
726		[gnuplotcommands,outputfiles]=gnuplotcommandac(inputfiles,couplingatoms,basissets)
727	else:
728		[gnuplotcommands,outputfiles]=gnuplotcommand(inputfiles,couplingatoms,basissets)
729	gnuplotexecute(gnuplotcommands)
730
731#TRANSFORMING FILE FORMATS
732
733	mergeplots(outputfiles)
734if ps==1:
735	postscript()
736
737