\subsection{Adding distributions}
\label{Adding distributions}

When the user wants to add an own distribution, the following steps are needed:
\begin{enumerate}
\item Decide a name for the distribution. The name must begin with ``user\_''.
\item Add an explanation line in the beginning of user\_dist.f90.
\item Add subroutine user\_name\_freq() into the module user\_dist.f90. The parameters depend on the parameters of the distribution.
\item If the distribution could be used as a proposal distribution, add user\_name\_gen() into the module user\_dist.f90. 
\end{enumerate}

The parameters of user\_name\_freq and user\_name\_gen subroutines depend on the parameters of the distribution: the subroutine implementing the frequency function has two additional parameters (the point on which the frequency is calculated and the result) and the subroutine generating the proposals has one additional parameter (the array which to generate proposals to).

Note that the generation subroutine is assumed to generate an array full of proposals.

Note also that the user might want to use the NAG library for existing generation subroutines, see chapter 5.

The explanation has the following syntax:
\begin{verbatim}
! name param_count types gen_present
\end{verbatim}

Where 
\begin{itemize}
\item ``param\_count'' is an an integer
\item ``types'' contain as many types as param\_count suggests
\item each type is either INTEGER or REAL
\item gen\_present is .TRUE. if there is a subroutine that generates proposals from the distribution, .FALSE. otherwise.
\end{itemize}

For example: 
\begin{verbatim}
! user_defined_points 1 INTEGER .FALSE.
\end{verbatim}

If the user wants to add many distributions all the explanations are written on consecutive lines at the beginning of the file. Note that no other comment lines are allowed at the beginning of the file. 