# Variables

Data may be stored in *variables*. A variable can be of type *string*, *real* or *logical*, depending on the type of the expression in its definition. Any sequence of characters which is not recognized as expression or variable is treated as string. In this section, we will discuss only *real* and *logical* variables. *String* variables will be discussed in more detail in section string variables. Variables can be used anywhere in the input, but they can be set only outside the input blocks for specific programs. For example, if a variable is used within the input block for `HF`

, it must have been set before the `HF{...} `

input block.

Molpro automatically stores various results and data in system variables (see section variables set by the program), which can be used for further processing. A new feature of Molpro2002 is that most system variables are write protected and cannot be overwritten by the user. The input is automatically checked before the job starts, and should a system variable be set in the input the job will stop immediately with an error message. Only in some exceptions (see section system variables), system variables can be modified using the `SET`

command (but not with the simple `NAME`

=*value* syntax). Note that due to the changed usage and syntax of the `SET`

command, compatibility with Molpro92 input syntax is no longer maintained.

## Setting variables

A variable can be defined using

*variable1=**value1*, *variable2=**value2*, …

A variable definition is recognized by the equals sign in the *first* field of the input card. For example,

`THRESH,ENERGY=1.d-8,GRADIENT=1.d-5`

does *not* define variables; here `ENERGY`

and `GRADIENT`

are options for the `THRESH`

directive.

Variables can have different types:

**Numbers:**The value is a number or an expression. The general form of*value*is

*expression* [,] [*unit*]

*unit* is an optional string which can be used to associate a unit to the value. `ANG[STROM]`

, `DEGREE`

, `HARTREE`

are examples. Undefined variables in expressions are assumed to be zero (and defined to be zero at the same time).

**Logicals:**The value can be`.TRUE.`

or`.FALSE.`

(`.T.`

and .F. also work), or a logical expression. Internally,`.TRUE.`

is stored as 1 and`.FALSE.`

as zero.**Strings:**The value can either be a string enclosed in quotes or a string variable. See section string variables for more details.

## Indexed variables

Variables can be indexed, but only one-dimensional indexing is available. Indexed variables can be defined either individually, e.g.

R(1)=1.0 ANG R(2)=1.2 ANG R(3)=1.3 ANG

or as a vector of values enclosed by square brackets:

`R=[1.0,1.1,1.2] ANG`

Subranges can also be defined, e.g.

R(1)=1.0 ANG R(2:3)=[1.1,1.2] ANG

leads to the same result as the above two forms.

The type of each element depends on the type of the assigned value, and it is possible to mix types in one variable. Example:

geometry={he} hf result=[program,energy,status.gt.0]

yields:

RESULT(1) = HF-SCF RESULT(2) = -2.85516048 AU RESULT(3) = TRUE

In this example the variables `PROGRAM`

, `ENERGY`

, and `STATUS`

are system variables, which are set by the program (see section system variables).

## String variables

As explained already in section setting variables, string variables can be set as other variables in the form

*variable* `=`

’*string*’

*variable* `=`

*string_variable*

Strings must be enclosed by quotes. Otherwise the string is assumed to be a variable, and if this is undefined it is assumed to be zero.

Alternatively, if the name of the variable is preceded by a dollar ($), all values are assumed to be a string. This can be a string variable, a quoted string, or an unquoted string. Note that unquoted strings are converted to upper case. Also note that quotes are compulsory if the string contains blanks.

Example:

`$str=[a,b+4,’This is an example for strings’]`

yields

STR(1) = A STR(2) = B+4 STR(3) = This is an example for strings

As a general rule, string variables are replaced by their value only if they are preceded by a dollar ($) (exceptions: in variable definitions, on ''SHOW'' cards, and in logical expressions on ''IF'' cards, the dollar is optional). This is a precaution to avoid commands which have the same name as a variable being interpreted as variables. Variables may also appear on ''TEXT'' or ''TITLE'' cards or in strings, but must be preceded by $ in these cases. Example:

$METHOD=MCSCF R=1.5 TEXT,$method results for R=$R Bohr

prints

