- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]

From: Andrea Fontana <andrea.fontana_at_pv.infn.it>

Date: Mon, 23 Apr 2018 15:43:46 +0200

Hello ArghyaC,

I see 2 mistakes in your source file, easy to correct:

1) in Fortran each line should have 6 spaces at the beginning: in your

code you ony left 5 spaces at lines 204-212;

2) in fortran you cannot mix declarations of variables with instructions:

so the two lines

DIMENSION CENTERS(5)

DATA CENTERS/-10.,-5.,0.,5.,10./

are out of place. Please move them at the beginning of the file.

I attach a correct version of your source that will compile.

Kind regards,

Andrea

Il 23/04/2018 14:43, arghyac_at_barc.gov.in ha scritto:

*> On 2017-09-16 14:15, Andrea Fontana wrote:
*

*>> Hello Arghya,
*

*>> the idea is to save the x coordinates of the five centers in the
*

*>> array CENTERS and then to randomly generate the index in the interval
*

*>> 1:5 to select a random center among the five. The array looks like:
*

*>>
*

*>> ARRAY(1) = -10.
*

*>> ARRAY(2) = -5.
*

*>> ARRAY(3) = 0.
*

*>> ARRAY(4) = 5.
*

*>> ARRAY(5) = 10.
*

*>>
*

*>> Actually, if you check in the manual of FLUKA, FLRNDM returns a
*

*>> uniform random number in the interval [0,1), i.e. with 1 excluded:
*

*>> so it would be better to write 1+5*FLRNDM(XDUMMY) to have a random
*

*>> index among 1,2,3,4,5.
*

*>>
*

*>> In Fortran you can use the implicit type declaration (as in the FLUKA
*

*>> user routines) and so you can skip both REAL*4 or REAL*8 instructions
*

*>> and simply write a DIMENSION instruction. FLRNDM returns a 64-bit
*

*>> number and the conversion is done automatically: in your case I think
*

*>> this is not relevant since you round your numbers...
*

*>>
*

*>> So a better version of the code is:
*

*>>
*

*>> DIMENSION CENTERS(5)
*

*>> DATA CENTERS/-10.,-5.,0.,5.,10./
*

*>>
*

*>> INDEX = FLOOR(1+5*FLRNDM(XDUMMY))
*

*>> X0 = CENTERS(INDEX)
*

*>>
*

*>> CALL RACO(TXX, TYY, TZZ)
*

*>>
*

*>> RADIUS = R*FLRNDM(XDUMMY)
*

*>> XFLK (NPFLKA) = X0 + RADIUS*TXX
*

*>> YFLK (NPFLKA) = RADIUS*TYY
*

*>> ZFLK (NPFLKA) = RADIUS*TZZ
*

*>>
*

*>> I hope that now it is more clear. Please test it in your simulation
*

*>> and let us know in case of other doubts.
*

*>>
*

*>> Best regards,
*

*>> Andrea
*

*>>
*

*>>> On 2017-09-15 20:10, Andrea Fontana wrote:
*

*>>>> Dear Arghya,
*

*>>>> Â what about choosing randomly among the 5 sphere centers?
*

*>>>> Let us say with a code like:
*

*>>>>
*

*>>>> Â Â Â Â Â REAL*4 CENTERS(5), X0
*

*>>>> Â Â Â Â Â DATA CENTERS/-10.,-5.,0.,5.,10./
*

*>>>>
*

*>>>> Â Â Â Â Â X0 = CENTERS(FLOOR(6*FLRNDM(XDUMMY)))
*

*>>>>
*

*>>>> where X0 is the center of your current sphere and then:
*

*>>>>
*

*>>>> Â Â Â CALL RACO(TXX, TYY, TZZ)
*

*>>>> Â Â Â RADIUS = R*FLRNDM(XDUMMY)
*

*>>>> Â Â Â XFLK (NPFLKA) = X0 + RADIUS*TXX
*

*>>>> Â Â Â YFLK (NPFLKA) = RADIUS*TYY
*

*>>>> Â Â Â ZFLK (NPFLKA) = RADIUS*TZZ
*

*>>>>
*

*>>>> You have to generate 5 times histories, but the result should be
*

*>>>> the one you are looking for. I hope this helps.
*

*>>>>
*

*>>>> Kind regards,
*

*>>>> Andrea
*

*>>>>
*

*>>>> Il 15/09/2017 14:15, arghyac_at_barc.gov.in ha scritto:
*

*>>>>> Dear Experts,
*

*>>>>>
*

*>>>>> Â Â I need to simulate 5 spherical sources with different spatial
*

*>>>>> co-ordinate in a single source.f card.
*

*>>>>>
*

