15 September 2014

593. nwchem 6.5 on debian jessie and wheezy

A new version of nwchem is out now, and this time we're seeing a new solvation model: SMD! Given how long it took to get COSMO right, the involvement of Truhlar in implementing SMD is a very good thing.

Either way, in order to be able to compile nwchem 6.5 on wheezy you'll need to do a few things:
sudo apt-get install build-essential libopenmpi-dev openmpi-bin
wget http://www.nwchem-sw.org/download.php?f=Nwchem-6.5.revision26243-src.2014-09-10.tar.gz -O Nwchem-6.5.revision26243-src.2014-09-10.tar.gz
tar xvf Nwchem-6.5.revision26243-src.2014-09-10.tar.gz 
cd Nwchem-6.5.revision26243-src.2014-09-10/


Create a patch file, e.g. 6.5.patch with the following content (most of the patches are for compatibility with gabedit, but a few of them are needed in order to compile nwchem on debian):
diff -rupN src.original/config/makefile.h src/config/makefile.h --- src.original/config/makefile.h 2014-09-15 12:28:58.153787833 +1000 +++ src/config/makefile.h 2014-09-15 12:30:58.745787161 +1000 @@ -2208,7 +2208,7 @@ endif ifeq ($(BUILDING_PYTHON),python) # EXTRA_LIBS += -ltk -ltcl -L/usr/X11R6/lib -lX11 -ldl - EXTRA_LIBS += -lnwcutil -lpthread -lutil -ldl -lz + EXTRA_LIBS += -lnwcutil -lpthread -lutil -ldl -lz -lssl LDOPTIONS = -Wl,--export-dynamic endif ifeq ($(NWCHEM_TARGET),CATAMOUNT) diff -rupN src.original/ddscf/movecs_pr_anal.F src/ddscf/movecs_pr_anal.F --- src.original/ddscf/movecs_pr_anal.F 2014-09-15 12:28:58.229787833 +1000 +++ src/ddscf/movecs_pr_anal.F 2014-09-15 12:32:33.801786632 +1000 @@ -195,7 +195,7 @@ c 22 format(1x,2(' Bfn. Coefficient Atom+Function ',5x)) write(LuOut,23) 23 format(1x,2(' ----- ------------ ---------------',5x)) - do klo = 0, min(n-1,9), 2 + do klo = 0, min(n-1,199), 2 khi = min(klo+1,n-1) write(LuOut,2) ( $ int_mb(k_list+k)+1, diff -rupN src.original/ddscf/rohf.F src/ddscf/rohf.F --- src.original/ddscf/rohf.F 2014-09-15 12:28:58.229787833 +1000 +++ src/ddscf/rohf.F 2014-09-15 12:33:12.897786414 +1000 @@ -153,7 +153,7 @@ c ilo = 1 ihi = nmo endif - call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs, + call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs, $ 'ROHF Final Molecular Orbital Analysis', $ .true., dbl_mb(k_eval), oadapt, int_mb(k_irs), $ .true., dbl_mb(k_occ)) diff -rupN src.original/ddscf/scf_vec_guess.F src/ddscf/scf_vec_guess.F --- src.original/ddscf/scf_vec_guess.F 2014-09-15 12:28:58.229787833 +1000 +++ src/ddscf/scf_vec_guess.F 2014-09-15 12:34:41.533785920 +1000 @@ -511,19 +511,19 @@ c nprint = min(nclosed+nopen+30,nmo) if (scftype.eq.'RHF' .or. scftype.eq.'ROHF') then call movecs_print_anal(basis, 1, - & nprint, 0.15d0, g_movecs, + & nprint, 0.01d0, g_movecs, & 'ROHF Initial Molecular Orbital Analysis', & .true., dbl_mb(k_eval), oadapt, int_mb(k_irs), & .true., dbl_mb(k_occ)) else nprint = min(nalpha+20,nmo) call movecs_print_anal(basis, max(1,nbeta-20), - & nprint, 0.15d0, g_movecs, + & nprint, 0.01d0, g_movecs, & 'UHF Initial Alpha Molecular Orbital Analysis', & .true., dbl_mb(k_eval), oadapt, int_mb(k_irs), & .true., dbl_mb(k_occ)) call movecs_print_anal(basis, max(1,nbeta-20), - & nprint, 0.15d0, g_movecs(2), + & nprint, 0.01d0, g_movecs(2), & 'UHF Initial Beta Molecular Orbital Analysis', & .true., dbl_mb(k_eval+nbf), oadapt, int_mb(k_irs+nmo), & .true., dbl_mb(k_occ+nbf)) diff -rupN src.original/ddscf/uhf.F src/ddscf/uhf.F --- src.original/ddscf/uhf.F 2014-09-15 12:28:58.229787833 +1000 +++ src/ddscf/uhf.F 2014-09-15 12:35:25.225785676 +1000 @@ -144,11 +144,11 @@ C enddo ihi = max(ihi-1,1) 9611 continue - call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs, + call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs, $ 'UHF Final Alpha Molecular Orbital Analysis', $ .true., dbl_mb(k_eval), oadapt, int_mb(k_irs), $ .true., dbl_mb(k_occ)) - call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs(2), + call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs(2), $ 'UHF Final Beta Molecular Orbital Analysis', $ .true., dbl_mb(k_eval+nbf), oadapt, int_mb(k_irs+nmo), $ .true., dbl_mb(k_occ+nbf)) diff -rupN src.original/mcscf/mcscf.F src/mcscf/mcscf.F --- src.original/mcscf/mcscf.F 2014-09-15 12:28:58.441787832 +1000 +++ src/mcscf/mcscf.F 2014-09-15 12:35:55.233785509 +1000 @@ -723,7 +723,7 @@ c if (util_print('final vectors analysis', print_default)) $ call movecs_print_anal(basis, $ max(1,nclosed-10), min(nbf,nclosed+nact+10), - $ 0.15d0, g_movecs, 'Analysis of MCSCF natural orbitals', + $ 0.01d0, g_movecs, 'Analysis of MCSCF natural orbitals', $ .true., dbl_mb(k_evals), .true., int_mb(k_sym), $ .true., dbl_mb(k_occ)) c diff -rupN src.original/nwdft/scf_dft/dft_mxspin_ovlp.F src/nwdft/scf_dft/dft_mxspin_ovlp.F --- src.original/nwdft/scf_dft/dft_mxspin_ovlp.F 2014-09-15 12:28:58.457787831 +1000 +++ src/nwdft/scf_dft/dft_mxspin_ovlp.F 2014-09-15 12:37:23.401785018 +1000 @@ -184,14 +184,14 @@ c call ga_sync() c call movecs_print_anal(basis,int_mb(k_non),int_mb(k_non) - & ,0.15d0,g_alpha,'Alpha Orbitals without Beta Partners', + & ,0.01d0,g_alpha,'Alpha Orbitals without Beta Partners', & .false., 0.0 ,.false., 0 , .false., 0 ) c if (nct.GE.2) then do i = 2,nct ind = int_mb(k_non+i-1) call movecs_print_anal(basis,ind,ind - & ,0.15d0,g_alpha,' ', + & ,0.01d0,g_alpha,' ', & .false., 0.0 ,.false., 0 , .false., 0 ) enddo endif @@ -350,7 +350,7 @@ c endif c endif c 9990 format(/,18x,'THERE ARE',i3,1x,'UN-PARTNERED ALPHA ORBITALS') c - call movecs_print_anal(basis, 1, nalp, 0.15d0, g_ualpha, + call movecs_print_anal(basis, 1, nalp, 0.01d0, g_ualpha, & 'Alpha Orb. w/o Beta Partners (after maxim. alpha/beta overlap)', & .false., 0.0 ,.false., 0 , .false., 0 ) c diff -rupN src.original/nwdft/scf_dft/dft_scf.F src/nwdft/scf_dft/dft_scf.F --- src.original/nwdft/scf_dft/dft_scf.F 2014-09-15 12:28:58.457787831 +1000 +++ src/nwdft/scf_dft/dft_scf.F 2014-09-15 12:38:29.713784648 +1000 @@ -2097,7 +2097,7 @@ c endif c ... jochen: replaced 0.15 at the end of the line with 'tanalyze' c which can be read from input -c call movecs_print_anal(ao_bas_han, ilo, ihi, 0.15d0, +c call movecs_print_anal(ao_bas_han, ilo, ihi, 0.01d0, call movecs_print_anal(ao_bas_han, ilo, ihi, tanalyze, & g_movecs(ispin), & blob, diff -rupN src.original/nwdft/scf_dft_cg/dft_cg_solve.F src/nwdft/scf_dft_cg/dft_cg_solve.F --- src.original/nwdft/scf_dft_cg/dft_cg_solve.F 2014-09-15 12:28:58.445787832 +1000 +++ src/nwdft/scf_dft_cg/dft_cg_solve.F 2014-09-15 12:39:25.497784337 +1000 @@ -193,7 +193,7 @@ c blob = 'DFT Final Beta Molecular Orbital Analysis' endif call movecs_fix_phase(g_movecs(ispin)) - call movecs_print_anal(basis, ilo, ihi, 0.15d0, + call movecs_print_anal(basis, ilo, ihi, 0.01d0, & g_movecs(ispin),blob, & .true., dbl_mb(k_eval+(ispin-1)*nbf), & oadapt, int_mb(k_irs+(ispin-1)*nbf), @@ -216,7 +216,7 @@ c endif call movecs_fix_phase(g_movecs) blob = 'DFT Final Molecular Orbital Analysis' - call movecs_print_anal(basis, ilo, ihi, 0.15d0, + call movecs_print_anal(basis, ilo, ihi, 0.01d0, & g_movecs,blob, & .true., dbl_mb(k_eval), & oadapt, int_mb(k_irs),

Apply it with
patch -p0 < 6.5.patch

Then build using something along the lines of
export NWCHEM_TOP=`pwd`
export LARGE_FILES=TRUE
export TCGRSH=/usr/bin/ssh
export NWCHEM_TOP=`pwd`
export NWCHEM_TARGET=LINUX64
export NWCHEM_MODULES="all python"
export PYTHONVERSION=2.7
export PYTHONHOME=/usr
export BLASOPT="-L/opt/openblas/lib -lopenblas"

export USE_MPI=y
export USE_MPIF=y
export USE_MPIF4=y
export MPI_LOC=/usr/lib/openmpi/lib
export MPI_INCLUDE=/usr/lib/openmpi/include
export LIBRARY_PATH="$LIBRARY_PATH:/usr/lib/openmpi/lib:/opt/openblas/lib"

export LIBMPI="-lmpi -lopen-rte -lopen-pal -ldl -lmpi_f77 -lpthread"
export ARMCI_NETWORK=SOCKETS

cd $NWCHEM_TOP/src

make clean
make nwchem_config
make FC=gfortran 1> make.log 2>make.err

cd $NWCHEM_TOP/contrib
export FC=gfortran
./getmem.nwchem

See other posts for using different math libs: openblas, intel mkl, AMD acml

If you're building for Jessie, set the following flags before building:
export PYTHONCONFIGDIR=config-x86_64-linux-gnu
export PYTHONLIBTYPE=so

592. Government ads in Australia

Sorry for getting political/cultural. Skip this if you prefer to read apolitical posts about linux and science.


Having lived in the US for a number of years (the US is far from perfect and there are plenty of things that bother me there, like healthcare, gun laws etc.) I'm shocked by how the government here patronises the population of Australia.

Government ads in Australia can be divided into two types:
1. You're a criminal/idiot and will be caught
2. We're going to gross you out/make you depressed to make you stop [smoking, eating, take drugs etc.]

Note that I think I always pay for using public transport, that I think it's bad to smoke, that you shouldn't be fat, and that you should use sun screen.

So what should  they do instead? I don't know.  But in my mind there's a difference between the populist and the reasonable way of doing things:

Populist: Everyone else is a criminal. This ad is actually for you, upstanding citizen, so that you can feel better about yourself, and so that you think we're doing something about the hoons and yobs that constitutes everyone else but you.

Reasonable: Instead of using shock tactics or crude populist messages we will explain why it's a good idea to do or not do something. We will give you a choice without calling you names, since we are serving at your pleasure, and not the other way around.

The bottom line is that I don't like a "the end justifies the means" mentality -- we are not serfs to the public institutions, but should only let them serve us at our pleasure. When bureaucrats find it acceptable to patronise the people they are meant to serve, then something is wrong.

