21 March 2017

635. Installing R on Rocks 5.4.3

Rocks 5.4.3 is based on CentOS 5.6 which is practically ancient by now (released Jan 2011).

Either way, when dealing with someone else's cluster its better to not fiddle too much with what is already working.

Here's a not at all elegant way of install R on Rocks 5.4.3
wget http://mirror.nsw.coloau.com.au/epel/5/x86_64/R-core-3.3.2-3.el5.x86_64.rpm
wget http://mirror.nsw.coloau.com.au/epel/5/x86_64/R-3.3.2-3.el5.x86_64.rpm 
wget http://mirror.nsw.coloau.com.au/epel/5/x86_64/R-devel-3.3.2-3.el5.x86_64.rpm 
wget http://mirror.nsw.coloau.com.au/epel/5/x86_64/libRmath-3.3.2-3.el5.x86_64.rpm 
wget http://mirror.nsw.coloau.com.au/epel/5/x86_64/libRmath-devel-3.3.2-3.el5.x86_64.rpm 
wget http://mirror.nsw.coloau.com.au/epel/5/x86_64/R-core-devel-3.3.2-3.el5.x86_64.rpm
wget http://mirror.nsw.coloau.com.au/epel/5/x86_64/libssh2-0.18-10.el5.x86_64.rpm 
wget http://mirror.nsw.coloau.com.au/epel/5/x86_64/xdg-utils-1.0.2-4.el5.noarch.rpm 
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/xz-devel-4.999.9-0.3.beta.20091007git.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/texinfo-tex-4.8-14.el5.x86_64.rpm
wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/texinfo-4.8-14.el5.x86_64.rpm

sudo yum install R-3.3.2-3.el5.x86_64.rpm libRmath-devel-3.3.2-3.el5.x86_64.rpm libRmath-3.3.2-3.el5.x86_64.rpm R-devel-3.3.2-3.el5.x86_64.rpm R-core-3.3.2-3.el5.x86_64.rpm R-core-devel-3.3.2-3.el5.x86_64.rpm libssh2-0.18-10.el5.x86_64.rpm xdg-utils-1.0.2-4.el5.noarch.rpm texinfo-tex-4.8-14.el5.x86_64.rpm xz-devel-4.999.9-0.3.beta.20091007git.el5.x86_64.rpm texinfo-4.8-14.el5.x86_64.rpm 
[..] Total size: 169 M Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : libssh2 1/11 Installing : libRmath 2/11 Installing : texinfo 3/11 Installing : texinfo-tex 4/11 Installing : libRmath-devel 5/11 Installing : xz-devel 6/11 Installing : xdg-utils 7/11 Installing : R-core 8/11 Installing : R-core-devel 9/11 Installing : R-devel 10/11 Installing : R 11/11 Installed: R.x86_64 0:3.3.2-3.el5 R-core.x86_64 0:3.3.2-3.el5 R-core-devel.x86_64 0:3.3.2-3.el5 R-devel.x86_64 0:3.3.2-3.el5 libRmath.x86_64 0:3.3.2-3.el5 libRmath-devel.x86_64 0:3.3.2-3.el5 libssh2.x86_64 0:0.18-10.el5 texinfo.x86_64 0:4.8-14.el5 texinfo-tex.x86_64 0:4.8-14.el5 xdg-utils.noarch 0:1.0.2-4.el5 xz-devel.x86_64 0:4.999.9-0.3.beta.20091007git.el5 Complete!

Testing:
R
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-redhat-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > q() Save workspace image? [y/n/c]: n

634. Compiling EQ3/6 on Debian

EQ3/6, a program for calculation of geochemical equilibrium in aqueous systems and which can be downloaded here, has a spectacularly unhelpful Install.txt file.

Sadly, we do not provide specific instructions on how to compile and link
the software to build the executables. You have to figure that out yourself
for your specific platform. It will require some number of steps. Also, we 
do not provide makefiles. It is not necessary to use make files, although
some people like them. If all this seems to exceed your knowledge and capacity,
seek the assistance of a qualified Linux or Unix maven who knows how to do
these things on your platform. 


