Merge branch 'master' into pygromacs
authorAlexey Shvetsov <alexxy@omrb.pnpi.spb.ru>
Wed, 3 Jun 2015 20:45:55 +0000 (23:45 +0300)
committerAlexey Shvetsov <alexxy@omrb.pnpi.spb.ru>
Wed, 3 Jun 2015 20:45:55 +0000 (23:45 +0300)
src/gromacs/listed-forces/bonded.cpp
src/gromacs/mdlib/clincs.cpp
src/gromacs/onlinehelp/helpwritercontext.cpp
src/gromacs/onlinehelp/tests/helpwritercontext.cpp
src/gromacs/onlinehelp/tests/refdata/HelpWriterContextTest_FormatsBulletList.xml
src/gromacs/onlinehelp/tests/refdata/HelpWriterContextTest_FormatsEnumeratedList.xml [new file with mode: 0644]
src/gromacs/random/CMakeLists.txt
src/gromacs/random/random.cpp [moved from src/gromacs/random/random.c with 94% similarity]
src/gromacs/random/random.h
src/gromacs/selection/selhelp.cpp
src/gromacs/utility/basedefinitions.h

index 2e2c8598922ec49cd7cc7929dec1759bb98d0e95..070547a2031d34540598275ee473ddb5aa434197 100644 (file)
@@ -177,7 +177,7 @@ gmx_hack_simd4_transpose_to_simd_r(const gmx_simd4_float_t *a,
  * \param[in]     v           Array of rvecs
  * \param[in]     index0      Index into the vector array
  * \param[in]     index1      Index into the vector array
- * \param[in,out] buf_aligned Aligned tmp buffer of size 3*GMX_SIMD_REAL_WIDTH
+ * \param[in,out] buf         Aligned tmp buffer of size 3*GMX_SIMD_REAL_WIDTH
  * \param[out]    dx          SIMD register with x difference
  * \param[out]    dy          SIMD register with y difference
  * \param[out]    dz          SIMD register with z difference
@@ -186,7 +186,7 @@ static gmx_inline void gmx_simdcall
 gmx_hack_simd_gather_rvec_dist_two_index(const rvec      *v,
                                          const int       *index0,
                                          const int       *index1,
-                                         real gmx_unused *buf_aligned,
+                                         real gmx_unused *buf,
                                          gmx_simd_real_t *dx,
                                          gmx_simd_real_t *dy,
                                          gmx_simd_real_t *dz)
@@ -204,6 +204,12 @@ gmx_hack_simd_gather_rvec_dist_two_index(const rvec      *v,
     }
     gmx_hack_simd4_transpose_to_simd_r(d, dx, dy, dz, &tmp);
 #else /* generic SIMD */
+#if GMX_ALIGNMENT
+    GMX_ALIGNED(real, GMX_SIMD_REAL_WIDTH) buf_aligned[3*GMX_SIMD_REAL_WIDTH];
+#else
+    real* buf_aligned = buf;
+#endif
+
     int i, m;
 
     for (i = 0; i < GMX_SIMD_REAL_WIDTH; i++)
index a1b9ed893cdd3bcdbef0f6210b456a1c08a00571..7be3cef649211d2536bdfd3e541ced058f170be9 100644 (file)
@@ -206,9 +206,6 @@ gmx_hack_simd_transpose_to_simd4_r(gmx_simd_float_t   row0,
 
 #endif /* AVX */
 
-
-
-
 #ifdef GMX_SIMD_HAVE_REAL
 /*! \brief Store differences between indexed rvecs in SIMD registers.
  *
@@ -217,7 +214,7 @@ gmx_hack_simd_transpose_to_simd4_r(gmx_simd_float_t   row0,
  *
  * \param[in]     v           Array of rvecs
  * \param[in]     pair_index  Index pairs for GMX_SIMD_REAL_WIDTH vector pairs
- * \param[in,out] buf_aligned Aligned tmp buffer of size 3*GMX_SIMD_REAL_WIDTH
+ * \param[in,out] buf         Aligned tmp buffer of size 3*GMX_SIMD_REAL_WIDTH
  * \param[out]    dx          SIMD register with x difference
  * \param[out]    dy          SIMD register with y difference
  * \param[out]    dz          SIMD register with z difference
@@ -225,7 +222,7 @@ gmx_hack_simd_transpose_to_simd4_r(gmx_simd_float_t   row0,
 static gmx_inline void gmx_simdcall
 gmx_hack_simd_gather_rvec_dist_pair_index(const rvec      *v,
                                           const int       *pair_index,
-                                          real gmx_unused *buf_aligned,
+                                          real gmx_unused *buf,
                                           gmx_simd_real_t *dx,
                                           gmx_simd_real_t *dy,
                                           gmx_simd_real_t *dz)
@@ -243,6 +240,12 @@ gmx_hack_simd_gather_rvec_dist_pair_index(const rvec      *v,
 
     gmx_hack_simd4_transpose_to_simd_r(d, dx, dy, dz, &tmp);
 #else
+#if GMX_ALIGNMENT
+    GMX_ALIGNED(real, GMX_SIMD_REAL_WIDTH) buf_aligned[3*GMX_SIMD_REAL_WIDTH];
+#else
+    real* buf_aligned = buf;
+#endif
+
     int i, m;
 
     for (i = 0; i < GMX_SIMD_REAL_WIDTH; i++)
@@ -266,14 +269,14 @@ gmx_hack_simd_gather_rvec_dist_pair_index(const rvec      *v,
  * \param[in]     x           SIMD register with x-components of the vectors
  * \param[in]     y           SIMD register with y-components of the vectors
  * \param[in]     z           SIMD register with z-components of the vectors
- * \param[in,out] buf_aligned Aligned tmp buffer of size 3*GMX_SIMD_REAL_WIDTH
+ * \param[in,out] buf         Aligned tmp buffer of size 3*GMX_SIMD_REAL_WIDTH
  * \param[out]    v           Array of GMX_SIMD_REAL_WIDTH rvecs
  */
 static gmx_inline void gmx_simdcall
 gmx_simd_store_vec_to_rvec(gmx_simd_real_t  x,
                            gmx_simd_real_t  y,
                            gmx_simd_real_t  z,
-                           real gmx_unused *buf_aligned,
+                           real gmx_unused *buf,
                            rvec            *v)
 {
 #if defined(GMX_SIMD_X86_AVX_256) || defined(GMX_SIMD_X86_AVX2_256)
@@ -288,6 +291,12 @@ gmx_simd_store_vec_to_rvec(gmx_simd_real_t  x,
         gmx_hack_simd4_store3_r(v[i], s4[i]);
     }
 #else
+#if GMX_ALIGNMENT
+    GMX_ALIGNED(real, GMX_SIMD_REAL_WIDTH) buf_aligned[3*GMX_SIMD_REAL_WIDTH];
+#else
+    real* buf_aligned = buf;
+#endif
+
     int i, m;
 
     gmx_simd_store_r(buf_aligned + 0*GMX_SIMD_REAL_WIDTH, x);
index 8d5a44903be1664c72c3b4578c3a5f5107dab949..415f2602f7f9d57d4cae5d5233d6a3fc058b38f0 100644 (file)
@@ -309,8 +309,7 @@ std::string toUpperCase(const std::string &text)
  * \param[in] text  Input text.
  * \returns   \p text with all sequences of more than two newlines replaced
  *     with just two newlines.
- *
- * Does not throw.
+ * \throws    std::bad_alloc if out of memory.
  */
 std::string removeExtraNewlinesRst(const std::string &text)
 {
@@ -342,6 +341,36 @@ std::string removeExtraNewlinesRst(const std::string &text)
     return result;
 }
 
+/*! \brief
+ * Returns `true` if a list item starts in \p text at \p index.
+ *
+ * Does not throw.
+ */
+bool startsListItem(const std::string &text, size_t index)
+{
+    if (text.length() <= index + 1)
+    {
+        return false;
+    }
+    if (text[index] == '*' && std::isspace(text[index+1]))
+    {
+        return true;
+    }
+    if (std::isdigit(text[index]))
+    {
+        while (index < text.length() && std::isdigit(text[index]))
+        {
+            ++index;
+        }
+        if (text.length() > index + 1 && text[index] == '.'
+            && std::isspace(text[index+1]))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
 //! \}
 
 }   // namespace
@@ -606,8 +635,7 @@ void HelpWriterContext::Impl::processMarkup(const std::string &text,
                             ++currentIndent;
                             continue;
                         }
-                        else if (i + 1 < result.length()
-                                 && result[i] == '*' && result[i + 1] == ' ')
+                        else if (startsListItem(result, i))
                         {
                             if (currentLine > 0)
                             {
@@ -619,7 +647,17 @@ void HelpWriterContext::Impl::processMarkup(const std::string &text,
                                 nextBreakSize = 1;
                                 break;
                             }
-                            indent = currentIndent + 2;
+                            int prefixLength = 0;
+                            while (!std::isspace(result[i + prefixLength]))
+                            {
+                                ++prefixLength;
+                            }
+                            while (i + prefixLength < result.length()
+                                   && std::isspace(result[i + prefixLength]))
+                            {
+                                ++prefixLength;
+                            }
+                            indent = currentIndent + prefixLength;
                         }
                         bLineStart = false;
                     }
index 4216fccf0ba70f3746af6348d04bdf8a8b3f4d97..9db5f0e3403159f08174d5320e5b40a99ef86637 100644 (file)
@@ -173,10 +173,31 @@ TEST_F(HelpWriterContextTest, FormatsBulletList)
     const char *const text[] = {
         "Sample list:",
         "",
-        " * first item",
-        " * second item that",
+        "* first item",
+        "* second item that",
+        "  spans multiple lines",
+        "* third item that has a single long line",
+        "",
+        "Normal paragraph"
+    };
+    // Wrapping to rst with a fixed line length does not currently work
+    // correctly, but it is not used, either.
+    settings_.setLineLength(15);
+    testFormatting(text);
+}
+
+TEST_F(HelpWriterContextTest, FormatsEnumeratedList)
+{
+    const char *const text[] = {
+        "Sample list:",
+        "",
+        "1. first item",
+        "2. second item that",
         "   spans multiple lines",
-        " * third item that has a single long line",
+        "3. third item that has a single long line",
+        "",
+        "9.  Item with extra indentation",
+        "10. Double digit item",
         "",
         "Normal paragraph"
     };
index 2bceed2aaf8a898de0bac07e38dca49e4c73a595..2acdee18802d31251e56589a1ac7dcfd98b18869 100644 (file)
@@ -4,27 +4,27 @@
   <String Name="Console"><![CDATA[
 Sample list:
 
- * first item
- * second item
-   that spans
-   multiple
-   lines
- * third item
-   that has a
-   single long
-   line
+* first item
+* second item
+  that spans
+  multiple
+  lines
+* third item
+  that has a
+  single long
+  line
 
 Normal
 paragraph]]></String>
   <String Name="reStructuredText"><![CDATA[
 Sample list:
 
- * first item
- * second item
+* first item
+* second item
 that
-   spans
+  spans
 multiple lines
- * third item
+* third item
 that has a
 single long
 line
diff --git a/src/gromacs/onlinehelp/tests/refdata/HelpWriterContextTest_FormatsEnumeratedList.xml b/src/gromacs/onlinehelp/tests/refdata/HelpWriterContextTest_FormatsEnumeratedList.xml
new file mode 100644 (file)
index 0000000..b68ed95
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+  <String Name="Console"><![CDATA[
+Sample list:
+
+1. first item
+2. second item
+   that spans
+   multiple
+   lines
+3. third item
+   that has a
+   single long
+   line
+
+9.  Item with
+    extra
+    indentation
+10. Double
+    digit item
+
+Normal
+paragraph]]></String>
+  <String Name="reStructuredText"><![CDATA[
+Sample list:
+
+1. first item
+2. second item
+that
+   spans
+multiple lines
+3. third item
+that has a
+single long
+line
+
+9.  Item with
+extra
+indentation
+10. Double
+digit item
+
+Normal
+paragraph]]></String>
+</ReferenceData>
index e819cc2ab11cbfd3244dabbdfd61b0d21d1f8300..dc82c7a4590695942ea7801985129827912c02b8 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014, by the GROMACS development team, led by
+# Copyright (c) 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.
@@ -32,7 +32,7 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-file(GLOB RANDOM_SOURCES *.c)
+file(GLOB RANDOM_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${RANDOM_SOURCES} PARENT_SCOPE)
 if (BUILD_TESTING)
     add_subdirectory(tests)
similarity index 94%
rename from src/gromacs/random/random.c
rename to src/gromacs/random/random.cpp
index 1e8390abe24ffcb323a0c2c261709d1afec06e03..8c442895f69cb65ad709b68b504ef2f16b9af8b2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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.
@@ -200,10 +200,10 @@ gmx_rng_set_state(gmx_rng_t rng,  unsigned int *mt, int mti)
 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
@@ -226,6 +226,7 @@ gmx_rng_make_seed(void)
     if (fp != NULL)
     {
         ret = fread(&data, sizeof(unsigned int), 1, fp);
+        GMX_IGNORE_RETURN_VALUE(ret);
         fclose(fp);
     }
     else
@@ -245,14 +246,13 @@ gmx_rng_make_seed(void)
 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)
@@ -393,8 +393,8 @@ gmx_rng_gaussian_table(gmx_rng_t rng)
 }
 
 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;
@@ -409,8 +409,8 @@ gmx_rng_cycle_2uniform(gmx_int64_t ctr1, gmx_int64_t ctr2,
 }
 
 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}};
@@ -423,8 +423,8 @@ gmx_rng_cycle_3gaussian_table(gmx_int64_t ctr1, gmx_int64_t 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}};
index a4eb24ebb4c47bb21748bd67e89ddaae6a8c53f4..5cbacebd51d3edae6a2f4d2c8675a3c5c51cb942 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2010,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
@@ -295,8 +295,8 @@ gmx_rng_gaussian_table(gmx_rng_t rng);
  * (threefry2x64).
  */
 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);
 
 /* Return three Gaussian random numbers with expectation value
@@ -308,14 +308,14 @@ gmx_rng_cycle_2uniform(gmx_int64_t ctr1, gmx_int64_t ctr2,
  * threadsafe: yes
  */
 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);
 
 /* As gmx_rng_3gaussian_table, but returns 6 Gaussian numbers. */
 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);
 
 #ifdef __cplusplus
index e521f1bc3084639ee831afbbf75c7dbc86d43eea..891e927509aaca89e6252e7d8a7190d51eb43e02 100644 (file)
@@ -152,10 +152,9 @@ const char *const CmdLineHelpText::text[] = {
     "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:",
     "",
@@ -219,44 +218,90 @@ const char        ExamplesHelpText::name[]  = "examples";
 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
@@ -271,7 +316,7 @@ const char        KeywordsHelpText::title[] =
     "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.",
 };
 
@@ -344,39 +389,39 @@ const char        PositionsHelpText::name[]  = "positions";
 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.",
@@ -632,11 +677,13 @@ void KeywordsHelpTopic::writeHelp(const HelpWriterContext &context) const
 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("");
     }
 }
@@ -650,7 +697,9 @@ void KeywordsHelpTopic::writeKeywordListEnd(const HelpWriterContext &context,
     }
     if (!isNullOrEmpty(extraInfo))
     {
-        context.writeTextBlock(extraInfo);
+        std::string fullInfo("  ");
+        fullInfo.append(extraInfo);
+        context.writeTextBlock(fullInfo);
     }
     context.writeTextBlock("");
 }
@@ -669,9 +718,9 @@ void KeywordsHelpTopic::printKeywordList(const HelpWriterContext &context,
         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);