`MCSCF results for R=1.5 Bohr`

String variables can be concatenated with strings or other string variables in the following way. Assume that variable `PROGRAM`

has the value `MRCI`

. Setting

`METHOD=’$PROGRAM+Q’`

sets `METHOD`

to `MRCI+Q`

. Alternatively, if we would also have a variable `VERSION`

with value `Q`

, we could write

`METHOD=’$PROGRAM+$VERSION’`

Again, the value of `METHOD`

would be `MRCI+Q`

. Note that the quotes are necessary in these cases.

Substring operations are not implemented.

## System variables

As mentioned above, most system variables cannot be written by the user. In some exceptions, it is possible to redefine them using the `SET`

command:

`SET`

,*variable* `=`

*expression* [,] [*unit*]

This holds for the following variables:

Total charge of the molecule`CHARGE`

Number of electrons`NELEC`

Spin quantum number, given as $2\cdot M\_S$ (integer)`SPIN`

Same as`SCFSPIN`

`SPIN`

, but only for HFSame as`MCSPIN`

`SPIN`

, but only for MCSCFSame as`CISPIN`

`SPIN`

, but only for MRCIState to be optimized`STATE`

Same as`MCSTATE`

`STATE`

but only for MCSCFSame as`CISTATE`

`STATE`

but only for MRCIState symmetry`SYMMETRY`

Same as`SCFSYM[METRY]`

`SYMMETRY`

but only for HFSame as`MCSYM[METRY]`

`SYMMETRY`

but only for MCSCFSame as`CISYM[METRY]`

`SYMMETRY`

but only for MRCILambda quantum number for linear molecules`LQUANT`

Geometry optimization convergence criterion`OPTCONV`

Last program name`PROGRAM`

CPU-time of last program step`CPUSTEP`

System-time of last program step`SYSSTEP`

Elapsed-time of last program step`WALLSTEP`

Indicates if closed-shell fock operator is available.`FOCKDONE`

Max number of basis sets stored on dump files. If the maximum is reached, the last one is overwritten when a new one is made, and all information (including dump records etc) of the previous basis is lost. The default is the maximum possible number of basis sets (30), which cannot be exceeded.`MAXBASIS`

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

- examples/oh_macros.inp
***,test for parser text,This fancy input demonstrates how string variables and macros can be used text basis=vdz !define basis set geometry={O;H,O,r} !define geometry (z-matrix) text,methods $method=[rhf,2[casscf,2[mrci]]] text,active spaces $spaces=['[3,1,1]',3['[4,2,2]'],3['[5,2,2]']] text,symmetries $symset=['1',2['[1,2,3]','1','2']] text,weight factors for state averaged casscf $weights=['1','[1,1,1]',2[' '],'[1,0.5,0.5]',2[' ']] text,scf occupation set,scfocc=[3,2[1]] text,bond distance r=1.85 hf do i=1,#method !loop over methods mcocc=$$spaces(i) !set active space for this run set,symmetry=$$symset(i) !set symmetries for this run set,weight=$$weights(i) !set weights for this run $method(i) !now run method e(i)='$energy' !save energies in strings dipol(i)='$dmz' !save dipole moments in strings enddo table,method,spaces,symset,weights,e,dipol title,Results for OH, r=$r, basis=$basis head,method,spaces,symmetries,weights,energies,'dipole moments' exit

## Indexed Variables (Vectors)

Variables may be indexed, but only one-dimensional arrays (vectors) are supported. The index may itself be a variable. For instance

`METHOD(I)=PROGRAM`

`E(I)=ENERGY`

are valid variable definitions, provided `I`

, `PROGRAM`

, and `ENERGY`

are also defined variables. Indices may be nested to any depth.

Different elements of an array can be of different type (either *real* or *logical*). However, only one *unit* can be assigned to an array. String variables have no associated value and cannot be mixed with the other variable types. Therefore, a given variable name can only be used either for a *string* variable or a *real* (*logical*) variable.

Vectors (arrays) can be conveniently defined using square brackets:

`R=[1.0,1.2,1.3] ANG`