Here I describe how I went about to compile it.


1. Download EQ36_80a_linux.zip from https://www-gs.llnl.gov/about/energy-security/geochemistry


2. Extract it. Move the EQ3_6v8.0a folder to ~
You can put it wherever you want, but then need to edit eq36cfg, and you'll have to deal with csh not handling long paths that well. It's just easier to give up and put EQ3_6v8.0a under $HOME


3. Time to extract further, compile and set up
cd ~/EQ3_6v8.0a
ls *.tar |xargs -I {} tar xvf {}
find -name "*.gz"|xargs -I {} gunzip {}

Time to look at what we have. There are .f files in
xcon6/src
eq3nr/src
eqlib/src
eqlibu/src
eq6/src
xcon3/src
eqpt/src
eqlibg/src

A lot of these are subroutines. We'll compile all files as modules and make static libraries
cd eqlibg/src
gfortran -c *.f
ar cr eqlibg.a *.o
cd ../../eqlibu/src
gfortran -c *.f
ar cr eqlibu.a *.o
cd ../../eqlib/src
gfortran -c *.f
ar cr eqlib.a *.o

cd ../../eqpt/src
sh makelinks
gfortran *.f *.a -o eqpt
cp eqpt ../../bin/
cd ../../xcon3/src
sh makelinks
gfortran *.f *.a -o xcon3
cp xcon3 ../../bin/
cd ../../xcon6/src
sh makelinks
gfortran *.f *.a -o xcon6
cp xcon6 ../../bin/
cd ../../eq3nr/src
sh makelinks
gfortran *.f *.a -o eq3nr
cp eq3nr ../../bin/
cd ../../eq6/src
sh makelinks
gfortran *.f *.a -o eq6

You'll get
eq6.f:16.9: use mod6pt 1 Fatal Error: Can't open module file 'mod6pt.mod' for reading at (1): No such file or directory eqcalc.f:77.9: use mod6pt 1 Fatal Error: Can't open module file 'mod6pt.mod' for reading at (1): No such file or directory eqphas.f:129.9: use mod6pt 1 Fatal Error: Can't open module file 'mod6pt.mod' for reading at (1): No such file or directory eqshel.f:146.9: use mod6pt 1 Fatal Error: Can't open module file 'mod6pt.mod' for reading at (1): No such file or directory exivar.f:121.9: use mod6pt 1 Fatal Error: Can't open module file 'mod6pt.mod' for reading at (1): No such file or directory
Don't despair, just run again:

gfortran *.f *.a -o eq6
cp eq6 ../../bin/

You should now have a bin/ that looks like
eq3nr eq6 eqpt readme.txt runeq3 runeq6 runeqpt xcif3 xcif6 xcon3 xcon6
cd ~/EQ3_6v8.0a
cat eq36cfg >> ~/.cshrc
cd scripts/
ln -s runeq36 runeq3
ln -s runeq36 runeq6
sudo mkdir /usr/tmp
sudo chmod ugo+rw /usr/tmp
cd ../db/
csh ../scripts/runeqpt all
------------------------------------ All done

4. Test
cd ~/EQ3_6v8.0a/3tlib_fmt
csh ../scripts/runeq36 fmt ../db/data0 c4pgwbN2.3i
[..] Done. Optimization ended outside requested limits. Starting hybrid Newton-Raphson iteration. Done. Hybrid Newton-Raphson iteration converged in 56 iterations. * Warning - (EQ3NR/eq3nr) The calculated TDS of 3.44395E+05 mg/L differs from the input file value of 3.54016E+05 mg/L by more than 1%. The calculated value will be used in subsequent calculations. The pickup file has been written. No further input found. Start time = 13:57:15 21Mar2017 End time = 13:57:15 21Mar2017 Run time = 0.586E-01 seconds Normal exit Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG ------------------------------------ The following output files were written: c4pgwbN2.3o c4pgwbN2.3p ------------------------------------ The following input files were run without generating any EQ3NR error messages: c4pgwbN2.3i ------------------------------------ All done
The question here is whether the error is indicative of a serious issue with the compiled software.

