2121* When used with MPI, the --ncount given on the commandline is overwritten by
2222* #MPI nodes x #events in the file.
2323*
24- * %BUGS
24+ * Example: MCPL_input(filename=voutput,verbose=1,repeat_count=1,v_smear=0.1,pos_smear=0.001,dir_smear=0.01)
2525*
2626* %P
2727* INPUT PARAMETERS
@@ -226,13 +226,9 @@ INITIALIZE
226226 Z[used_neutrons]=particle->position[2];
227227
228228 if(polarisationuse){
229- SX[used_neutrons]=(double)particle->polarisation[0];
230- SY[used_neutrons]=(double)particle->polarisation[1];
231- SZ[used_neutrons]=(double)particle->polarisation[2];
232- }else{
233- SX[used_neutrons]=0;
234- SY[used_neutrons]=0;
235- SZ[used_neutrons]=0;
229+ SX[used_neutrons]=(double)particle->polarisation[0];
230+ SY[used_neutrons]=(double)particle->polarisation[1];
231+ SZ[used_neutrons]=(double)particle->polarisation[2];
236232 }
237233
238234 double d0=particle->direction[0];
@@ -339,11 +335,11 @@ TRACE
339335
340336 if(polarisationuse){
341337 if(!preload) {
342- #ifndef OPENACC
338+ #ifndef OPENACC
343339 sx=particle->polarisation[0];
344340 sy=particle->polarisation[1];
345341 sz=particle->polarisation[2];
346- #endif
342+ #endif
347343 } else {
348344 sx=SX[i];
349345 sy=SY[i];
@@ -355,9 +351,9 @@ TRACE
355351
356352 /*ekin is in MeV, in McStas meV*/
357353 if (!preload) {
358- #ifndef OPENACC
354+ #ifndef OPENACC
359355 nrm = particle->ekin *1e9/VS2E;
360- #endif
356+ #endif
361357 } else {
362358 nrm = E[i] *1e9/VS2E;
363359 }
@@ -368,11 +364,11 @@ TRACE
368364 }
369365 double d0,d1,d2;
370366 if (!preload) {
371- #ifndef OPENACC
367+ #ifndef OPENACC
372368 d0=particle->direction[0];
373369 d1=particle->direction[1];
374370 d2=particle->direction[2];
375- #endif
371+ #endif
376372 } else {
377373 d0=VX[i];
378374 d1=VY[i];
@@ -408,53 +404,53 @@ TRACE
408404
409405SAVE
410406%{
411- #ifndef OPENACC
407+ #ifndef OPENACC
412408 if (!preload) {
413- mcpl_close_file(inputfile);
409+ mcpl_close_file(inputfile);
414410 }
415- #endif
411+ #endif
416412%}
417413
418414FINALLY
419415%{
420- long long ncount;
416+ long long ncount;
421417
422- ncount=mcget_ncount();
418+ ncount=mcget_ncount();
423419
424- if (used_neutrons!=read_neutrons){
425- fprintf(stdout,"Message(%s): You have used %lu of %lu neutrons available in the MCPL file.\n",NAME_CURRENT_COMP,
420+ if (used_neutrons!=read_neutrons){
421+ fprintf(stdout,"Message(%s): You have used %lu of %lu neutrons available in the MCPL file.\n",NAME_CURRENT_COMP,
426422 (long unsigned)used_neutrons,(long unsigned)read_neutrons);
427- }
428- if (ncount != used_neutrons){
429- fprintf(stderr,"Warning (%s): You requested %lu neutrons from a file which contains %lu particles in general, of which only %lu are neutrons (within the wanted energy interval).\n"
430- "Please examine the recorded intensities carefully.\n",
423+ }
424+ if (ncount != used_neutrons){
425+ fprintf(stderr,"Warning (%s): You requested %lu neutrons from a file which contains %lu particles in general, of which only %lu are neutrons (within the wanted energy interval).\n"
426+ "Please examine the recorded intensities carefully.\n",
431427 NAME_CURRENT_COMP,(long unsigned)ncount,(long unsigned)nparticles,(long unsigned)used_neutrons);
432- }
428+ }
433429
434- destroy_darr1d(X);
435- destroy_darr1d(Y);
436- destroy_darr1d(Z);
437- destroy_darr1d(VX);
438- destroy_darr1d(VY);
439- destroy_darr1d(VZ);
440- destroy_darr1d(SX);
441- destroy_darr1d(SY);
442- destroy_darr1d(SZ);
443- destroy_darr1d(T);
444- destroy_darr1d(P);
445-
446- free(resolved_filename);
430+ destroy_darr1d(X);
431+ destroy_darr1d(Y);
432+ destroy_darr1d(Z);
433+ destroy_darr1d(VX);
434+ destroy_darr1d(VY);
435+ destroy_darr1d(VZ);
436+ destroy_darr1d(SX);
437+ destroy_darr1d(SY);
438+ destroy_darr1d(SZ);
439+ destroy_darr1d(T);
440+ destroy_darr1d(P);
441+
442+ free(resolved_filename);
447443%}
448444
449445MCDISPLAY
450446%{
451- multiline(5, 0.2,0.2,0.0, -0.2,0.2,0.0, -0.2,-0.2,0.0, 0.2,-0.2,0.0, 0.2,0.2,0.0);
452- /*M*/
453- multiline(5,-0.085,-0.085,0.0, -0.085,0.085,0.0, -0.045,-0.085,0.0, -0.005,0.085,0.0, -0.005,-0.085,0.0);
454- /*I*/
455- line(0.045,-0.085,0, 0.045, 0.085,0);
456- line(0.005, 0.085,0, 0.085, 0.085,0);
457- line(0.005,-0.085,0, 0.085,-0.085,0);
447+ multiline(5, 0.2,0.2,0.0, -0.2,0.2,0.0, -0.2,-0.2,0.0, 0.2,-0.2,0.0, 0.2,0.2,0.0);
448+ /*M*/
449+ multiline(5,-0.085,-0.085,0.0, -0.085,0.085,0.0, -0.045,-0.085,0.0, -0.005,0.085,0.0, -0.005,-0.085,0.0);
450+ /*I*/
451+ line(0.045,-0.085,0, 0.045, 0.085,0);
452+ line(0.005, 0.085,0, 0.085, 0.085,0);
453+ line(0.005,-0.085,0, 0.085,-0.085,0);
458454%}
459455
460456END
0 commit comments