Index: pcp/src/output.c
===================================================================
--- pcp/src/output.c	(revision 18d0651b3eacc9a085b3cf20e85ce1535b5fb9f3)
+++ pcp/src/output.c	(revision da424485788179d04071722950aab2f31e6f6227)
@@ -1350,45 +1350,64 @@
   FILE *SrcIonDoc, *SrcIonData;
   char *suffix;
+  int flag = 0;
   // read the doc file and check
-  suffix = (char *)
-    Malloc(strlen(suffixsrciondoc) + 3 + 1,"ReadSrcIons: suffix");
-  sprintf(suffix, ".L%i%s", P->Lat.Lev[STANDARTLEVEL].LevelNo, suffixsrciondoc);
-  if (OpenFile(P, &SrcIonDoc, suffix, "r",P->Call.out[ReadOut])) {
-    if (fscanf(SrcIonDoc,"%i", &Max_Types) != 1) {
-      //Error(SomeError, "ReadSrcIons: read error");
-      Free(suffix, "ReadSrcIons: suffix");
-      return 0;
-    }
-    if (Max_Types != I->Max_Types) {
-      //Error(SomeError, "ReadSrcIons: srcion file does not fit to system, MaxTypes");
-      Free(suffix, "ReadSrcIons: suffix");
-      return 0;
-    }
-    Max_IonsOfType = (int *) Malloc(Max_Types*sizeof(int), "ReadSrcIons: Max_IonsOfType");
-    for (is=0; is < Max_Types; is++) {
-      if (fscanf(SrcIonDoc,"%i", &Max_IonsOfType[is]) != 1) {
-        //Error(SomeError, "ReadSrcIons: read error");
-        Free(suffix, "ReadSrcIons: suffix");
-    	  return 0;
-      }
-      if (Max_IonsOfType[is] != I->I[is].Max_IonsOfType) {
-        //Error(SomeError, "ReadSrcIons: srcion file does not fit to system, Max_IonsOfType");
-        Free(suffix, "ReadSrcIons: suffix");
-  	    return 0;
+
+  if (!P->Par.me) { // process 0 reads and broadcasts ..
+	  suffix = (char *)
+  	  Malloc(strlen(suffixsrciondoc) + 3 + 1,"ReadSrcIons: suffix");
+	  sprintf(suffix, ".L%i%s", P->Lat.Lev[STANDARTLEVEL].LevelNo, suffixsrciondoc);
+  	if (OpenFile(P, &SrcIonDoc, suffix, "r",P->Call.out[ReadOut])) {
+    	if (fscanf(SrcIonDoc,"%i", &Max_Types) != 1) {
+      	//Error(SomeError, "ReadSrcIons: read error");
+	      Free(suffix, "ReadSrcIons: suffix");
+        if (MPI_Bcast(&flag,1,MPI_INT,0,P->Par.comm) != MPI_SUCCESS)
+          Error(SomeError,"ReadSrcIons: Bcast of signal failed\n");
+        return flag;
 	    }
-    }
-    fclose(SrcIonDoc);
-    // read basis, then positions and speeds of ions
+  	  if (Max_Types != I->Max_Types) {
+    	  //Error(SomeError, "ReadSrcIons: srcion file does not fit to system, MaxTypes");
+	      Free(suffix, "ReadSrcIons: suffix");
+        if (MPI_Bcast(&flag,1,MPI_INT,0,P->Par.comm) != MPI_SUCCESS)
+          Error(SomeError,"ReadSrcIons: Bcast of signal failed\n");
+        return flag;
+	    }
+  	  Max_IonsOfType = (int *) Malloc(Max_Types*sizeof(int), "ReadSrcIons: Max_IonsOfType");
+  	  for (is=0; is < Max_Types; is++) {
+	      if (fscanf(SrcIonDoc,"%i", &Max_IonsOfType[is]) != 1) {
+  	      //Error(SomeError, "ReadSrcIons: read error");
+    	    Free(suffix, "ReadSrcIons: suffix");
+          Free(Max_IonsOfType, "ReadSrcIons: Max_IonsOfType");
+          if (MPI_Bcast(&flag,1,MPI_INT,0,P->Par.comm) != MPI_SUCCESS)
+            Error(SomeError,"ReadSrcIons: Bcast of signal failed\n");
+          return flag;
+        }
+        if (Max_IonsOfType[is] != I->I[is].Max_IonsOfType) {
+    	    //Error(SomeError, "ReadSrcIons: srcion file does not fit to system, Max_IonsOfType");
+      	  Free(suffix, "ReadSrcIons: suffix");
+          Free(Max_IonsOfType, "ReadSrcIons: Max_IonsOfType");
+          if (MPI_Bcast(&flag,1,MPI_INT,0,P->Par.comm) != MPI_SUCCESS)
+            Error(SomeError,"ReadSrcIons: Bcast of signal failed\n");
+          return flag;
+		    }
+	    }
+      Free(Max_IonsOfType, "ReadSrcIons: Max_IonsOfType");
+	    fclose(SrcIonDoc);
+  	}
+	  // read basis, then positions and speeds of ions
     if (OpenFile(P, &SrcIonData, suffixsrciondat, "rb",P->Call.out[ReadOut])) {
       if (fread(RealBasis, sizeof(double), (size_t)(NDIM_NDIM), SrcIonData) != NDIM_NDIM) {
         //Error(SomeError, "ReadSrcIons: read error");
         Free(suffix, "ReadSrcIons: suffix");
-        return 0;
+        if (MPI_Bcast(&flag,1,MPI_INT,0,P->Par.comm) != MPI_SUCCESS)
+          Error(SomeError,"ReadSrcIons: Bcast of signal failed\n");
+        return flag;
       }
       for (i=0; i < NDIM_NDIM; i++)
         if (RealBasis[i] != P->Lat.RealBasis[i]) {
           //Error(SomeError, "ReadSrcIons: srcion file does not fit to system, RealBasis");
-	        Free(suffix, "ReadSrcIons: suffix");
-          return 0;
+          Free(suffix, "ReadSrcIons: suffix");
+          if (MPI_Bcast(&flag,1,MPI_INT,0,P->Par.comm) != MPI_SUCCESS)
+            Error(SomeError,"ReadSrcIons: Bcast of signal failed\n");
+          return flag;
         }
       for (is=0; is < I->Max_Types; is++) {
@@ -1396,6 +1415,8 @@
           if (fread(&data, sizeof(double), (size_t)(2*NDIM), SrcIonData) != 2*NDIM) {
           	//Error(SomeError, "ReadSrcIons: read error");
-		        Free(suffix, "ReadSrcIons: suffix");
-            return 0;
+            Free(suffix, "ReadSrcIons: suffix");
+            if (MPI_Bcast(&flag,1,MPI_INT,0,P->Par.comm) != MPI_SUCCESS)
+              Error(SomeError,"ReadSrcIons: Bcast of signal failed\n");
+            return flag;
           }
           U = &I->I[is].U[NDIM*ia];
@@ -1408,9 +1429,21 @@
       }
       fclose(SrcIonData);
-    }
-    if (Max_IonsOfType != NULL) Free(Max_IonsOfType, "Max_IonsOfType");
-  }
+      flag = 1;
+    }
     Free(suffix, "ReadSrcIons: suffix");
-  return 1;
+  }
+  if (MPI_Bcast(&flag,1,MPI_INT,0,P->Par.comm) != MPI_SUCCESS)
+    Error(SomeError,"ReadSrcIons: Bcast of signal failed\n");
+  //fprintf(stderr, "(%i) Flag is %i\n", P->Par.me, flag);
+  if (flag) {
+    for (is=0; is < I->Max_Types; is++) {
+      if (MPI_Bcast(I->I[is].R, I->I[is].Max_IonsOfType*NDIM, MPI_DOUBLE, 0, P->Par.comm) != MPI_SUCCESS)
+        Error(SomeError,"ReadSrcIons: Bcast of I->I[is].R failed\n");       
+      if (MPI_Bcast(I->I[is].U, I->I[is].Max_IonsOfType*NDIM, MPI_DOUBLE, 0, P->Par.comm) != MPI_SUCCESS)
+        Error(SomeError,"ReadSrcIons: Bcast of I->I[is].U failed\n");
+    }
+  }
+  //fprintf(stderr, "(%i) ReadSrcIons done\n", P->Par.me);
+  return flag;
 }
 
