Re: Using CERN Library

From: Giuseppe Battistoni (giuseppe.battistoni@mi.infn.it)
Date: Wed Mar 12 2003 - 09:40:50 CET


That example was specifically prepared for people who are used to CERN
library,
like those working in high energy physics, therefore it cannot be of
general interest.
 
Having established that we cannot give assistance for CERN (or other)
library installations,
if you belong to an academical institution you may get CERN library
starting from:
    http://wwwinfo.cern.ch/asd/index.html

Read carefully the license agreement.

If you want to really use CERN library with FLUKA I personally recommend
to install 2001 version, for a series of technical issues connected to
2002 release.

If you succeed in installing it, use in place of lflukac the script
lfluka_cernlib that I attach here.
BE CAREFUL: change in the script the path of installation of CERN
library according
to your specific installation!
There you find:
CERNPATH = /cern/2001/lib
but this might not be your case!

As in the example, use -C option to link to CERN library.
Good luck
    Giuseppe Battistoni

Christopher Knievel wrote:

>Dear FLUKA Users:
>
>I am new to FLUKA and I am trying to run a few simple examples to understand basic input and output for FLUKA. I was following along with an example given on the website when I ran into a problem. The example is one describing how to use the CERN library inside of FLUKA to generate an HBOOK output. The web address is http://lxmi.mi.infn.it/~battist/fluka_hbk/fluka_hbk.html. It is a really good example and easy for me to follow along. However, when I went to create an executable, it called for a script named lflukac which I found out later is a specific script to link to CERNLIB. Now I am running FLUKA2002, the RH7 version, on a Linux machine of course. I know for a fact that I do not have the CERN library or this lfukac script with my installation of FLUKA. I am wondering if I am supposed to have the CERN library, and if not, where I might be able to find it so that I can run the example and generate some sort of output. Any help at this point would be greatly appre!
>ciated.
>
>Christopher Knievel
>Health, Safety and Environment Assistant
>Canadian Light Source
>
>


#!/bin/sh
#
 if [ -z "$FLUPRO" ] ; then
    echo \$FLUPRO not defined
    exit 1
 fi
 echo \$FLUPRO = $FLUPRO
 F77=f77
 FTOP=${FLUPRO}
 CERNPATH=/cern/2001/lib
 FFLAGS="-O -W -fno-inline -mno-align-double -fno-automatic -fno-silent"
 FFLAGS="$FFLAGS -I${FTOP}/flukapro"
 EXE=flukahp
 OBJ=
 LIBO=
 LIBA=
 LIBJ=
 LIBF=flukahp
 LIBZ=
 OBJC=
 CERNL=
 DIRF="-L${FTOP} -L${FTOP}/flutil"
 CURDIR=`pwd`
#
 set -- `getopt o:l:m:L:O:F:Z:Ca:h $*`
 if [ $? -ne 0 ] ; then
    cat <<!

Usage: lfluka -o <executable> -l <user libraries> -a <user libraries>
              -m <main program> -L <library directories> -F <fluka library>
              -O <user lib> -C [obj files...]

!
    exit 2
 fi
#
 while [ $# -gt 0 ] ; do
    case $1 in
    -h)
cat <<!

       lfluka -o <executable> -l <user libraries> -m <main program>
              -L <library directories> -F <fluka library>
              -O <user lib> -C [obj files...]

       -o<file> name of the executable to be created, if more are
                 specified, the last one is taken, default is flukahp

       -l<lib> user library to be added in the link sequence, before
                 the fluka library, more than one library will be
                 specified and they will be searched in order. The name
                 of the file must be lib<lib>.a

       -a<lib> user library to be added in the link sequence, after
                 the fluka library, more than one library will be
                 specified and they will be searched in order. The name
                 of the file must be lib<lib>.a

       -O<lib> user library to be added in the link sequence AS OBJECT
                 file. The name of the file must be lib<lib>.a
 

       -m<prog> main program to be used, it will be extracted from
                 the fluka library and linked as first object code

       -L<dir> directory where libraries should be searched. The
                 default is ${FTOP}. This option can be repeated
                 and the directories will searched in the order given

       -F<flib> name of the main fluka library. The default value is
                 libflukahp.a

       -C add to the link sequence a standard set of CERN
                 and X libraries and their paths as well

       -h print this help file

       obj object files to be linked after <main> (if specified)
                 but before the user libraries

!
        exit
        ;;
    -o)
               EXE=${2}
               shift 2
               ;;
    -l)
               LIBO="${LIBO} -l${2}"
               shift 2
               ;;
    -O)
               LIBJ="${LIBJ} ${2}"
               shift 2
               ;;
    -a)
               LIBA="${LIBA} -l${2}"
               shift 2
               ;;
    -L)
               DIRF=
               DIR="${DIR} -L${2}"
               shift 2
               ;;
    -m)
               OBJ=${2}
               shift 2
               ;;
    -F)
               LIBF=${2}
               shift 2
               ;;
    -C)
               DIR="${DIR} -L${X11PATH} -L${CERNPATH}"
        CERNL="-lmathlib -lpawlib -lgraflib -lgrafX11 -lpacklib -lkernlib"
               shift
               ;;
    --)
               shift
               break
               ;;
    esac
 done
 DIR=${DIRF}${DIR}
 WHERE=`echo $DIR | sed -e 's/-L/ /g' -e 's/,/ /g'`
 FLU=`find $WHERE -name lib${LIBF}.a 2>/dev/null`
 if [ `echo $FLU | wc -w` -gt 1 ] ; then
    echo " "
    echo "lfluka: More than one fluka library found:"
    echo " $FLU"
    echo " First taken"
    echo " "
    FLU=`echo $FLU | awk '{print $1}'`
 fi
 if [ ! -z "$LIBJ" ] ; then
    mkdir tmpo
    cd tmpo
    for LIBJJ in $LIBJ ; do
        ar -x ${FTOP}/lib${LIBJJ}.a
    done
    cd $CURDIR
    LIBJ=`ls tmpo/*.o`
 fi

 if [ ! -z "$OBJC" ] ; then
    echo ar x ${FLU} ${OBJC}
    ar x ${FLU} ${OBJC}
 fi
 if [ ! -z "$OBJ" ] ; then
    echo ar x ${FLU} ${OBJ}.o
    ar x ${FLU} ${OBJ}.o
    OBJO=${OBJ}.o
 fi
 OBJO="${OBJO} ${OBJC}"
 LIBA="-L${CERNPATH} ${CERNL}"
 rm ${EXE}.map
 echo $F77 $FFLAGS -v -g -o ${EXE} -Xlinker -Map -Xlinker ${EXE}.map ${OBJO} $* ${LIBJ} ${DIR}${LIBO} -l${LIBF} ${LIBA}
 $F77 $FFLAGS -v -g -o ${EXE} -Xlinker -Map -Xlinker ${EXE}.map ${OBJO} $* \
 ${LIBJ} ${DIR}${LIBO} -l${LIBF} ${LIBA} ${LIBZ}
 if [ ! -z "$OBJO" ] ; then
    rm -f ${OBJO}
 fi
 if [ ! -z "$LIBJ" ] ; then
    rm -Rf tmpo
 fi



This archive was generated by hypermail 2.1.6 : Tue Jun 10 2003 - 14:47:42 CEST