AleX's Blog

Random stuff on informatics, computer science, physics, etc.

Month: August, 2013

Making PyQuante work with Libint

Pyquante is a very nice “open-source suite of programs for developing quantum chemistry methods” developed by Richard Muller. Although not as fast as comercial software, I can atest that the code is very simple to understand and to modify. And in case you need to implement your own Quantum Chemistry routines, PyQuante takes you off the burden of having to write everything from scratch.

Libint is a software stack for computing integrals found in Quantum Chemistry created by Edward Valeev. I certainly cannot say much about libint as I haven’t had enough time to fiddle around with it. What I can say is that Gabriele Lanaro wrote some bindings that allow PyQuante to use libint and that make the calculation of the integrals faster (I cannot give you exact figures, since I never did any rigorous runtime tests, but I can attest that for the situations I tested, it did indeed run faster – also the ground state energy was indeed the same).

My problem was that I did not find any instructions on how to make PyQuante work with libint.
So here are my own (they works for PyQuante 1.6.4 and libint-1.1.4)

Download libint 1.1.4 and then compile it by doing:


./configure --enable-shared
make

If using Ubuntu (and possibly other Linux distros) you may get an error similar to:


/bin/sh ./libtool --mode=compile g++ -DHAVE_CONFIG_H -D_ISOC99_SOURCE=1 
-I./include -I/data/development/libint-2.0.3-stable/./include -O2 -c src/HRRPart1bra0ket0gf.cc -o src/HRRPart1bra0ket0gf.lo
./libtool: 1: eval: base_compile+= g++: not found
./libtool: 1: eval: base_compile+= -DHAVE_CONFIG_H: not found
./libtool: 1: eval: base_compile+= -D_ISOC99_SOURCE=1: not found
./libtool: 1: eval: base_compile+= -I./include: not found
./libtool: 1: eval: base_compile+= -I/data/development/libint-2.0.3-stable/./include: not found
./libtool: 1: eval: base_compile+= -O2: not found
./libtool: 1: eval: base_compile+= -c: not found
./libtool: 1: eval: CC_quoted+= gcc: not found
./libtool: 1: eval: CC_quoted+= g++: not found
libtool: compile: you must specify a compilation command
libtool: compile: Try `libtool --help --mode=compile' for more information.
make: *** [src/HRRPart1bra0ket0gf.lo] Error 1

This is due to the fact that in Ubuntu 6.10, the default system shell, /bin/sh, was changed to dash.
Changing the shell to bash by adding

SHELL = /bin/bash

to the Makefile should solve the problem.
Now download PyQuante 1.6.4 and copy the folder libint-1.1-4 to PyQuante’s folder and install PyQuante with libint support by running

sudo python install --enable-libint

.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Everything should be working now, and the integrations should now be now faster than before!

Installing and properly configuring Cygwin

Cygwin is a Linux-like interface for Microsoft Windows. It’s very neat. In my case I have a Lenovo X230 tablet and it’s just less of a nuisance and more functional to use MS Windows. Also, even though Wine works very well, it’s still not perfect. That way I have Windows installed and simply use Cygwin to easily access to my Linux server and have that Linux feel in Windows.

Cygwin is very easy to install and can be downloaded from here. There is a 64-bit version, but at the moment it is lacking some useful packages like rxvt. During install you will be prompted to choose a mirror (most work well) and which packages to install. Be sure to install wget, because we will need it for customizing cygwin later.

Now, if you need to install some packages on Cygwin, the usual procedure is to re-run the setup executable. This is not very convenient. Fortunately there’s a better way. Stephen Jungels has written a command line installer for Cygwin which works just like apt-get. You should visit apt-cyg webpage here and install it.

Now, in Cygwin to access VI Improved, which comes selected for install by default, you should type vi and not vim (as you may be used to) .

The problem is that if you try to run vim, it enters in compatibility mode, and some stuff simply won’t work. You may notice that you cannot see in the bottom in which mode you are, backspace won’t probably work, etc… This is because it is lacking a .virc file in your home folder.
Simply creating an empty .virc file using touch .virc in your home folder should be enough.

Now, something I strongly recommend, is to install rxvt. It is, in my opinion, a better shell than the standard Cygwin one.
If you have installed apt-cyg, simply issuing apt-cyg rxvt should be enough to install it (mind you, that the 64-bits version of Cygwin is, at the moment I am writing this post, lacking rxvt!)

You may notice that once you start rxvt the background, foreground, and font are quite different from the usual shell. To configure this, as well as the appearance of the window, you need to create in your home directory a file named .Xdefaults.
Then add the following to this file:


Rxvt*geometry: 100x30        ! WxH
Rxvt*background: #000000
Rxvt*foreground: #ffffbf
Rxvt*scrollBar: True
Rxvt*scrollBar_right: True
Rxvt*font: Lucida Console-12
Rxvt*SaveLines: 2000
Rxvt*loginShell: True
! VIM-like colors
Rxvt*color0:    #000000      ! pure black
Rxvt*color1:    #FFFFFF      ! pure white
Rxvt*color2:    #00A800      
Rxvt*color3:    #FFFF00
Rxvt*color4:    #6495ED      ! cornflower blue
Rxvt*color5:    #A800A8
Rxvt*color6:    #00A8A8
Rxvt*color7:    #D8D8D8
Rxvt*color8:    #000000
Rxvt*color9:    #FFFFFF      ! pure white
Rxvt*color10:   #00A800
Rxvt*color11:   #FFFF00
Rxvt*color12:   #6495ED      ! cornflower blue
Rxvt*color13:   #A800A8
Rxvt*color14:   #00A8A8
Rxvt*color15:   #D8D8D8

We are still not done. You it may happen that if you SSH into a Linux machine and try to use some programs such as less, man or top they will fail with errors such as “unknown terminal type”. The problem is the TERM variable which rxvt sets to rxvt-cygwin which is unrecognized by your remote machine.
Simply add


case "$TERM" in
    rxvt-cygwin)
        TERM=rxvt
        ;;

to the .bashrc file in the home folder of your remote machine and things should work flawlessly.
An alternative, in case you are using a shortcut to run rxvt, is to add the flag -tn xterm.

If you are planing on using X, you should install the package xinit in Cygwin.
You can then run the Xserver and open an X terminal by running:

startxwin

or

startx

For more information on this, you should consult the Cygwin/X page.

Note: If you don’t see any X window and find yourself unable to start the X server, it may already be running. You may need to kill the process

XWin.exe

using the task manager.

There are many other things that you can customize in Cygwin, but this should be enough to get you going.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Finally my own blog, and login secured by SSL

I finally decided to have a blog! After so many years trying to stay away from such things, the idea of installing Worpress on my home server and enabling SSL on Apache so I can login securely, convinced me :). Nothing beats the joy of self achievement!

My idea is to publish here all sort of things that I find interesting/useful. Most will probably be related to informatics, computer science, physics, mathematics, chemistry, etc. (after all that’s what I do for a living). To begin with, I think I will publish some of the contents from a folder I have called “useful stuff”. If at least one person makes use of that info, this blog has been worth it. And I am sure that even if nobody ever visits this, at least I will come here from time to time instead of visiting my own “useful stuff” folder.

See you soon!