This defines an array with three elements, which can be accessed using indices; for instance, `R(2)`

has the value `1.2 ANG`

. A repeat specifier can be given in front of the left bracket: `5[0]`

is equivalent to `[0,0,0,0,0]`

. Brackets can even be nested: for instance, `2[1,2,2[2.1,3.1]]`

is equivalent to `[1,2,2.1,3.1,2.1,3.1,1,2,2.1,3.1,2.1,3.1]`

.

Arrays can be appended from a given position just by entering additional elements; for instance,

`R(4)=[1.4,1.5] ANG`

or

`R(4:)=[1.4,1.5] ANG`

extends the above array to length 5. Previously defined values can be overwritten. For instance

`R(2)=[1.25,1.35,1.45]`

modifies the above vector to (1.0, 1.25, 1.35, 1.45, 1.5).

If no index is given on the left hand side of the equal sign, an existing variable of the same name is replaced by the new values, and all old values are lost. For instance

set four values`THETA=[100,110,120,130]`

**…**replace`THETA(1)=104`

`THETA(1)`

by a new value;`THETA(2:4)`

are unchanged**…**old variable`THETA=[140,150]`

`THETA`

is replaced;`THETA(3:4)`

are deleted

Square brackets can also be used to define an array of strings, e.g.,

`METHOD=[INT,HF,CASSCF,MRCI]`

These could be used as follows:

DO I=1,4 $METHOD(I) ENDDO

The above input would be equivalent to

INT HF CASSCF MRCI

The current length of an array can be accessed by preceding `#`

to the variable name. For instance, in the above examples `#R`

and `#METHOD`

have the values 5 and 4, respectively. If a variable is not defined, zero is returned but no error occurs. This can be used to test for the existence of a variable, for example:

`IF(#SPIN.EQ.0.AND.#NELEC.EQ.1) SET,SPIN=MOD(NELEC,2)`

This defines variable `SPIN`

if it is unknown and if `NELEC`

is a scalar (one dimensional) variable.

## Vector operations

The following simple vector operations are possible:

- Copying or appending a vector to another vector. For instance
`S=R`

copies a vector`R`

to a vector`S`

.`S(3)=R`

copies`R`

to`S(3), S(4), …`

.`S(#S+1)=R`

appends vector`R`

to vector`S`

. It is also possible to access a range of subsequent elements in a vector:`S=R(2:4)`

copies elements 2 to 4 of`R`

to`S(1), S(2), S(3)`

. Note that`R(2:)`

denotes elements`R(2)`

to`R(#R)`

, but`R(2)`

denotes a single element of`R`

. - Vector-scalar operations:
`R=R*2`

multiplies each element of`R`

by 2. Instead of the number 2, also scalar (one dimensional) variables or expressions can be used, e.g.,`R=R*ANG`

converts all elements of`R`

from Ångstrøm to bohr, or`Z=R*COS(THETA)`

creates a vector`Z`

with elements`Z(i) = R(i)*COS(THETA)`

. All other algebraic operators can be used instead of “*”. Note that the scalar must come last since the first variable in the expression determines the vector length. - Vector-vector operations: If
`A`

and`B`

are vectors of the same length, then`A \times B`

is also a vector of this length. Here $\times$ stands for any algebraic operator, and the operation is done for each pair of corresponding elements. For instance,`A + B`

adds the vectors`A`

and`B`

, and`A * B`

multiplies their elements. Note that the latter case is not a scalar product. If an attempt is made to connect two vectors of different lengths by an algebraic operator, an error occurs. - Intrinsic functions: Assume
`THETA=[100,110,120,-130]`

to be a vector of angles (in degrees). In this case`X=2*COS(THETA)`

is also a vector containing the cosines of each element of`THETA`

multiplied by two, i.e.,`X(i) = 2*COS(THETA(i))`

.`MAX(THETA)`

or`MIN(THETA)`

return the maximum and minimum values, respectively, in array`THETA`

. Vector operations can also be nested, e.g.,`MAX(ABS(THETA))`

returns the maximum value in array`ABS(THETA)`

.

At present, vector operations are not supported with `string`

