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

6.7.3 Labels (LABEL)<br />

LABEL<br />

This is a dummy command, sometimes useful in conjunction with GOTO.<br />

6.8 Procedures (PROC/ENDPROC)<br />

Procedures can be defined at the top of the input or in INCLUDE files as follows:<br />

PROC name<br />

statements<br />

ENDPROC<br />

Alternatively, one can use the form<br />

PROC name[=]{statements}<br />

In the latter case, it is required that the left curly bracket ({) appears on the same line as PROC,<br />

but statements can consist of several lines. If in the subsequent input name is found as a command<br />

in the first field of a line, it is substituted by the statements. Example:<br />

PROC SCF<br />

IF (#SPIN.EQ.0.OR.MOD(SPIN,2).NE.MOD(NELEC,2)) SET,SPIN=MOD(NELEC,2)<br />

IF (SPIN.EQ.0) THEN<br />

HF<br />

ELSE<br />

RHF<br />

ENDIF<br />

ENDPROC<br />

Alternatively, this could be written as<br />

PROC SCF={<br />

IF (#SPIN.EQ.0.OR.MOD(SPIN,2).NE.MOD(NELEC,2)) SET,SPIN=MOD(NELEC,2)<br />

IF (SPIN.EQ.0) THEN; HF; ELSE; RHF; ENDIF}<br />

Procedures may be nested up to a depth of 10. In the following example SCF is a procedure:<br />

PROC CC<br />

SCF<br />

IF (SPIN.EQ.0) THEN<br />

CCSD<br />

ELSE<br />

RCCSD<br />

ENDPROC<br />

Note: Procedure names are substituted only if found in the first field of an input line. Therefore,<br />

they must not be used on one-line IF statements; please use IF / ENDIF structures instead.<br />

If as first statement of a procedure ECHO is specified, the substituted commands of the present<br />

and lower level procedures will be printed. If ECHO is specified in the main input file, all<br />

subsequent procedures are printed.

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

Saved successfully!

Ooh no, something went wrong!