@ECHO OFF REM 131213 REM After Windows 7 REM Usage: egs5run %1 , or , egs5run %1 %2 , or egs5run %1 %2 %3 REM (ex: egs5run ucsampl5 ucsampl5) REM %1.f: user code (ex: ucsampl5.f) REM %2.inp: pegs5 input (ex: ucsampl5.inp) REM %3.data: input data (optional) REM Usage 2: egs5run cl ...This is only for cleaning up. REM Set BASKET to the directory containing the EGS5 system SET BASKET=c:\egs5 REM Set COMPILER to the compiler which can be used SET COMPILER=g77 rem SET COMPILER=gfortran rem SET COMPILER=lf95 REM == Delete previous files and links === RMDIR /q include pegscommons auxcommons data 2>null rem DEL egs5job.* fort.* pgs5job.* epstar.dat ics.dat iff.dat scp.dat 2>null DEL egs5job.* fort.* pgs5job.* 2>null IF "%1"=="cl" EXIT /B REM === User Code === IF "%1" =="" (ECHO User code must be specified as a first parameter ) ELSE IF NOT EXIST %1.f ECHO %1.f does not exist REM === pegs5 input === IF NOT "%2"=="" (SET r2=%2 ) ELSE IF EXIST %1.inp (SET r2=%1 ) ELSE (ECHO pegs5 input must be specified as a second parameter EXIT /B ) REM === egs5 input ex, CG data === IF NOT "%3"=="" (SET r3=%3) ELSE IF EXIST %1.data (SET r3=%1) REM == Create egs5job.f etc === COPY %1.f+%BASKET%\egs\COPYRIGHT+%BASKET%\egs\*.f+%BASKET%\auxcode\*.f+%BASKET%\pegs\*.f egs5job.f > egs5job.err COPY %r2%.inp pgs5job.pegs5inp IF EXIST %r3%.data COPY %r3%.data egs5job.inp REM mklink /J is a windows command for symbolic link without junction.exe. mklink /J include %BASKET%\include mklink /J pegscommons %BASKET%\pegscommons mklink /J auxcommons %BASKET%\auxcommons mklink /J data %BASKET%\data echo If you want to run in debug mode, key in db. set /p INP="Dubug mode ?>" echo %time% if "%COMPILER%"=="g77" goto g77 if "%COMPILER%"=="gfortran" goto gfort if "%COMPILER%"=="lf95" goto lf95 EXIT /B :g77 if "%INP%"=="db" goto g77-db REM === Compile using g77 === echo Compile by using g77. g77 -o egs5job -O -fno-automatic egs5job.f 2> egs5job.err goto execute :g77-db REM --- debug --- echo Compile by using g77 in debug mode. g77 -o egs5job -O -fno-automatic -g -ffortran-bounds-check egs5job.f 2> egs5job.err goto execute :gfort if "%INP%"=="db" goto gfort-db REM === Compile using gfortran === echo Compile by using gfortran. gfortran -o egs5job -O -fno-automatic egs5job.f 2> egs5job.err goto execute :gfort-db REM --- debug --- echo Compile by using gfortran in debug mode. gfortran -o egs5job -O -fno-automatic -g -fbounds-check egs5job.f 2> egs5job.err goto execute REM === Compile using g95 === rem GCC 4.1.2 (g95 0931) most new at 2010/06/21 still error occured. rem g95 -o egs5job -O -fno-backslash -fsloppy-char egs5job.f 2> egs5job.err REM --- debug --- rem g95 -o egs5job -O -fno-backslash -fsloppy-char -g -fbounds-check egs5job.f 2> egs5job.err :lf95 if "%INP%"=="db" goto lf95-db REM === Compile using Lahey/Fujitsu fortran 95 (Ver.7.1) === echo Compile by using lf95. lf95 egs5job.f -nw -lst -sav -ignore:4084 goto execute :lf95-db REM --- debug --- echo Compile by using lf95 in debug mode. lf95 egs5job.f -nw -lst -sav -g -win -CHK -ignore:4084 :execute echo %time% REM === Execute egs5job.exe === egs5job.exe rem RMDIR /q include pegscommons auxcommons data 2>null