Re: How to output 'unformatted file'?

From: Giuseppe Battistoni <giuseppe.battistoni_at_mi.infn.it>
Date: Mon, 03 Aug 2009 12:46:11 +0200

Dear Hantao
this is a trivial fortran problem.
If you write in the code:
    WRITE(60,200) XSCO,YSCO,ZSCO,TPPTRACK,WTRACK
....
200 format(3F8.3,E15.7,F6.2)
...
you are asking to write using the format specified at label 200,
therefore you cannot
ask to open an unformatted file.
In order to write into an unformatted file, beyond opening the file with
FORM="UNFORMATTED" your code must be transformed into:

WRITE(60) XSCO,YSCO,ZSCO,TPPTRACK,WTRACK

dropping the FORMAT statement with label 200.
Notice that after WRITE there is only (60) instead of (60,200)

    Giuseppe Battistoni

Hantao Jing wrote:
> Dear FLUKA experts,
>
> I want to output results in an unformatted file by employing the
> USERDUMP card. So I do the following things:
> firstly, I defined the USERDUMP card in my input file,
> *...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
>
> USERDUMP 100.0 0.0 3.0 0.0
> ;
> Then, I add my user-code in the 'mgdraw.f' file,
>
>
> ENTRY BXDRAW ( ICODE, MREG, NEWREG, XSCO, YSCO, ZSCO )
>
> IF (.NOT. LFCOPE) THEN
> LFCOPE = .TRUE.
> OPEN(UNIT=60, FILE = 'Age.60',FORM = 'UNFORMATTED',
> & STATUS = 'NEW')
> END IF
>
> IF( JTRACK.EQ.1) THEN ! Select protons
> IF(ETRACK.GT.AM(JTRACK)) THEN ! Neutron has survived
> TPPTRACK = ETRACK - AM(JTRACK)
> IF(MREG.EQ.2 .AND. NEWREG.EQ.8) THEN ! Select the desired
> boundary
>
>
> * TPPTRACK is kinetic energy,PTRACK is the momentum; ETRACK, PTRACK AND
> * AM(JTRACK) satisfy the mass-energy relation E^2=m^2+p^2;
>
>
> WRITE(60,200) XSCO,YSCO,ZSCO,TPPTRACK,WTRACK
>
>
>
> ENDIF
>
> ENDIF
> ENDIF
>
> 200 format(3F8.3,E15.7,F6.2)
>
> RETURN
> ;
>
>
>
> When I run the fluka, the error apperars,
>
> [jinght_at_sns022 ~/TailEnd/collimators/NoJaw]$ $TARGET_MACHINE = Linux
> $FLUPRO = /home/jinght/fluka
> $PEMF = /home/jinght/fluka/libec_thihecufealw_10t.pemf
>
> Initial seed copied from /home/jinght/fluka
> Running fluka in /home/jinght/TailEnd/collimators/NoJaw/fluka_5998
>
> ======================= Running FLUKA for cycle # 1
> =======================
>
> [jinght_at_sns022 ~/TailEnd/collimators/NoJaw]$
> /home/jinght/fluka/flutil/rfluka: line 338: 6024 Aborted (core
> dumped) ${EXE} < $INPN 2> $LOGF > $LOGF
>
> [1]+ Exit 134 $FLUPRO/flutil/rfluka -e myfluka -N0 -M1
> NoJaw
> .
>
>
> But when I revise the FORM = 'UNFORMATTED' to FORM = 'FORMATTED',
> everything is ok. I can obtain the formatted the file. The fluka works
> well.
>
> My input file and mgdraw.f is in attachment.
>
> Please tell me how to output unformatted file correctly. Thank you in
> advance.
>
>
> Hantao Jing
> 2009-8-3
Received on Mon Aug 03 2009 - 13:24:35 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 03 2009 - 13:24:35 CEST