variables.

## Special variables

### Variables set by the program

A number of variables are predefined by the program. The following variables can be used to convert between atomic units and other units:

EV=1.d0/27.2113839d0 HARTREE KELVIN=1.d0/3.157747d5 HARTREE KJOULE=1.d0/2625.500d0 HARTREE KCAL=1.d0/627.5096d0 HARTREE CM=1.d0/219474.63067d0 HARTREE CM-1=1.d0/219474.63067d0 HARTREE HZ=1.d0/6.5796839207d15 HARTREE HERTZ=1.d0/6.5796839207d15 HARTREE ANG=1.d0/0.529177210903d0 BOHR ANGSTROM=1.d0/0.529177210903d0 BOHR TOEV=27.2113839d0 EV TOK=3.157747d5 K TOKELVIN=3.157747d5 K TOCM=219474.63067d0 CM-1 TOHERTZ=6.5796839207d15 HZ TOHZ=6.5796839207d15 HZ TOKJ=2625.500d0 KJ/MOL TOKJOULE=2625.500d0 KJ/MOL TOKCAL=627.5096d0 KCAL/MOL TOA=0.529177210903d0 ANGSTROM TOANG=0.529177210903d0 ANGSTROM TODEBYE=2.54158d0 DEBYE

Further variables which are set during execution of the program:

defines integral program to be used. Either`INTYP`

`INTS`

(Seward) or`INTP`

(Argos).has the value`INTDONE`

`.true.`

if the integrals are done for the current geometry.Set to one if Cartesian basis functions are used.`CARTESIAN`

has the value`SCFDONE`

`.true.`

if an SCF calculation has been done for the current geometry.number of variables presently defined`NUMVAR`

status of last step (1=no error, -1=error or no convergence)`STATUS`

Total charge of the molecule`CHARGE`

number of electrons in last wavefunction`NELEC`

spin multiplicity minus one of last wavefunction`SPIN`

record of last optimized orbitals (set but never used in the program)`ORBITAL`

Type of last optimized orbitals (`LASTORB`

`RHF`

,`UHF`

,`UHFNAT`

, or`MCSCF`

).Symmetry of wavefunction for last optimized orbitals.`LASTSYM`

$2*M_S$ for wavefunctions for last optimized orbitals.`LASTSPIN`

Number of electrons in wavefunction for last optimized orbitals.`LASTNELEC`

Reference energy for state`ENERGR(istate)`

*istate*in MRCI and CCSD.last computed total energy for state`ENERGY(istate)`

