1 subroutine mygetenv(string,var)
5 C This subroutine passes the environmental variables to FORTRAN program.
6 C If the flags -DMYGETENV and -DMPI are not for compilation, it calls the
7 C standard FORTRAN GETENV subroutine. If both flags are set, the subroutine
8 C reads the environmental variables from $HOME/.env
10 C Usage: As for the standard FORTRAN GETENV subroutine.
12 C Purpose: some versions/installations of MPI do not transfer the environmental
13 C variables to slave processors, if these variables are set in the shell script
14 C from which mpirun is called.
19 character*(*) string,var
20 #if defined(MYGETENV) && defined(MPI)
21 include "DIMENSIONS.ZSCOPT"
26 character*360 string1(360),karta
30 call getenv("HOME",home)
31 open(99,file=home(:ilen(home))//"/.env",status="OLD",err=112)
33 read (99,end=111,err=111,'(a)') karta
37 call split_string(karta,string1,80,n)
38 if (ucase(string1(1)(:ilen(string1(1)))).eq."SETENV" .and.
39 & string1(2)(:ilen(string1(2))).eq.string(:ilen(string)) ) then
41 print *,"Processor",me,": ",var(:ilen(var)),
42 & " assigned to ",string(:ilen(string))
47 111 print *,"Environment variable ",string(:ilen(string))," not set."
50 112 print *,"Error opening environment file!"
52 call getenv(string,var)