Under normal circumstances, the OOMMF host server (also known as the host service directory) is automatically launched in the background as needed by client applications. However, it can be useful, primarily in batch compute environments, to launch the host server explicitly in order to control the host server port address.
The launchhost command line is:
tclsh oommf.tcl launchhost [standard options] portwhere
In batch-mode settings, however, it can occur that one wants to run multiple concurrent but independent OOMMF sessions on a single machine. One way to accomplish this is to set the environment variable OOMMF_HOSTPORT to distinct values in each session. A difficulty here is the bookkeeping necessary to insure that each session really gets a distinct value. Using launchhost with port set to zero provides a straightforward solution to this problem. For example, consider the Bourne shell script:
#!/bin/sh OOMMF_HOSTPORT=`tclsh oommf.tcl launchhost 0` export OOMMF_HOSTPORT tclsh oommf.tcl mmArchive tclsh oommf.tcl boxsi sample.mif tclsh oommf.tcl killoommf allThe second line (OOMMF_HOSTPORT=...) launches the host server on a random port; the port selected is printed to stdout by launchhost and sets the environment variable OOMMF_HOSTPORT. (Note in particular the backticks around the launchhost command, which invoke command execution.) The subsequent commands launch an instance of mmArchive in the background, and run boxsi on the problem described by sample.mif. (By default, boxsi runs in the foreground.) When boxsi returns, the killoommf command is used to terminate all OOMMF processes in this session. (Alternatively, the boxsi command option -kill may be used to the same effect as killoommf.) For csh and derivatives, use
setenv OOMMF_HOSTPORT `tclsh oommf.tcl launchhost 0`in place of the two OOMMF_HOSTPORT commands in the above example.