*istate*for the method specified in the input (e.g.,`HF`

,`MULTI`

,`CCSD(T)`

, or`CCSD[T]`

.State-averaged energy of the MCSCF program multi.`ENERGY_AVRG`

String variable holding name of the method used for calculating`ENERGY_METHOD`

`ENERGY`

String variable holding name of the orbital basis-set used for calculating`ENERGY_BASIS`

`ENERGY`

Equal to the value of`GEOMETRY_METHOD`

`ENERGY_METHOD`

for the most recent geometry optimisationEqual to the value of`GEOMETRY_BASIS`

`ENERGY_BASIS`

for the most recent geometry optimisationTotal energy for state`ENERGD(istate)`

*istate*including Davidson correction (set only in`CI`

).Total energy for state`ENERGP(istate)`

*istate*including Pople correction (set only in`CI`

).Total energy including perturbative triples`ENERGT(1)`

`(T)`

correction (set only in`CCSD(T), QCI(T)`

).Total energy including perturbative triples`ENERGT(2)`

`[T]`

correction (set only in`CCSD(T), QCI(T)`

).Total energy including perturbative triples`ENERGT(3)`

`-t`

correction (set only in`CCSD(T), QCI(T)`

).holds MP2 energy in MPn, CCSD, BCCD, or QCISD calculations, and RS2 energy in MRPT2 (CASPT2) calculations.`EMP2`

holds MP3 energy in MP3 and MP4 calculations, and RS3 energy in MRPR3 (CASPT3) calculations.`EMP3`

holds MP4(SDQ) energy in MP4 calculations. The MP4(SDTQ) energy is stored in variable`EMP4`

`ENERGY`

.String variable holding name of the methods used for`METHODC`

`ENERGC`

, e.g.,`CCSD, BCCD, QCI`

.String variable holding name of the methods used for`METHODT(1)`

`ENERGT(1)`

, e.g.,`CCSD(T), BCCD(T), QCI(T)`

.String variable holding name of the methods used for`METHODT(2)`

`ENERGT(2)`

, e.g.,`CCSD[T], BCCD[T], QCI[T]`

.String variable holding name of the methods used for`METHODT(3)`

`ENERGT(3)`

, e.g.,`CCSD-T, BCCD-T, QCI-T`

.Total energy excluding perturbative triples correction (set only in`ENERGC`

`QCI`

or`CCSD`

with triples correction enabled).total value of density functional in`DFTFUN`

`DFT`

or`KS`

.value of`DFTFUNS(ifun)`

`ifun`

’th component of density functional in`DFT`

or`KS`

.name of`DFTNAME(ifun)`

`ifun`

’th component of density functional in`DFT`

or`KS`

.factor multiplying`DFTFAC(ifun)`

`ifun`

’th component of density functional in`DFT`

or`KS`

.factor multiplying exact exchange in`DFTEXFAC`

`KS`

.computed property for state`PROP(istate)`

*istate*. See below for the names`PROP`

of various properties.last program called, as specified in the input (e.g.,`PROGRAM`

`HF`

,`CCSD(T)`

, etc.)Number of iterations used. Set negative if no convergence or max number of iterations reached.`ITERATIONS`

User-CPU time in seconds for last program called.`CPUSTEP`

System-CPU time in seconds for last program called.`SYSSTEP`

Elapsed time in seconds for last program called.`WALLSTEP`

The variable names for properties are the same as used on the `EXPEC`

input cards.

Overlap`OV`

Kinetic energy`EKIN`

Potential`POT`

Delta function`DELTA`

$\nabla^4$`DEL4`

Darwin term of relativistic correction`DARWIN`

Mass-velocity term of relativistic correction`MASSV`

Total relativistic correction`EREL`

Dipole moments`DMX, DMY, DMZ`

Second moments`XX, YY, ZZ, XY, XZ, XY`

Third moments`XXX, XXY, XXZ, XYY, XYZ, XZZ, YYY, YYZ, YZZ, ZZZ`

Quadrupole moments`QMXX, QMYY, QMZZ, QMXY, QMXZ, QMXY`

Electric field`EFX, EFY, EFZ`

Electric field gradients`FGXX, FGYY, FGZZ, FGXY, FGXZ, FGXY`

Velocity`D/DX, D/DY, D/DZ`

One-electron spin-orbit`LSX, LSY, LSZ`

Total angular momentum squared $L^2$`LL`

Electronic angular momentum`LX, LY, LZ`

Two-electron angular momentum`LXLX, LYLY, LZLZ, LXLY, LXLZ, LYLZ`

By default, only the dipole moments are computed and defined. The values of other properties are only stored in variables if they are requested by `EXPEC`

cards. If more than one state is computed (e.g., in state-averaged MCSCF, corresponding arrays `PROP(istate)`

are returned. If properties are computed for more than one center, the center number is appended to the name, e.g. `EFX1`

, `EFX2`

etc.

If transition properties are computed, their values are stored in corresponding variables with prefix `TR`

, e.g., `TRDMX, TRDMY, TRDMZ`

for transition dipole moments. If more than two states are computed, the index is $(i-1)*(i-2)/2+j$, where $i \gt j \ge 1$ are state numbers. In a state-averaged calculation, states are counted sequentially for all state symmetries.

For instance, in the following state-averaged MCSCF

`MULTI;WF,14,1,0;STATE,3;WF,14,2,0;STATE,2;WF,14,3,0`

the states are counted as

$i$ | 1 | 2 | 3 | 4 | 5 | 6 | |

Symmetry | 1 | 1 | 1 | 2 | 2 | 3 | |

Root in Sym. | 1 | 2 | 3 | 1 | 2 | 1 |

### Variables recognized by the program

All variables described below are checked by the program, but not set (except `NELEC`

and `SPIN`

). If these are not defined by the user, the program uses its internal defaults. The variables are only recognized and used if defined using the `SET`

command, e.g.

`SET,MCOCC=[6,3,2]`

`SET,STATE=2`

etc.

Variables recognized by the SCF program:

Total charge of the molecule (can be given instead of nelec)`CHARGE`

number of electrons`NELEC`

spin multiplicity minus one`SPIN`

wavefunction symmetry`SCFSYM[METRY]`

`SYMMETRY`

`as SCFSYMM`

; only used if`SCFSYMM`

is not present.number of occupied orbitals in each symmetry for`SCFOC[C]`

`SCF`

number of closed-shell orbitals in each symmetry for`SCFCL[OSED]`

`SCF`

record of saved orbitals in`SCFORB`

`SCF`

record of starting orbitals used in`SCFSTART`

`SCF`

Variables recognized by the MCSCF program:

Total charge of the molecule (can be given instead of nelec)`CHARGE`

number of electrons`NELEC`

wavefunction symmetry. This can be an array for state-averaged calculations.`MCSYM[METRY]`

as`SYMMETRY`

`MCSYMM`

; only used if`MCSYMM`

is not present.spin multiplicity minus one. This can be an array for state-averaged calculations, but different spin multiplicities can only be used in determinant CASSCF. If only one value is specified, this is used for all states`MCSPIN`

as`SPIN`

`MCSPIN`

; only used if`MCSPIN`

is not present.number of states for each symmetry in`MCSTATE`

`MCSCF`

as`STATE`

`MCSTATE`

; only used if`MCSTATE`

is not present.weight factors for all states defined by`WEIGHT`

`SYMMETRY`

and`STATE`

Eigenvalues of $L_z^2$ for linear molecules for each state defined by`LQUANT`

`SYMMETRY`

and`STATE`

.records from which configurations can be selected and selection threshold`MCSELECT`

as`SELECT`

`MCSELECT`

; only used if`MCSELECT`

is not present.can be used to define occupancy restrictions`MCRESTRICT`

as`RESTRICT`

`MCRESTRCT`

; only used if`MCRESTRICT`

is not present:if set to .true. or to one triggers use of CSFs`CONFIG`

number of occupied orbitals in each symmetry`MCOC[C]`

as`OCC`

`MCOCC`

; only used if`MCOCC`

is not present.number of optimized closed-shell orbitals in each symmetry`MCCL[OSED]`

as`CLOSED`

`MCCLOSED`

; only used if`MCCLOSED`

is not present.number of frozen core orbitals in each symmetry`MCFROZEN`

as`FROZEN`

`MCFROZEN`

; only used if`MCFROZEN`

is not present.record of starting orbitals`MCSTART`

record of frozen core orbitals`COREORB`

record for saving optimized orbitals`MCORB`

records for saving CI wavefunction (like`MCSAVE`

`SAVE`

card in MCSCF)

Variables recognized by the CI/CCSD program:

Total charge of the molecule (can be given instead of nelec)`CHARGE`

number of electrons`NELEC`

spin multiplicity minus one`SPIN`

wavefunction symmetry. If this is an array, only SYMMETRY(1) is used.`CISYM[METRY]`

as`SYMMETRY`

`CISYMM`

; only used if`CISYMM`

is not present.number of states in CI`CISTATE`

as`STATE`

`CISTATE`

, only used if`CISTATE`

is not present.records from which configurations can be selected`CISELECT`

as`SELECT`

`CISELECT`

; only used if`CISELCT`

is not present.defines occupancy restrictions`CIRESTRICT`

as`RESTRICT`

`RESTRICT`

; only used if`CIRESTRICT`

is not present.number of occupied orbitals in each symmetry`CIOC[C]`

`OCC`

`as CIOCC`

; only used if`CIOCC`

is not present.number of closed-shell orbitals in each symmetry`CICL[OSED]`

`CLOSED`

`as CICLOSED`

; only used if`CICLOSED`

is not present.number of core orbitals in each symmetry`CICO[RE]`

`CORE`

`as CICORE`

; only used if`CICORE`

is not present.record of orbitals used in CI`CIORB`

records for saving CI wavefunction (like`CISAVE`

`SAVE`

card in CI)records for restarting with previous CI wavefunction (like`CISTART`

`START`

card in CI)

Variables recognized by the DFT/KS program:

name of`DF(ifun)`

or`DFTNAME(ifun)`

`ifun`

’th component of density functional.factor multiplying`DFTFAC(ifun)`

`ifun`

’th component of density functional.factor multiplying exact exchange in`DFTEXFAC`

`KS`

.

Example for the use of these variables for a state-averaged MCSCF (note that system variables can only be modified using the SET command, see section system variables):

defines number of electrons`SET,NELEC=9`

defines wavefunction to be a doublet`SET,SPIN=1`

defines wavefunction symmetries for state averaged calculation`SET,SYMMETRY=[1,2,3]`

defines number of states to be averaged in each symmetry`SET,STATE=[2,1,1]`

defines weights for the above four states`WEIGHT=[2,2,1,1]`

number of occupied orbitals in each symmetry`OCC=[5,2,2]`

number of closed-shell orbitals in symmetry 1`CLOSED=2`

record for optimized orbitals`MCORB=3100.2`

do mcscf with above parameters`MULTI`

Note: Setting the variables `NELEC`

, `SPIN`

, or `SYMMETRY`

, has the same effect giving these on a gobal `WF`

directive. If the global `WF`

directive is given after the variable definition, the values of the variables are replaced by the values given on the `WF`

directive. Vice versa, if a variable definition follows a gobal `WF`

directive, the new value of the variable is used in the following. Note that `WF`

input cards in command blocks have preference over global `WF`

directives or input variables.

## Displaying variables

Variables or the results of expressions can be displayed in the output using `SHOW`

and `TABLE`

.

### The SHOW command

The general form of the `SHOW`

command is as follows:

`SHOW[ncol,format],expression`

where *expression* can be an expression or variable, *ncol* is the number of values printed per line (default 6), and *format* is a format (default 6F15.8). This can be used to print vectors in matrix form. The specification of *ncol* and *format* is optional. Assume that `E`

is a vector:

prints`SHOW,E`

`E`

using defaults.prints`SHOW[n],E`

`E`

with`n`

elements per line; (if`n>6`

, more than one line is needed, but in any case a new line is started after`n`

elements).prints`SHOW[n,10f10.4],E`

`E`

in the format given, with newline forced after`n`

elements.

Note that the total length of the format should not exceed 100 characters (a left margin of 30 characters is always needed).

A *wild card* format can be used to show several variables more easily:

`SHOW,qm*,dm*`

shows all variables whose names begin with `QM`

and `DM`

. Note that no letters must appear after the `, i.e., the wild card format is less general than in `

`UNIX`

commands.

See the `TABLE`

command for another possibility to tabulate results.

## Clearing variables

Variables can be deleted using

`CLEAR`

,*name1, name2, …*

Wild cards can be used as in `SHOW`

, e.g.,

`CLEAR,ENERG*`

clears all variables whose names begin with `ENERG`

. All variables can be cleared using

`CLEARALL`

The length of vectors can be truncated simply by redefining the length specifier: `#R=2`

truncates the array `R`

to length 2. Higher elements are no longer available (but could be redefined). Setting `#R=0`

is equivalent to the command `CLEAR,R`

.

## Reading variables from an external file

Variables can be read from an external file using

`READVAR`

, *filename*, [*option*]

Such files can be saved, for instance by the geometry optimization program, and reused later to recover a certain optimized geometry. The format of the input in *filename* is the same as for ordinary input.

If *option*=`NOINDEX|IGNOREINDEX`

is given then variable indices are ignored and only the last value saved is read (without index). This can be useful if for example a file saved with `SAVEACT`

in a geometry optimization is read, and it is intended to continue with the variables that were saved last.