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 50<br />

are valid variable definitions, provided I, PROGRAM, and ENERGY are also defined variables.<br />

Indices may be nested to any depth.<br />

Different elements of an array can be of different type (either real or logical). However, only<br />

one unit can be assigned to an array. String variables have no associated value and cannot be<br />

mixed with the other variable types. Therefore, a given variable name can only be used either<br />

for a string variable or a real (logical) variable.<br />

Vectors (arrays) can be conveniently defined using square brackets:<br />

R=[1.0,1.2,1.3] ANG<br />

This defines an array with three elements, which can be accessed using indices; for instance,<br />

R(2) has the value 1.2 ANG. A repeat specifier can be given in front of the left bracket: 5[0]<br />

is equivalent to [0,0,0,0,0]. Brackets can even be nested: for instance, 2[1,2,2[2.1,3.1]]<br />

is equivalent to [1,2,2.1,3.1,2.1,3.1,1,2,2.1,3.1,2.1,3.1].<br />

Arrays can be appended from a given position just by entering additional elements; for instance,<br />

R(4)=[1.4,1.5] ANG<br />

or<br />

R(4:)=[1.4,1.5] ANG<br />

extends the above array to length 5. Previously defined values can be overwritten. For instance<br />

R(2)=[1.25,1.35,1.45]<br />

modifies the above vector to (1.0, 1.25, 1.35, 1.45, 1.5).<br />

If no index is given on the left hand side of the equal sign, an existing variable of the same name<br />

is replaced by the new values, and all old values are lost. For instance<br />

THETA=[100,110,120,130] set four values<br />

. . .<br />

THETA(1)=104 replace THETA(1) by a new value; THETA(2:4) are unchanged<br />

. . .<br />

THETA=[140,150] old variable THETA is replaced; THETA(3:4) are deleted<br />

Square brackets can also be used to define an array of strings, e.g.,<br />

METHOD=[INT,HF,CASSCF,MRCI]<br />

These could be used as follows:<br />

DO I=1,4<br />

$METHOD(I)<br />

ENDDO<br />

The above input would be equivalent to<br />

INT<br />

HF<br />

CASSCF<br />

MRCI

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

Saved successfully!

Ooh no, something went wrong!