X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=source%2Fwham%2Fsrc-NEWSC-NEWCORR%2Fmygetenv.F;fp=source%2Fwham%2Fsrc-NEWSC-NEWCORR%2Fmygetenv.F;h=b5ea4a234021874ba6b4e0cb2d8944a5a3fb14d4;hb=7308760ff07636ef6b1ee28d8c3a67a23c14b34b;hp=0000000000000000000000000000000000000000;hpb=9a54ab407f6d0d9d564d52763b3e2136450b9ffc;p=unres.git diff --git a/source/wham/src-NEWSC-NEWCORR/mygetenv.F b/source/wham/src-NEWSC-NEWCORR/mygetenv.F new file mode 100644 index 0000000..b5ea4a2 --- /dev/null +++ b/source/wham/src-NEWSC-NEWCORR/mygetenv.F @@ -0,0 +1,55 @@ + subroutine mygetenv(string,var) +C +C Version 1.0 +C +C This subroutine passes the environmental variables to FORTRAN program. +C If the flags -DMYGETENV and -DMPI are not for compilation, it calls the +C standard FORTRAN GETENV subroutine. If both flags are set, the subroutine +C reads the environmental variables from $HOME/.env +C +C Usage: As for the standard FORTRAN GETENV subroutine. +C +C Purpose: some versions/installations of MPI do not transfer the environmental +C variables to slave processors, if these variables are set in the shell script +C from which mpirun is called. +C +C A.Liwo, 7/29/01 +C + implicit none + character*(*) string,var +#if defined(MYGETENV) && defined(MPI) + include "DIMENSIONS.ZSCOPT" + include "mpif.h" + include "COMMON.MPI" + character*360 ucase + external ucase + character*360 string1(360),karta + character*240 home + integer i,n,ilen + external ilen + call getenv("HOME",home) + open(99,file=home(:ilen(home))//"/.env",status="OLD",err=112) + do while (.true.) + read (99,end=111,err=111,'(a)') karta + do i=1,80 + string1(i)=" " + enddo + call split_string(karta,string1,80,n) + if (ucase(string1(1)(:ilen(string1(1)))).eq."SETENV" .and. + & string1(2)(:ilen(string1(2))).eq.string(:ilen(string)) ) then + var=string1(3) + print *,"Processor",me,": ",var(:ilen(var)), + & " assigned to ",string(:ilen(string)) + close(99) + return + endif + enddo + 111 print *,"Environment variable ",string(:ilen(string))," not set." + close(99) + return + 112 print *,"Error opening environment file!" +#else + call getenv(string,var) +#endif + return + end