Pages

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

10 August 2014

590. Home-made Titrino tip

Metrohm make a range of autotitrators called titrino, titrando etc. While they are great, they are expensive (ca AU$15,000 +/- 5,000) -- and the parts are ridiculously overpriced. For example, a simple pH electrode cable costs AU$100-150, which isn't a good use of taxpayer money.


I'm also not a big fan of their titration tips, one of which is shown in the photo below

The piece in this photo costs AU$30:
AU$30 -- reasonable?

Besides, in my own experience they don't work as well as the home made tips we used in a lab I used to work in.

So, here's a description of an alternative type of tip for doing titrations with a titrino.

The design in my old lab:

This is the tip -- it's a glass capillary which is connected to 1/16 PTFE tubing using a piece of elastic silicone tubing
The titrino is connected to the 1/16 PTFE tubing via an M6 (or 1/4-28) PTFE union.
The PTFE tubing is connected to the union using an 1/4-28 (or M6) ferrule
Like this

In my current lab:
Since I wasn't sure what the size of the capillary and the connecting silicone tubing was, I had to guess, and used the following parts:

Capillary OD 0.66 mm ID 0.5 mm
Silicone tubing OD  3 mm ID 0.5 mm
PTFE tubing 1/16 (ID 0.5 x OD 1.6 mm)
1/16 ID and 1/4 OD PEEK Ferrule
1/4-28 PTFE connector

It basically came down to what I could order online from a Chinese equivalent to ebay called taobao.

NOTE: the capillary here doesn't go that great with the silicone tubing, so I had to glue it using silicone glue. A smaller ID silicone tubing or a larger OD capillary might work better. Note also that you'd want as thin a capillary ID as possible though to avoid diffusion and leakage.

Here's the assembly (the glass capillary is a bit short since it broke):
And here's the capillary with the silicone part (the light in my office is pretty bad).
I used silicone glue to fix the capillary in place:
Some more photos of the different parts:
Very affordable Chinese capillaries -- $5 for 1,000!

1/16 inner and 1/4 outer diameter PEEK ferrule

The PEEK ferrule and the M6 (1/4-28) union


02 August 2014

589. Gnome-shell 3.12.2 -- another feature gone

The Gnome team has been removing feature after feature from different gnome-related applications. In the current version of gnome-shell (3.12.2-3) on debian testing (jessie) there's yet another feature gone -- you can't access the audio settings from the desktop.

Whether you use right- or left-click on the audio icon, you get the same menu. Clicking on the audio (left- or right-click) icon in that menu only causes the volume to go to zero.




Instead, the only way to access audio settings is now via the system settings which takes longer and involves more clicks. It's a minor nuisance if you're used to how gnome has previously worked.