manual   quickstart   instguide   update   basis

Next: 8.6 Indexed Variables (Vectors) Up: 8 VARIABLES Previous: 8.4 System variables   Contents   Index   PDF


8.5 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:

oh_macros.com



molpro@molpro.net 2017-12-13