18 February 2014

554. Briefly: Drawing molecules on linux: Marvinsketch

I don't remember how I installed this, but marvinsketch is by far the fanciest molecular drawing application on linux. It's written in java, which means that it runs natively (well, as natively as something like java can run).

Note: it's free for academia only and you will need to register.

To get MarvinBeans, go to https://www.chemaxon.com/ and register as an academic. Then go to http://www.chemaxon.com/download/marvin-suite/ and download the 64 bit linux installer with jre.

Presumable you can install it by doing
sh marvinbeans-6.1.0-linux_with_jre64.sh

in the download directory.
Once it's installed create a file called ~/.local/share/applications/marvinsketch.desktop:
[Desktop Entry] Name=MarvinSketch GenericName=MarvinSketch Comment=Software for drawing molecules Exec=sh /home/me/ChemAxon/MarvinBeans/MarvinSketch Terminal=false Type=Application Categories=Science Version=6.1

You should now be able to find it in GNOME 3.

There are a lot of similarities between ISISDraw and MarvinSketch -- and that's a good thing since it allows people like myself to draw molecules quickly without thinking too much about it.
A Blank slate

Running Chem Inspector

It didn't like my wedges

I turned the structure into 3D and rotated it

Elemental analysis

553. Briefly: Drawing molecules on Debian Wheezy: ISISDraw under wine (very briefly)

I'm cheating here: this isn't a program for linux. Instead we're running a windows program under wine, which is not ideal. On the other hand, it's so easy to do that it's worth exploring as an option to 'pure' linux offerings.

I'll be posting about native linux offerings later.

Either way, I've kept a copy of ISISDraw 2.5 around since the early 2000s. Luckily, other people are mirroring the installation file for it as well. See e.g. http://fc.smcdsb.on.ca/~rszerminski/addl_files_for_web/DRAW24.EXE for ISISDraw 2.4

 You'll need to install wine:i386 and for that you'll need to enable multiarch if you're on amd64:
sudo dpkg --add-architecture
sudo apt-get update
sudo apt-get install wine:i386
wget http://fc.smcdsb.on.ca/~rszerminski/addl_files_for_web/DRAW24.EXE
wine DRAW24.EXE

As always, if you have problems with e.g. weird fonts, use winetricks to install at least corefonts, or ideally allfonts:
wget http://winetricks.org/winetricks
sudo mv winetricks /usr/bin/winetricks
chmod +x /usr/bin/winetricks 
winetricks allfonts

Then run ISISDraw:
A blank slate
 ISISDraw has a lot of options, including templates and journal settings.
Chem Inspector
 There's a bug under wine: to get the menus for the buttons on the left side to show up, click on the button on the left panel, and then move the mouse left while still holding the button down.
To get the menus to work, click and while still holding the left button down move right
 ISISDraw is not going to blow you away, but it's free and it works under wine.

15 February 2014

552. Very briefly: Enthalpy of correction and different number of reactants and products in nwchem and gaussian

Those who are well-versed in the computational arts won't get much out of this post. On the other hand, happy amateurs like myself might find it a bit more useful as it clarifies something that's been bothering  me.

Short version: Hcorr in Nwchem and Gaussian include PV.

As usual, I am not an expert in either computational or theoretical chemistry. I try to use it as a tool, and I try to use it as well as I can. But I am not an authority. Also, if you consult older posts on the blog you'll find plenty of examples of me misunderstanding basic computational concepts (with 550+ posts it's difficult to go back and erase all the embarrassing little gems).


The background
I had a bit of a fright the other day. I'm currently working on computationally characterising a system which undergoes a reaction that can lead to a large number of isomers. Only one of them is experimentally observed, and so it was of interest to see whether this is the thermodynamically favoured product as predict by reasonably cheap computational methods.

Because DFT calculations like these are based on gas phase reactions (even if you use a solvation model) the free energy that you get is based on the standard conditions for gas phase corrections i.e. 1 bar of partial pressure of each reactant.

If you want to calculate the free energy of reaction in solution you need to use concentrations instead. As you will see, you'll only have to worry about this for reactions that involve an unequal number of reactants and products. Normally your best results will be obtained by using isodesmic reaction schemes anyway, which is a great way of avoiding this. However, if you do have unequal numbers of reactants and products you /must/ correct for it when making solution phase predictions.

A gas at 1 bar of pressure is ca
V=n*R*T/P= 1*8.314*298.15/101350=0.024458 m^3= 24.46 litres


So for an example reaction like this:
A+B -> C


Using

