*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
unsigned int
gmx_rng_make_seed(void)
{
- FILE *fp;
- unsigned int data;
- int ret;
- long my_pid;
+ FILE *fp;
+ unsigned int data;
+ int ret;
+ long my_pid;
#ifdef HAVE_UNISTD_H
/* We never want Gromacs execution to halt 10-20 seconds while
if (fp != NULL)
{
ret = fread(&data, sizeof(unsigned int), 1, fp);
+ GMX_IGNORE_RETURN_VALUE(ret);
fclose(fp);
}
else
static void
gmx_rng_update(gmx_rng_t rng)
{
- unsigned int lastx, x1, x2, y, *mt;
- int mti, k;
+ unsigned int x1, x2, y, *mt;
+ int k;
const unsigned int mag01[2] = {0x0UL, RNG_MATRIX_A};
/* mag01[x] = x * MATRIX_A for x=0,1 */
/* update random numbers */
mt = rng->mt; /* pointer to array - avoid repeated dereferencing */
- mti = rng->mti;
x1 = mt[0];
for (k = 0; k < RNG_N-RNG_M-3; k += 4)
}
void
-gmx_rng_cycle_2uniform(gmx_int64_t ctr1, gmx_int64_t ctr2,
- gmx_int64_t key1, gmx_int64_t key2,
+gmx_rng_cycle_2uniform(gmx_uint64_t ctr1, gmx_uint64_t ctr2,
+ gmx_uint64_t key1, gmx_uint64_t key2,
double* rnd)
{
const gmx_int64_t mask_53bits = 0x1FFFFFFFFFFFFF;
}
void
-gmx_rng_cycle_3gaussian_table(gmx_int64_t ctr1, gmx_int64_t ctr2,
- gmx_int64_t key1, gmx_int64_t key2,
+gmx_rng_cycle_3gaussian_table(gmx_uint64_t ctr1, gmx_uint64_t ctr2,
+ gmx_uint64_t key1, gmx_uint64_t key2,
real* rnd)
{
threefry2x64_ctr_t ctr = {{ctr1, ctr2}};
}
void
-gmx_rng_cycle_6gaussian_table(gmx_int64_t ctr1, gmx_int64_t ctr2,
- gmx_int64_t key1, gmx_int64_t key2,
+gmx_rng_cycle_6gaussian_table(gmx_uint64_t ctr1, gmx_uint64_t ctr2,
+ gmx_uint64_t key1, gmx_uint64_t key2,
real* rnd)
{
threefry2x64_ctr_t ctr = {{ctr1, ctr2}};
"To use groups from a traditional index file, use argument [TT]-n[tt]",
"to provide a file. See the \"syntax\" subtopic for how to use them.",
"If this option is not provided, default groups are generated.",
- "The default groups are generated by reading selections from a file",
- "[TT]defselection.dat[tt]. If such a file is found in the current",
- "directory, it is used instead of the one provided by default.[PAR]",
-
+ "The default groups are generated with the same logic as for",
+ "non-selection tools.",
+ "",
"Depending on the tool, two additional command-line arguments may be",
"available to control the behavior:",
"",
const char ExamplesHelpText::title[] =
"Selection examples";
const char *const ExamplesHelpText::text[] = {
- // TODO: Once there are more tools available, use examples that invoke
- // tools and explain what the selections do in those tools.
- "Below, examples of increasingly complex selections are given.[PAR]",
-
- "Selection of all water oxygens::",
+ "Below, examples of different types of selections are given.",
"",
- " resname SOL and name OW",
+ "* Selection of all water oxygens::",
"",
-
- "Centers of mass of residues 1 to 5 and 10::",
+ " resname SOL and name OW",
"",
- " res_com of resnr 1 to 5 10",
+ "* Centers of mass of residues 1 to 5 and 10::",
"",
-
- "All atoms farther than 1 nm of a fixed position::",
+ " res_com of resnr 1 to 5 10",
"",
- " not within 1 of [1.2, 3.1, 2.4]",
+ "* All atoms farther than 1 nm of a fixed position::",
"",
-
- "All atoms of a residue LIG within 0.5 nm of a protein (with a custom name)::",
+ " not within 1 of [1.2, 3.1, 2.4]",
"",
- " \"Close to protein\" resname LIG and within 0.5 of group \"Protein\"",
+ "* All atoms of a residue LIG within 0.5 nm of a protein (with a custom name)::",
"",
-
- "All protein residues that have at least one atom within 0.5 nm of a residue LIG::",
+ " \"Close to protein\" resname LIG and within 0.5 of group \"Protein\"",
"",
- " group \"Protein\" and same residue as within 0.5 of resname LIG",
+ "* All protein residues that have at least one atom within 0.5 nm of a residue LIG::",
"",
-
- "All RES residues whose COM is between 2 and 4 nm from the COM of all of them::",
+ " group \"Protein\" and same residue as within 0.5 of resname LIG",
"",
- " rdist = res_com distance from com of resname RES",
- " resname RES and rdist >= 2 and rdist <= 4",
+ "* All RES residues whose COM is between 2 and 4 nm from the COM of all of them::",
"",
-
- "Selection like C1 C2 C2 C3 C3 C4 ... C8 C9 (e.g., for g_bond)::",
+ " rdist = res_com distance from com of resname RES",
+ " resname RES and rdist >= 2 and rdist <= 4",
+ "",
+ // TODO: Make it possible to use links below.
+ "* Selection like with duplicate atoms like C1 C2 C2 C3 C3 C4 ... C8 C9::",
+ "",
+ " name \"C[1-8]\" merge name \"C[2-9]\"",
+ "",
+ " This can be used with [TT]gmx distance[tt] to compute C1-C2, C2-C3 etc.",
+ " distances.",
+ "",
+ "* Selection with atoms in order C2 C1::",
+ "",
+ " name C1 C2 permute 2 1",
+ "",
+ " This can be used with [TT]gmx gangle[tt] to get C2->C1 vectors instead of",
+ " C1->C2.",
+ "",
+ "* Selection with COMs of two index groups::",
+ "",
+ " com of group 1 plus com of group 2",
+ "",
+ " This can be used with [TT]gmx distance[tt] to compute the distance between",
+ " these two COMs.",
+ "",
+ "* Fixed vector along x (can be used as a reference with [TT]gmx gangle[tt])::",
+ "",
+ " [0, 0, 0] plus [1, 0, 0]",
"",
- " name \"C[1-8]\" merge name \"C[2-9]\"",
+ "* The following examples explain the difference between the various",
+ " position types. This selection selects a position for each residue",
+ " where any of the three atoms C[123] has [TT]x < 2[tt]. The positions",
+ " are computed as the COM of all three atoms.",
+ " This is the default behavior if you just write [TT]res_com of[tt]. ::",
+ "",
+ " part_res_com of name C1 C2 C3 and x < 2",
+ "",
+ " This selection does the same, but the positions are computed as COM",
+ " positions of whole residues::",
+ "",
+ " whole_res_com of name C1 C2 C3 and x < 2",
+ "",
+ " Finally, this selection selects the same residues, but the positions",
+ " are computed as COM of exactly those atoms atoms that match the",
+ " [TT]x < 2[tt] criterion::",
+ "",
+ " dyn_res_com of name C1 C2 C3 and x < 2",
+ "",
+ "* Without the [TT]of[tt] keyword, the default behavior is different from",
+ " above, but otherwise the rules are the same::",
+ "",
+ " name C1 C2 C3 and res_com x < 2",
+ "",
+ " works as if [TT]whole_res_com[tt] was specified, and selects the three",
+ " atoms from residues whose COM satisfiex [TT]x < 2[tt].",
+ " Using ::",
+ "",
+ " name C1 C2 C3 and part_res_com x < 2",
+ "",
+ " instead selects residues based on the COM computed from the C[123] atoms.",
};
struct KeywordsHelpText
"Selection keywords";
const char *const KeywordsHelpText::text[] = {
"The following selection keywords are currently available.",
- "For keywords marked with a star, additional help is available through",
+ "For keywords marked with a plus, additional help is available through",
"a subtopic KEYWORD, where KEYWORD is the name of the keyword.",
};
const char PositionsHelpText::title[] =
"Specifying positions in selections";
const char *const PositionsHelpText::text[] = {
- "Possible ways of specifying positions in selections are:[PAR]",
-
+ "Possible ways of specifying positions in selections are:",
+ "",
"1. A constant position can be defined as [TT][XX, YY, ZZ][tt], where",
- "[TT]XX[tt], [TT]YY[tt] and [TT]ZZ[tt] are real numbers.[PAR]",
-
+ " [TT]XX[tt], [TT]YY[tt] and [TT]ZZ[tt] are real numbers.[PAR]",
+ "",
"2. [TT]com of ATOM_EXPR [pbc][tt] or [TT]cog of ATOM_EXPR [pbc][tt]",
- "calculate the center of mass/geometry of [TT]ATOM_EXPR[tt]. If",
- "[TT]pbc[tt] is specified, the center is calculated iteratively to try",
- "to deal with cases where [TT]ATOM_EXPR[tt] wraps around periodic",
- "boundary conditions.[PAR]",
-
+ " calculate the center of mass/geometry of [TT]ATOM_EXPR[tt]. If",
+ " [TT]pbc[tt] is specified, the center is calculated iteratively to try",
+ " to deal with cases where [TT]ATOM_EXPR[tt] wraps around periodic",
+ " boundary conditions.",
+ "",
"3. [TT]POSTYPE of ATOM_EXPR[tt] calculates the specified positions for",
- "the atoms in [TT]ATOM_EXPR[tt].",
- "[TT]POSTYPE[tt] can be [TT]atom[tt], [TT]res_com[tt], [TT]res_cog[tt],",
- "[TT]mol_com[tt] or [TT]mol_cog[tt], with an optional prefix [TT]whole_[tt]",
- "[TT]part_[tt] or [TT]dyn_[tt].",
- "[TT]whole_[tt] calculates the centers for the whole residue/molecule,",
- "even if only part of it is selected.",
- "[TT]part_[tt] prefix calculates the centers for the selected atoms, but",
- "uses always the same atoms for the same residue/molecule. The used atoms",
- "are determined from the the largest group allowed by the selection.",
- "[TT]dyn_[tt] calculates the centers strictly only for the selected atoms.",
- "If no prefix is specified, whole selections default to [TT]part_[tt] and",
- "other places default to [TT]whole_[tt].",
- "The latter is often desirable to select the same molecules in different",
- "tools, while the first is a compromise between speed ([TT]dyn_[tt]",
- "positions can be slower to evaluate than [TT]part_[tt]) and intuitive",
- "behavior.[PAR]",
-
+ " the atoms in [TT]ATOM_EXPR[tt].",
+ " [TT]POSTYPE[tt] can be [TT]atom[tt], [TT]res_com[tt], [TT]res_cog[tt],",
+ " [TT]mol_com[tt] or [TT]mol_cog[tt], with an optional prefix [TT]whole_[tt]",
+ " [TT]part_[tt] or [TT]dyn_[tt].",
+ " [TT]whole_[tt] calculates the centers for the whole residue/molecule,",
+ " even if only part of it is selected.",
+ " [TT]part_[tt] prefix calculates the centers for the selected atoms, but",
+ " uses always the same atoms for the same residue/molecule. The used atoms",
+ " are determined from the the largest group allowed by the selection.",
+ " [TT]dyn_[tt] calculates the centers strictly only for the selected atoms.",
+ " If no prefix is specified, whole selections default to [TT]part_[tt] and",
+ " other places default to [TT]whole_[tt].",
+ " The latter is often desirable to select the same molecules in different",
+ " tools, while the first is a compromise between speed ([TT]dyn_[tt]",
+ " positions can be slower to evaluate than [TT]part_[tt]) and intuitive",
+ " behavior.",
+ "",
"4. [TT]ATOM_EXPR[tt], when given for whole selections, is handled as 3.",
- "above, using the position type from the command-line argument",
- "[TT]-seltype[tt].[PAR]",
-
+ " above, using the position type from the command-line argument",
+ " [TT]-seltype[tt].",
+ "",
"Selection keywords that select atoms based on their positions, such as",
"[TT]dist from[tt], use by default the positions defined by the",
"[TT]-selrpos[tt] command-line option.",
void KeywordsHelpTopic::writeKeywordListStart(const HelpWriterContext &context,
const char *heading) const
{
- context.writeTextBlock(heading);
+ std::string fullHeading("* ");
+ fullHeading.append(heading);
+ context.writeTextBlock(fullHeading);
if (context.outputFormat() == eHelpOutputFormat_Rst)
{
context.writeTextBlock("");
- context.writeTextBlock("::");
+ context.writeTextBlock(" ::");
context.writeTextBlock("");
}
}
}
if (!isNullOrEmpty(extraInfo))
{
- context.writeTextBlock(extraInfo);
+ std::string fullInfo(" ");
+ fullInfo.append(extraInfo);
+ context.writeTextBlock(fullInfo);
}
context.writeTextBlock("");
}
if (method.type == type && bModifiers == bIsModifier)
{
const bool bHasHelp = (method.help.nlhelp > 0 && method.help.help != NULL);
- const bool bPrintStar
+ const bool bPrintHelpMark
= bHasHelp && context.outputFormat() == eHelpOutputFormat_Console;
- file.writeString(formatString(" %c ", bPrintStar ? '*' : ' '));
+ file.writeString(formatString(" %c ", bPrintHelpMark ? '+' : ' '));
if (method.help.syntax != NULL)
{
file.writeLine(method.help.syntax);