Next: 10.4 Indexed Variables (Vectors) Up: 10 VARIABLES Previous: 10.2 String variables


10.3 Macro definitions using string variables

String variables for which the stored string has the form of an algebraic expression are evaluated to a number if they are preceded by two dollars ($$). Example:

string='a+b'
a=3
b=4
text,This is string $string which evaluates to $$string
prints

** This is string a+b which evaluates to 7

This can be used to define simple macros, which can be used at various places in the subsequent input. For instance,

ECORR='ENERGY-ESCF' !define a macro
HF                  !do SCF calculation
ESCF=ENERGY         !store SCF energy in variable ESCF
MULTI               !do CASSCF
DEMC=$$ECORR        !store CASSCF correlation energy in variable DEMC
MRCI                !do MRCI
DECI=$$ECORR        !store MRCI correlation energy in variable DECI

Here is an example of advanced use of macros and string variables:

Input: oh_macros.com

Output: oh_macros.out



P.J. Knowles and H.-J. Werner
molpro@tc.bham.ac.uk
Jan 15, 2002