20 July 2012

212. TmoleX client on Debian

Based on what Andreas Klamt has said about COSMO vs COSMO-RS I figured it might be worth taking a look at Turbomole. Turbomole is not GPLd, so whether it's a viable approach depends on whether you have a university paying for a license on your behalf. Luckily, I do, and APAC also has it on their HPC clusters.

As always, turbomole may or may not be for you -- the basis set nomenclature is definitely different from the Pople one. I'm only half-heartedly shopping around among different computational packages, but my guides may benefit someone.

The client is free and can be downloaded from here:
http://www.cosmologic.de/index.php?cosId=3016&crId=3

put TmoleXClient33_Linux64.sh in your ~/tmp
launch it by doing
sh TmoleXClient33_Linux64.sh

I don't like the idea of littering my system folders with symmlinks when you can fire up your PATH instead.
If you want to install in /opt, make sur eyou've already created /opt/COSMO and chown:ed it

Once all that's done you can do
echo 'export PATH=$PATH:/opt/COSMO/bin' >> ~/.bashrc
source ~/.bashrc

Start the binary by typing
TmoleX


211. Putting a 'Hold' on Gnome

Update 05/08/2012: The Mint people may have their own reasons for forking various GNOME components, but it seems that the removal of features in Nautilus was a direct reason for the creation of Nemo: http://www.webupd8.org/2012/08/nemo-linux-mint-team-forks-nautilus.html


There are a lot of things which are yet to come to Gnome. It's becoming increasingly clear that the Gnome people are going to push their ideas on the distros using Gnome regardless of whether the changes make sense or not. My main issue is still the destruction of gnome-screenshot, but it's clear that there are other things afoot that will make many of us unhappy. See e.g. nautilus

Actually, GNOME 3 is mostly fine. It's the removal of functionality from some of the GNOME applications which bothers me the most.

Going to KDE, XFCE, Xmonad, LXDE etc. won't bring me back gnome-screenshot. When it comes to Evolution, Epiphany etc. there are plenty of good alternatives. But Shutter etc. don't cut it when it comes to replacing gnome-screenshot. Nautilus, to me, is a good file manager and I prefer it to e.g. dolphin, thunar etc. for various reasons (dolphin because it's QT, thunar because...I don't even remember. Maybe I should have a look at it again...)

In all fairness, a subsection of the users will not care or maybe even like changes that I hate. Change isn't bad. Bad changes are bad. Change for the sake of change is bad.

Anyway. A temporary solution is to freeze gnome and not allow upgrades until you are sure that you won't be trading higher version numbers for reduced functionality.

Also, some might like the Mac-like idea of putting menus at the top of the screen, while most people using a desktop-sized screen will be severely unhappy with this (mouse has to travel a lot further). 

I suppose the idea is that you're only using one application per desktop at a time BUT WHY WAS THIS EVER THOUGHT TO BE THE WAY PEOPLE WORK?

Really, designing with non-work uses (chat/browsing) in mind seems a bit counter-productive. Literally.

Wikipedia has a list of the gnome applications which are the things that might get fiddled with. Basically, google for upcoming changes and prevent the heck out of them.

Early warning about stuff about to be changed in GNOME 3.6: 
see e.g. http://www.phoronix.com/scan.php?page=news_item&px=MTEzMzY
empathy
clutter
evolution
mutter
nautilus

Additional stuff to consider freezing
gnome-screenshot
gnome-shell
epiphany-browser
evince

Again, change may be good, but we've been burned before, so better to freeze stuff now, and make deliberate decisions about what changes to allow once they've been tested.

So how to freeze specific packages?
sudo su
echo "empathy hold"|dpkg --set-selections
echo "epiphany-browser hold"|dpkg --set-selections
echo "evince hold"|dpkg --set-selections
echo "gnome-shell hold"|dpkg --set-selections
echo "gnome-screenshot hold"|dpkg --set-selections
echo "mutter hold"|dpkg --set-selections
echo "mutter-common hold"|dpkg --set-selections
echo "nautilus hold"|dpkg --set-selections

Note that this may hold other packages, which list the above packages as dependencies, back as well. Still, better to make informed choices.

19 July 2012

210. Compiling CPMD on Debian Wheezy

[To those coming here from cpmd.org -- I wasn't meant to post in the bug tracking section, but unfortunately I also can't delete posts]

Here's how to compile cpmd on Wheezy. CPMD is the standard implementation of ab initio Carr-Parrinello method for molecular dynamic and would thus be useful to have at hand.

It took a fair while to hammer out the method, so this post might not read very well. Right now I'm having crashes after the binary has been running for a while -- this point towards system resources more than anything else.


WARNING:
 This involves patching a file -- you never know IF that causes problems with the output. To the best of my knowledge, it should be safe.

There's no reason to think that Ubuntu and Linux mint won't work just as well (i.e. you may want to look here if you're trying to compile for Ubuntu or Mint)

Errors I encountered on the road are found at the end of the post together with solutions.




COMPILING THE BINARY

First you need to request a username and password from http://cpmd.org/. That'll take a few days.

You may have to install libopenmpi-dev libfftw3-dev libblas-dev first

Once your application is approved and you've downloaded your file (in my case cpmd-v3_15_3.tar.gz) copy it to ~/tmp, then

tar -xvf cpmd-v3_15_3.tar.gz
cd CPMD/CONFIGURE

create CONFIGURE/LINUX-x86_64-DEBIAN
     IRAT=2
     CFLAGS='-c -O2 -Wall'
     CPP='/lib/cpp -P -C -traditional'
     CPPFLAGS='-D__Linux -D__PGI -D__GNU -DFFT_FFTW3 -DPARALLEL -DPOINTER8'
     FFLAGS='-c -O2 -fcray-pointer -fno-whole-file -fsecond-underscore'
     LFLAGS='-lfftw3 -lfftw3f -I/usr/include -lblas -llapack -lpthread -lmpi'
     FFLAGS_GROMOS='  $(FFLAGS)' 
      FC='mpif77 -fbounds-check'
      CC='mpicc'
      LD='mpif77 -fbounds-check'


cd ../

Edit the following lines in wfnio.F and change them to:
 15       CHARACTER(len=*) TAG
 63         IF(TAG(1:2).EQ.'NI') THEN
201       IF(TAG(1:2).NE.'NI') THEN
271         IF(TAG(1:2).EQ.'NI') THEN
(See below for the reasons why)

./mkconfig.sh LINUX-x86_64-DEBIAN > Makefile
make -j5

You should now have a working binary. This was a real PITA to sort out.

sudo mkdir /opt/cpmd
sudo chown $USER /opt/cpmd
cp cpmd.x /opt/cpmd


Done! Almost...



Time to get some pseudopotential files from http://cpmd.org/download

Download the following files:
http://cpmd.org/downloadable-files/authentication/contributions/pseudo_std.tar.gz
http://cpmd.org/downloadable-files/authentication/contributions/pseudo_ext.tar.gz
http://cpmd.org/downloadable-files/authentication/contributions/pseudo_vdb.tar.gz
And some test files:
http://cpmd.org/downloadable-files/authentication/contributions/cpmd-test.tar.gz
Put them in /opt/cpmd
cd /opt/cpmd
ls *.gz|xargs -I {} tar xvf {}
echo "export PP_LIBRARY_PATH=/opt/cpmd/PP_LIBRARY" >>~/.bashrc
echo "export PATH=$PATH:/opt/cpmd" >>~/.bashrc.
source ~/.bashrc

Note:
For some reason cpmd refuses to read my pseudopotential files unless I remove the .psp ending. Doesn't matter how eagerly I'm trying to point cpmd in the right direction. You can quickly mv all the psp files like this:
cp /opt/cpmd/pseudo_extlib/*.psp /opt/cpmd/PP_LIBRARY/
cd  /opt/cpmd/PP_LIBRARY/
ls *.psp|sed 's/\./\t/g'|gawk '{print $1}'|xargs -I {} mv {}.psp {}
mv Cu_MT_PBE_SEMI_2.08.psp Cu_MT_PBE_SEMI_2.08
mv Ga.1_GO_LDA.psp Ga.1_GO_LDA
Not that this will guarantee that it'll work. I often find myself putting the full relative path in the .in file:

&ATOMS
*../../PP_LIBRARY/O_MT_PBE KLEINMAN-BYLANDER
LMAX=P
Anyway

Test your binary
cd /opt/cpmd/CPMD-test/vdw
mpirun -n 4 cpmd.x ch4-ch4.inp


 ****************************************************************
 *                                                              *
 *                            TIMING                            *
 *                                                              *
 ****************************************************************
 SUBROUTINE            CALLS         CPU TIME        ELAPSED TIME
        HIP               12            19.64               21.55
    FFT-G/S              734            11.94               12.02
     GCENER               12             4.82                4.86
      FWFFT               72             4.80                4.85
    INVFFTN              100             3.93                3.93
     INVFFT               61             3.82                3.86
    HOCKNEY                1             3.20                3.31
     FFTCOM              133             2.34                2.33
       VPSI               21             2.22                2.20
     FWFFTN               56             2.14                2.15
     XCENER               12             1.70                1.71
     RHOOFR               11             1.59                1.61
     GRADEN               12             1.58                1.58
      PHASE              133             1.46                1.43
     LOADPA                1             1.30                1.31
      ODIIS               11             0.96                0.99
   N-FFTCOM              156             0.80                0.82
    VOFRHOH               12             0.61                0.62
    VOFRHOB               12             0.57                0.57
     EICALC               12             0.43                0.43
      NUMPW                1             0.31                0.31
      ATRHO                1             0.26                0.29
 ----------------------------------------------------------------
 TOTAL TIME                             70.43               72.74
 ****************************************************************

       CPU TIME :    0 HOURS  1 MINUTES 11.75 SECONDS     
   ELAPSED TIME :    0 HOURS  1 MINUTES 14.21 SECONDS     
 ***      CPMD| SIZE OF THE PROGRAM IS  141512/ 484936 kBYTES ***

 PROGRAM CPMD ENDED AT:   Thu Jul 19 12:50:17 2012  

 ================================================================
 = COMMUNICATION TASK  AVERAGE MESSAGE LENGTH  NUMBER OF CALLS  =
 = SEND/RECEIVE              370967. BYTES                 51.  =
 = BROADCAST                  10413. BYTES                297.  =
 = GLOBAL SUMMATION            1153. BYTES                190.  =
 = GLOBAL MULTIPLICATION          0. BYTES                  1.  =
 = ALL TO ALL COMM          8815282. BYTES                313.  =
 =                             PERFORMANCE          TOTAL TIME  =
 = SEND/RECEIVE             3014.256  MB/S           0.006 SEC  =
 = BROADCAST                 271.033  MB/S           0.011 SEC  =
 = GLOBAL SUMMATION            1.996  MB/S           0.220 SEC  =
 = GLOBAL MULTIPLICATION       0.000  MB/S           0.001 SEC  =
 = ALL TO ALL COMM           643.149  MB/S           4.290 SEC  =
 = SYNCHRONISATION                                   0.067 SEC  =
 ================================================================


Almost completely and utterly done.

There are a few more things to do for a full install:
 1. cpmd2cube
Download cpmd2xyz-scripts.xyz and cpmd2cube.tar.gz and put them in ~/tmp

cd ~/tmp
tar xvf cpmd2cube.tar.gz
cd cpmd2cube/
./Configure  Linux-PC-GFORTRAN-FFTW >Makefile


Edit the Makefile
 11 #--------------- Configuration

 12 FC  = mpif77
 13 FFLAGS  =  -ffree-form -D__GFORTRAN -DFFT_FFTW3 -std=gnu -O2  -fno-whole-file
 14 LFLAGS  =
 15 LIBS    =  -lfftw3

Then compile:
make

cp *.x /opt/cpmd/

2. cpdm2xyz-scripts
tar xvf cpmd2xyz-scripts.tar.gz
mv *xyz.pl /opt/cpmd/



ERRORS I encountered on the way to success:


Why I patched wfnio.F



 (K+E1+L+N+X)           TOTAL ENERGY =          -15.69316800 A.U.
 (K)                  KINETIC ENERGY =           11.26654720 A.U.
 (E1=A-S+R)     ELECTROSTATIC ENERGY =          -14.51438081 A.U.
 (S)                           ESELF =           15.95769122 A.U.
 (R)                             ESR =            0.61466148 A.U.
 (L)    LOCAL PSEUDOPOTENTIAL ENERGY =           -8.04105016 A.U.
 (N)      N-L PSEUDOPOTENTIAL ENERGY =            1.58864226 A.U.
 (X)     EXCHANGE-CORRELATION ENERGY =           -5.99292649 A.U.
          GRADIENT CORRECTION ENERGY =           -0.34038005 A.U.

 NFI      GEMAX       CNORM           ETOT        DETOT      TCPU
   1  2.271E-02   2.070E-03     -15.693168    0.000E+00     12.31
   2  2.968E-03   6.595E-04     -16.042408   -3.492E-01     12.23
   3  2.302E-03   2.795E-04     -16.073138   -3.073E-02     12.41
   4  1.202E-03   1.028E-04     -16.079251   -6.113E-03     13.11
   5  5.911E-04   3.645E-05     -16.080017   -7.655E-04     12.86
   6  2.152E-04   1.926E-05     -16.080119   -1.020E-04     12.27
   7  7.666E-05   8.749E-06     -16.080151   -3.277E-05     12.24
   8  4.416E-05   4.054E-06     -16.080159   -8.141E-06     12.54
   9  2.411E-05   1.531E-06     -16.080162   -2.318E-06     12.14
  10  1.203E-05   5.610E-07     -16.080162   -3.935E-07     12.22
  11  6.744E-06   2.833E-07     -16.080162   -3.662E-08     12.31
At line 2 of file ./wfnio.f
Fortran runtime error: Actual string length is shorter than the declared one for dummy argument 'tag' (2/10)

Line 2 in wfnio.f is 

      SUBROUTINE W_WFNIO(NW,IERROR,NSTATE,C,TAG)


I tried compiling with my own openblas libraries:

Used the following config file base:
     IRAT=2
     CFLAGS='-c -O1 -Wall'
     CPP='/lib/cpp -P -C -traditional'
     CPPFLAGS='-D__Linux -D__PGI -D__GNU -DFFT_FFTW -DPOINTER8  -DPARALLEL'
      FFLAGS='-c -O2 -fcray-pointer -fno-whole-file -fsecond-underscore'
     LFLAGS='-L/opt/fftw/fftw-2.1.5/double/lib -l:libfftw.a -I/opt/fftw/fftw-2.1.5/double/include -I/usr/include -L/opt/openblas/lib -lopenblas'
     FFLAGS_GROMOS='  $(FFLAGS)'
      FC='mpif90'
      CC='mpicc'
      LD='mpif90'


Tested with:
!  Wavefunction optimization using default setting
!
 &CPMD
    OPTIMIZE WAVEFUNCTION
 &END
 &SYSTEM
   SYMMETRY
    1
   CELL
    10.2612  1.0    1.0   0.0 0.0 0.0
   CUTOFF
   13.
 &END
 &ATOMS
*SI_SGS  KLEINMAN-BYLANDER
  LMAX=P
   8
           .00000      .00000      .00000    1
           .00000     5.13000     5.13000    1
          5.13000      .00000     5.13000    1
          5.13000     5.13000      .00000    1
          2.56500     2.56500     2.56500    1
          2.56500     7.69500     7.69500    1
          7.69500     2.56500     7.69500    1
          7.69500     7.69500     2.56500    1
 &END

And here's the output (NOTE: it wouldn't have worked anyway due to missing pseudopot files. But that's unrelated):
 PROGRAM CPMD STARTED AT: Wed Jul 18 20:41:51 2012
 SETCNST| USING: CODATA 2006 UNITS

[LOTS OF STUFF CUT OUT]
 EXCHANGE CORRELATION FUNCTIONALS
    LDA EXCHANGE:                                            NONE
    LDA XC THROUGH PADE APPROXIMATION
    S.GOEDECKER, J.HUTTER, M.TETER PRB 54 1703 (1996)

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:#0  0x2B3D01CFA667#1  0x2B3D01CFAC34#2  0x2B3D026F64EF#3  0x2B3CFFD8CBF7Segmentation fault


Valgrind told me:

 EXCHANGE CORRELATION FUNCTIONALS 
    LDA EXCHANGE:                                            NONE
    LDA XC THROUGH PADE APPROXIMATION
    S.GOEDECKER, J.HUTTER, M.TETER PRB 54 1703 (1996)

==1406== Invalid read of size 8
==1406==    at 0x59D0BF7: dcopy_k (in /opt/openblas/lib/libopenblas_barcelona-r0.1.1.so)
==1406==    by 0x485152: setsc_ (in /home/me/tmp/CPMD/cpmd.x)
==1406==    by 0x4264EE: cpmd_ (in /home/me/tmp/CPMD/cpmd.x)
==1406==    by 0x4262EE: main (in /home/me/tmp/CPMD/cpmd.x)
==1406==  Address 0x30016a9908 is not stack'd, malloc'd or (recently) free'd
==1406== 

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7737667
#1  0x7737C34
#2  0x81314EF
#3  0x59D0BF7
==1406== 
==1406== HEAP SUMMARY:
==1406==     in use at exit: 2,152,258 bytes in 2,802 blocks
==1406==   total heap usage: 10,893 allocs, 8,091 frees, 16,699,612 bytes allocated
==1406== 
==1406== LEAK SUMMARY:
==1406==    definitely lost: 567 bytes in 20 blocks
==1406==    indirectly lost: 2,973 bytes in 9 blocks
==1406==      possibly lost: 0 bytes in 0 blocks
==1406==    still reachable: 2,148,718 bytes in 2,773 blocks
==1406==         suppressed: 0 bytes in 0 blocks
==1406== Rerun with --leak-check=full to see details of leaked memory
==1406== 
==1406== For counts of detected and suppressed errors, rerun with: -v
==1406== Use --track-origins=yes to see where uninitialised values come from
==1406== ERROR SUMMARY: 591 errors from 4 contexts (suppressed: 4 from 4)
Segmentation fault

Ergo, it seems to be a problem with the openblas libs -- but they've work just fine with nwchem and gromacs...who knows? It might be due to mixing debian fftw3 and my own openblas.

I compiled openblas according to http://verahill.blogspot.com.au/2012/05/nwchem-with-openblas.html



If you're having problems with the output below it is because fftw 2 and fftw 3 are not compatible and CPDM uses the fftw 2 iface by default.


mltfft.o: In function `mltfft_fftw_': mltfft.f:(.text+0x958): undefined reference to `fftw_f77_create_plan_' mltfft.f:(.text+0x9af): undefined reference to `fftw_f77_' mltfft.f:(.text+0x9c2): undefined reference to `fftw_f77_destroy_plan_' mltfft.f:(.text+0xaee): undefined reference to `fftw_f77_create_plan_' mltfft.f:(.text+0xb4d): undefined reference to `fftw_f77_' mltfft.f:(.text+0xd03): undefined reference to `fftw_f77_' mltfft.f:(.text+0xdc4): undefined reference to `fftw_f77_' mltfft.f:(.text+0xe6e): undefined reference to `fftw_f77_create_plan_' mltfft.f:(.text+0xe8f): undefined reference to `fftw_f77_create_plan_' collect2: ld returned 1 exit status make: *** [cpmd.x] Error 1

You can either
1. Install fftw2 (sudo apt-get install fftw-dev, fftw2), and put -l:libfftw.so.2 -l:librfftw.so.2 in your LFLAGS.
or
2. Set -DFFT_FFTW3 instead of -DFFT_FFTW.

209. Quantum Espresso on Debian

Quantum Espresso seems to be a fairly capable software package for ab initio QM and MD calculations. In their own words:
"Quantum ESPRESSO is an integrated suite of Open-Source computer codes for electronic-structure calculations and materials modeling at the nanoscale.It is based on density-functional theory, plane waves, and pseudopotentials."

Reading between the lines it seems to be particularly geared towards solid state simulations, but given that I haven't used it much (I'm just an interested observer), you may take that statement with a grain of salt.

Anyway. Here's how to get it up and running.
Don't ask me how to USE these pieces of software though. For that, read the documentation at the Quantum Espresso website or look in /opt/QE/Doc


The download page can be found here: http://qe-forge.org/frs/?group_id=10. You won't need all the packages, since the espresso-5.0.tar.gz bundles most of them.

1. Housekeeping:
sudo mkdir /opt/QE
sudo chown $USER /opt/QE
mkdir ~/tmp/QE -p
cd ~/tmp/QE

2. Downloading:
wget http://qe-forge.org/frs/download.php/211/espresso-5.0.tar.gz
wget http://qe-forge.org/frs/download.php/214/PWgui-5.0.tgz
wget http://qe-forge.org/frs/download.php/204/xspectra-5.0.tar.gz

3. Extraction:
tar xvf espresso-5.0.tar.gz
tar xvf PWgui-5.0.tgz
tar xvf xspectra-5.0.tar.gz

4. Compilation:
cd espresso-5.0/

Edit environment_variables and set them to e.g.

PREFIX=/opt/QE
TMP_DIR=/scratch
PARA_PREFIX=" mpirun -n 3"

Don't know if any of those params are ever read though.

The following parameters will depend on your system. I tried compiling with openblas without luck. who knows? It might be due to mixing debian fftw3 and my own openblas.

Instead, install libblas-dev, libfftw3-dev, libopenmpi-dev etc.

./configure --prefix=/opt/QE/bin --exec-prefix=/opt/QE/bin/ FC=mpif90 BLAS_LIBS=-lblas LIBS="-lmpi -lopen-rte -lopen-pal -ldl -lmpi_f77 -lpthread" CPPFLAGS="-I/usr/lib/openmpi/include"
cd PW/
make

cd ../
make all -j5 
echo 'export PATH=$PATH:/opt/QE/bin' >>~/.bashrc
echo 'export PSEUDO_DIR=/opt/QE/pseudo' >>~/.bashrc
(replace 5 with  the number of cores you compile with +1)

cp * -R /opt/QE/
source ~/.bashrc

For some reason I had to move everything by hand. Oh well.

[It should be enough to set the env var PSEUDO_DIR to point at /opt/QE/pseudo, but it didn't work for me. Instead I symmlinked the entire /opt/QE to ~/espresso. Desperate? Sure...
ln -s /opt/QE/ /home/me/espresso]


5. Testing PW
Some examples are found in /opt/QE/PW/examples
cd /opt/QE/PW/examples/example01
./run_examples

/opt/QE/PW/examples/example01 : starting
This example shows how to use pw.x to calculate the total energy and
the band structure of four simple systems: Si, Al, Cu, Ni.
  executables directory: /opt/QE/bin
  pseudo directory:      /opt/QE/pseudo
  temporary directory:   /scratch
  checking that needed directories and files exist... done
  running pw.x as: mpirun -n 3 /opt/QE/bin/pw.x
  cleaning /scratch... done
  running the scf calculation for Si... done
  running the band-structure calculation for Si... done
  cleaning /scratch... done
  ..
  cleaning /scratch... done
  running the scf calculation for Ni... done
  running the band-structure calculation for Ni... done
Or you can try

cd /opt/QE/PW/tests/
./check-pw.x.j
A number of tests will now be executed.  Most will pass.
IF YOU DON'T HAVE A vdw_kernel_table file one of the tests will fail.

6. Installing PWgui
Assuming you downloaded and extracted the PWgui-5.0.tgz file in step 2 above.
sudo apt-get install itk3 iwidgets4
cd ~/tmp/QE/
mv PWgui-5.0 /opt/QE/
cd /opt/QE/bin
ln -s /opt/QE/PWgui-5.0/pwgui /opt/QE/bin/pwgui

Start by typing
pwgui


settings
You can try e.g. opening /opt/QE/PW/examples/example01/results/al.scf.cg.in if you ran the test in step 5 above. Then run it.


7. Installing Xspectra
This assumes you downloaded and extracted as shown in steps 2-3 above.
cd ~/tmp/QE/
mv XSpectra/ espresso-5.0/
cd espresso-5.0/XSpectra/
make
cd ..
mv XSpectra/ /opt/QE/
cd /opt/QE/bin
ln -s /opt/QE/XSpectra/src/xspectra.x xspectra.x



Notes: in an ideal world the --prefix during configure should suffice in telling a program where to install. No luck for me here though. Also, I had to start the compile in the PW directory and only by using make without any switches, or there would be complaints about a missing libpw.a

13 July 2012

208. Weird things with desktops -- nvidia cockup?

Just in case someone else is having an equally entertaining Friday the 13th (of July 2012).

So, I had a little gnome 3 crash. You know the ones with the frowny screen and a message saying that "yeah, we probably could have let you save everything you're working one but screw you 'cos we're logging you out"? (hmm...don't remember seeing that with gnome 2/metacity -- have we in fact been turned into Metro/Win8 guinea pigs?!)

Well, anyway, I had one of those and rebooted.

I got to gdm3, logged in and...nothing. I mean, I saw the desktop background, but no menus, nothing. Nothing at all. Moving the mouse to the top left corner would give me the typical gnome-shell splash pattern and make the screen a bit darker. I didn't get anything else though (like a list over programs, icons or anything). Oh, and the conky stuff briefly flashed by each time (but in the top left area instead of flush to the right side of the screen)

Given that I played around with testing different desktops recently I figured I might have upset the update-alternatives balance, and played around with --config x-window-manager and --config x-session-manager. I mean, I was hoping that the lack of a menu of some sort was due to having the wrong window manager, in spite of all the signs pointing to me actually using gnome-shell.

That not working I spent another hour playing with installing and uninstalling nvidia. For some reason smxi pulled in the 173 driver, before replacing it with 302. Every time. Finally, I managed to get everything to the point where I could do startx with the nouveau drivers installed.

Not that things were perfect -- in fact my screen was scaled to 1024*768 (supposed to be 1920x1280), and the flicker whenever I moved my mouse was not funny, but at least it kind of worked.

So back to the terminal, sudo rmmod nouveau, sudo smxi, install the nvidia driver again -- but this time selecting nvidia current instead of debian-nvidia, and then startx

Huh. This time I kind of got the icon panel and the bottom panel, and the gnome-shell hot corner worked ok. It's almost like...no way...is it pretending I have two displays???

I then went to System settings/Displays and the bloody thing had set it up so there were two active display (I don't OWN two displays and certainly did not set this willingly).

Here it's been deactivated. But seriously, wtf???

So if you find yourself in a similar situation without panels and stuff: check your settings. Now how the hell did this come about? And who can I blame? Debian? Nvidia? Nvidia has been the cause of most of my more severe problems with debian...I just wish nouveau was a better alternative than it currently is for my setup.

PS I do realise that some of the language in the post above is more fitting for a valley girl, but screw this: I'm a busy person with a tight schedule (semester starts in two weeks and still hammering away on lectures, not to mention research) who lost three valuable Friday afternoon hours on a stupid thing. Not happy.

12 July 2012

207. apt-get, apt-cacher-ng and hash sum mismatch

Update: Another day and we're back to the same crap with Hash sum mismatches. It's getting old...however, I'm beginning to suspect it's not the mirror, but my apt-cacher-ng.

I was getting a bit peeved with getting intermittent messages about 'hash sum mismatch' etc. when trying to do sudo apt-get update

Ign http://dl.google.com stable/main Translation-en                                                                                                                                                                                         
Fetched 17.1 MB in 9s (1,736 kB/s)                                                                                                                                                                                                          
W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_main_binary-amd64_Packages  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_contrib_binary-amd64_Packages  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_non-free_binary-amd64_Packages  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_contrib_i18n_Translation-en  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_main_i18n_Translation-en  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_non-free_i18n_Translation-en  Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.


So I took action:
sudo rm -rf /var/cache/apt-cacher-ng/*

But then
sudo apt-get update    
Get:1 http://192.168.1.1 testing InRelease [190 kB]
Err http://192.168.1.1 testing InRelease                                                                                                                        
Ign http://192.168.1.1 stable InRelease                                                                                                                         
Get:2 http://192.168.1.1 stable Release.gpg [1,672 B]                                                                                    
..
Fetched 7,004 kB in 7s (965 kB/s)                                                                                                                                                                                                           
Reading package lists... Done
W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://192.168.1.1 testing InRelease: File /var/lib/apt/lists/partial/192.168.1.1:3142_ftp.iinet.net.au_debian_debian_dists_testing_InRelease doesn't start with a clearsigned message

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/InRelease  

so I

sudo apt-get install debian-keyring

which didn't solve anything

Solution:
Edit you /etc/apt/sources.list and replace all instances of testing with wheezy, e.g.

deb http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/ wheezy main contrib non-free
deb http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/ stable main contrib non-free

I don't know if this has to do with the transition towards freezing wheezy, but basically, if you're having problems like that, have a look at what's actually on the mirror you're using. In my case I had a look at ftp://ftp.iinet.net.au/debian/debian/dists/ and found no 'testing' directory.


It also took care of these related messages on a different node:

Fetched 7,493 kB in 8s (885 kB/s)
W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/contrib/binary-amd64/PackagesIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/contrib/i18n/Translation-enIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/non-free/binary-amd64/PackagesIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/non-free/i18n/Translation-enIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/main/i18n/Translation-enIndex  MD5Sum mismatch

W: Failed to fetch http://192.168.1.1:3142/ftp.iinet.net.au/debian/debian/dists/testing/main/binary-amd64/PackagesIndex  MD5Sum mismatch

206. Chrome, cookies and incessant spying

With age and added responsibilities I'm becoming grumpier and grumpier.

I read lxer.com everyday since it provides a good aggregation of linux-related news. On clicking on this link to h-online I was shown a pop-up in the top left corner letting me know that h-online uses cookies, and by clicking close my consent to be tracked is assumed. A link was given to a page where I could opt out, and another link to etracker was provided on that page. Clicking on that and eventually getting past the captcha told me that etracker will no longer track my browser (so I have to do it for chrome, chromium, and iceweasel? And on every one of my six computers?)

I signed up for my first dial-up internet connection in 1996, and as far as I can remember cookies were heavily discussed already back then. However -- and again this is as far as I can remember -- accepting cookies wasn't necessary since not every website + their mum was using them to track you. 

As far as I can see there are a few reasons why websites want to set first or third party cookies:
* Ads. Targeted ads.
* Information. Which is then sold to companies tailoring ads.
* Automatic log-in and customisations
* Because everyone else is doing it


I've cleared my cache, but I saw cookies from the Swedish ministry of foreign affairs, among others. I find it difficult to imagine a legitimate reason for them to set a local cookie on my computer. I don't think there is any evil intent behind it -- instead it's probably a case of 'why not?'.


It's easy enough to set your browser to block all cookies or to automatically delete them on closing your browser. Some browsers allow you to accept cookies on a site/provider basis. This easily leads to you having to click pop-up after pop-up after pop-up...

The ideal case -- from the point of the user -- is one where you block all cookies and add exceptions for sites that YOU deem have legitimate reasons to set cookies and where YOU benefit from having cookies set.

A little experiment. Try disabling cookies completely, and then log-in to your blogger or gmail account. Try adding an exception for google servers only, then log in to blogger -- you get stuck in a nice little loop which only gets broken if you add an exception for blogger.

In fact, I can't even do much on the university network without allowing cookies -- the university wants to set cookies in order to allow me to do just about anything.

Anyway, after that rant, here's how you might want to manage your cookies in google chrome:
Got to settings in google chrome and type in cookies

Click on Content Settings.
Check:
* Block sites from settings any data
* Block third party cookies and site data
Then click on Manage Exceptions 

 Add sites YOU feel should have the right to add cookies.
With google and blogger you have little choice: in order to use those sites you need to enable cookies.
Note that wildcards are added using [*.]


You may also want to clear you cache to get rid of cookies which have already been set.
Continuously add exceptions for sites which you want to grant the ability to set cookies. 

You can also add sites by clicking on the cookie icon to the right of the URL field in your browser:

Take a look at what cookies are set every now and again.

If you find that you have plenty of cookies like these:

it's likely because you have the Google Opt Outs enabled:




10 July 2012

205. Debian, TeXLive and style files: making lecture slides

Because I keep forgetting...(my blog serves as a public notebook). I don't make any presumptions about this being terribly new or relevant to a lot of people.

This post expanded into something quite different from what was indicated by the title:

Here's the short version:
kpsewhich -var-value=TEXMFHOME
$HOME/texmf
ls $HOME/texmf
ls: cannot access /home/me/texmf: No such file or directory
mkdir ~/texmf/tex/latex -p

Copy your style files e.g.
cp lecturestyles/ -R ~/texmf/tex/latex

(sudo) texhash

And here goes the long version:

I hate powerpoint presentations --- even if they are made with latex (time to make it a generic trademark?) but the university I'm working at considers blackboards too old-fashioned. Apparently the maths and physics departments are still fighting the good fight, but my department has rolled over. Why do we let people who don't teach decide how we do things? Anyway...

For my lecturs, slides, seminar talks etc. I'm using a fairly heavily edited version of this
http://robjhyndman.com/researchtips/latex-templates-for-monash/
for making slides. It's served me well for giving seminar talks etc. I'm currently putting together a new course* and it's now becoming more important than ever to make sure I organise my material already from the outset.

So, a few things to do:
1. Organise everything neatly in folders:
main.tex

/lectures/silicon.tex
/lectures/aluminium.tex

images/aluminium/
images/algorithms/opa

etc.

Beware: when you include images in silicon.tex but call silicon.tex via main.tex, the paths are relative to main.tex, i.e. it's not ../images/aluminium/ore.eps but images/aluminium/ore.eps.

2. Finally move the style files from the local folder (i.e. where the tex file is) to the destination indicated by TEXMFHOME variable:


kpsewhich -var-value=TEXMFHOME
/home/me/texmf
ls $HOME/texmf
ls: cannot access /home/me/texmf: No such file or directory
mkdir ~/texmf/tex/latex -p

Copy your style files e.g.
cp lecturestyles/ -R ~/texmf/tex/latex/

(sudo) texhash 

3. Make liberal use of \include{} in latex
Basically -- you have a document with the preamble

\documentclass[14pt]{beamer}
\usepackage[version=3]{mhchem}
\usepackage{array}
\usepackage{color}
\usetheme{styles/Hytex}
 \def\biz{\begin{itemize}[<+-| alert@+>]}
 \def\eiz{\end{itemize}}
 \def\ben{\begin{enumerate}[<+-| alert@+>]}
 \def\een{\end{enumerate}}

\title{Chemistry 3456}
\author{Verahill}
\date{}

\begin{document}
\include{lectures/introduction}
\include{lectures/silicon}
\include{lectures/phosphorous}
\include{lectures/aluminium}
\end{document}

And then you create individual files for each lecture or topic e.g. silicon.tex:

\title{Silicon: spines, shells and minerals}
\begin{frame}
 \titlepage
 \centerline{Department of Chemistry}
 \centerline{\includegraphics[width=8cm]{styles/myunilogo}}
 \centerline{\small\color[rgb]{0.01,0.33,0.58}}
\end{frame}

\section{Silicon}
\begin{frame}
Today's lecture will cover:
biz
\item Bouncy balls
\item Froth reductors
eiz
\end{frame}

without preambles or anything of that sort.

It's still a bit annoying that you can't set the location of the aux, nav, log etc. files in each .tex document since the clutter offends my eyes. But hey, there's a limit even to my grumpiness.

4. \usepackage{}
Try looking for chemistry related packages which are installed on your system
find /usr/share/texlive/texmf-dist/tex/latex/ -name "*.sty"|grep [cC]hem

The ones which show up on my system are:
achemso, mychemistry, chemstyle, chemcompounds, mhchem, chemmacros, chemarrow and chemfig

mhchem is most likely the most useful one:
\usepackage[version=3]{mhchem}
You can either do
\ce{OH-}+\ce{[B(OH)3} $\rightarrow$ \ce{[B(OH)4-}or more elegantly:\begin{reaction}
OH- + B(OH)3 -> B(OH)4-
\end{reaction}
SIunits are good too:
\usepackage{SIunits}
The bond length is 1.1 \angstrom{} at 298\kelvin{} (25 \celsius{})
Chemfig looks very promising for a 2D chemistry drawing package and uses tikz, but it has a fairly steep learning curve (in the sense that you need to familiarise yourself with most use cases before you can do anything - it doesn't necessarily take very long):

\chemfig{C(-[2]H)(-[4]H)(-[6]H)-C(-[2]H)(-[6]H)-H}
draws ethane. The 2, 4, 6 are angles in multiples of 45 degrees. So, there are H at 90, 180 and 360  relative to the first carbon. 0 degrees is parallel to the horizontal, and angles increase as in a normal coordinate system (i.e. counter-clockwise).
In addition, you can do Lewis dot structures:
\chemfig{B(-[3]\lewis{420,Cl})(-[5]\lewis{460,Cl})-\lewis{260,Cl}
The 420 means bar to the left (0), top (2) and left (4). 260 means bar left, bottom and top. There's a lot to learn though...

Lastly, e.g.
\chemfig{*6(-=-=-=)}
draws benzene. The 6 indicates a hexagon and the -=-= the sequence of bonds.


5. Dia for flowcharts and cycles
I tried using tikz to make pretty, native flowcharts and cycling diagrammes, but it was too much work and too hard for lecture slides (I might revisit it for articles)
Instead, the dia package in debian make it easy to quickly make up .eps flowcharts

6. Use inkscape to turn png into eps
A lot of programmes can create eps files from raster formatted image files. However, most of them do a very poor job.

Instead I like using inkscape and have a .sh file for it:
inkscape --verb FileSave --verb FileClose --export-eps=$1.eps $1.png

7. BKChem for more difficult schemes
8. GDIS/povray for nice 3D structures.

9. MOdiagram for MO diagrams. Awesome BUT enabling labels leads to catastrophic failure:
"! Font LGR/cmss/m/n/12=gsmn1200 at 12.0pt not loadable: Metric (TFM) file not found."

You need to install cbfonts which is supposed to be included in texlive (I think). But it seems that some files are missing. Download cbfonts.zip from http://www.ctan.org/tex-archive/fonts/greek/cbfonts. Assuming you downloaded in ~/Downloads.
mv ~/Downloads/cbfonts.zip ~/tmp
cd ~/tmp
unzip cbfonts.zip
cd cbfonts/
sudo cp fonts/* -R /usr/share/texmf/fonts/ 

sudo update-updmap

sudo texhash && sudo updmap-sys
*to all my former lecturers: I am so, so, so truly sorry for not appreciating more how 1) much effort is involved in putting together a course (even a badly prepared one) and 2) as an undergraduate I didn't acknowledge that teaching isn't your main job.

204. GNOME 3: prevent shotwell from taking over storage devices with photos

I occasionally move pictures off my phone and the CF card of my camera. It annoys me a little bit that shotwell  gets to open and import my photos uninvited.

It also annoys me that a 5 seconds search through the preferences of nautilus and shotwell doesn't offer a solution, but I suppose when we really think about it is a GNOME issue.

Well, it's easy to sort it out: start the gnome system settings, go to details, and select Removable Media.

Post-script:
A lot of functionality is disabled, shifted around or removed completely in the core gnome apps because select devs consider it 'confusing', not obvious or difficult to locate (fixing the sentence to make it grammatically coherent would make it unreadable and clunky -- you know what I mean). Yet somehow the System Settings/Details as a dumping ground for some rather odd stuff has survived since Gnome 3.0.

Again, I like gnome. But gnome will probably do a whole lot better taking criticism from it's loyal users than catering to imaginary mobile device users, hypothetical ex-windows/osx users or basing design decisions on classroom-appropriated theory.

09 July 2012

203. Gimme a desktop I can use and love...the OTHER reason why I use the terminal

* The first, obvious reason for using the terminal is that it's the most efficient way of processing data -- the DE is good for presenting data but is awful at handling data input, the terminal is great at input but is often found wanting at presentation. 

[this is a fairly meandering post without any real purpose -- originally it was meant to show how to set up a quick E17 DE which wouldn't feel too foreign for a GNOME refugee, but that was not to be]

I like gnome. It works. It's pretty. I know how to use it and I can be productive with GNOME. Also, I do think GNOME 3 make GNOME 2.3X look dated. Functionality-wise, once I've installed enough extensions, GNOME 3 works as well or better than GNOME 2.3. Almost... 

 The problem is: it often feels like my trust has been betrayed and I constantly dread the what features the next update are going to remove. The problem lies very much with the applications that combine to make up what we know as gnome:

+ Evolution is constantly breaking. In particular, whether you'll be able to use google calendar or not is always a gamble. Actually, almost EVERYTHING to do with the calendar functionality of evolution tends to be problematic: at the moment I can't see the names of my calendars, I can't select a default view (e.g. day/week/month) of calendars and more...

+ A direct insult was what recently happened to gnome-screenshot. Screw that.

And yes: this probably means that I can stick with gnome but look for other pieces of software instead e.g. use thunderbird instead of evolution etc. In fact, I already do...

At any rate, not trusting the GNOME project anymore, instead of waiting for the disaster to strike, like many of us I'm constantly exploring alternative desktops.

First of all familiarise yourself with: 
sudo update-alternatives --config x-session-manager 
sudo update-alternatives --config x-window-manager 

The first command changes what starts (in the absence of a ~/.xinitrc) when you do startx. The second command select the window manager. 

Anyway.

Xmonad always seems like the logical destination for me since I spend most of my time working in the terminal. The whole idea of having a completely keyboard driven DE is awesome -- yes, it makes the learning curve steeper, but ponder this: you should never ever select a tool because it's easy to learn how to use, you should select a tool that is easy to USE (for your intended purpose etc. etc.). After all, you may spend a week learning a new skill, but you'll be spending the next 10 years using that skill.

In spite of everything about xmonad that sounds so, so right, somehow I just can't warm to it.

XFCE and LXDE are ok, but I'm feeling a bit lukewarm about XFCE in particular -- remember that my issues with GNOME aren't really about their focus on eye-candy, but about the removal of features: essentially treating the users like something verging on idiots. 

Be a bit careful about what you're doing windows manager wise -- e.g. openbox and metacity will create two completely different LXDE experiences out of the box. Metacity is what underpinned gnome 2.3. Openbox doesn't seems to be associate with a default menu bar or anything along those line.

I won't comment much on KDE. That's for some other day. Suffice to say that for you should make sure to do
sudo update-alternatives --config x-window-manager 
and make sure to select kwin, or you will not be able to switch between virtual desktops in KDE. KDE is pretty, but it's different enough that you should devote a reasonable fair amount of time to learning the proper workflow before making your mind up.

Enlightment: I've had a look at it over the years, and it's looked fast, and responsive. Checking it out again today on two different desktops., it proceeded to eat up all my ram, then all my swap (8+16 GB) and then die an undignified death. Of course it might just be a temporary bug, but it does make me think twice. And here, since I tired it out on two very different systems, I think the problem lies squarely with E17.

So after my little safari I'm back in the familiar gnome shell. Maybe we'll switch tomorrow instead...

05 July 2012

202. Reproducing the paper: computing organic reduction potentials

This post is not altogether finished yet -- will be updated with additional results as they come in

This isn't as much as a straight reproduction as a test of the authors' thesis that the SCFE+solvation energies can be used vs the results from using a classic adiabatic thermodynamic cycle.

The paper by Speelman and Gillmore can be found here:
http://pubs.acs.org/doi/abs/10.1021/jp800782e

Again, I'm doing this in large part to deepen my understanding of the practical aspects of computational chemistry. It's not a critical evaluation of the authors' approach -- I don't possess that kind of expertise.

0. Exploring solvation
Because NWChem implements one implicit solvation model (COSMO) and Gaussian implements three, it may be worth quickly exploring what they yield in terms of predicting solvation energies. In particular for processes like reduction or oxidation, solvation is highly important.

Benzene:
The structure of benzene was optimised at 3-21G in vacuo in both software packages. 3-21G was used throughout since it's a matter of making a crude comparison. The solvent was set to be water for all calcs. Note that benzene is neutral, so the solvation energy will be much smaller than for e.g. a cation.

Programme   Solvation model Energy (hartree)    Relative energy to gas phase
NWChem     none                      -230.9757626747    0
NWChem     COSMO               -230.9820692591    3.96 kcal/mol
G09               none                     -230.97576997        0
G09               PCM                    -230.9795649          2.38 kcal/mol
G09               cPCM                  -230.9796073          2.41 kcal/mol
G09               iPCM                   -230.9810728          3.33 kcal/mol

Basically, the gas phase energies are very similar for both G09 and NWChem. The differences lie in the solvation model energies, which iPCM and COSMO yielding the values closest to each other. Ultimately, the energy of solvation spans a fairly small region.

What about frequency calculations?
Well, without PCM I get an enthalpy correction of 0.106934 and with PCM I get 0.106976, a difference of .026355126 hartree. We're talking about a precision beyond that of the method itself. The entropy varies similarly: 68.754 w/o PCM, 68.764 cal/MolK with or ca 0.003 kcal/mol at 298.15 K.

1. Thermodynamic cycle of compound 5 (1,2,4,5-tetracyano-benzene)

A. G09 was used to optimise the structure first using b3lyp/3-21G, then using b3lyp/6-31+G* while applying a solvation model using PCM (water). The optimised structure was then used with IPCM. Also, the frequencies were calculated in vacuo.

(species:   gas phase E/IPCM E/Free Energy corr)
Neutral:   -601.2211700670/-601.2223222/0.057097
Reduced: -601.3655493120/-601.3680354/0.054093

Absolute potential: 
[(-601.3680354+0.054093)-(-601.2223222+0.057097)]*27.2107 eV/hartree= -4.0469 eV
The paper we're following gives 4.12 as the SCE absolute potential.
4.0469-4.12=-0.0731 V

Not close at all...one obvious problems is the reference potential though -- is this really applicable to acetonitrile? Our ideal reference potential should be somewhere around  4.05+0.7=4.75 eV in order to give the desired value of -0.7 V.

IUPAC gives SHE in acetonitrile as 4.60 eV (as mentioned here by Davis and Fry). Also, Pavlishchuck and Addison discuss different reference electrodes in acetonitrile in Inorg. Chim. Acta 200, 298, 97-102 and recommend subtracting 244 mV from SHE to yield the SCE potential. This still leaves us with 4.60-0.24=4.36 V. That in turn gives 4.05-4.36=-0.31 V as the potential. An improvement, certainly, but still 360 mV off.

If we use the old trick of optimising in one level, but using single-point and solvation energies from another level of theory (see section 3 for the origin of the values):

cpcm: [(-601.513973+0.054093)-(-601.3684665+0.057097)]*27.2107= -4.0411/(-1 e)
ipcm: [(-601.5166797+0.054093)-(-601.3698362+0.057097)]*27.2107=-4.0775/(-1 e)

It hardly changes it at all. Also, it quite clear that solvation effectsdominate over thermochemical correction terms here.

B. NWChem was used to optimise the structure at b3lyp/6-31+G* (gas phase) starting with the b3lyp/3-21G structure obtained from G09. 

(species:   gas phase opt/COSMO E/Enthalpy corr/Entropy Corr)
Neutral:    -601.1996294139/-601.2262889216/66.800 kcal/105.187 cal (times/2 cores: 15 min + 4 min +2h 10 min)
Reduced:  -601.2988217652/-601.373759558/65.498 kcal/105.799 cal (times/2 cores: 15 min + 4 min + 2h 30 min)

Absolute potential:
((-601.373759558+(65.498-298.15*105.799/1000)/627.503)-(-601.2262889216+(66.8-298.15*105.187/1000)/627.503))*27.2107=-4.077 eV

Basically the same as we saw with gaussian (ipcm).

2. The proposed method using 6-311++G**
Instead of using MIDI! I optimised the structures with ub3lyp/6-31+G*/PCM.

(species:  cpcm/ipcm energies in hartree)
Neutral:   -601.3684665/-601.3698362
Reduced: -601.513973/-601.5166797
EQM: -3.959 eV /-3.99571
PotCPCM: (-3.959+4.6067)/(-1.0886)    = -0.5949 eV; reported (comp.) -0.604 V
PotIPCM: (-3.99571+4.6291)/(-1.0508) = -0.603 eV

3. Reality
-0.74 V vs SCE in acetonitrile.

4. Summary
From the computational chemist's point of view anions are difficult. Metals are difficult. Radicals are difficult. What I didn't appreciate is quite how difficult anions really are. There should be no appreciable difference between the computation of an oxidation potential and a reduction potential since they are each other's conjugate-- the difference in these particular examples is only in the nature of the product when starting with a neutral parent species.
Empirically we've been getting excellent results in the lab calculating the oxidation potential of neutral organic compounds, and awful results for the reduction potential. This can't really be blamed on the reference potentials used either since they should be the same for both processes. Instead the challenge must be more fundamental.

04 July 2012

201. ...not like linux or anything...

The linux community is even more marginalised in Australia than in the US

In
http://www.theage.com.au/technology/technology-news/taxtime-mac-attack-gains-momentum-20120703-21enx.html

there's this little gem:
"..it isn't as if we're asking for  Linux or anything like that, Mac OS is a major operating system."

25 June 2012

200. How long will your nwchem frequency calc take?

Update 19/12/12: Having done a lot more frequency calculations since I posted this I sincerely doubt that this approach works.

Original post
Because I'm stuck waiting for the results of frequency calcs on some large transition metal clusters, I've become interested in understanding the output of frequency calculations in progress. After all, why wait 15 days for a results if there are early signs that the calculation has gone haywire?

Also, it might just be me, but frequency calculations are not that easy to restart, so you want to make sure that you give them enough wall time to finish if you use a queue manager.

I'm sure most of this could be appreciated by RTFM, but who has time for that?

So this is what the calc does:
After the usual boredom of reading in the geometry and doing an energy calculation, followed by an MO analysis, the computational fun starts.

Each cycle contains the following reports:


  1. Total Density - Mulliken Population Analysis
  2. Spin Density - Mulliken Population Analysis
  3. Total Density - Lowdin Population Analysis
  4. Spin Density - Lowdin Population Analysis
  5. Expectation value of S2:  
  6. NWChem DFT Module
  7.   Caching 1-el integrals 
  8.       Total Density - Mulliken Population Analysis
  9.       Spin Density - Mulliken Population Analysis
with the exception of the first cycle, which also look at the alpha-beta orbital overlaps, the centre of mass, moments of inertia and does a multipole analysis of density and save an initial hessian.





Each cycle ends with a report of the energy for that vibration:


         Total DFT energy =    -3297.032399945703
      One electron energy =   -26618.764098759657
           Coulomb energy =    12938.745973154924
    Exchange-Corr. energy =     -382.742230868704
 Nuclear repulsion energy =    10765.727956527733

 Numeric. integr. density =      441.999974968347

     Total iterative time =   7947.4s

If you do cat nwch.nwout|egrep "Total iterative time|Total DFT energy" you can see the progress:
        Total DFT energy =    -3297.032416366805
     Total iterative time =  12146.0s
         Total DFT energy =    -3297.032399945703
     Total iterative time =   7947.4s
         Total DFT energy =    -3297.032399544749
     Total iterative time =   7946.0s
         Total DFT energy =    -3297.032406934719
     Total iterative time =   7945.8s
         Total DFT energy =    -3297.032405026814

You now have an idea of how long each step takes. But how many steps in total? I think it's 3N steps, where N is the number of atoms.

For my 50 atoms POM using the values above it'd be roughly 8000 s * 150 = 13 days 22 hours.

Which seems about right...

cat nwch.nwout|grep 'Total DFT'|gawk 'END {print NR}'
66
so I've got another 8 days before I can get my hand on some juicy thermochemical data...

Time to start preparing lectures...