Merge "Merge release-5-0 into master"
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 5 Jun 2014 06:53:11 +0000 (08:53 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 5 Jun 2014 06:53:11 +0000 (08:53 +0200)
CMakeLists.txt
manual/special.tex
share/top/gurgle.dat
src/external/tng_io/src/lib/tng_io.c
src/gromacs/gmxana/gmx_trjconv.c
src/gromacs/gmxpreprocess/topio.c
src/gromacs/mdlib/coupling.c
src/gromacs/tools/dump.c

index 939754ee61105c4702418f8083c056badb39418d..4a07b24e2d29dc0396cb9ce1b1f7e95f991cc6a4 100644 (file)
@@ -218,6 +218,8 @@ gmx_detect_target_architecture()
 if(GMX_CPU_ACCELERATION)
     # Stay compatible with old Jenkins command line options for specific SIMD acceleration
     set(GMX_SIMD "${GMX_CPU_ACCELERATION}" CACHE STRING "SIMD instruction set level and compiler optimization" FORCE)
+    message("You set GMX_CPU_ACCELERATION, which is deprecated, and will be removed in a later version of GROMACS. It is replaced by GMX_SIMD. For now, copying the value from GMX_CPU_ACCELERATION to GMX_SIMD.")
+    # TODO remove all references to GMX_CPU_ACCELERATION in master branch
 endif()
 
 if(NOT GMX_TARGET_MIC)
@@ -592,7 +594,7 @@ gmx_set_build_information()
 # Note: it's better to not use the later set value of GMX_SIMD because
 # it reflects the system's capability of both compiling and running AVX code.
 # TODO: After merge with 5.0 one could implement a cache variable dependency
-# such that GMX_USE_RDTSCP can change if GMX_CPU_ACCELERATION is changed to AVX
+# such that GMX_USE_RDTSCP can change if GMX_SIMD is changed to AVX
 # after the first cmake pass.
 if (BUILD_CPU_FEATURES MATCHES "rdtscp" OR GMX_SIMD MATCHES "AVX")
     set(GMX_USE_RDTSCP_DEFAULT_VALUE ON)
index 83739ed0ba59516c2b7d3e1e4cbea9df594ef63c..0d8b129b58ae3687e5040b38c42c797c187e4b9a 100644 (file)
@@ -77,7 +77,7 @@ by using only {\tt fep-lambdas} to define the pathway.
 
 For example, if you wanted to first to change the Coulombic terms,
 then the van der Waals terms, changing bonded at the same time rate as
-the van der Wheals, but changing the restraints throughout the first
+the van der Waals, but changing the restraints throughout the first
 two-thirds of the simulation, then you could use this $\lambda$ vector:
 
 \begin{verbatim}
index 9e997a1d981a0c7b31023b646d9294f02bc69b53..1f5aa7406cc69585932c03509af142ebdb197df1 100644 (file)
@@ -1,4 +1,4 @@
-399
+402
 If You Want Something Done You Have to Do It Yourself_(Highlander II)
 I Live the Life They Wish They Did_(Tricky)
 Jesus Built My Hotrod_(Ministry)
@@ -398,3 +398,6 @@ It was something to at least have a choice of nightmares_(Joseph Conrad)
 You fight, work, sweat, nearly kill yourself, sometimes you do kill yourself, trying to accomplish something - and you can't._(Joseph Conrad)
 And after some more talk we agreed that the wisdom of rats had been grossly overrated, being in fact no greater than that of men_(Joseph Conrad)
 It's an easy game, just don't let the ball past!_(Szilard Pall)
+The soul? There's nothing but chemistry here_(Breaking Bad)
+You got one part of that wrong. This is not meth._(Breaking Bad)
+It's easy to remember: a half a kT is equal to five fourths of a kJ/mol._(Anders Gabrielsson)
index efcaaabea07076b444ca15a998f5f66ac5a93051..b6c6f22227e791677bc752ec05d48e5f88a5debe 100644 (file)
@@ -1029,6 +1029,41 @@ static tng_function_status tng_block_header_read
 //     return(TNG_SUCCESS);
 // }
 */
+
+static tng_function_status tng_reread_frame_set_at_file_pos
+                (tng_trajectory_t tng_data,
+                 const int64_t pos)
+{
+    tng_gen_block_t block;
+    tng_function_status stat;
+
+    tng_block_init(&block);
+
+    fseek(tng_data->input_file, pos, SEEK_SET);
+    if(pos > 0)
+    {
+        stat = tng_block_header_read(tng_data, block);
+        if(stat == TNG_CRITICAL || block->id != TNG_TRAJECTORY_FRAME_SET)
+        {
+            fprintf(stderr, "TNG library: Cannot read block header at pos %"PRId64". %s: %d\n", pos,
+                    __FILE__, __LINE__);
+            tng_block_destroy(&block);
+            return(TNG_FAILURE);
+        }
+
+        if(tng_block_read_next(tng_data, block,
+                               TNG_SKIP_HASH) != TNG_SUCCESS)
+        {
+            tng_block_destroy(&block);
+            return(TNG_CRITICAL);
+        }
+    }
+
+    tng_block_destroy(&block);
+
+    return(TNG_SUCCESS);
+}
+
 /** Write the header of a data block, regardless of its type
  * @param tng_data is a trajectory data container.
  * @param block is a general block container.
@@ -16007,7 +16042,7 @@ tng_function_status DECLSPECDLLEXPORT tng_data_get_stride_length
     tng_function_status stat;
     tng_non_particle_data_t np_data;
     tng_particle_data_t p_data;
-    long file_pos;
+    long orig_file_pos, file_pos;
     int is_particle_data;
 
     if(tng_data->current_trajectory_frame_set_input_file_pos <= 0)
@@ -16023,6 +16058,7 @@ tng_function_status DECLSPECDLLEXPORT tng_data_get_stride_length
             return(stat);
         }
     }
+    orig_file_pos = tng_data->current_trajectory_frame_set_input_file_pos;
     stat = tng_data_find(tng_data, block_id, &np_data);
     if(stat != TNG_SUCCESS)
     {
@@ -16042,6 +16078,8 @@ tng_function_status DECLSPECDLLEXPORT tng_data_get_stride_length
             }
             if(stat != TNG_SUCCESS)
             {
+                tng_reread_frame_set_at_file_pos(tng_data, orig_file_pos);
+
                 return(stat);
             }
             stat = tng_data_find(tng_data, block_id, &np_data);
@@ -16050,6 +16088,8 @@ tng_function_status DECLSPECDLLEXPORT tng_data_get_stride_length
                 stat = tng_particle_data_find(tng_data, block_id, &p_data);
                 if(stat != TNG_SUCCESS)
                 {
+                    tng_reread_frame_set_at_file_pos(tng_data, orig_file_pos);
+
                     return(stat);
                 }
                 else
@@ -16079,6 +16119,8 @@ tng_function_status DECLSPECDLLEXPORT tng_data_get_stride_length
     {
         *stride_length = np_data->stride_length;
     }
+    tng_reread_frame_set_at_file_pos(tng_data, orig_file_pos);
+
     return(TNG_SUCCESS);
 }
 
@@ -16572,7 +16614,14 @@ tng_function_status DECLSPECDLLEXPORT tng_util_particle_data_next_frame_read
     }
     else
     {
-        i = data->last_retrieved_frame + data->stride_length;
+        if(data->n_frames == 1)
+        {
+            i = data->last_retrieved_frame + 1;
+        }
+        else
+        {
+            i = data->last_retrieved_frame + data->stride_length;
+        }
         if(i < frame_set->first_frame || i >= frame_set->first_frame + frame_set->n_frames)
         {
             stat = tng_frame_set_of_frame_find(tng_data, i);
@@ -16725,7 +16774,14 @@ tng_function_status DECLSPECDLLEXPORT tng_util_non_particle_data_next_frame_read
     }
     else
     {
-        i = data->last_retrieved_frame + data->stride_length;
+        if(data->n_frames == 1)
+        {
+            i = data->last_retrieved_frame + 1;
+        }
+        else
+        {
+            i = data->last_retrieved_frame + data->stride_length;
+        }
         if(i < frame_set->first_frame || i >= frame_set->first_frame + frame_set->n_frames)
         {
             stat = tng_frame_set_of_frame_find(tng_data, i);
@@ -18319,33 +18375,38 @@ tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_next_frame_present_dat
         }
     }
 
-    if(frame_set->n_particle_data_blocks <= 0 || frame_set->n_data_blocks <= 0)
+    /* If no data blocks have been found in the frame set check what data blocks
+     * are present. If they have already been found do not read them again. */
+    if(frame_set->n_particle_data_blocks <= 0 && frame_set->n_data_blocks <= 0)
     {
-        tng_block_init(&block);
         file_pos = ftell(tng_data->input_file);
         /* Read all blocks until next frame set block */
-        stat = tng_block_header_read(tng_data, block);
-        while(file_pos < tng_data->input_file_len &&
-            stat != TNG_CRITICAL &&
-            block->id != TNG_TRAJECTORY_FRAME_SET)
+        if(file_pos < tng_data->input_file_len)
         {
-            stat = tng_block_read_next(tng_data, block,
-                                       TNG_USE_HASH);
-            if(stat != TNG_CRITICAL)
+            tng_block_init(&block);
+            stat = tng_block_header_read(tng_data, block);
+            while(file_pos < tng_data->input_file_len &&
+                stat != TNG_CRITICAL &&
+                block->id != TNG_TRAJECTORY_FRAME_SET)
             {
-                file_pos = ftell(tng_data->input_file);
-                if(file_pos < tng_data->input_file_len)
+                stat = tng_block_read_next(tng_data, block,
+                                        TNG_USE_HASH);
+                if(stat != TNG_CRITICAL)
                 {
-                    stat = tng_block_header_read(tng_data, block);
+                    file_pos = ftell(tng_data->input_file);
+                    if(file_pos < tng_data->input_file_len)
+                    {
+                        stat = tng_block_header_read(tng_data, block);
+                    }
                 }
             }
-        }
-        tng_block_destroy(&block);
-        if(stat == TNG_CRITICAL)
-        {
-            fprintf(stderr, "TNG library: Cannot read block header at pos %ld. %s: %d\n",
-                    file_pos, __FILE__, __LINE__);
-            return(stat);
+            tng_block_destroy(&block);
+            if(stat == TNG_CRITICAL)
+            {
+                fprintf(stderr, "TNG library: Cannot read block header at pos %ld. %s: %d\n",
+                        file_pos, __FILE__, __LINE__);
+                return(stat);
+            }
         }
         read_all = 1;
     }
index ca554147d99bc82dde1596b3520a5e59ca4df553..62726f169ba85cfa92a9639636435577b0fd046d 100644 (file)
@@ -1033,9 +1033,10 @@ int gmx_trjconv(int argc, char *argv[])
         {
             /* check if velocities are possible in input and output files */
             ftpin = fn2ftp(in_file);
-            bVels = (ftp == efTRR || ftp == efTRJ || ftp == efGRO || ftp == efG96)
-                && (ftpin == efTRR || ftpin == efTRJ || ftpin == efGRO || ftpin == efG96 ||
-                    ftpin == efCPT);
+            bVels = (ftp == efTRR || ftp == efTRJ || ftp == efGRO ||
+                     ftp == efG96 || ftp == efTNG)
+                && (ftpin == efTRR || ftpin == efTRJ || ftpin == efGRO ||
+                    ftpin == efG96 || ftpin == efTNG || ftpin == efCPT);
         }
         if (bSeparate || bSplit)
         {
index 6154ded2c796ea6a6a659a673bf0e06ed85f4e95..78124c50fb1ef6a21d2ccaef7c78719b7dcdaa11 100644 (file)
@@ -176,7 +176,7 @@ double check_mol(gmx_mtop_t *mtop, warninp_t wi)
     char     buf[256];
     int      i, mb, nmol, ri, pt;
     double   q;
-    real     m;
+    real     m, mB;
     t_atoms *atoms;
 
     /* Check mass and charge */
@@ -190,30 +190,31 @@ double check_mol(gmx_mtop_t *mtop, warninp_t wi)
         {
             q += nmol*atoms->atom[i].q;
             m  = atoms->atom[i].m;
+            mB = atoms->atom[i].mB;
             pt = atoms->atom[i].ptype;
             /* If the particle is an atom or a nucleus it must have a mass,
              * else, if it is a shell, a vsite or a bondshell it can have mass zero
              */
-            if ((m <= 0.0) && ((pt == eptAtom) || (pt == eptNucleus)))
+            if (((m <= 0.0) || (mB <= 0.0)) && ((pt == eptAtom) || (pt == eptNucleus)))
             {
                 ri = atoms->atom[i].resind;
-                sprintf(buf, "atom %s (Res %s-%d) has mass %g\n",
+                sprintf(buf, "atom %s (Res %s-%d) has mass %g (state A) / %g (state B)\n",
                         *(atoms->atomname[i]),
                         *(atoms->resinfo[ri].name),
                         atoms->resinfo[ri].nr,
-                        m);
+                        m, mB);
                 warning_error(wi, buf);
             }
             else
-            if ((m != 0) && (pt == eptVSite))
+            if (((m != 0) || (mB != 0)) && (pt == eptVSite))
             {
                 ri = atoms->atom[i].resind;
-                sprintf(buf, "virtual site %s (Res %s-%d) has non-zero mass %g\n"
+                sprintf(buf, "virtual site %s (Res %s-%d) has non-zero mass %g (state A) / %g (state B)\n"
                         "     Check your topology.\n",
                         *(atoms->atomname[i]),
                         *(atoms->resinfo[ri].name),
                         atoms->resinfo[ri].nr,
-                        m);
+                        m, mB);
                 warning_error(wi, buf);
                 /* The following statements make LINCS break! */
                 /* atoms->atom[i].m=0; */
index fd8d11f05372e1f92724e8be257a6223bca25006..3eb1d2ff2b354ca15422deba20f5fcff0ba73485 100644 (file)
@@ -1520,7 +1520,7 @@ void vrescale_tcoupl(t_inputrec *ir, gmx_int64_t step,
 
             Ek_new  = vrescale_resamplekin(Ek, Ek_ref, opts->nrdf[i],
                                            opts->tau_t[i]/dt,
-                                           ir->ld_seed, step);
+                                           step, ir->ld_seed);
 
             /* Analytically Ek_new>=0, but we check for rounding errors */
             if (Ek_new <= 0)
index 28aa6da5580a676ff649e136d23911154e01d3b2..cdf422d4ae573639b1ebb32139e9079ac598691b 100644 (file)
@@ -382,6 +382,9 @@ static void list_tng(const char gmx_unused *fn)
                 /* Can't write any output because we don't know what
                    arrays are valid. */
                 fprintf(stderr, "\nWARNING: Incomplete frame at time %g, will not write output\n", frame_time);
+            }
+            else
+            {
                 list_tng_inner(fn, (0 == i), values, step, frame_time,
                                n_values_per_frame, n_atoms, prec, nframe, block_name);
             }