19 July 2012

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