\Command      {MAKE\_RESTRAINTS}{make restraints}

\Options{
\OptLine{RESTRAINT\_TYPE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RADII\_FACTOR}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{TOPOLOGY\_MODEL}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{DIH\_LIB\_ONLY}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{MNCH\_LIB}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{INTERSEGMENT}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{ADD\_RESTRAINTS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESIDUE\_GROUPING}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{MAXIMAL\_DISTANCE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESIDUE\_SPAN\_RANGE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESIDUE\_SPAN\_SIGN}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESTRAINT\_SEL\_ATOMS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{NONBONDED\_SEL\_ATOMS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{EXCL\_LOCAL}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{ACCESSIBILITY\_TYPE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{DISTANCE\_RSR\_MODEL}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESTRAINT\_STDEV}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESTRAINT\_PARAMETERS}{TYPE}{VALUES}{DEFAULT}{restraint parameters for 
         \Z{USER\_DISTANCE}}
\OptLine{MDT\_LIB\_FILE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{BIN\_LIB\_FILE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{ATOM\_FILES\_DIRECTORY}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{BASIS\_PDF\_WEIGHT}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{BASIS\_RELATIVE\_WEIGHT}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESIDUE\_IDS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{SPLINE\_ON\_SITE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
}

\Requirements   {topology \AND\ parameters [\AND\ alignment] 
                 [\AND\ picked atoms sets 2 and 3]}

\Description  {This command calculates and selects new restraints of
a specified type. See the original papers for the most detailed definition
and description of the restraints \cite{SalBlu93,SalOve94}. The
calculation of restraints of all types is now (partly) limited to the 
selected atoms only (either set 1, or 2 and 3; see below).

If \K{ADD\_RESTRAINTS} is \V{off}, all old restraints are deleted,
otherwise new restraints are added to the old ones.
  
\K{RESTRAINT\_TYPE} selects the types of the generated restraints. 
Only one restraint type can be selected at a time, except
for the stereochemical restraints (\V{BOND}, \V{ANGLE}, \V{DIHEDRAL}, 
\V{IMPROPER})
that can all be calculated at the same time. It is useful to
distinguish between the stereochemical restraints and homology-derived
restraints. The stereochemical restraints are obtained from 
libraries that depend on atom and/or residue types only (\eg, 
\CHARMM~22 force field \cite{CHARMM98} or statistical 
potentials), and do not require an 
alignment with template structures. In contrast, the homology-derived 
restraints are calculated from related protein structures, which
correspond to all but the last sequence in the alignment (the target).
These templates are read from coordinate files,
which are the only data files required. All restraints are added to the
existing restraints, even if they duplicate them (but see the comment
for the \Z{OMEGA} restraints below).

\begin{itemize}
\item \bull\ {\bf Stereochemical restraints:}

\item \Z{BOND}. This calculates covalent bond restraints (harmonic terms). 
It relies on the 
list of the atom--atom bonds for MODEL, prepared previously by the 
\C{GENERATE\_\-TOPOLOGY} command. The mean values and force constants are 
obtained from the parameter library in memory. Only those bonds
are restrained that have all or at least \K{RESTRAINT\_SEL\_ATOMS}
in the selected atom set 1.

\item \Z{ANGLE}. This calculates covalent angle restraints (harmonic
terms). It relies on the
list of the atom--atom--atom bonds for MODEL, prepared previously by the 
\C{GENERATE\_\-TOPOLOGY} command. The mean values and force constants are 
obtained from the parameter library in memory. Only those angles
are restrained that have all or at least \K{RESTRAINT\_SEL\_ATOMS}
in the selected atom set 1.

\item \Z{DIHEDRAL}. This calculates covalent dihedral angle restraints 
(cosine terms). It relies on the list of the atom--atom--atom--atom 
dihedral angles for MODEL, prepared previously by the \C{GENERATE\_\-TOPOLOGY} 
command. The minima, phases, and force constants are obtained from the 
parameter library in memory. Only those dihedral angles are restrained 
that have all or at least \K{RESTRAINT\_SEL\_ATOMS} in the selected atom 
set 1.

\item \Z{IMPROPER}. This calculates improper dihedral angle restraints
(harmonic terms). It relies on the list of the improper dihedral angles 
for MODEL, prepared previously by the 
\C{GENERATE\_\-TOPOLOGY} command. The mean values and force constants are 
obtained from the parameter library in memory. Only those impropers
are restrained that have all or at least \K{RESTRAINT\_SEL\_ATOMS}
in the selected atom set 1.

\item \Z{STEREO}. This implies all \Z{BOND}, \Z{ANGLE}, \Z{DIHEDRAL}, and 
\Z{IMPROPER} restraints.

\item \Z{MRFP\_BOND}. Similar to \Z{BOND} except that spline restraints
from the corresponding \V{MRFP} entries in the parameter library are used 
instead of the harmonic terms. Only those bonds
are restrained that have all or at least \K{RESTRAINT\_SEL\_ATOMS}
in the selected atom set 1.

\item \Z{MRFP\_ANGLE}. Similar to \Z{ANGLE} except that spline restraints
from the corresponding \V{MRFP} entries in the parameter library are used 
instead of the harmonic terms. Only those angles
are restrained that have all or at least \K{RESTRAINT\_SEL\_ATOMS}
in the selected atom set 1.

\item \Z{MRFP\_DIHEDRAL}. Similar to \Z{DIHEDRAL} except that spline restraints
from the corresponding \V{MRFP} entries in the parameter library are used 
instead of the cosine terms. Only those dihedral angles
are restrained that have all or at least \K{RESTRAINT\_SEL\_ATOMS}
in the selected atom set 1.

\item \Z{MRFP\_STEREO}. This implies all \Z{MRFP\_BOND}, \Z{MRFP\_ANGLE}, 
and \Z{MRFP\_DIHEDRAL} restraints.

\item \Z{SPHERE14}. This constructs soft-sphere overlap restraints (lower 
harmonic bounds) for atom pairs separated by exactly three bonds (1--4 
pairs). It relies on atom radii from the \Z{\$RADII14\_LIB} library.
Only those non-bonded pairs are restrained that have all or at least 
\K{NONBONDED\_SEL\_ATOMS} in the selected atom set 1.
They must also satisfy the \K{RESIDUE\_SPAN\_RANGE} \& \K{RESIDUE\_SPAN\_SIGN}
criterion.

\item \Z{LJ14}. This constructs 1--4 Lennard-Jones restraints using the 
modified 1--4 Lennard-Jones parameters from the \CHARMM\ parameter library.
There is no way to calculate \Z{LJ14} as dynamic restraints.
Only those non-bonded pairs are restrained that have all or at least 
\K{NONBONDED\_SEL\_ATOMS} in the selected atom set 1.
They must also satisfy the \K{RESIDUE\_SPAN\_RANGE} \& \K{RESIDUE\_SPAN\_SIGN}
criterion.

\item \Z{COULOMB14}. This constructs 1--4 Coulomb restraints by relying
on the atomic charges from the \CHARMM\ topology library.
There is no way to calculate \Z{COULOMB14} as dynamic restraints.
Only those non-bonded pairs are restrained that have all or at least 
\K{NONBONDED\_SEL\_ATOMS} in the selected atom set 1.
They must also satisfy the \K{RESIDUE\_SPAN\_RANGE} \& \K{RESIDUE\_SPAN\_SIGN}
criterion.

\item \Z{SPHERE}. This constructs soft-sphere overlap restraints
(lower harmonic bounds) for all atom pairs that are not in bonds, 
angles, dihedral angles, improper dihedral angles, nor are explicitly 
excluded by the \Z{E} entries read from a restraint file or added
by the \C{ADD\_RESTRAINT} command. 
Only those non-bonded pairs are restrained that have all or at least 
\K{NONBONDED\_SEL\_ATOMS} in the selected atom set 1.
They must also satisfy the \K{RESIDUE\_SPAN\_RANGE} \& \K{RESIDUE\_SPAN\_SIGN}
criterion.  Note that this makes these restraints 
static (\ie, not dynamic) and that you must set \K{DYNAMIC\_SPHERE}
to \V{off} before evaluating the molecular pdf if you want to avoid 
duplicated restraints. These restraints should usually not be combined 
with the Lennard-Jones (\Z{LJ}) restraints.

When \K{INTERSEGMENT} is \V{on}, the inter-segment non-bonded restraints 
are also constructed; otherwise, the segments do not feel each other 
\via\ the non-bonded restraints. This option does not apply to 
the \C{OPTIMIZE} command where information about segments is not used 
at all (\ie, \C{OPTIMIZE} behaves as if \K{INTERSEGMENT} = \V{on}).

\item \Z{LJ}. This constructs Lennard-Jones restraints for all atom pairs 
that are not in bonds, angles, dihedral angles, improper dihedral angles, 
nor are explicitly excluded by the \Z{E} entries read from a restraint file 
or added by the \C{ADD\_RESTRAINT} command. 
Only those non-bonded pairs are restrained that have all or at least 
\K{NONBONDED\_SEL\_ATOMS} in the selected atom set 1.
They must also satisfy the \K{RESIDUE\_SPAN\_RANGE} \& \K{RESIDUE\_SPAN\_SIGN}
criterion.
Note that this command makes the non-bonded
restraints static (\ie, not dynamic) and that you must set \K{DYNAMIC\_LENNARD}
to \V{off} before evaluating the molecular pdf if you want to avoid 
duplicated restraints. Note that \CHARMM\ uses both \Z{LJ14} and \Z{LJ}.
For large molecules, it is better to calculate \Z{LJ} as dynamic restraints 
because you can use distance cutoff \K{CONTACT\_SHELL} in \C{OPTIMIZE} to 
reduce significantly the number of non-bonded atom pairs.

\item \Z{COULOMB}. This constructs Coulomb restraints for all atom pairs that 
are not in bonds, angles, dihedral angles, improper dihedral angles, nor are 
explicitly excluded by the \Z{E} entries read from a restraint file or added
by the \C{ADD\_RESTRAINT} command. 
Only those non-bonded pairs are restrained that have all or at least 
\K{NONBONDED\_SEL\_ATOMS} in the selected atom set 1.
They must also satisfy the \K{RESIDUE\_SPAN\_RANGE} \& \K{RESIDUE\_SPAN\_SIGN}
criterion.
Note that this command makes the non-bonded restraints 
static (\ie, not dynamic) and that you must set \K{DYNAMIC\_COULOMB}
to \V{off} before evaluating the molecular pdf if you want to avoid 
duplicated restraints. Note that \CHARMM\ uses both \Z{COULOMB14} and 
\Z{COULOMB}. For large molecules, it is better to calculate \Z{COULOMB} 
as dynamic restraints because you can use distance cutoff \K{CONTACT\_SHELL} 
in \C{OPTIMIZE} to reduce significantly the number of non-bonded atom pairs.

\item \Z{ALPHA}. This makes restraints enforcing an \al-helix (mainchain
conformation class ``A'') for the residue segment specified by the two 
\K{RESIDUE\_IDS} (Section~\ref{alignmentformat}). The helix is restrained 
by $\Phi,\Psi$ binormal restraints, N--O hydrogen bonds, 
\Calpha--\Calpha\ distances for $i-j \in \{2-9\}$, \Calpha--O distances 
for $i-j \in \{2-9\}$, 
and O--O distances for $i-j \in \{2-6\}$. These target distances were all 
obtained from a regular \al-helix in one of the high-resolution myoglobin 
structures. A convenient way to add \Z{HELIX}, \Z{STRAND}, or \Z{SHEET}
restraints to the calculation by the \Z{model} script is to include them 
in the {\tt special\_restraints} routine (Section~\ref{SECTION:faq}, 
Question~\ref{FAQ:secstr}). Note that at least the non-hydrogen mainchain 
atoms topology model is required although the same functionality could also 
be provided for the \Calpha-only topology with small changes to the source 
code.

\item \Z{STRAND}. This makes restraints enforcing an extended strand 
conformation for the residue segment specified by the two \K{RESIDUE\_IDS} 
(Section~\ref{alignmentformat}). This is achieved by applying $\Phi,\Psi$ 
binormal restraints only. These binormal restraints force the mainchain 
conformation into class ``B'', except for the Pro residues which are 
restrained to class ``P'' \cite{SalBlu93}.

\item \Z{SHEET}. This calculates H-bonding restraints for a pair of 
\be-strands. \K{ATOM\_IDS} specifies the two atom identifiers 
(Section~\ref{SECTION:atomid}) defining the first H-bond in the \be-sheet
ladder. \K{SHEET\_H-BONDS} specifies the number of H-bonds to be added.
The parallel and anti-parallel sheets are selected by a positive and negative 
integer in \K{SHEET\_H-BONDS}, respectively. In a parallel sheet, hydrogen 
bonds start at the first or the second term of the following series 
(depending on \K{ATOM\_IDS}): 1N:1O, 1O:3N, 3N:3O, 3O:5N, \etc. For an 
anti-parallel sheet, the corresponding series is 1N:3O, 1O:3N, 3N:1O, 
3O:1N, \etc; note that the residue indices are always decreasing for the 
second strand. The extended structure of the individual strands must be 
enforced separately by the \Z{STRAND} restraints if so desired. 

\item \Z{USER\_DISTANCE}. This makes distance restraints between pairs
of atoms from set 2 and 3 (inter-set only), using the value of
\K{RESTRAINT\_PARAMETERS}. Only distances satisfying the
\K{RESIDUE\_\-SPAN\_\-RANGE} criterion are restrained. This command 
is useful for making non-specific ``compactization'' restraints.


\item \bull\ {\bf Homology-derived restraints:}
  
\item \label{SECTION:span} \Z{DISTANCE}. This makes distance restraints 
that are generated for all pairs of atoms $i,j$ where
atom $i$ is from selected set 2 and atom $j$ is from selected set 3
(as defined by the \C{PICK\_ATOMS} command). The atoms also have to be
within the residue spanning range specified by
\K{RESIDUE\_SPAN\_RANGE} = \V{r1 r2}, such that the residue index
difference $r1 \le |ir2 - ir1| \le r2$ when \K{RESIDUE\_SPAN\_SIGN} = 
\V{off} and $r1 \le (ir2 - ir1) \le r2$ when \K{RESIDUE\_SPAN\_SIGN} = 
\V{on}. Moreover, for a restraint to be created, at least one distance in the
template structures must be less than \K{MAXIMAL\_DISTANCE} (in \Ang).
\K{RESTRAINT\_STDEV} = \V{a b} specifies the linear transformation for the
first six standard deviation models ($\sigma' = a + b*\sigma)$ 
These six models are polynomials and depend on several structural features 
of the template and its similarity to the target. The polynomial 
coefficients are specified in library file \Z{\$PARAMS\_LIB}. When 
``polynomial model'' 7 is selected, the standard deviation of restraints
is set to constant $a$. Each basis pdf in the distance pdf corresponds
to one template structure with an equivalent distance.  The mean of
this basis pdf is equal to the template distance and its standard
deviation is calculated from an analytic model specified by
\K{DISTANCE\_RSR\_MODEL}. Use model 5 for \Calpha--\Calpha\ distances and model 
6 for N--O distances.
The weights of basis pdf's depend on local sequence similarity between
the target and the templates when \K{BASIS\_\-PDF\_\-WEIGHT} = \Z{LOCAL}
and on global sequence identity when \K{BASIS\_\-PDF\_\-WEIGHT} = \Z{GLOBAL}.
In addition, the atom pairs restrained by homology-derived restraints
must by default not be in a chemical bond, chemical angle, dihedral angle, 
or on an excluded pairs list. This behavior can be changed by resetting
\K{EXCL\_LOCAL} (see \C{OPTIMIZE}).

\item \Z{PHI-PSI\_CLASS}, \Z{CHI1\_DIHEDRAL}, \Z{CHI2\_DIHEDRAL},
\Z{CHI3\_DIHEDRAL}, \Z{CHI4\_DIHEDRAL}, \Z{PHI\_\-DIHEDRAL}, \Z{PSI\_DIHEDRAL},
\Z{OMEGA\_DIHEDRAL}, \Z{PHI-PSI\_BINORMAL} are the mainchain and sidechain 
dihedral angle restraints. Only those dihedral angles are restrained that 
have all or at least \K{NONBONDED\_SEL\_ATOMS} in the selected atom set 1.
The means and standard deviations for the dihedral 
Gaussian restraints are obtained from the {\tt \$RESDIH\_LIB} and 
{\tt \$MNCH?\_LIB} libraries and their weights from the MDT tables,
specified by \K{MDT\_LIB\_FILE} and \K{BIN\_LIB\_FILE}.
The large MDT tables give the conditional weights for each possible dihedral
angle class, as a function of all possible combinations of features on which 
a particular class depends. If \K{DIH\_LIB\_ONLY} is \V{ON} or there is 
no equivalent residue in any of the
templates, the weights for the dihedral angle classes depend only on
the residue type and are obtained from the \Z{\$RESDIH\_LIB} and 
\Z{\$MNCH?\_LIB} libraries; the \K{DIH\_LIB\_ONLY} argument allows
one to force the calculation of the ``homology-derived'' mainchain
and sidechain dihedral angle restraints that ignore template information.
\K{BASIS\_\-PDF\_\-WEIGHT} has the same effect as 
for the distance pdf's. \K{MDT\_LIB\_FILE} and \K{BIN\_LIB\_FILE} have 
to be specified for all homology-derived restraints that depend on the 
MDT files, including all mainchain and sidechain dihedral angle restraints.
When \MODELLER's \Z{OMEGA} restraints are calculated, the currently existing 
restraints on atoms \Z{O C +N +CA} in all residues are automatically deleted. 
These deleted restraints correspond to the {\it improper} dihedral angles
involving the $\omega$ atoms. They are deleted because they could be 
``frustrated'' by the new \Z{OMEGA} restraints. No action is taken with 
regard to any of the previously existing, possibly duplicated dihedral angle
restraints. Thus, to avoid restraint duplication, including that of the
\Z{OMEGA} restraints, call the \C{CONDENSE\_RESTRAINTS} command after all 
the restraints are calculated.
\end{itemize}

\K{BASIS\_RELATIVE\_WEIGHT} is the cutoff for removing weak basis pdf's
from poly-Gaussian feature pdf's: a basis pdf whose weight is less
than the \K{BASIS\_RELATIVE\_WEIGHT} fraction of the largest weight is deleted.
}


\Example{../examples/commands/make_restraints.top}





\Command      {DEFINE\_SYMMETRY}{define similar segments}

\Options{
\OptLine{SYMMETRY\_WEIGHT}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{ADD\_SYMMETRY}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
}

\Description  {This command allows defining pairs of segments that will
be restrained to be the same during optimization of the objective 
function. This is achieved by adding the sum of squares of the differences 
between the equivalent distances (similar to distance \RMS\ deviation) 
to the objective function being optimized, separately for each pair of 
segments defined by \C{DEFINE\_SYMMETRY}. The value of this term is reported 
in the \logf\ file by the \C{ENERGY} command, which also reports the 
individual contributions to the term when \K{OUTPUT} contains word 
\Z{SYMMETRY}. In each call of the 
\C{DEFINE\_SYMMETRY} command, the list of such segments is either initiated, 
extended by a new pair of segments, or the last defined pair of segments is 
extended by adding new atoms.

\K{SYMMETRY\_WEIGHT} specifies the atomic weights to be used in the 
calculation of the symmetry term (Eq.~\ref{eq:symmetry}).

The two segments correspond to the selected sets 2 and 3 (obtained 
by the \C{PICK\_RESTRAINTS} command). They must have the same 
number of atoms.

A pair of segments can be either added to the list 
(\K{ADD\_SYMMETRY}[1] = \V{on}) or the list can be initialized 
(\K{ADD\_SYMMETRY}[1] = \V{off}). 

If \K{ADD\_SYMMETRY}[2] = \V{on}, the currently selected atoms
are added to the last segment pair in the segment pairs list, otherwise a
new segment pair is started.
}


\Example{../examples/commands/define_symmetry.top}





\Command      {PICK\_RESTRAINTS}{pick restraints for selected atoms}

\Options{
\OptLine{RESIDUE\_RANGE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESTRAINTS\_FILTER}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESTRAINT\_SEL\_ATOMS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{ADD\_RESTRAINTS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
}

\Description  {This command selects some or all of the restraints currently 
in memory. 

If \K{ADD\_RESTRAINTS} is \V{on}, the already selected restraints
remain selected; additional restraints also become selected if they
satisfy currently specified conditions (see below). If \K{ADD\_RESTRAINTS} is 
\V{off}, only those restraints that satisfy currently specified conditions become
selected. This command runs over all restraints in memory, including
the currently unselected restraints. Be careful about this: If you have
some unselected restraints in memory, \C{PICK\_RESTRAINTS} may select them;
to prevent this, do \C{CONDENSE\_RESTRAINTS} before calling \C{PICK\_RESTRAINTS}.

A static restraint is selected if all or at least \K{RESTRAINT\_SEL\_ATOMS}
of its atoms are selected (set 1), if it is strong enough based on its standard 
deviations or force constants (see the next paragraph), and if it does not 
span less (more) than the minimal (maximal) allowed number of residues specified 
by \K{RESIDUE\_RANGE}. Note that here the
\K{RESTRAINT\_SEL\_ATOMS} is used also for the static non-bonded restraints,
while \C{MAKE\_RESTRAINTS} and \C{OPTIMIZE} commands use 
\K{NONBONDED\_SEL\_ATOMS} for this purpose (\K{RESTRAINT\_SEL\_ATOMS} is 
used in \C{MAKE\_RESTRAINTS} only for most restraint type other than 
non-bonded pairs).

To decide if a restraint is strong enough, the current standard 
deviations or force constants are compared with the corresponding 
\K{RESTRAINTS\_FILTER}[physical\_restraint\_type]. A harmonic restraint, 
lower and upper bounds, and multi-modal Gaussian restraints are selected
if the (smallest) standard deviation is less than the corresponding
\K{RESTRAINTS\_FILTER}[i]. The cosine energy term is selected if its 
force constant is larger than the corresponding \K{RESTRAINTS\_FILTER}[i]. 
If \K{RESTRAINTS\_FILTER}[i] = $-999$, a restraint of type $i$ is always 
selected. Restraints of the other physical\_restraint\_types are always 
selected (Coulomb, Lennard-Jones, binormal, and spline). The 
\K{RESTRAINTS\_FILTER} angles have to be specified in radians.
}



\Example{../examples/commands/pick_restraints.top}




\Command      {CONDENSE\_RESTRAINTS}{remove unselected restraints}

\Description  {This command removes all the unselected restraints from
memory. In addition, it also removes those cosine dihedral angle restraints 
(\K{RESTRAINT\_TYPE} = \Z{DIHEDRAL}) that operate on the same atoms as any 
other restraints on a dihedral angle or a pair of dihedral angles. Such 
restraints include the \MODELLER\ \Z{PHI\_DIHEDRAL}, \Z{PSI\_DIHEDRAL}, 
\Z{OMEGA\_DIHEDRAL}, \Z{CHI1\_DIHEDRAL}, \Z{CHI2\_DIHEDRAL}, 
\Z{CHI3\_DIHEDRAL}, 
\Z{CHI4\_DIHEDRAL}, \Z{PHI\_PSI\_CLASS}, \Z{MRFP\_DIHEDRAL}, and 
\Z{PHI\_PSI\_BINORMAL} dihedral angle restraints, as well as the 2nd, 3rd, 
\etc. cosine dihedral angle restraints on the same atoms; the improper dihedral 
angle restraints are not considered here. For this command to work properly, 
the cosine dihedral angle restraints must be constructed before any other 
dihedral angle restraints. This functionality is needed because some of the 
\CHARMM\ cosine terms are sometimes duplicated by other \CHARMM\ cosine terms 
as well as by \MODELLER\ homology-derived mainchain and sidechain dihedral 
and bi-dihedral angle restraints. In the standard \Scr{model} script, the 
redundant \CHARMM\ terms are always removed.
}

\SeeExample{\C{READ\_MODEL}}



\Command      {ADD\_RESTRAINT}{add restraint}

\Options{
\OptLine{ATOM\_IDS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESTRAINT\_PARAMETERS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
}

\Description{This command adds a specified restraint to the end of the
restraints list and selects it. It can also add an excluded pair or
a pseudo atom definition to the respective lists, depending on the
dimension of \K{RESTRAINT\_PARAMETERS} (Section~\ref{SECTION:atomid}).
This command is useful for specifying \cis-peptide bonds from a \TOP\ 
script. The angles have to be in radians.}


\Example{../examples/commands/add_restraint.top}




\Command      {DELETE\_RESTRAINT}{unselect restraint}

\Options{
\OptLine{ATOM\_IDS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
}

\Requirements { MODEL }

\Description  {This command scans the currently selected restraints to find 
all the restraints that operate on the specified atoms (Section~\ref{SECTION:atomid})
and then unselects them. The order of the atom names in \K{ATOM\_IDS} does not 
matter: All restraints that contain all and only the specified 
atoms are unselected. This means that it is not possible to distinguish between
the dihedral angle and improper dihedral angle restraints on the same four
atoms.

The command only unselects the restraints found. To completely remove
all the unselected restraints from memory, use \C{CONDENSE\_RESTRAINTS}. 
The \C{DELETE\_RESTRAINT} command is useful in specifying \cis-peptide bonds 
from a \TOP\ script. }

\SeeExample{\C{ADD\_RESTRAINT}}




% \Command      {PMF}{potential of mean force}
% \K{PMF\_GRID} = \Real{8} & $r1$ $dr$ $nr$ $nrot1$ $nrot2$ $x1$ $dx$ $nx$ \\
% \K{TEMPERATURE} = \Real{1} & temperature for Boltzmann averaging \\
% \K{DISTANCE\_ATOMS} = \String{2} & centers of the two segments \\
% \K{PMF\_INDICES} = \Integer{0} & atom indices \\
% \K{ROUTINE\_TYPE} = \Integer{1} & 1 or 2\\
% \Description  {This command calculates a potential of mean force for
%                all separations $r$ between the two segments in memory.
%                The current restraints are used for the calculation of energy.
%                $r$ is varied from $r_1$ for $nr$ steps of $dr$.
%                At each separation, the potential is averaged (Boltzmann 
%                average) over all possible relative orientations of the 
%                two segments.
%                These orientations are obtained by rotating both segments,
%                around X and Y axes for 360 and 180 degrees in $nrot1$ and 
%                $nrot2$ steps, respectively; a rotation is performed around 
%                the center of the segment.
%                The distance $r$ is the distance between the two
%                centers. The center is obtained as the first atom in 
%                the segment that is of the type specified by 
%                \K{DISTANCE\_ATOMS}[2] (segment one, first atom name, 
%                segment 2, second atom name).
%                No internal degrees of freedom are sampled yet.
%                }






\Command      {REINDEX\_RESTRAINTS}{renumber MODEL2 restraints for MODEL}

\Requirements {restraints \AND\ MODEL \AND\ MODEL2}

\Description  {This command renumbers atom indices in all restraints
in memory. It is expected that the input restraints refer to MODEL2;
the re-indexed restraints will correspond to MODEL. Both MODEL and
MODEL2 have to be in memory.  Only those restraints that have all
atoms in MODEL will be selected. You can remove the others by
\C{CONDENSE\_RESTRAINTS}. This command is useful when the old restraints 
have to be used while changing from one topology model to another.
}


\Example{../examples/commands/reindex_restraints.top}





\Command      {SPLINE\_RESTRAINTS}{approximate restraints by splines}

\Options{
\OptLine{SPLINE\_DX}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{SPLINE\_MIN\_POINTS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{SPLINE\_RANGE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{SPLINE\_SELECT}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\rule{6.5mm}{0cm} The \C{ENERGY} command keywords
}

\Description  {This command calculates and selects new restraints that are
a spline approximation of the selected restraints of the specified type. 
It unselects the approximated restraints.

The type of the approximated restraints is specified by 
\K{SPLINE\_SELECT} and is defined by the
mathematical form (Gaussian, \etc), feature type (distance, \etc), and
physical restraint group (sidechain $\chi_1$, \etc) (the first, third,
and fourth integer numbers in the restraint specification). 

The restraint is approximated in a certain range only, determined
differently for different mathematical forms.  For example, the
poly-Gaussian range is from 
$m - \K{SPLINE\_RANGE} \times \sigma_m$ to
$M + \K{SPLINE\_RANGE} \times \sigma_M$,
where $m$ and $M$ are the minimal and maximal means of the basis pdfs,
and $\sigma_m$ and $\sigma_M$ are their corresponding standard deviations.

The spline points are distributed evenly
over this range with an interval of \K{SPLINE\_DX}. \K{SPLINE\_DX}
should be equal to the scale of the peaks of the restraint that you
want to approximate reliably. The value of the restraint beyond the
range is determined by linear extrapolation using the first
derivatives at the bounds.  

If the x-range and \K{SPLINE\_DX} are such that the number of spline 
points would be less than \K{SPLINE\_\-MIN\_POINTS}, \K{SPLINE\_DX}
is decreased so that there are \K{SPLINE\_\-MIN\_\-POINTS} defining
the ``splined'' restraint.
}

\SeeExample{\C{MAKE\_RESTRAINTS}}



\Command      {READ\_RESTRAINTS}{read spatial restraints}

\Options{
\OptLine{FILE}{TYPE}{VALUES}{DEFAULT}{input restraints file} 
\OptLine{DIRECTORY}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{FILE\_FORMAT}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{ADD\_RESTRAINTS}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
}

\Description  {This command reads restraints, excluded atom pairs, and
pseudo atom definitions from a file. An excluded atom pair specifies
two atoms that are not to be tested during generation of the dynamic
non-bonded pair list. There is one restraint entry per line. The two 
possible formats of the file, \V{MODELLER} and \V{USER}, are
described in Section~\ref{SECTION:restraints}. The routine determines
automatically which format is used, based on the presence of the 
\V{MODELLER} or \V{USER} keywords in the first line. The new restraints 
are added to those that are already in memory if \K{ADD\_RESTRAINTS} =
\V{on}, otherwise they initiate the restraints list. All the new 
restraints are automatically selected.
} 

\SeeExample{\C{MAKE\_RESTRAINTS}}




\Command      {WRITE\_RESTRAINTS}{write spatial restraints}

\Options{
\OptLine{FILE}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{OUTPUT\_DIRECTORY}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{FILE\_FORMAT}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
\OptLine{RESTRAINTS\_FORMAT}{TYPE}{VALUES}{DEFAULT}{DESCRIPTION} 
}

\Description  {This command writes the currently selected restraints to 
a file in the MODELLER format (see Section~\ref{SECTION:restraints}).
If \Z{UNFORMATTED} format is selected the file is approximately one
third of the \Z{FORMATTED} size.  Both formats can be read with the
\C{READ\_RESTRAINTS} command. The output in the USER format
is not yet implemented.
}

\SeeExample{\C{MAKE\_RESTRAINTS}}

\vfill
