/*! @page pag_concepts Design

\section sec_components Components

The code for a PMSCO job consists of the following components.

@startuml "top-level components of scattering and optimization code"

skinparam componentStyle uml2

component "PMSCO" as pmsco
component "project" as project
component "scattering code\n(calculator)" as calculator

interface "command line" as cli
interface "experimental data" as data
interface "results" as results
interface "output files" as output

cli --> pmsco
data -> project
pmsco ..> project
pmsco ..> calculator
calculator -> output
pmsco -> results

@enduml

The main entry point is the _PMSCO_ module.
It implements a task loop to carry out the structural optimization
and provides an interface between calculation programs and project-specific code.
It also provides common utility classes and functions for the handling project data.

The _project_ consists of program code and parameters
that are specific to a particular experiment and calculation job.
The project code reads experimental data, defines the parameter dictionary of the model,
and contains code to generate the cluster, parameter and phase files for the scattering code.
The project is also the main entry point of process execution.

The _scattering code_ on the other hand is a static calculation engine
which accepts detailed input files
(parameters, atomic coordinates, emitter specification, scattering phases)
and outputs an intensity distribution of photoelectrons versus energy and/or angle.


\section sec_control_flow Control flow

The basic control flow of a optimization job is depicted schematically in the following figure.

@startuml "top-level activity diagram"

start
:initialize;
:import experimental data;
repeat
:define tasks;
fork
:calculate\ntask 1;
fork again
:calculate\ntask N;
end fork
:evaluate results;
repeat while
-> [finished];
:report results;

stop

@enduml

After importing experimental data and setting up the model dictionary and job parameters,
the calculation tasks are defined depending on the execution mode and system setup.
Each task consists of a specific set of model, experimental and calculation parameters
that describe an independent calculation step,
while several steps may be required to produce a dataset that can be compared to the experimental data.
The idea is that tasks can be defined quickly
and that the time-consuming operations are dispatched to slave processes which can run in parallel.

As soon as all necessary results are available they are combined into one dataset and compared to the experimental data.
Depending on the execution mode, the process of task definition and calculation repeats until the model has converged
or the calculations are stopped for another reason.

*/