I reran as
csh ../scripts/runeq3 fmt c4pgwbN2.3i |tee c4pgwbN2.3o

and compared
diff c4pgwbN2.3o Outputs/c4pgwbN2.3o
18c18 < Run 14:12:44 21Mar2017 --- > Run 13:18:06 07Sep2011 870,871c870,871 < -0.0000 per cent of the total charge < -0.0000 per cent of the mean charge --- > 0.0000 per cent of the total charge > 0.0000 per cent of the mean charge 1235,1236c1235,1236 < Start time = 14:12:44 21Mar2017 < End time = 14:12:44 21Mar2017 --- > Start time = 13:18:06 07Sep2011 > End time = 13:18:06 07Sep2011 1238c1238 < Run time = 0.586E-01 seconds --- > Run time = 0.781E-01 seconds

The results are the same.We're good.

Everything put together as a script:
mkdir ~/tmp cd ~/tmp wget http://www-gs.llnl.gov/content/assets/docs/energy/EQ36_80a_Linux.zip unzip EQ36_80a_Linux.zip cd Linux mv EQ3_6v8.0a ~/ rm -rf Linux cd ~/EQ3_6v8.0a ls *.tar |xargs -I {} tar xvf {} find -name "*.gz"|xargs -I {} gunzip {} cd eqlibg/src gfortran -c *.f ar cr eqlibg.a *.o cd ../../eqlibu/src gfortran -c *.f ar cr eqlibu.a *.o cd ../../eqlib/src gfortran -c *.f ar cr eqlib.a *.o cd ../../eqpt/src sh makelinks gfortran *.f *.a -o eqpt cp eqpt ../../bin/ cd ../../xcon3/src sh makelinks gfortran *.f *.a -o xcon3 cp xcon3 ../../bin/ cd ../../xcon6/src sh makelinks gfortran *.f *.a -o xcon6 cp xcon6 ../../bin/ cd ../../eq3nr/src sh makelinks gfortran *.f *.a -o eq3nr cp eq3nr ../../bin/ cd ../../eq6/src sh makelinks gfortran *.f *.a -o eq6 gfortran *.f *.a -o eq6 cp eq6 ../../bin/ cd ~/EQ3_6v8.0a cat eq36cfg >> ~/.cshrc cd scripts/ ln -s runeq36 runeq3 ln -s runeq36 runeq6 sudo mkdir /usr/tmp sudo chmod ugo+rw /usr/tmp cd ../db/ csh ../scripts/runeqpt all

31 January 2017

633. Multiwfn on debian, with gaussian

Not much to say. I wanted to do some Bader-type AIM analyses, and I don't have AIM2000/AIMPAC. Multiwfn can do this, and a lot more.


Setting up multiwfn
Download the precompiled Multiwfn binaries here: https://multiwfn.codeplex.com/

Extract the binary and the copy the directory to .e.g /opt

$ ls /opt/Multiwfn_3.3.9_bin_Linux/
examples  Multiwfn  settings.ini

Edit your ~/.bashrc and add:
export KMP_STACKSIZE=64000000
export Multiwfnpath=/opt/Multiwfn_3.3.9_bin_Linux

When I hit 0 to visualize something, the plot screen is empty. Check/uncheck a box in the window and the plot will show.
Generating wfx files in gaussian:
If you've already run a job that has generated a .chk file, then run a simple quick job like this:
%nprocshared=2 %mem=500Mb %chk=test.chk #P chkbasis geom=allcheck guess=(check,only) output=wfx pop=(none) test.wfx

To analyse the .wfx file using multiwfn, look at the examples in the manual: https://www.codeplex.com/Download?ProjectName=multiwfn&DownloadId=1607667
The strength of multiwfn is that it can do a LOT. That's also its weakness, in the sense that the menu options are a bit overwhelming. Following the examples in the manual is probably mandatory.