[fluka-discuss]: RE: phantom problem - fortran code

From: 委v鋱k Aleksandras <aleksandras.sevcik_at_ktu.edu>
Date: Wed, 10 Oct 2018 15:10:40 +0000

Dear Kermit

I really appreciate your efforts and help, however, it does not compile, many errors followed... I can see that there is an example in fluka manual p.297 where fortran code giving some output is shown , maybe can be used as an example..

In general, the writing part given by you is:
Write (20,'("phantom file") ')
     Write (20,'("number of columns",i4," rows", I5,"slices",i5)') ncol, crow,nsli
      Do 50 nc=1,ncol
      Do 50 nr=1,rnow
       Write (20,'(348i4)')(noid(nc,nr,nsl),nsl=1,nsli)
  50 continue

When Paola wrote:
open (20,file='AFnew.dat')
      do 400 nsl=1,nsli
          do 401 nr=1,nrow
             write (20,*) (noid(nc,nr,nsl),i=1,ncol)
          401 continue
      400 continue
      close (20)

Unfortunately neither of it compiles. The errors are about expecting end do, invalid characters, etc. When I look to the fortran code in fluka manual for writegolem.f, I see that syntax is somehow different, but cannot understand if it is significant or no..

Regards
Alex

From: Bunde, Kermit A <bundeka_at_id.doe.gov>
Sent: Wednesday, October 10, 2018 15:59
To: 委v鋱k Aleksandras <aleksandras.sevcik_at_ktu.edu>
Subject: RE: phantom problem - fortran code

I think that I got the bad characters fixed.

Kermit Bunde
From: 委v鋱k Aleksandras <aleksandras.sevcik_at_ktu.edu<mailto:aleksandras.sevcik_at_ktu.edu>>
Sent: Wednesday, October 10, 2018 4:43 AM
To: Bunde, Kermit A <bundeka_at_id.doe.gov<mailto:bundeka_at_id.doe.gov>>; fluka-discuss_at_fluka.org<mailto:fluka-discuss_at_fluka.org>
Subject: RE: phantom problem - fortran code

Dear Kermit

Thank you very much for your input and help. However, when I try to compile that code, I am getting the following error codes, pls see below. Maybe you know how I could fix them?
Regards
Alex

[user_at_v0161 voxel_ruh2]$ $FLUPRO/flutil/fff reading2.f

reading2.f:7:21:

       open (20,file='AF.out')
                     1
Error: Invalid character 0xE2 at (1)
reading2.f:7:20:

       open (20,file='AF.out')
                    1
Error: Invalid value for FILE specification at (1)
reading2.f:26:16:

      Write (20,'("phantom file") ')
                1
Error: Invalid character 0xE2 at (1)
reading2.f:25:14:

    40 continue
              1
Error: Syntax error in CONTINUE statement at (1)
reading2.f:27:72:

      Write (20,'("number of columns",i4," rows", I5,"slices",i5)') ncol, crow,nsli
                                                                        1
Warning: Line truncated at (1) [-Wline-truncation]
reading2.f:29:72:

reading2.f:13:72:

       do 40 nr=1,nrow
                                                                        2
reading2.f:29:72:

       Do 50 nr=1,rnow
                                                                        1
Error: Variable 'nr' at (1) cannot be redefined inside loop beginning at (2)
reading2.f:30:18:

        Write (20,'(348i4)')(noid(nc,nr,nsl),nsl=1,nsli)
                  1
Error: Invalid character 0xE2 at (1)
reading2.f:30:17:

        Write (20,'(348i4)')(noid(nc,nr,nsl),nsl=1,nsli)
                 1
Error: Syntax error in WRITE statement at (1)
reading2.f:31:6:

   50 continue
      1
Error: Bad continuation line at (1)
reading2.f:31:6:

   50 continue
      1
Error: Unclassifiable statement at (1)
reading2.f:33:16:

       close (10)
                1
Error: Syntax error in CLOSE statement at (1)
reading2.f:35:9:

       end
         1
Error: END DO statement expected at (1)
f951: Error: Unexpected end of file in 'reading2.f'

From: Bunde, Kermit A <bundeka_at_id.doe.gov<mailto:bundeka_at_id.doe.gov>>
Sent: Tuesday, October 9, 2018 16:35
To: 委v鋱k Aleksandras <aleksandras.sevcik_at_ktu.edu<mailto:aleksandras.sevcik_at_ktu.edu>>; fluka-discuss_at_fluka.org<mailto:fluka-discuss_at_fluka.org>
Subject: RE: phantom problem - fortran code

You could try this fortran file:

      program readdata
* Programme to read the voxel phantom data from ASCII file
* AF.dat and store them in a three-dimensional array of
* organ identification numbers
      dimension norgin(300),nodum(16),noid(300,200,350)
* Number of columns, rows and slices:
      ncol=299
      nrow=137
      nsli=348
      open (10,file='AF.dat')
      open (20,file='AF.out')
* Read phantom file, assign organ identification numbers to
* array positions
* The organ identification numbers are stored in portions of 16,
* but the number of columns is not a multiple of 16.
* Therefore, when ncol OIDs are read, this ends right in the
* middle of a line, and the rest is ignored. Therefore, the next
* "read" statement has to account for this; the last line that
* has been read only partially, has to be read again, whereby
* that first part that has been registered already needs to be
* skipped. Therefore, the number "ndum" of these items has to be
* tracked.
      write (6,'('' Reading of phantom file started'')')
      nrorea=ncol/16
      ndifcol=ncol-16*nrorea
      ndum=0
      do 40 nsl=1,nsli
      do 40 nr=1,nrow
      if (ndum.ne.0) then
                  backspace (10)
          read (10,*) (nodum(i),i=1,ndum), (norgin(i),i=1,ncol)
      else
          read (10,*) (norgin(i),i=1,ncol)
      endif
      do 30 nc=1,ncol
      noid(nc,nr,nsl)=norgin(nc)
   30 continue
      ndum=ndum+ndifcol
      if (ndum.ge.16) ndum=ndum-16
   40 continue
     Write (20,'("phantom file") ')
     Write (20,'("number of columns",i4," rows", I5,"slices",i5)') ncol, crow,nsli
      Do 50 nc=1,ncol
      Do 50 nr=1,rnow
       Write (20,'(348i4)')(noid(nc,nr,nsl),nsl=1,nsli)
  50 continue
      write (6,'('' ... finished'')')
      close (10)
     close (20)
      end


Kermit Bunde

From: owner-fluka-discuss_at_mi.infn.it<mailto:owner-fluka-discuss_at_mi.infn.it> <owner-fluka-discuss_at_mi.infn.it<mailto:owner-fluka-discuss_at_mi.infn.it>> On Behalf Of 委vcik Aleksandras
Sent: Sunday, October 07, 2018 2:45 AM
To: fluka-discuss_at_fluka.org<mailto:fluka-discuss_at_fluka.org>
Subject: [fluka-discuss]: phantom problem - fortran code

Dear experts,

Despite that I have been able to successfully convert icrp phantom to fluka vxl and it works with some correction, I still need to understand one tricky moment here which, unfortunately, could not being solved by my own for a long time.
In the ICRP's data readme.txt states the following, see below. My problem is that I cannot open original .dat file with imageJ with parameters col 299 row137 sli348 which means that original .dat file is not build in such way so it must be altered as readme.txt states. I can understand basically what this code tries to do, and I can successfully compile and run it, however, nothing changes in that .dat file, i.e. it is not stored in the (299x137x348) array! Does this code lacks some output parameter or smth?

"The organ identification numbers are stored in portions of 16, but the number of columns is not a multiple of 16. Therefore, appropriate care has to be applied for reading the data. As an example, a FORTRAN programme that reads the data of the female reference computational phantom and stores them into a (299 x 137 x 348) array is given in the following:

      program readdata
* Programme to read the voxel phantom data from ASCII file
* AF.dat and store them in a three-dimensional array of
* organ identification numbers
      dimension norgin(300),nodum(16),noid(300,200,350)
* Number of columns, rows and slices:
      ncol=299
      nrow=137
      nsli=348
      open (10,file='AF.dat')
* Read phantom file, assign organ identification numbers to
* array positions
* The organ identification numbers are stored in portions of 16,
* but the number of columns is not a multiple of 16.
* Therefore, when ncol OIDs are read, this ends right in the
* middle of a line, and the rest is ignored. Therefore, the next
* "read" statement has to account for this; the last line that
* has been read only partially, has to be read again, whereby
* that first part that has been registered already needs to be
* skipped. Therefore, the number "ndum" of these items has to be
* tracked.
      write (6,'('' Reading of phantom file started'')')
      nrorea=ncol/16
      ndifcol=ncol-16*nrorea
      ndum=0
      do 40 nsl=1,nsli
      do 40 nr=1,nrow
      if (ndum.ne.0) then
                  backspace (10)
          read (10,*) (nodum(i),i=1,ndum), (norgin(i),i=1,ncol)
      else
          read (10,*) (norgin(i),i=1,ncol)
      endif
      do 30 nc=1,ncol
      noid(nc,nr,nsl)=norgin(nc)
   30 continue
      ndum=ndum+ndifcol
      if (ndum.ge.16) ndum=ndum-16
   40 continue
      write (6,'('' ... finished'')')
      close (10)
      end"


__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Wed Oct 10 2018 - 18:49:55 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 10 2018 - 18:50:11 CEST