6.8 Procedures (

Procedures can be defined at the top of the input or in `INCLUDE`
files as follows:

`PROC name
statements
ENDPROC`

Alternatively, one can use the form

`PROC name[=]{statements}`

In the latter case, it is required that the left curly bracket () appears on the same line as `PROC`,
but *statements* can consist of several lines.
If in the subsequent input *name* is found as a command *in the first field* of a line, it is
substituted by the *statements*. Example:

PROC SCF IF (#SPIN.EQ.0.OR.MOD(SPIN,2).NE.MOD(NELEC,2)) SET,SPIN=MOD(NELEC,2) IF (SPIN.EQ.0) THEN HF ELSE RHF ENDIF ENDPROC

Alternatively, this could be written as

PROC SCF={ IF (#SPIN.EQ.0.OR.MOD(SPIN,2).NE.MOD(NELEC,2)) SET,SPIN=MOD(NELEC,2) IF (SPIN.EQ.0) THEN; HF; ELSE; RHF; ENDIF}Procedures may be nested up to a depth of 10. In the following example

PROC CC SCF IF (SPIN.EQ.0) THEN CCSD ELSE RCCSD ENDPROC

Note: Procedure names are substituted only
if found in the first field of an input line. Therefore, they must not be used
on one-line `IF` statements; please use `IF / ENDIF` structures instead.

If as first statement of a procedure `ECHO` is specified, the substituted commands of the present
and lower level procedures will be printed. If `ECHO` is specified in the main input
file, all subsequent procedures are printed.

Certain important input data can be passed to the program using variables. For instance, occupancy patterns, symmetries, number of electrons, and multiplicity can be defined in this way (see section 8.8 for more details). This allows the quite general use of procedures. For example, assume the following procedure has been defined at the top of the input:

PROC MRCI IF (INTDONE.EQ.0) INT IF (SCFDONE.EQ.0) THEN SCF ENDIF MULTI CI ENDPROC

This procedure can be used for a calculation of a vertical ionization potential of HO as follows:

R=1 ANG !Set bond distance THETA=104 DEGREE !Set bond angle BASIS=VTZ !Define basis set GEOMETRY !Geometry input block O !Z-matrix H1,O,R H2,O,R,H1,THETA ENDG !End of geometry input HF MRCI !Compute mrci energy of water using defaults EH2O=ENERGY !save mrci energy in variable EH2O SET,NELEC=9 !Set number of electrons to 9 SET,SYMMETRY=2 !Set wavefunction symmetry to 2 HF MRCI !Compute mrci energy of H2O+ (2B2 state) IPCI=(ENERGY-EH2O)*TOEV !Compute MRCI ionization potential in eV

Note: At present, all variables are *global*, i.e., variables are commonly
known to all procedures and all variables defined in procedures will be subsequently known
outside the procedures as well. The reason is that procedures are included into the internal input
deck at the beginning of the job and not at execution time; for the same reason, variable
substitution of procedure names is not possible, e.g. one cannot use constructs like

method=scf $method !this does not work!

manual quickstart instguide update basis

molpro@molpro.net 2018-02-17