*>>>>> Â Â I model one sphere (centre at (0,0,0) in source.f card as
*

*>>>>> follows
*

*>>>>>
*

*>>>>> *particle corodinate
*

*>>>>> Â Â Â CALL RACO(TXX, TYY, TZZ)
*

*>>>>> Â Â Â RADIUS = R*FLRNDM(XDUMMY)
*

*>>>>> Â Â Â XFLK (NPFLKA) = RADIUS*TXX
*

*>>>>> Â Â Â YFLK (NPFLKA) = RADIUS*TYY
*

*>>>>> Â Â Â ZFLK (NPFLKA) = RADIUS*TZZ
*

*>>>>>
*

*>>>>> I guess I need to editÂ XFLK (NPFLKA), YFLK (NPFLKA), ZFLK
*

*>>>>> (NPFLKA) to
*

*>>>>> sample 5 spherical sources in single subroutine.
*

*>>>>> Co-ordinate of other 4 sphere's centre are (-10,0,0),
*

*>>>>> (-5,0,0),(5,0,0)
*

*>>>>> and (10,0,0). radius of each = 1.5 cm.
*

*>>>>>
*

*>>>>> Now how to sample other spheres here or how to edit it to accommodate
*

*>>>>> all the 5 sources at the same time.
*

*>>>>>
*

*>>>>> Kindly give some suggestions.
*

*>>>>>
*

*>>>>> Thanking you in advance.
*

*>>>>>
*

*>>>>> With regards,
*

*>>>>> Arghya
*

*>>>>>
*

*>>>>> __________________________________________________________________________
*

*>>>>>
*

*>>>>> You can manage unsubscription from this mailing list at
*

*>>>>> https://www.fluka.org/fluka.php?id=acc_info
*

*>>>>>
*

*>>> Dear Sir/Madam,
*

*>>> Thank you very much for quick reply.
*

*>>> I am beginner and not much excellence in Fortran programming. So I
*

*>>> have few doubts. Kindly reply me.
*

*>>>
*

*>>> I need to choose all 5 sources randomly with equal probability
*

*>>> i.e as
*

*>>> if detector are exposed by all 5 sources simultaneously.
*

*>>>
*

*>>> Since I am using 64 bit computer,
*

*>>> can I use REAL*8 instead of REAL*4
*

*>>> CENTERS(5) and below that declared centers values as DATA
*

*>>> CENTERS/-10.,-5.,0.,5.,10./
*

*>>>
*

*>>> Then use X0 = CENTERS(FLOOR(6*FLRNDM(XDUMMY)))
*

*>>> here FLOOR(6*FLRNDM(XDUMMY) will produce integer number
*

*>>> 0,1,2,3,4,5,6
*

*>>> I am not getting how it will produce -5 and -10 and 10
*

*>>> co-ordinates ?
*

*>>> and why FLRNDM(XDUMMY) is multiplied by 6 only.
*

*>>>
*

*>>> Thanking you in advance
*

*>>>
*

*>>> __________________________________________________________________________
*

*>>>
*

*>>> You can manage unsubscription from this mailing list at
*

*>>> https://www.fluka.org/fluka.php?id=acc_info
*

*>>>
*

*>>>
*

*>
*

*>
*

*> Dear FLUKA experts,
*

*>
*

*> As discussed earlier, I am trying to model 5 spherical source
*

*> using source.f card but not able to compile it.
*

*>
*

*> During compilation, it is giving following error
*

*>
*

*>
*

*> tarted 2018.04.23 18:19:50
*

*>>>> Compiling: /home/arghya/fluka/flutil/fff -b -N multi.f
*

*> multi.f:204:24:
*

*>
*

*> DIMENSION CENTERS(5)
*

*> 1
*

*> Error: Invalid character in name at (1)
*

*> Ended: 2018.04.23 18:19:50
*

*>
*

*> Error compiling
*

*> Error: compiling file: multi.f
*

*> No object generated
*

*>
*

*>
*

*>
*

*> Please find attached source.f card also.
*

*>
*

*> Kindly suggest me some solutions.
*

*>
*

*> Thanking you in advance.
*

*>
*

*> with regards
*

*> ArghyaC
*

Date: Mon, 23 Apr 2018 15:43:46 +0200

Hello ArghyaC,

I see 2 mistakes in your source file, easy to correct:

1) in Fortran each line should have 6 spaces at the beginning: in your

code you ony left 5 spaces at lines 204-212;

2) in fortran you cannot mix declarations of variables with instructions:

so the two lines

DIMENSION CENTERS(5)

DATA CENTERS/-10.,-5.,0.,5.,10./

are out of place. Please move them at the beginning of the file.

I attach a correct version of your source that will compile.

Kind regards,

Andrea

Il 23/04/2018 14:43, arghyac_at_barc.gov.in ha scritto:

-- ======================================================================== Dr. Andrea Fontana tel: +39 0382 987991 Istituto Nazionale fax: +39 0382 423241 di Fisica Nucleare Sezione di Pavia e-mail: andrea.fontana_at_pv.infn.it Via Bassi 6 web : www.pv.infn.it/~fontana 27100 PAVIA, Italy ======================================================================== __________________________________________________________________________ You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_infoReceived on Mon Apr 23 2018 - 17:15:15 CEST

*
This archive was generated by hypermail 2.3.0
: Mon Apr 23 2018 - 18:23:17 CEST
*