05 May 2012

136. Compiling GIMP 2.8 on Debian Wheezy/Testing

EDIT 14/12/2012: To use an ugly approach to running gimp 2.8 on debian stable/squeeze, look here:
http://verahill.blogspot.com.au/2012/12/running-gimp-28-in-chroot-on-debian.html
It ain't pretty...

EDIT 27/05/2012: GIMP 2.8 is now in the debian testing repos.

GIMP 2.8 is out -- and it's got the fabled single-window mode: http://www.phoronix.com/scan.php?page=news_item&px=MTA5NjA

First you need to install babl >=0.1.10, and gegl-0.2 >= 0.2.0,  then you can compile and install GIMP 2.8. The versions of babel and gegl in the debian testing/wheezy repos are too old, so you will need to compile tboth babel and gegl yourself -- luckily it is very easy to do so (see below).

Building with python script support needed a ton of packages (it requires PyGTK which depends on pygobject which depends on glib and gobject-introspection etc.), so here I passed --disable-python during build. It just means you can't script gimp with python. No python.

As always, I only spot what packages are missing on my system. If you find that other packages are missing, let me know in the comment section and I'll expand the post. At a minimum, you will need build-essential

LMDE MINT USERS: it seems like you need to add a single line to your /etc/ld.so.conf file:
/usr/local/lib
Then do
sudo ldconfig 

ldconfig is in the package libc-bin

Both babl and gegl are gimp specific, so not giving install prefixes is probably ok. Just don't try to uninstall the pre-existing versions or gnome will disappear on you. See here http://forums.linuxmint.com/viewtopic.php?f=190&t=101253 for more LMDE discussions. See here http://cloudplasma.co.uk/2012/05/gimp-2-8-on-linux-mint-debian-edition/ for a compile based on this post.

START HERE
0. sudo apt-get install build-essential libatk1.0-dev libfontconfig1-dev libcairo2-dev libgudev-1.0-0 libdbus-1-dev libdbus-glib-1-dev liblcms1-dev libexif-dev libxfixes-dev libgtk2.0-dev python2.7-dev libtiff4-dev libpango1.0-dev

1. babl 0.1.10
wget ftp://ftp.gtk.org/pub/babl/0.1/babl-0.1.10.tar.bz2
tar xvf babl-0.1.10.tar.bz2
cd babl-0.1.10/
./configure
make
sudo make install

2. gegl 0.2.0
sudo apt-get install libglib2.0-dev zlib1g-dev
wget ftp://ftp.gtk.org/pub/gegl/0.2/gegl-0.2.0.tar.bz2
tar xvf gegl-0.2.0.tar.bz2 
cd gegl-0.2.0/
./configure
make
sudo make install

3. gimp 2.8.0
sudo apt-get install intltool
wget ftp://ftp.gimp.org/pub/gimp/v2.8/gimp-2.8.0.tar.bz2
tar xvf gimp-2.8.0.tar.bz2 
cd gimp-2.8.0/
./configure --prefix=/home/me/.gimp --disable-python
make
make install

3. ~/.bashrc
Chuck the following in your ~/.bashrc
alias gimp28='/home/me/.gimp/bin/gimp-2.8'
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

and source it. (source ~/.bashrc)

Start from the terminal using
gimp28

Done!

You can turn on single-window mode, by going to Windows and checking Single-Window Mode.


Edit: posted the how-to above eight hours ago, and already linked to by Debian-facile :-)


Links to this post:
http://forums.linuxmint.com/viewtopic.php?t=101253&f=190
http://cloudplasma.co.uk/2012/05/gimp-2-8-on-linux-mint-debian-edition/
http://linuxmint-fr.org/forum/graphisme/92501-installation-de-gimp-28.html

04 May 2012

135. Oniom in gaussian -- with a little bit of help from gromacs and openbabel

Example -- I want to do explicit solvent modelling of methanol in water. This is obviously an articifical approach, but generally applicable.

This is a rough approach to doing oniom calculations using gaussian 09

1. Pre-optimisation
Draw methanol and set up a simple calc using e.g. ecce to pre-optimise the structure with e.g. an implicit solvent model. Here's g03.g03in:

  1 %nprocshared=4
  2 %Chk=g09_oniom.chk
  3 #P rb3lyp/GEN 5D Opt=()  Freq=()  Punch=(MO) Pop=() scrf=(pcm,solvent=water)
  4 
  5 g09_oniom
  6 
  7 0 1 ! charge and multiplicity
  8  C     0.00000     0.00000     0.00000
  9  H     -0.675500     -0.675500     0.675500
 10  H     0.675500     -0.675500     -0.675500
 11  H     -0.675500     0.675500     -0.675500
 12  O     0.866025     0.866025     0.866025
 13  H     1.51843     0.213620     1.51843
 14 
 15  H  0
 16  S   3  1.00
 17       18.73113700      0.03349500
 18        2.82539400      0.23472700
 19        0.64012200      0.81375700
 20  S   1  1.00
 21        0.16127800      1.00000000
 22  ****
 23  O  0
 24  S   6  1.00
 25     5484.67170000      0.00183100
 26      825.23495000      0.01395000
 27      188.04696000      0.06844500
 28       52.96450000      0.23271400
 29       16.89757000      0.47019300
 30        5.79963500      0.35852100
 31  SP  3  1.00
 32       15.53961600     -0.11077800      0.07087400
 33        3.59993400     -0.14802600      0.33975300
 34        1.01376200      1.13076700      0.72715900
 35  SP  1  1.00
 36        0.27000600      1.00000000      1.00000000
 37  SP  1  1.00
 38        0.08450000      1.00000000      1.00000000
 39  D   1  1.00
 40        0.80000000      1.00000000
 41  ****
 42  C  0
 43  S   6  1.00
 44     3047.52490000      0.00183500
 45      457.36951000      0.01403700
 46      103.94869000      0.06884300
 47       29.21015500      0.23218400
 48        9.28666300      0.46794100
 49        3.16392700      0.36231200
 50  SP  3  1.00
 51        7.86827200     -0.11933200      0.06899900
 52        1.88128800     -0.16085400      0.31642400
 53        0.54424900      1.14345600      0.74430800
 54  SP  1  1.00
 55        0.16871400      1.00000000      1.00000000
 56  SP  1  1.00
 57        0.04380000      1.00000000      1.00000000
 58  D   1  1.00
 59        0.80000000      1.00000000
 60  ****

