Re: Opening file within SOURCE user routine

From: Paola Sala (paola.sala@cern.ch)
Date: Wed Apr 04 2007 - 14:32:13 CEST

  • Next message: Alberto Fasso': "Re: Opening file within SOURCE user routine"

    Dear Frances
    The only problem I see in the lines you send is that
    an INTEGER declaration for the STAT variable is missing,
    probably you did not include it in the section you sent.

    When using the OPEN statement it is mandatory to specify the full path,
    because the executable is run in a temporary subdirectory.
    I tried your code with a dummy file, giving the full path, it works. Are
    you sure you spelled the filename correctly (silly question...)?

    A useful tool to open files is the OAUXFI routine ( contained in the
    libflukahp library): in your case

           CALL OAUXFI ('spectrum.dat',21,'OLD',STAT)
    OAUXFI looks for the specified file in
       - the temporary sub-directory
       - the initial working directory
       - the directory pointed to by $FLUPRO
       - the user home directory
    (in this order)
    If nothing works it triggers a core dump and writes a message
    in the out and log files.

    Greetings
    Paola

           -

      
    On Wed, 2007-04-04 at 09:34 +0100, Burge, F (Frances) wrote:
    > Hello all,
    >
    > I am trying to modify the SOURCE user routine to read in a file
    > containing spectrum data, so that I can then sample photon energies from
    > this spectrum.
    > I have included a Fortran OPEN statement in the initialisation part of
    > SOURCE to do this, as instructed in the fluka manual, and have been able
    > to compile the routine and link it to create a new fluka exe. However
    > when I run this exe it apparently cannot open the spectrum data file. I
    > have been able to open and read it with a separate Fortran program,
    > using very similar statements to the ones I include in the SOURCE
    > routine, so I don't think there is anything wrong with the spectrum file
    > itself. I was thinking that maybe it has to be saved in a particular
    > directory, but I've tried specifying the full path to it and it still
    > doesn't work.
    > Can anyone advise me what I need to do to get the file to open? I've
    > attached the relevant section of SOURCE as a text file.
    >
    > Many thanks,
    >
    > Frances
    >
    > Frances Burge
    > Health Physicist
    > 01235 778269
    > Diamond Light Source Ltd.
    > Rutherford Appleton Laboratory
    > Chilton
    > Didcot
    > OX11 0DE


  • Next message: Alberto Fasso': "Re: Opening file within SOURCE user routine"

    This archive was generated by hypermail 2.1.6 : Wed Apr 04 2007 - 15:36:31 CEST