VM - System call

(7/27/10)

PURPOSE

To access the operating system from SPIDER using a system (Unix) command. Obsolete legacy operation use 'SYS' operation now.   Example.

SEE ALSO

EV [Set system environmental variable]

USAGE

.OPERATION: VM
  <or>
VM M [For 'VM M' multiline input is accepted until a line has only a intial '.' (dot). To put a blank at the end of a line, place it at the beginning of the following line or it will disappear.]

.SYSTEM COMMAND:   ls   *.OMM
[Enter the system command you want executed. This may also be a Unix shell command file.
Substitution of do-loop indices, symbolic and register variables is allowed anywhere in the command line.]

NOTES

  1. SPIDER comments are not accepted in the system command line because the SPIDER comment character (;) is used to string system commands together on the same line in Unix.

  2. You must specify the extension for any filenames within the system command as they are NOT appended automatically by SPIDER (as there is no way to recognize what is a filename). You can use the string: $DATEXT to substitute the current SPIDER data extension into the corresponding position in your command line. You can use the string: $PRJEXT to substitute the current SPIDER project extension into the corresponding position in your command line.

  3. The "VM" name for this operation is left over from the VAX/VMS system operation name.

  4. Sample of substituting register variables in floating point format into a 'VM' system command:

    [var] = 34.56

    VM    ; To write out the following: Var is now= 34.5600
      echo Var is now= {%F7.4%[var]}

    VM    ; To write out the following: Var is now= 3.4560E+01
      echo Var is now= {%ES11.4%[var]}

  5. Sample of substituting register variables in integer format into a 'VM' system command:

    [var] = -1
    VM    ; To write out the following: Var is now= -1
      echo Var is now= {%I3%[var]}

  6. Sample of substituting string variables into a 'VM' system command:

    [filename] = 'gifile.gnu'
    VM    ; To write out the following: cat file.gnu
       cat [filename]

    Place the FORTRAN format within '%' symbols followed by the register whose contents are to be substituted. All of this has to be enclosed within the wavy brackets.

  7. Samples of usage within SPIDER loops.
     
     xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    -- Sample loop for converting series of 1024 x 512 raw images -- to SGI rgb format:

    [nsam] = 1024 ; Nsam [nrow] = 512 ; Nrow DO I=1,5 ; Loop VM ; Use "frombin" to convert images frombin raw{***i}.$DATEXT sgi{***i}.rgb {****[nsam]} {***[nrow]} ENDDO ; End loop

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    -- Sample loop for renaming/renumbering series of SPIDER images:

    [n]=33 DO I=1,4 ; Loop VM ; System call for renumbering cp jnk{***[n]}.dat jnk444{***I}.dat [n]=[n]+1 ; Increment output file number counter ENDDO ; End loop

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    -- Sample loop for consecutively renaming/renumbering series of SPIDER -- images while skipping any missing image numbers:

    [num]=0 ; Initialize output file number counter DO [it]=1,4 ; Loop IQ FI [exists] ; Use "IQ FI" to see if file exists jnk{***[it]} ; Filename IF([exists].LE.0)CYCLE ; Skip if file not found [num]=[num]+1 ; Increment output file number counter VM ; System call for renaming/renumbering SPIDER images cp jnk{***[it]}.dat jnk444{***[num]}.dat ENDDO ; End loop

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    -- Sample showing symbolic parameter substitution within a procedure:

    [var]=55 ; Set register variable outside of procedure ; (binding time for parameter substitution is ; before procedure is executed!) @testvm ; Invoke testvm SPIDER procedure doc ; Value given to: FILENAME PREFIX solicited ; by testvm procedure Contents of invoked procedure testvm: FR ?FILENAME PREFIX?[pre] VM rm [pre]{***[var]}.$DATEXT Result of invoked procedure: rm doc055.DAT

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

SUBROUTINES

VMS

CALLER

DRIV1