Next: 3.1 SUBROUTINE INI_INP_G Up: MOLPRO Programming Manual Previous: 2.3 Conditional code in

3 Utilities for input parameter processing

Author H.-J. Werner

Global Input routines:

ini_inp_g:
Global initialization (called from driver)
default_inpi:
Sets a global default (integer)
default_inpf:
Sets a global default (floating point)
default_inps:
Sets a global default (string)
global_inp:
Processes GLOBAL directive (called from driver)
scan_inp_g:
Scans an input card for global parameters
set_inpi_g:
Sets a global integer parameter
set_inpf_g:
Sets a global floating point parameter
set_inps_g:
Sets a global string parameter

Local Input routines:

ini_inp:
Initializes local input and copies global parameter list to local one. Called from driver before call of each program.
scan_inp:
Scans an input card for local parameters
set_inpi:
Sets a local integer parameter
set_inpf:
Sets a local floating point parameter
set_inps:
Sets a local string parameter
get_inpi:
Gets current value of an integer parameter
get_inpf:
Gets current value of a floating point parameter
get_inps:
Gets current value of a string parameter
check_inp:
Checks parameter list and copies data
print_inp:
Print current input parameters.

Overview:
Each parameter is associated to a name (naminp), an input setname (set), and a type (inptyp). Internally, a global and a local parameter list are kept. Global parameters are also associated to a program name. If this is blank, the global parameter is used as default in all subsequent programs, otherwise only in the ones specified by the name. Local parameters can be set as part of the input in a particular program and are then only known to this program. After execution of this program, the parameters are reset to their global values.

New parameters can be defined simply by setting a global default using DEFAULT_INP. The default parameters can be overwritten by input values using SET_INP_G or SET_INP and retrieved using GET_INP. GET_INP must only be used for any parameters for which a default value has been defined.

The default values for a given global input set (e.g., PARAM, THRESH, DIRECT, LOCAL) should be defined in individual subroutines, e.g., LOCAL_DEFAULT. These subroutines must be called only once from INI_INP_G. Additional parameters can then be added in these subroutines at any time without affecting the rest of the program. A default value for a given parameter can be defined only once.

Parameter types:
inptyp=0:
a default value has been set
inptyp=1:
default value is overwritten by local input
inptyp=2:
default value is overwritten by global input
inptyp=-1:
unknown parameter (no default) given in local input
inptyp=-2:
unknown parameter (no default) given in gobal input

Compatibility with existing code:
check_inp:
can be used to check whether globally unknown parameters are locally known in a parameter list. The known parameters are copied to an array passed to check_inp (can be equivalenced to a common). If parameters are known neither globally (via defaults) nor locally an error results. This mechanism is used for compatibility with the existing program.



Subsections

Next: 3.1 SUBROUTINE INI_INP_G Up: MOLPRO Programming Manual Previous: 2.3 Conditional code in

P.J. Knowles and H.-J. Werner
molpro-support@tc.bham.ac.uk
Jan 10, 2000