G_SATP=G(gas phase) + R*T*ln Q
=G(gas phase)+ R*T*ln([C]/([A]*[B])
=G(gas phase)+ R*T*ln((1/24.46)/((1/24.46)*(1/24.46)))
=G(gas phase)+1.89 kcal/mol 

In other words: you can't ignore the standard state change when doing solution phase calculations. This is obviously of extra importance in pH calculations, which are notoriously tricky.

Enthalpy
So knowing the need for standard state corrections I was a bit paranoid about how to treat the reaction enthalpy and came across this document: http://chemistry.illinoisstate.edu/standard/che38037/handouts/380.37assign3.pdf

On page, equation 2 states that for Gaussian
Ee+Hcorr=Ee+Hvib+Hrot+Htrans

(where Ee is the electronic energy) which is an expression that doesn't include Δ(PV). In that case
Δ(H)=Σ(Hproducts)-Σ(Hreactants)+Δn*R*T
where Δn is the difference in number of moles of products and reactants.

Consulting the excellent Gaussian thermochemistry whitepaper (http://www.gaussian.com/g_whitepap/thermo.htm) offers the following:
Hcorr=Etot+kBT
and
The Gibbs free energy includes Δ(PV) , so when it's applied to calculating ΔG for a reaction, ΔNRT=ΔPV is already included. This means that ΔG will be computed correctly when the number of moles of gas changes during the course of a reaction.
[Note that H=Ee+Hcorr=Ee+Etot+kBT]

At a first glance, kBT isn't equivalent to RT, but in fact kB=R/NA -- in the words of Wikipedia: "[The gas constant R] is equivalent to the Boltzmann constant, but expressed in units of energy".

In other words, Δ(PV) is already accounted for in Hcorr in gaussian.

Somewhat clearer: the Freq() page, http://www.gaussian.com/g_tech/g_ur/k_freq.htm, on the gaussian website now states
Sum of electronic and zero-point Energies=-527.492585  E0=Eelec+ZPE
Sum of electronic and thermal Energies= -527.489751     E= E0+ Evib+ Erot+Etrans
Sum of electronic and thermal Enthalpies=-527.488807  H=E+RT

We test that claim:
E=-527.489751 Hartree
RT=(1.987*298.15/1000)/627.503=9.4410e-04 Hartree
E+RT=-527.489751+9.4410e-04=-527.488807

It holds up. 

A similar example from an nwchem calculation:
Zero-Point correction to Energy = 120.416 kcal/mol ( 0.191895 au)
Thermal correction to Energy = 127.114 kcal/mol ( 0.202569 au)
Thermal correction to Enthalpy = 127.706 kcal/mol ( 0.203513 au)
(0.203513-0.202569)=9.4400e-04 Hartree(1.987*298.15/1000)/627.503

Nwchem also includes Δ(PV) in the thermal correction to enthalpy.

05 February 2014

551. Very Briefly: Getting ECCE to work with Gaussian 09 (G09) part 3: Energy gradients (EGRADVEC)

This is a really simple fix to make ECCE return the energy gradient vectors for geometry optimisation jobs in G09:

Edit apps/scripts/parsers/gaussian-03.egradvec and comment out lines 38 (if () {... ) and 70 (}):

diff --git a/ecce-v7.0/scripts/parsers/gaussian-03.egradvec b/ecce-v7.0/scripts/parsers/gaussian-03.egradvec
index a2f5633..4a4b691 100755
--- a/ecce-v7.0/scripts/parsers/gaussian-03.egradvec
+++ b/ecce-v7.0/scripts/parsers/gaussian-03.egradvec
@@ -35,7 +35,7 @@ $| = 1;
 #Don't parse gradients for runtypes with geometry optimization
 #since we can't match gradients with correct geometry.
 
-if (!($runtype =~ /Geo/i)) {
+#if (!($runtype =~ /Geo/i)) {
   $natom = 0;
   while () {
     if (/-----/) { last; }
@@ -67,4 +67,4 @@ if (!($runtype =~ /Geo/i)) {
   }
   print "units:\nHartree/Bohr\n";
   print "END\n";
-}
+#}
-- 


550. Briefly: Getting ECCE to work with Gaussian 09 (G09) part 2: Geometry trace when using NoSymm

I've made a couple of posts about how to modify ECCE to work better in general, but in particular with Gaussian 09  (G09).

See here for some of the previous posts:
Adding new basis sets, part 1: http://verahill.blogspot.com.au/2013/06/455-adding-nwchem-basis-sets-to-ecce.html
Adding new basis sets, part 2:  http://verahill.blogspot.com.au/2013/06/456-adding-nwchem-basis-sets-to-ecce.html
Adding new exchange/correlation functionals:
http://verahill.blogspot.com.au/2013/12/533-adding-new-exchangecorrelation.html
Adding new options to ECCE
http://verahill.blogspot.com.au/2013/12/534-adding-new-options-to-ecce-adding.html
Getting ECCE to read frequency calc output from G09 calcs:
http://verahill.blogspot.com.au/2013/12/536-briefly-getting-ecce-to-work-with.html


Either way, I've noticed that when I'm using the NoSymm option during optimisation ECCE fails to import the geometries from the geometry steps.
No geometry trace option


What is even worse is that if you use an optimisation job like that as the basis for another job by selecting Duplicate Setup with Last Geometry ECCE will in fact use the starting geometry -- not the optimised one.

Luckily the fix is simple -- edit apps/parsers/gaussian-03.desc and add the following lines:
[GEOMTRACE] Script=gaussian-03.geomtrace Begin=Z-Matrix orientation\: Skip=5 Frequency=all End=-------------------------------------- [END]


You can now 'Reconnect job monitoring' also to your old jobs if you still have access to the run directory. Either way, the view will now be a sweet one:
Et voila: A geometry trace

03 February 2014

549. Very briefly: Unexpected comment spam

I get about 2-3 spam comments on my blog per day. Typically they advertise money making schemes, email marketing schemes etc., and look something like this:
This site was... how do I say it? Relevant!! Finally I have found something that helped me. Kudos! Also visit my web site: minecraft 1.0

Today I got an odd one though and I'll post it here even though it kind of works in their favour:
 Anonymous has left a new comment on your post "341. Upgrading/installing BankID on 64 bit linux":

That was enjoyable to read, thanks for posting it.

My site: Bing (www.bing.com) 

I presume that spammers don't work for free, so someone must be paying them. Is Microsoft hiring less-than-reputable web marketing companies to do their bidding?

548. A lot has been happening with Kingsoft WPS

Seems like they have been making progress.

I wrote my original post about wps (also see this post) for version 8.1.0.3724, and on this site they are currently at 9.1.0.4244 -- Alpha 12, patch 3. Judging from all the bugs that have been fixed it seems that the devs have been quite busy. The short interval between different alpha version also indicates that the development is very active. Good stuff.

Basically, WPS is the only reasonable (subjective) solution for reading .docx files on linux that I've encountered.

Either way,if you have a previous version of wps installed, remove it
sudo apt-get autoremove wps-office:i386

Then get on with it:
mkdir ~/tmp
cd ~/tmp
sudo dpkg --add-architecture i386
sudo apt-get update
wget http://wdl.cache.ijinshan.com/wps/download/Linux/unstable/kingsoft-office_9.1.0.4244~a12p3_i386.deb
sudo dpkg -i kingsoft-office_9.1.0.4244~a12p3_i386.deb
sudo apt-get install -f




Missing fonts. Clicking on the link takes you indirectly to bbs.wpn.cn, which is in Chinese.


To sort out the fonts issue above you can join bbs.wpn.cn as shown in this post, then download the wps_symbol_fonts.zip file from this post. Install the fonts by doing
cp ~/Downloads/wps_symbol_fonts.zip ~/.fonts
cd ~/.fonts
unzip wps_symbol_fonts.zip

And start WPS. The 'symbol' issue should be solved. Either way, the look of WPS has been updated, and now it can handle my test file which even MS offerings are struggling with:
See here for a post where I compare different office suites using that file (older post): http://verahill.blogspot.com.au/2013/01/313-which-office-for-linux-users.html

To sort out mime types/file associations do
sudo update-desktop-database /usr/local/share/applications/
sudo update-mime-database /usr/share/mime/

02 February 2014

547. NMR on Debian Jessie: gSim

Note: the gsim deb needs glibc 2.14, while wheezy has version 2.13. See here for how to deal with glibc > 2.14 on wheezy: http://verahill.blogspot.com.au/2014/03/562-pulling-in-glibc-214-from-testing.html

gSim is a free program (doesn't appear to be open source -- I can't find the source anyway) for processing 1D and 2D nmr spectra. I don't have much to say about it other than that it seems to provide all the things I require of an NMR processing program, including line fitting (deconvolution).

One neat extra is that gsim has a terminal-like window at the bottom similar to xwinnmr/topspin so that you can control the processing completely via the keyboard. 

gSim can be downloaded from http://sourceforge.net/projects/gsim/

 
installation via gdebi

splash screen

can read bruker files


fid

overview of processing options. I had to select bruker to correct the fid before doing ft


zooming is a bit awkward, but can be done using the mouse

I had some issue with deconvolution

awkwardly it uses ppm for the width too if the x axis is in ppm

you can always switch to hz though
gsim also reads the acqu/s files

It can output the spectrum to eps in case you're too lazy to work in gnuplot


31 January 2014

546. NMR on Debian Wheezy: ACD/LABS NMR under Wine

I'm currently exploring options for processing NMR data on linux (see e.g. here for nmrnotebook). There are four categories of programs:
* proprietary/for-cost running natively on linux

* proprietary/non-open source but gratis running natively on linux
* gratis and open source running natively on linux

* windows programs that happen to run ok in wine

ACD/LABS belongs to the last category, and as such is not an ideal solution. However, at this point I'm willing to try just about anything.

So yes, this relies on you having wine installed, but sometimes we need to be pragmatic like Torvalds rather than dogmatic like Stallman (the world needs both of them).


Either way:

First register at http://www.acdlabs.com/account/register.php?redirect=/account/logout.php


Then download



Installation:

Install by running
wine ~/Downloads/nmrproc_academia12.exe

Go through the installation steps:











Running the software

For most of the steps below there's little need to provide a commentary:










I could only get it to fit by hitting 'Auto'

However, 'Auto' did respect my choice of function e.g. lorentzian vs mixed.


You can export the data as simple ascii files


In conclusion I must say that I'm fairly happy with this piece of software. I haven't used it for production purposes, so I can't vouch for it spitting out reliable data though. It's definitely worth exploring though.