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.

6 PROGRAM CONTROL 32<br />

6.5 Allocating dynamic memory (MEMORY)<br />

MEMORY,n,scale;<br />

Sets the limit on dynamic memory to n floating point words. If scale is given as K, n is multiplied<br />

by 1000; if scale is M, n is multiplied by 1 000 000.<br />

Note: The MEMORY card must precede all FILE cards!<br />

Examples:<br />

MEMORY,90000<br />

MEMORY,500,K<br />

MEMORY,2,M<br />

allocates 90 000 words of memory<br />

allocates 500 000 words of memory<br />

allocates 2 000 000 words of memory<br />

6.6 DO loops (DO/ENDDO)<br />

DO loops can be constructed using the DO and ENDDO commands. The general format of the DO<br />

command is similar to Fortran:<br />

DO variable=start, end [[,]increment] [[,]unit]<br />

where start, end, increment may be expressions or variables. The default for increment is 1. In<br />

contrast to Fortran, these variables can be modified within the loop (to be used with care!). For<br />

instance:<br />

DR=0.2<br />

DO R=1.0,6.0,DR,ANG<br />

IF (R.EQ.2) DR=0.5<br />

IF (R.EQ.3) DR=1.0<br />

....<br />

ENDDO<br />

performs the loop for the following values of R: 1.0, 1.2, 1.4, 1.6, 1.8, 2.0,<br />

2.5, 3.0, 4.0, 5.0, 6.0 Ångstrøm. The same could be achieved as follows:<br />

RVEC=[1.0,1.2,1.4,1.6,1.8,2.0,2.5,3.0,4.0,5.0,6.0] ANG<br />

DO I=1,#RVEC<br />

R=RVEC(I)<br />

....<br />

ENDDO<br />

Up to 20 DO loops may be nested. Each DO must end with its own ENDDO.<br />

Jumps into DO loops are possible if the DO variables are known. This can be useful in restarts,<br />

since it allows to continue an interrupted calculation without changing the input (all variables<br />

are recovered in a restart).

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

Saved successfully!

Ooh no, something went wrong!