19.01.2015 Views

MOLPRO

MOLPRO

MOLPRO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

8 VARIABLES 49<br />

prints<br />

** This is string a+b which evaluates to 7<br />

This can be used to define simple macros, which can be used at various places in the subsequent<br />

input. For instance,<br />

ECORR=’ENERGY-ESCF’ !define a macro<br />

HF<br />

!do SCF calculation<br />

ESCF=ENERGY<br />

!store SCF energy in variable ESCF<br />

MULTI<br />

!do CASSCF<br />

DEMC=$$ECORR !store CASSCF correlation energy in variable DEMC<br />

MRCI<br />

!do MRCI<br />

DECI=$$ECORR !store MRCI correlation energy in variable DECI<br />

Here is an example of advanced use of macros and string variables:<br />

***,test for parser<br />

text,This fancy input demonstrates how string variables and macros can be used<br />

text<br />

basis=vdz<br />

!define basis set<br />

geometry={O;H,O,r} !define geometry (z-matrix)<br />

text,methods<br />

$method=[rhf,2[casscf,2[mrci]]]<br />

text,active spaces<br />

$spaces=[’[3,1,1]’,3[’[4,2,2]’],3[’[5,2,2]’]]<br />

text,symmetries<br />

$symset=[’1’,2[’[1,2,3]’,’1’,’2’]]<br />

text,weight factors for state averaged casscf<br />

$weights=[’1’,’[1,1,1]’,2[’ ’],’[1,0.5,0.5]’,2[’ ’]]<br />

text,scf occupation<br />

set,scfocc=[3,2[1]]<br />

text,bond distance<br />

r=1.85<br />

hf<br />

do i=1,#method<br />

!loop over methods<br />

mcocc=$$spaces(i) !set active space for this run<br />

set,symmetry=$$symset(i) !set symmetries for this run<br />

set,weight=$$weights(i) !set weights for this run<br />

$method(i)<br />

!now run method<br />

e(i)=’$energy’<br />

!save energies in strings<br />

dipol(i)=’$dmz’ !save dipole moments in strings<br />

enddo<br />

table,method,spaces,symset,weights,e,dipol<br />

title,Results for OH, r=$r, basis=$basis<br />

head,method,spaces,symmetries,weights,energies,’dipole moments’<br />

exit<br />

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

8.6 Indexed Variables (Vectors)<br />

Variables may be indexed, but only one-dimensional arrays (vectors) are supported. The index<br />

may itself be a variable. For instance<br />

METHOD(I)=PROGRAM<br />

E(I)=ENERGY

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

Saved successfully!

Ooh no, something went wrong!