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

1 comment: