19.01.2015 Views

MOLPRO

MOLPRO

MOLPRO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6 PROGRAM CONTROL 33<br />

6.6.1 Examples for do loops<br />

The first example shows how to compute a potential energy surface for water.<br />

***,H2O potential<br />

symmetry,x<br />

!use cs symmetry<br />

geometry={<br />

o; !z-matrix<br />

h1,o,r1(i);<br />

h2,o,r2(i),h1,theta(i) }<br />

basis=vdz<br />

!define basis set<br />

angles=[100,104,110]<br />

!list of angles<br />

distances=[1.6,1.7,1.8,1.9,2.0] !list of distances<br />

i=0 !initialize a counter<br />

do ith=1,#angles<br />

!loop over all angles H1-O-H2<br />

do ir1=1,#distances<br />

!loop over distances for O-H1<br />

do ir2=1,ir1<br />

!loop over O-H2 distances(r1.ge.r2)<br />

i=i+1<br />

!increment counter<br />

r1(i)=distances(ir1)<br />

!save r1 for this geometry<br />

r2(i)=distances(ir2)<br />

!save r2 for this geometry<br />

theta(i)=angles(ith)<br />

!save theta for this geometry<br />

hf;<br />

!do SCF calculation<br />

escf(i)=energy<br />

!save scf energy for this geometry<br />

ccsd(t);<br />

!do CCSD(T) calculation<br />

eccsd(i)=energc<br />

!save CCSD energy<br />

eccsdt(i)=energy<br />

!save CCSD(T) energy<br />

enddo<br />

!end of do loop ith<br />

enddo<br />

!end of do loop ir1<br />

enddo<br />

!end of do loop ir2<br />

{table,r1,r2,theta,escf,eccsd,eccsdt !produce a table with results<br />

head, r1,r2,theta,scf,ccsd,ccsd(t) !modify column headers for table<br />

save,h2o.tab<br />

!save the table in file h2o.tab<br />

title,Results for H2O, basis $basis !title for table<br />

sort,3,1,2}<br />

!sort table<br />

http://www.molpro.net/info/current/examples/h2o_pes_ccsdt.com<br />

The next example shows how to loop over many methods.<br />

***,h2o benchmark<br />

$method=[hf,fci,ci,cepa(0),cepa(1),cepa(2),cepa(3),mp2,mp3,mp4,\<br />

qci,ccsd,bccd,qci(t),ccsd(t),bccd(t),casscf,mrci,acpf]<br />

basis=dz<br />

!Double zeta basis set<br />

geometry={o;h1,o,r;h2,o,r,h1,theta} !Z-matrix for geometry<br />

r=1 ang, theta=104 !Geometry parameters<br />

do i=1,#method<br />

!Loop over all requested methods<br />

$method(i);<br />

!call program<br />

e(i)=energy<br />

!save energy for this method<br />

enddo<br />

escf=e(1)<br />

!scf energy<br />

efci=e(2)<br />

!fci energy<br />

table,method,e,e-escf,e-efci<br />

!print a table with results<br />

!Title for table:<br />

title,Results for H2O, basis $basis, R=$r Ang, Theta=$theta degree<br />

http://www.molpro.net/info/current/examples/h2o_manymethods.com<br />

6.7 Branching (IF/ELSEIF/ENDIF)<br />

IF blocks and IF/ELSEIF blocks can be constructed as in FORTRAN.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!