Either way, I managed to find some of the videos that have disturbed me over the years in Oz. I wouldn't even say that these are the worst ones, but we'll have to make do with what's on youtube.

Category 1:
You are bad, bad person -- "This stealing will be rubbed out/ You will be caught:"

The party's over - we will get you. Oh, and these crackdowns have nothing to do with raising revenue. Of course.


Freeloaders -- you're a criminal. Note that you can't pay cash for a fare onboard, but you can pay your fine on the spot -- in cash.
Note that the public transport ticket inspectors have pushed for getting guns! Luckily the Victoria police wasn't impressed.


Category 2:

These are shown during prime time when children are watching. If I had grown up here I would've had some seriously disturbing nightmares.

Let's invent a new, emotive name and pair it with disgusting pictures -- Toxic fat:
"You can actually hear the cancer":

Let's just plain gross you out:

A mild one -- There's nothing healthy about a tan:

28 August 2014

591. Briefly: Changes to compiling nwchem 6.3 with python support on debian jessie

In general you can compile nwchem 6.3 on debian jessie just like you would on wheezy -- see here for detailed instructions: http://verahill.blogspot.com.au/2013/06/449-nwchem-63-updated-sources-compiling.html

To compile with python support you need to make an additional change in the code though:

On debian wheezy apt-file search libpython2.7.a shows 
python2.7-dev: /usr/lib/python2.7/config/libpython2.7.a

whereas on jessie it says
libpython2.7-dev: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.a

This is causing issues, as alluded to here: http://www.nwchem-sw.org/index.php/Special:AWCforum/st/id1363/how_do_I_set_the_path_to_python_....html

However, it is easy to solve by editing src/config/makefile.h to read
2357 ifdef USE_PYTHON64 2358 CORE_LIBS += $(PYTHONHOME)/lib/python$(PYTHONVERSION)/config-x86_64-linux-gnu/libpython$(PYTHONVERSION).$(PYTHONLIBTYPE) 2359 else 2360 CORE_LIBS += $(PYTHONHOME)/lib/python$(PYTHONVERSION)/config-x86_64-linux-gnu/libpython$(PYTHONVERSION).$(PYTHONLIBTYPE) 2361 endif
(Note that I'm just guessing with the x86_64 part -- I don't have an i386 system to test on)

In addition, you will need to set
export PYTHONLIBTYPE=so
before building.

My full patch file (my.patch) for version 6.3 now looks like this (it fixes a few compilation issues, and makes nwchem more compatible with gabedit):

diff -rupN src.original/config/makefile.h src/config/makefile.h
--- src.original/config/makefile.h      2013-04-15 12:41:45.016853322 +1000
+++ src/config/makefile.h       2013-04-15 12:38:44.933319544 +1000
@@ -2039,7 +2039,7 @@ endif
 
      ifeq ($(BUILDING_PYTHON),python)
 #   EXTRA_LIBS += -ltk -ltcl -L/usr/X11R6/lib -lX11 -ldl
-     EXTRA_LIBS +=    -lnwcutil  -lpthread -lutil -ldl
+     EXTRA_LIBS +=    -lnwcutil  -lpthread -lutil -ldl -lssl -lz
   LDOPTIONS = -Wl,--export-dynamic 
      endif
 ifeq ($(NWCHEM_TARGET),CATAMOUNT)
diff -rupN src.original/ddscf/movecs_pr_anal.F src/ddscf/movecs_pr_anal.F
--- src.original/ddscf/movecs_pr_anal.F 2013-04-15 12:41:45.036852381 +1000
+++ src/ddscf/movecs_pr_anal.F  2013-04-15 12:23:28.100409225 +1000
@@ -195,7 +195,7 @@ c
  22         format(1x,2('  Bfn.  Coefficient  Atom+Function  ',5x))
             write(LuOut,23)
  23         format(1x,2(' ----- ------------  ---------------',5x))
-            do klo = 0, min(n-1,9), 2
+            do klo = 0, min(n-1,199), 2
                khi = min(klo+1,n-1)
                write(LuOut,2) (
      $              int_mb(k_list+k)+1, 
diff -rupN src.original/ddscf/rohf.F src/ddscf/rohf.F
--- src.original/ddscf/rohf.F   2013-04-15 12:41:45.036852381 +1000
+++ src/ddscf/rohf.F    2013-04-15 12:23:28.100409225 +1000
@@ -153,7 +153,7 @@ c
             ilo = 1
             ihi = nmo
          endif
-         call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs, 
+         call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs, 
      $        'ROHF Final Molecular Orbital Analysis', 
      $        .true., dbl_mb(k_eval), oadapt, int_mb(k_irs),
      $        .true., dbl_mb(k_occ))
diff -rupN src.original/ddscf/scf_vec_guess.F src/ddscf/scf_vec_guess.F
--- src.original/ddscf/scf_vec_guess.F  2013-04-15 12:41:45.036852381 +1000
+++ src/ddscf/scf_vec_guess.F   2013-04-15 12:23:28.100409225 +1000
@@ -511,19 +511,19 @@ c
          nprint = min(nclosed+nopen+30,nmo)
          if (scftype.eq.'RHF' .or. scftype.eq.'ROHF') then
             call movecs_print_anal(basis, 1,
-     &           nprint, 0.15d0, g_movecs, 
+     &           nprint, 0.01d0, g_movecs, 
      &           'ROHF Initial Molecular Orbital Analysis', 
      &           .true., dbl_mb(k_eval), oadapt, int_mb(k_irs),
      &           .true., dbl_mb(k_occ))
          else
             nprint = min(nalpha+20,nmo)
             call movecs_print_anal(basis, max(1,nbeta-20),
-     &           nprint, 0.15d0, g_movecs, 
+     &           nprint, 0.01d0, g_movecs, 
      &           'UHF Initial Alpha Molecular Orbital Analysis', 
      &           .true., dbl_mb(k_eval), oadapt, int_mb(k_irs),
      &           .true., dbl_mb(k_occ))
             call movecs_print_anal(basis, max(1,nbeta-20),
-     &           nprint, 0.15d0, g_movecs(2), 
+     &           nprint, 0.01d0, g_movecs(2), 
      &           'UHF Initial Beta Molecular Orbital Analysis', 
      &           .true., dbl_mb(k_eval+nbf), oadapt, int_mb(k_irs+nmo),
      &           .true., dbl_mb(k_occ+nbf))
diff -rupN src.original/ddscf/uhf.F src/ddscf/uhf.F
--- src.original/ddscf/uhf.F    2013-04-15 12:41:45.036852381 +1000
+++ src/ddscf/uhf.F     2013-04-15 12:23:28.096409414 +1000
@@ -144,11 +144,11 @@ C
          enddo
          ihi = max(ihi-1,1)
  9611    continue
-         call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs, 
+         call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs, 
      $        'UHF Final Alpha Molecular Orbital Analysis', 
      $        .true., dbl_mb(k_eval), oadapt, int_mb(k_irs),
      $        .true., dbl_mb(k_occ))
-         call movecs_print_anal(basis, ilo, ihi, 0.15d0, g_movecs(2), 
+         call movecs_print_anal(basis, ilo, ihi, 0.01d0, g_movecs(2), 
      $        'UHF Final Beta Molecular Orbital Analysis', 
      $        .true., dbl_mb(k_eval+nbf), oadapt, int_mb(k_irs+nmo),
      $        .true., dbl_mb(k_occ+nbf))
diff -rupN src.original/mcscf/mcscf.F src/mcscf/mcscf.F
--- src.original/mcscf/mcscf.F  2013-04-15 12:41:45.000854073 +1000
+++ src/mcscf/mcscf.F   2013-04-15 12:23:23.748613695 +1000
@@ -719,7 +719,7 @@ c
       if (util_print('final vectors analysis', print_default))
      $     call movecs_print_anal(basis, 
      $     max(1,nclosed-10), min(nbf,nclosed+nact+10),
-     $     0.15d0, g_movecs, 'Analysis of MCSCF natural orbitals',
+     $     0.01d0, g_movecs, 'Analysis of MCSCF natural orbitals',
      $     .true., dbl_mb(k_evals), .true., int_mb(k_sym), 
      $     .true., dbl_mb(k_occ))
 c     
diff -rupN src.original/nwdft/scf_dft/dft_mxspin_ovlp.F src/nwdft/scf_dft/dft_mxspin_ovlp.F
--- src.original/nwdft/scf_dft/dft_mxspin_ovlp.F        2013-04-15 12:41:45.604825677 +1000
+++ src/nwdft/scf_dft/dft_mxspin_ovlp.F 2013-04-15 12:23:28.228403211 +1000
@@ -184,14 +184,14 @@ c
       call ga_sync()
 c
       call movecs_print_anal(basis,int_mb(k_non),int_mb(k_non)
-     & ,0.15d0,g_alpha,'Alpha Orbitals without Beta Partners',
+     & ,0.01d0,g_alpha,'Alpha Orbitals without Beta Partners',
      &   .false., 0.0 ,.false., 0 , .false., 0 )
 c
       if (nct.GE.2) then
       do i = 2,nct
       ind = int_mb(k_non+i-1)
       call movecs_print_anal(basis,ind,ind
-     & ,0.15d0,g_alpha,' ',
+     & ,0.01d0,g_alpha,' ',
      &   .false., 0.0 ,.false., 0 , .false., 0 )
       enddo
       endif
@@ -350,7 +350,7 @@ c      endif
 c      endif
 c 9990 format(/,18x,'THERE ARE',i3,1x,'UN-PARTNERED ALPHA ORBITALS')
 c
-       call movecs_print_anal(basis, 1, nalp, 0.15d0, g_ualpha,
+       call movecs_print_anal(basis, 1, nalp, 0.01d0, g_ualpha,
      & 'Alpha Orb. w/o Beta Partners (after maxim. alpha/beta overlap)',
      &   .false., 0.0 ,.false., 0 , .false., 0 )
 c
diff -rupN src.original/nwdft/scf_dft/dft_scf.F src/nwdft/scf_dft/dft_scf.F
--- src.original/nwdft/scf_dft/dft_scf.F        2013-04-15 12:41:45.608825490 +1000
+++ src/nwdft/scf_dft/dft_scf.F 2013-04-15 12:23:28.228403211 +1000
@@ -1774,7 +1774,7 @@ c
             else
                blob='DFT Final Beta Molecular Orbital Analysis' 
             endif
-            call movecs_print_anal(ao_bas_han, ilo, ihi, 0.15d0, 
+            call movecs_print_anal(ao_bas_han, ilo, ihi, 0.01d0, 
      &           g_movecs(ispin), 
      &           blob, 
      &           .true., dbl_mb(k_eval(ispin)), oadapt, 
diff -rupN src.original/nwdft/scf_dft_cg/dft_cg_solve.F src/nwdft/scf_dft_cg/dft_cg_solve.F
--- src.original/nwdft/scf_dft_cg/dft_cg_solve.F        2013-04-15 12:41:45.612825303 +1000
+++ src/nwdft/scf_dft_cg/dft_cg_solve.F 2013-04-15 12:23:28.220403588 +1000
@@ -183,7 +183,7 @@ c
             blob = 'DFT Final Beta Molecular Orbital Analysis'
           endif
           call movecs_fix_phase(g_movecs(ispin))
-          call movecs_print_anal(basis, ilo, ihi, 0.15d0,
+          call movecs_print_anal(basis, ilo, ihi, 0.01d0,
      &         g_movecs(ispin),blob,
      &         .true., dbl_mb(k_eval+(ispin-1)*nbf),
      &         oadapt, int_mb(k_irs+(ispin-1)*nbf),

--- src.original/config/makefile.h      2014-08-20 16:39:03.020195366 +1000
+++ src/config/makefile.h       2014-08-20 16:43:30.328351859 +1000
@@ -2355,9 +2355,9 @@ ifndef PYTHONLIBTYPE
        PYTHONLIBTYPE=a
 endif
 ifdef USE_PYTHON64
-  CORE_LIBS += $(PYTHONHOME)/lib64/python$(PYTHONVERSION)/config/libpython$(PYTHONVERSION).$(PYTHONLIBTYPE)
+  CORE_LIBS += $(PYTHONHOME)/lib/python$(PYTHONVERSION)/config-x86_64-linux-gnu/libpython$(PYTHONVERSION).$(PYTHONLIBTYPE)
 else
-  CORE_LIBS += $(PYTHONHOME)/lib/python$(PYTHONVERSION)/config/libpython$(PYTHONVERSION).$(PYTHONLIBTYPE)
+  CORE_LIBS += $(PYTHONHOME)/lib/python$(PYTHONVERSION)/config-x86_i386-linux-gnu/libpython$(PYTHONVERSION).$(PYTHONLIBTYPE)
 endif
 endif
 #

My build.sh file looks like this:

export LARGE_FILES=TRUE
export TCGRSH=/usr/bin/ssh
export NWCHEM_TOP=`pwd`
export NWCHEM_TARGET=LINUX64
export NWCHEM_MODULES="all python"
export PYTHONLIBTYPE=so
export PYTHONVERSION=2.7
export PYTHONHOME=/usr
#export BLASOPT="-L/opt/acml/acml5.3.1/gfortran64_int64/lib -lacml"
export BLASOPT="-L/opt/openblas/lib -lopenblas"

export USE_MPI=y
export USE_MPIF=y
export USE_MPIF4=y
export MPI_LOC=/usr/lib/openmpi/lib
export MPI_INCLUDE=/usr/lib/openmpi/include
#export LIBRARY_PATH="$LIBRARY_PATH:/usr/lib/openmpi/lib:/opt/acml/acml5.3.1/gfortran64_int64/lib"
export LIBRARY_PATH="$LIBRARY_PATH:/usr/lib/openmpi/lib:/opt/openblas/lib"

export LIBMPI="-lmpi -lopen-rte -lopen-pal -ldl -lmpi_f77 -lpthread"
export ARMCI_NETWORK=SOCKETS

cd $NWCHEM_TOP/src

patch -p0 < my.patch

make clean
make nwchem_config
make FC=gfortran 1> make.log 2>make.err
cd $NWCHEM_TOP/contrib
export FC=gfortran
./getmem.nwchem