NEW Sharing area
User documentation
Admin documentation
Development resources
Download
Private area

#!/bin/bash # to change for other platform TRIPOLI_ARCH=linux-intel-64 # to customize with your own installation path TRIPOLI_HOME=/produits/sec/CODES/TRIPOLI/tripoli4.8.1 usage() { cat <<EOFusage usage : $0 datafile or usage : $0 [-s NJOY|TABPROB] [-c jef2|endfb6|endl] datafile EOFusage } COPTION=$TRIPOLI_HOME/Env/t4path.endfb6 SOPTION=NJOY while getopts s:c: Opt do case $Opt in s) if [ "$OPTARG" = "NJOY" ] || [ "$OPTARG" = "TABPROB" ]; then SOPTION=$OPTARG else SOPTION=NJOY fi;; c) if [ "$OPTARG" = "endfb6" ]; then COPTION=$TRIPOLI_HOME/Env/t4path.endfb6 elif [ "$OPTARG" = "jef2" ]; then COPTION=$TRIPOLI_HOME/Env/t4path.jef2 elif [ "$OPTARG" = "endl" ]; then COPTION=$TRIPOLI_HOME/Env/t4path.endl elif [ "$OPTARG" = "ceav5" ]; then COPTION=$TRIPOLI_HOME/Env/t4path.ceav5 else COPTION=$OPTARG fi;; \?) usage $0 exit 2;; esac done shift $(( $OPTIND - 1 )) if [ $# = 0 ]; then usage $0 exit 2 fi # needed for some linux distros. This lib/linux-intel-64 dir must contains libg2c.so.0 libgcc_s.so.1 libgfortran.so.0 libstdc++.so.6 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TRIPOLI_HOME/CODE/lib/$TRIPOLI_ARCH # convert EOL from windows to unix FICH=`basename $1` mv -f $FICH $FICH.orig tr -d '\r' < $FICH.orig > $FICH # to check if graf is asked. In this case, uses Xvfb and xdotool to get .ps and continue calculation. # need packages Xvfb, xdotool, x11-xkb-utils. Xvfb and xdotool to be in PATH GRAF=`grep GRAF $FICH | wc -l` echo "GRAF="$GRAF PROG=$TRIPOLI_HOME/CODE/bin/$TRIPOLI_ARCH/static_tripoli4 PARALLEL="" if [ -e "graphe" ]; then PARALLEL="-p graphe -t bsd " fi echo $PROG -d $FICH -s $SOPTION -c $COPTION $PARALLEL -o $FICH.listing if [ ! "$GRAF" == "0" ]; then for i in `seq 1 10`; do if [ ! -e /tmp/.X$i-lock ]; then NDISPLAY=$i; break; fi done Xvfb :$NDISPLAY -fp /produits/sec/opt/Xvfb & PID_XVFB=$! echo $PID_XVFB >> PID echo "export DISPLAY=:"$NDISPLAY".0" export DISPLAY=:$NDISPLAY".0" fi $PROG -d $FICH -s $SOPTION -c $COPTION $PARALLEL -o $FICH.listing > $FICH.out & PID_TRIPOLI=$! # allows Promethee to kill Tripoli when needed echo $PID_TRIPOLI >> PID if [ ! "$GRAF" == "0" ]; then while [ ! -e $FICH.listing ]; do echo "."; sleep 1; done PRINTED_GRAF=`grep "checking association" $FICH.listing` PRINTED_ERROR=`grep "error" $FICH.out``grep "entry not found" $FICH.out``grep ERROR $FICH.listing` while [ "$PRINTED_GRAF" == "" ] && [ "$PRINTED_ERROR" == "" ] do sleep 3 echo "Return" xdotool key Return PRINTED_GRAF=`grep "checking association" $FICH.listing` PRINTED_ERROR=`grep "error" $FICH.out``grep "entry not found" $FICH.out``grep ERROR $FICH.listing` done kill -2 $PID_XVFB rm -f /tmp/.X$NDISPLAY-lock fi wait $PID_TRIPOLI # restore initial input file mv -f $FICH.orig $FICH rm -f PID PRINTED_ERROR=`grep "error" $FICH.out``grep "entry not found" $FICH.out``grep ERROR $FICH.listing` if [ ! "$PRINTED_ERROR" == "" ]; then echo "Calculation failed. exiting...." echo $PRINTED_ERROR >&2 #echo " simulation time -1" >> $FICH.listing # turn around no longer needed in 1.1 exit 10 fihttps://www.oecd-nea.org/tools/abstract/detail/nea-1716
#!/bin/bash export MCNP_HOME=$SEC_HOME/CODES/MCNP6/MCNP_CODE/MCNP6 export MCNP_BIN=$MCNP_HOME/bin/linux/mcnp6_linux_x86_64_omp export LD_LIBRARY_PATH=$MCNP_HOME export DATAPATH=$SEC_HOME/lib/ace6 export ADVANTG_HOME=$SEC_HOME/CODES/advantg/ export ADVANTG_BIN=$ADVANTG_HOME/bin/advantg # --------------------------------------------- # check license for user # --------------------------------------------- AUTHORIZED=`grep "$USERNAME" $MCNP_HOME/authorized_users.txt | wc -l` if [[ $AUTHORIZED == 0 ]]; then echo "user <"$USERNAME"> is NOT authorized." exit -1 else echo "user <"$USERNAME"> is authorized." fi # --------------------------------------------- # split file for adv and mcnp calculations # --------------------------------------------- function getsection() { local arg1=$tmp # input file infilei=${arg1#*=} local arg2=$2 # output file for MCNP if [[ $arg2 == 0 ]]; then infilen='out_mcnp.' else infilen=${arg2#*=} fi # Split accordingly ADV=$(grep DEBUT_ADVANTG $infilei | wc -l) #look for advantg keyword if [[ $ADV == 0 ]]; then echo nul >> input_adv.adv cp $infilei i.mcnp else csplit -s --prefix output $infilei /'DEBUT_ADVANTG'/+2 /'FIN_ADVANTG'/ rm output00 mv output01 input_adv.adv csplit -s --prefix out output02 /'FIN_ADVANTG'/+2 rm out00 output02 mv out01 i.mcnp fi } # --------------------------------------------- # split file for AdvantG # --------------------------------------------- function run_advantG() { if [[ $ADV == 0 ]]; then echo no_advantg else csplit -s --prefix output2 input_adv.adv /'mcnp_input'/ csplit -s --prefix output21 output201 /'mcnp_input'/+1 echo 'mcnp_input i.mcnp' >> tmp rm input_adv.adv cat output200 tmp output2101 >> input_adv.adv rm tmp rm output2* fi } #: <<'END' # --------------------------------------------- # process number in "PID" file # --------------------------------------------- echo $$ >> PID tmp=$1 #mcnp input in argument shift INP=$* var="i=i.mcnp" #new mcnp from advantG var2="i.mcnp" #var for dosunix if [[ ( $INP == ${INP##"inp="} ) && ( $INP == ${INP##"n="} ) && ( $INP == ${INP##"i="} ) ]]; then dos2unix $var2 echo $INP getsection $INP if [[ $ADV -gt 0 ]]; then echo 'ADVANTG...' run_advantG $ADVANTG_BIN -v input_adv.adv #run AdvantG mv output/inp ./i.mcnp #move new input mcnp with modifications from AdvantG mv output/wwinp ./ #move wwinp file for mcnp calculations $MCNP_BIN $var $INP & PID_MCNP=$! echo $PID_MCNP >> PID wait $PID_MCNP else $MCNP_BIN $var $INP & PID_MCNP=$! echo $PID_MCNP >> PID wait $PID_MCNP fi else dos2unix $var2 getsection $INP if [[ $ADV -gt 0 ]]; then echo 'ADVANTG...' run_advantG $ADVANTG_BIN -v input_adv.adv #run AdvantG mv output/inp ./i.mcnp #move new input mcnp with modifications from AdvantG mv output/wwinp ./ #move wwinp file for mcnp calculations $MCNP_BIN $var $INP & PID_MCNP=$! echo $PID_MCNP >> PID wait $PID_MCNP else $MCNP_BIN $var $INP & PID_MCNP=$! echo $PID_MCNP >> PID wait $PID_MCNP fi fi PRINTED_KSEN=`grep "KSEN" *` if [ "$PRINTED_GRAF" == "" ]; then DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" python $DIR/convert_mcnp_sens_238_.py -d *o fi # --------------------------------------------- # Suppress "PID" file # --------------------------------------------- if [ -f "PID" ]; then rm -f PID fi #END ...OR SOME SCREENSHOT: