How Xopt Interfaces with HyperStudy
The files hopt_lock and extopt_lock are opened alternately to switch between the operations of HyperOpt and Xopt. In addition, the files hopt_run and extopt_run identify if either process is still active.

Figure 1. HyperOpt and Xopt Processes
HyperOpt Process
- HyperStudy invokes HyperOpt.
Information is provided to HyperOpt on input variables, constraints, and the objective through the .opt file.
 - HyperOpt creates the files hopt_run and
                            hopt_lock.
- hopt_run indicates that HyperOpt is running. This file is automatically deleted if HyperOpt terminates.
 - extopt_lock indicates that HyperOpt must wait for Xopt.
 
 - HyperOpt creates the file extrnopt.dat.
Xopt will read some key data (number of variables, variable bounds, constraints, etc.) from extrnopt.dat.
 - Set ndes = 0.
 - HyperOpt invokes Xopt.
 - If ndes > 0, create extrnopt.rsp which contains the output response values.
 - HyperOpt creates the file extopt_lock and deletes the file hopt_lock.
 - HyperOpt checks for the existence of extopt_run; if extopt_run does not exist, go to step 14.
 - HyperOpt checks for the existence of extopt_lock.
If extopt_lock exists then HyperOpt waits, continually checking for the existence of extopt_lock. It continues on to step 10 when extopt_lock no longer exists.
 - HyperOpt creates the file hopt_lock.
 - HyperOpt reads the file extrnopt.des; if the keyword
                            "
stop" is found in the file, go to step 14. - HyperOpt invokes the solver defined in the HyperStudy interface.
 - ndes = ndes + 1.
If ndes < MAXDES (maximum number of iterations), go to step 6.
 - The process ends here.
 
Xopt Process
- Xopt creates the file extopt_run.
                                
extopt_run indicates that Xopt is running.
 - Xopt checks for the existence of
                            hopt_lock. 
If hopt_lock exists then Xopt sleeps for 0.1 seconds and repeats step 2.
 - Xopt reads extrnopt.dat which is essential for optimization (number of variables, variable bounds, constraints, etc.).
 - Xopt performs optimization iteration.
 - Xopt writes out the next design point that needs to be analyzed to the file extrnopt.des.
 - Xopt creates the file
                                hopt_lock.
hopt_lock indicates that Xopt must wait for HyperOpt (see step 9).
 - Xopt deletes extopt_lock.
This allows HyperOpt to continue.
 - Xopt checks for the existence of hopt_run; if hopt_run does not exist, then Xopt terminates as HyperOpt has been terminated irregularly.
 - Xopt checks for the existence of hopt_lock; if hopt_lock exists then Xopt sleeps for 0.1 seconds and repeats step 9.
 - Xopt creates the file
                                extopt_lock.
extopt_lock indicates that HyperOpt must wait for Xopt.
Xopt must remove the file extopt_lock in case of process termination. For example, if Xopt is written using Fortran, use of the statement
'dispose = "delete"'is required. - Xopt reads in output responses from the file extrnopt.rsp.
 - If the optimization process has not reached convergence, go to step 4.
 - The process ends here.