anchor.diff:      rev = "v5.6.3";
       sha256 = "0dgrli9rdxffzl0nd3998fbnlnlibx7ahid2v0nhis1r1i71k1dn";
     };
  -in
  -  stdenv.mkDerivation {
  +
  +in stdenv.mkDerivation {
       name = "nwchem-${version}";
   
       src = fetchFromGitHub {
  
positive.code:       export BLASOPT="-L${openblas}/lib -lopenblas"
  
        export BLAS_SIZE="8"
  #      export USE_INTERNALBLAS=y
  #      export BLAS_SIZE=4
  #export USE_64TO32=y
        cd src
  
        echo "ROOT: $NWCHEM_TOP"
        make nwchem_config
  #      make 64_to_32
      '';
  
      installPhase = ''
        mkdir -p $out/bin
        cp $NWCHEM_TOP/bin/LINUX64/nwchem $out/bin
  
        cp -r $NWCHEM_TOP/src/data $out/share
  
        cp -r $NWCHEM_TOP/src/basis/libraries $out/share
  
        cp -r $NWCHEM_TOP/QA $out/share
      '';
  
      checkPhase = ''
        cd $NWCHEM_TOP/QA
        ./doqmtests.mpi
      '';
  
      doCheck=true;
    }
  
  
  
negative.code:     };
  
  #hardeningDisable = [ "format" ];
      nativeBuildInputs = [ perl automake autoconf libtool ];
      buildInputs = [ tcsh openssh which gfortran openmpi openblas which python ];
  
  
      postUnpack = ''
        cp -r ${ga_src}/ source/src/tools/ga-5.6.3
        chmod -R u+w source/src/tools/ga-5.6.3
      '';
  
      postPatch = ''
  
  #      find -type f -executable -exec sed -i "s:/bin/bash:${bash}/bin/bash:" \{} \;
        find -type f -executable -exec sed -i "s:/bin/csh:${tcsh}/bin/tcsh:" \{} \;
        find -type f -name "GNUmakefile" -exec sed -i "s:/usr/bin/gcc:${gcc}/bin/gcc:" \{} \;
        find -type f -name "GNUmakefile" -exec sed -i "s:/bin/rm:rm:" \{} \;
        find -type f -executable -exec sed -i "s:/bin/rm:rm:" \{} \;
        find -type f -name "makelib.h" -exec sed -i "s:/bin/rm:rm:" \{} \;
  
  
        # Overwrite script, skipping the download
        echo -e '#!/bin/sh\n cd ga-5.6.3;autoreconf -ivf' > src/tools/get-tools-github
  
        patchShebangs ./
  
      '';
  
      enableParallelBuilding = true;
  
      preBuild = ''
        ln -s ${ga_src} src/tools/ga-5.6.3.tar.gz
  
  
        export NWCHEM_TOP="`pwd`"
        export NWCHEM_TARGET="LINUX64"
  
        export ARMCI_NETWORK="MPI-MT"
        export USE_MPI=y
        export USE_MPIF=y
        export LIBMPI=`mpif90 -showme:link`
  #export LIBMPI="-lmpi_f90 -lmpi_f77 -lmpi -ldl -Wl,--export-dynamic -lnsl -lutil"
  
  
        export NWCHEM_MODULES="all python"
        export MRCC_METHODS=TRUE
  