2. Solvation using gromacs
Take the output, g03.g03out, and use babel to export the optimised structure
babel -ig09 g03.g03out -oxyz molecule.xyz

The next few steps require gromacs:
editconf -f molecule.xyz -o molecule.gro -box 2 2 2
genbox -cp molecule.gro -cs spc216.gro -o solvated.gro
babel -igro solvated.gro -oxyz solvated.xyz

Because I'm lazy, I then add an extra column for high/low, chop off the first few lines, and add a column with zeros...because that works. Not sure what that's actually for. Molecule?

tail -n +3 solvated.xyz | gawk '{print $1,"0",$2,$3,$4,"Low"}'>oniom.xyz

Edit oniom.xyz by hand and change the lines with "Low" to "High" (or just H) for the atoms in the methanol molecule.

C 0 10.14000 10.34000 10.00000 High
H 0 9.65000 10.75000 10.90000 High
H 0 9.65000 10.75000 9.10000 High
H 0 11.19000 10.65000 10.00000 High
O 0 10.14000 8.91000 10.00000 High
H 0 9.22000 8.60000 10.00000 High
O 0 5.69000 12.75000 11.65000 Low
H 0 4.76000 12.68000 11.28000 Low
H 0 5.80000 13.64000 12.09000 Low
O 0 15.55000 15.11000 7.03000 Low
[..]
cp oniom.xyz oniom.in

Edit oniom.in and put in your gaussian instructions, e.g.:

%chk=methanol_explicit.chk
%mem=500MB
%nprocshared=3
#Oniom(rb3lyp/6-31+g*:uff) maxdisk=6000MB opt=()

Methanol in explicit water

0 1 0 1 0 1
C 0 10.14000 10.34000 10.00000 High
[...]
So, you specify Oniom(high level:low level) -- here dft and MM (via uff -- amber and charmm are available too -- but then you must carefully define the atom types. See here).

You don't always, but sometimes, have to specify the spin/multiplicity of the high and low level systems as well as the total spin and multiplicity. Anyway, you can: First the overall, the the high, then the low level. E.g. we have a chromium compound with an unpaired spin of 1 (multiplicity=2) and a charge of +3, and have a MM shell with five sodium atoms and a multiplicity of 1 (spin=0). The total charge is 8 and total multiplicity is 2. The line would read 8 2 3 2 0 1.

That's it! You're ready to roll.

The run takes about 3 minutes.

That's it!







134. Introducing a CA certificate in debian

So, for some reason you've been issued a CA certificate. Now what?

I've presumed that you've somehow downloaded both the root certificate (cacert.crt) and your personal certificate (usercert.pem). You'll need both.


Openssl

Convert to .p12
openssl pkcs12 -export -in usercert.pem -inkey userkey.pem -out usercert.p12

Verify
You can verify your issued certificate, e.g.
openssl verify  -CAfile ~/Downloads/cacert.crt ~/.globus/usercert.pem


Browsers:

Iceweasel/Firefox 
Go to Edit, Preferences, Advanced, Encryption: View certificates. Click import under Your Certificates and select your usercert.p12 (see above for conversion).  Got to servers, import cacert.crt.

Make sure that your cert authority shows up under the authority tab (otherwise try importing cacert.crt). Highlight the relevant authority, and click on edit trust: select the relevant fields of identification (e.g. website and/or email).


Chrome/Chromium
Click on the spanner icon, go to Settings, Under the bonnet, Manage Certificates and select Import under Your Certificates. Click on server, import the cacert.crt. Approve the certificate authority for the intended uses of the certificate. If you did it already in firefox it may have carried over.


Email:

Evolution
First go to Edit, Preferences, scroll down to Certificates and import your certificate and, under authorities, import the root certificate (cacert.crt).

Under the Authorities tab, select the issuing authority, click on edit and set the trust level (probably all)


Next, go to Edit, Preferences, Mail Accounts, Select an account and click on Edit. Select the Security tab


Repeat this for all accounts you want to use this certificate with.

Test it:


Send it. Receive it.

If all is correct, this is what greets you

If you don't add the certificate authority as being trusted -- and this will be the case for some of your recipients, this is what you see. Signature no good.


Thunderbird
Go to Edit, Account Settings... and under each account click on Security, then on View Certificates -- import your certificate and the issuing authority's certificate here, or you won't be able to Select the certificates under Digital Signing and Encryption.

Also, under View Certificates, highlight the certificate authority and select Edit Trust -- click on Edit CA trust, select website, mail etc., then select I do trust...
I presume that you do trust the authority or this is an exercise in futility.
You need to do this for ALL accounts that you intend to use, or you'll run into trust issues.

You can select/de-select signing when composing using the S/MIME menu.

If all goes well, users which also have the same certificate authority listed as trusted (probably not the case, but whatever) will see a sealed envelope (this message has been signed by pgp as well as S/MIME: