From: Francesco Cerutti <Francesco.Cerutti@cern.ch>

Date: Thu Mar 27 2008 - 15:53:27 CET

Date: Thu Mar 27 2008 - 15:53:27 CET

Dear Noemi,

i)

*> I used the lflukac script in
*

*> order to link Fluka with CERN Library but at the end of the procedure I
*

*> obtained the following error message:
*

*> "source_prot_min_new.f:130: undefined reference to `dgauss_'
*

*> collect2: ld returned 1 exit status". Can you find out where is the error?
*

I guess that you forgot the option -C when you launched the lflukac script

(when the CERNPATH variable in lflukac is set wrong, you get a different

error message)

ii)

*> 2) In source.f the sum
*

*> (TXFLK(NPFLKA))**2+(TYFLK(NPFLKA))**2+(TXFLK(NPFLKA))**2 must be exactly
*

*> equal 1 (double precision). In my source_prot_min_new.f I set
*

*> TXFLK(NPFLKA)=costx and TYFLK(NPFLKA)=costy (where costx and costy were read
*

*> from an external data file) and I obtained TZFLK(NPFLKA) from the algorithm
*

*> (which was commented on the original source.f in usermvax) reported at line
*

*> 228 TZFLK(NPFLKA) = SQRT(ONEONE - TXFLK(NPFLKA)**2- TYFLK(NPFLKA)**2 ) but
*

*> sometime it happen that the argument of SQRT is negative , moreover by
*

*> using this algorithm TZFLK(NPFLKA) is always positive while I need also
*

*> negative values in order to simulate an isotropic particle flux.
*

if the argument of SQRT is negative, it means that the input costx and

costy values are wrong (the sum of two squared direction cosines cannot be

greater than 1). Very likely it is a problem of accuracy: the number of

digits that you provide is not enough, i.e. the approximation on them is

too rough. You might solve both the mentioned problems by writing

TXFLK (NPFLKA) = costx / SQRT(costx**2+costy**2+costz**2)

TYFLK (NPFLKA) = costy / SQRT(costx**2+costy**2+costz**2)

TZFLK (NPFLKA) = costz / SQRT(costx**2+costy**2+costz**2)

But you can implement an isotropic sampling directly in your source

routine, according to the Sebastien's suggestion or, e.g., sampling

uniformly between ZERZER and TWOPIP the azimuthal angle and between

-ONEONE and ONEONE the cosine of the polar angle.

Note that in your source routine all real numbers are in single precision

(D0 missing), you redefine - in single precision! - something already

available (your PI is supposed to be PIPIPI in (DBLPRC)), and you write

IF(costz.ne.0.)

(bad because 0. is not ZERZER or 0d0 - as pointed out before - and

because to check the equality of two real numbers is quite dangerous and

unrecommended) instead of

IF(ABS(costz).LE.AZRZRZ)

Ciao

Francesco

**************************************************

Francesco Cerutti

CERN-AB

CH-1211 Geneva 23

Switzerland

tel. ++41 22 7678962

fax ++41 22 7668854

Received on Thu Mar 27 18:45:07 2008

*
This archive was generated by hypermail 2.1.8
: Thu Mar 27 2008 - 18:45:37 CET
*