--- branches/development/src/utils/simError.c	2010/07/09 23:08:25	1465
+++ branches/development/src/utils/simError.cpp	2012/07/06 22:01:58	1767
@@ -36,7 +36,8 @@
  * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).             
  * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
  * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
- * [4]  Vardeman & Gezelter, in progress (2009).                        
+ * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
+ * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
  */
  
 #include <stdlib.h>
@@ -72,9 +73,12 @@ int simError( void ) {
 int simError( void ) {
   
   int myError = 1;
-  int isError;
   char errorMsg[MAX_SIM_ERROR_MSG_LENGTH];
+
+#ifdef IS_MPI
+  int isError;
   char nodeMsg[MAX_SIM_ERROR_MSG_LENGTH];
+#endif
   
   strcpy(errorMsg, "OpenMD ");
   switch( painCave.severity ) {
@@ -92,22 +96,24 @@ int simError( void ) {
   }
   
 #ifdef IS_MPI
-  if ( painCave.isEventLoop ) {
-    sprintf( nodeMsg, " (reported by MPI node %d)", worldRank);
-    strncat(errorMsg, nodeMsg, strlen(nodeMsg));
-  }
+  if (worldRank == 0) {
+    if ( painCave.isEventLoop ) {
+      sprintf( nodeMsg, " (reported by MPI node %d)", worldRank);
+      strncat(errorMsg, nodeMsg, strlen(nodeMsg));
+    }
 #endif
-
-  strcat(errorMsg, ":\n\t");
-
-  strncat(errorMsg, painCave.errMsg, strlen(painCave.errMsg));
-
-  strcat(errorMsg, "\n");
-  fprintf(stderr, errorMsg);
-
+    
+    strcat(errorMsg, ":\n\t");
+    
+    strncat(errorMsg, painCave.errMsg, strlen(painCave.errMsg));
+    
+    strcat(errorMsg, "\n");
+    fprintf(stderr, "%s", errorMsg);
+    
 #ifdef IS_MPI
-  if (painCave.isEventLoop) 
-    return 1;
+    if (painCave.isEventLoop) 
+      return 1;
+  }
 #endif   
 
   if (painCave.isFatal) {