index be20290f685c4fc15b17d16f0245c2b201e4da47..4e5dc6d3e92e08a9edf74054fc9f3d8874860466 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,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.
@@ -222,6 +222,36 @@ typedef uint64_t gmx_uint64_t;
 #endif
 #endif
 
+/*! \def GMX_ALIGNMENT
+ * \brief
+ * Supports aligned variables */
+
+/*! \def GMX_ALIGNED(type, alignment)
+ * \brief
+ * Declare variable with data alignment
+ *
+ * \param[in] type       Type of variable
+ * \param[in] alignment  Alignment in multiples of type
+ *
+ * Typical usage:
+ * \code
+   GMX_ALIGNED(real, GMX_SIMD_REAL_WIDTH) buf[...];
+   \endcode
+ */
+/* alignas(x) is not used even with GMX-CXX11 because it isn't in the list of
+   tested features and thus might not be supported.
+   MSVC2010 has align but doesn't support sizeof inside. */
+#if defined(_MSC_VER) && (_MSC_VER >= 1700 || defined(__ICL))
+#  define GMX_ALIGNMENT 1
+#  define GMX_ALIGNED(type, alignment) __declspec(align(alignment*sizeof(type))) type
+#elif defined(__GNUC__) || defined(__clang__)
+#  define GMX_ALIGNMENT 1
+#  define GMX_ALIGNED(type, alignment) __attribute__ ((__aligned__(alignment*sizeof(type)))) type
+#else
+#  define GMX_ALIGNMENT 0
+#  define GMX_ALIGNED(type, alignment)
+#endif
+
 /*! \brief
  * Macro to explicitly ignore an unused value.
  *