home

Archive for the 'qc/mm/md progs' Category

GROMACS 5.0.1, nVidia CUDA Toolkit, And FFTW3 Under Ubuntu 14.04 LTS (64-bit); The Virtues Of VirtualBox

Monday, September 22nd, 2014

Summarized below are the catches and fixes from a recent effort to build GROMACS 5.0.1 with FFTW3 (single- and double-precision) and GPU support (so, single-precision). Also, a trick I’ve been doing with great success lately, using a virtual machine to keep my real machine as clean as possible.

0. The Virtues Of VirtualBox

Open source means never having to say you’re sorry.

I’ve made the above proclamation to anyone who’d listen lately who has any interest in using Linux software (because, regardless of what anyone says on the matter, it ain’t there yet as an operating system for general scientific users with general computing know-how). You will very likely find yourself stuck at a configure or make step in one or more prerequisite codes to some final build you’re trying to do, leaving yourself to google error messages to try to come up with some kind of solution. Invariably, you’ll try something that seems to work, only to find it doesn’t, potentially leaving a trail of orphaned files, version-breaking changes, and random downgrading only to find something else stupid (or not) fixed your build problems.

I’ve an install I’m quite happy with that has all of the working code I want on it working – and I’ve no interest in having to perform re-installs to get back to a working state again.

My solution, which I’ve used to great success with GAMESS-US, GROMACS, NWChem, and Amber (so far), is to break a virtual instance in VirtualBox first. For those who don’t know (and briefly), VirtualBox lets you install a fully-working OS inside of your own OS that simply sits as a file in a Virtual VM folder in your user directory. My procedure has been to install a 60 GB VirtualBox instance of (currently) Ubuntu 14.04 (which I will refer to here as PROTOTYPE), fully update it to the current state of my RealBox (updates, upgrades, program installs, etc.), then copy PROTOTYPE somewhere else on the machine. The only limitation of this approach is that VirtualBox doesn’t give you access to the GPU if you’re testing CUDA-specific calculations. That said, it does let you install the CUDA Development Toolkit and compile code just fine, so you can at least work your way through a full build to make sure you don’t run into problems.

When you’re done trashing your VirtualBox after a particularly heinous build, just delete PROTOTYPE from Virtual VM and re-copy your copy back into Virtual VM – voila! You’re ready for another build operation (or to make sure your “final” build actually works flawlessly before committing the build to your RealBox.

That’s all I have to say on the matter. Consider it as your default procedure (at this point, I won’t touch my RealBox with new installs until I know it’s safe in VirtualBox).

1. The State Of My Machine Pre-GROMACS And All Other apt-get’s Used Below

What follows below is pretty straightforward. Errors you might get that don’t appear below might be related to the lack of certain installs on your machine that I installed on VirtualBox. That is, my standard PROTOTYPE comes standard with Intel’s Fortran and C Compilers (for code optimization). Those installs required a few installs above the base Ubuntu install. These are (and are pretty standard anyway, so I say install them anyway):

sudo apt-get install build-essential gcc-multilib rpm openjdk-7-jre-headless 

I could have just installed a fresh version of 14.04 onto a machine to try this myself, but I’m not that motivated. Also, note this list does not include the all-important cmake. We’ll get to that.

And for the rest of GROMACS (at least for older versions), there were lots of mesa/gnuplot/motif-specific dependencies in older versions of GROMACS to build all of the files included in the GROMACS package. Regardless of GPU builds or not, I tend to default to install all the packages below just to have them (which all, for 14.04, currently apt-get properly).

sudo apt-get install openmpi-bin openmpi-common gfortran csh grace menu x11proto-print-dev motif-clients freeglut3-dev libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libgl1-mesa-dri libcurl-ocaml-dev libcurl4-gnutls-dev gnuplot

If you don’t install the libblas3gf libblas-doc libblas-dev liblapack3gf liblapack-doc liblapack-dev series, you’ll see the following note from your cmake steps in GROMACS.

— A library with BLAS API not found. Please specify library location.
— Using GROMACS built-in BLAS.
— LAPACK requires BLAS
— A library with LAPACK API not found. Please specify library location.
— Using GROMACS built-in LAPACK.

My own preference is to use the (assumedly newer) Ubuntu-specific libraries from apt-get.

sudo apt-get install libblas3gf libblas-doc libblas-dev liblapack3gf liblapack-doc liblapack-dev

GPU-Specific? One More apt-get

My first passes at proper GPU compilation involved several steps for the nVidia Developer Toolkit install. That’s now taken care of with apt-get, so perform the final apt-get to complete the component/dependency installations.

sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit

With luck, your first attempt at a GPU-based installation will look like the following:

[0%] Building NVCC (Device) object src/gromacs/gmxlib/cuda_tools/CMakeFiles/cuda_tools.dir//./cuda_tools_generated_copyrite_gpu.cu.o

[100%] Building CXX object src/programs/CMakeFiles/gmx.dir/legacymodules.cpp.o
Linking CXX executable ../../bin/gmx
[100%] Built target gmx

2. Nothing Happens Without cmake

Install cmake! Reproducing the output below to make sure you’re using the same versions for everything (in the event something breaks in the future).

sudo apt-get install cmake

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
linux-headers-3.13.0-32 linux-headers-3.13.0-32-generic
linux-image-3.13.0-32-generic linux-image-extra-3.13.0-32-generic
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
cmake-data
Suggested packages:
codeblocks eclipse
The following NEW packages will be installed:
cmake cmake-data
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,294 kB of archives.
After this operation, 16.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main cmake-data all 2.8.12.2-0ubuntu3 [676 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main cmake amd64 2.8.12.2-0ubuntu3 [2,618 kB]
Fetched 3,294 kB in 30s (106 kB/s)
Selecting previously unselected package cmake-data.
(Reading database … 258157 files and directories currently installed.)
Preparing to unpack …/cmake-data_2.8.12.2-0ubuntu3_all.deb …
Unpacking cmake-data (2.8.12.2-0ubuntu3) …
Selecting previously unselected package cmake.
Preparing to unpack …/cmake_2.8.12.2-0ubuntu3_amd64.deb …
Unpacking cmake (2.8.12.2-0ubuntu3) …
Processing triggers for man-db (2.6.7.1-1) …
Setting up cmake-data (2.8.12.2-0ubuntu3) …
Setting up cmake (2.8.12.2-0ubuntu3) …

3. First Pass At GROMACS

The make install step will place GROMACS where you want it on your machine, so you’re just as good building in $HOME/Downloads as you are anywhere else. I will be performing all operations from $HOME/Downloads unless otherwise stated.

According to the GROMACS Installation Manual, your quick-and-dirty install need only involve the following:

$ tar xvfz gromacs-src.tar.gz
$ ls
gromacs-src
$ mkdir build
$ cd build
$ cmake ../gromacs-src
$ make

This allows you build “out-of-source” as they put it. Frankly, I just dive right into the GROMACS folder and have at it.

CMake Error: The source directory “/home/user/Downloads/gromacs-5.0.1/build” does not appear to contain CMakeLists.txt.
Specify –help for usage, or press the help button on the CMake GUI.

And did you see the above error? If so, you read the GROMACS quick-and-dirty procedure backwards. I’m not running it this way, so doesn’t matter to what follows.

My first attempt at building GROMACS produced the following output from PROTOTYPE (reproducing all the text below).

user@PROTOTYPE:~$ cd Downloads/
user@PROTOTYPE:~/Downloads$ gunzip gromacs-5.0.1.tar.gz 
user@PROTOTYPE:~/Downloads$ tar xvf gromacs-5.0.1.tar 

gromacs-5.0.1/README
gromacs-5.0.1/INSTALL

gromacs-5.0.1/tests/CppCheck.cmake
gromacs-5.0.1/tests/CMakeLists.txt

user@PROTOTYPE:~/Downloads$ cd gromacs-5.0.1/
user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ cmake -DGMX_GPU=OFF

NOTE: If you just run cmake, you’ll get the following…

cmake version 2.8.12.2
Usage

cmake [options] cmake [options]

… which is to say, cmake requires at least one option be specified. Above, I’m just using -DGMX_GPU=OFF to start the process.

The C compiler identification is GNU 4.8.2
— The CXX compiler identification is GNU 4.8.2
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — works
— Detecting C compiler ABI info
— Detecting C compiler ABI info – done
— Check for working CXX compiler: /usr/bin/c++
— Check for working CXX compiler: /usr/bin/c++ — works
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info – done
— Checking for GCC x86 inline asm
— Checking for GCC x86 inline asm – supported
— Detecting best SIMD instructions for this CPU
— Detected best SIMD instructions for this CPU – SSE2
— Try OpenMP C flag = [-fopenmp]
— Performing Test OpenMP_FLAG_DETECTED
— Performing Test OpenMP_FLAG_DETECTED – Success
— Try OpenMP CXX flag = [-fopenmp]
— Performing Test OpenMP_FLAG_DETECTED
— Performing Test OpenMP_FLAG_DETECTED – Success
— Found OpenMP: -fopenmp
— Performing Test CFLAGS_WARN
— Performing Test CFLAGS_WARN – Success
— Performing Test CFLAGS_WARN_EXTRA
— Performing Test CFLAGS_WARN_EXTRA – Success
— Performing Test CFLAGS_WARN_REL
— Performing Test CFLAGS_WARN_REL – Success
— Performing Test CFLAGS_WARN_UNINIT
— Performing Test CFLAGS_WARN_UNINIT – Success
— Performing Test CFLAGS_EXCESS_PREC
— Performing Test CFLAGS_EXCESS_PREC – Success
— Performing Test CFLAGS_COPT
— Performing Test CFLAGS_COPT – Success
— Performing Test CFLAGS_NOINLINE
— Performing Test CFLAGS_NOINLINE – Success
— Performing Test CXXFLAGS_WARN
— Performing Test CXXFLAGS_WARN – Success
— Performing Test CXXFLAGS_WARN_EXTRA
— Performing Test CXXFLAGS_WARN_EXTRA – Success
— Performing Test CXXFLAGS_WARN_REL
— Performing Test CXXFLAGS_WARN_REL – Success
— Performing Test CXXFLAGS_EXCESS_PREC
— Performing Test CXXFLAGS_EXCESS_PREC – Success
— Performing Test CXXFLAGS_COPT
— Performing Test CXXFLAGS_COPT – Success
— Performing Test CXXFLAGS_NOINLINE
— Performing Test CXXFLAGS_NOINLINE – Success
— Looking for include file unistd.h
— Looking for include file unistd.h – found
— Looking for include file pwd.h
— Looking for include file pwd.h – found
— Looking for include file dirent.h
— Looking for include file dirent.h – found
— Looking for include file time.h
— Looking for include file time.h – found
— Looking for include file sys/time.h
— Looking for include file sys/time.h – found
— Looking for include file io.h
— Looking for include file io.h – not found
— Looking for include file sched.h
— Looking for include file sched.h – found
— Looking for include file regex.h
— Looking for include file regex.h – found
— Looking for C++ include regex
— Looking for C++ include regex – not found
— Looking for posix_memalign
— Looking for posix_memalign – found
— Looking for memalign
— Looking for memalign – found
— Looking for _aligned_malloc
— Looking for _aligned_malloc – not found
— Looking for gettimeofday
— Looking for gettimeofday – found
— Looking for fsync
— Looking for fsync – found
— Looking for _fileno
— Looking for _fileno – not found
— Looking for fileno
— Looking for fileno – found
— Looking for _commit
— Looking for _commit – not found
— Looking for sigaction
— Looking for sigaction – found
— Looking for sysconf
— Looking for sysconf – found
— Looking for rsqrt
— Looking for rsqrt – not found
— Looking for rsqrtf
— Looking for rsqrtf – not found
— Looking for sqrtf
— Looking for sqrtf – not found
— Looking for sqrt in m
— Looking for sqrt in m – found
— Looking for clock_gettime in rt
— Looking for clock_gettime in rt – found
— Checking for sched.h GNU affinity API
— Performing Test sched_affinity_compile
— Performing Test sched_affinity_compile – Success
— Check if the system is big endian
— Searching 16 bit integer
— Looking for sys/types.h
— Looking for sys/types.h – found
— Looking for stdint.h
— Looking for stdint.h – found
— Looking for stddef.h
— Looking for stddef.h – found
— Check size of unsigned short
— Check size of unsigned short – done
— Using unsigned short
— Check if the system is big endian – little endian
— Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version “2.9.1”)
— Looking for xmlTextWriterEndAttribute in /usr/lib/x86_64-linux-gnu/libxml2.so
— Looking for xmlTextWriterEndAttribute in /usr/lib/x86_64-linux-gnu/libxml2.so – found
— Looking for include file libxml/parser.h
— Looking for include file libxml/parser.h – found
— Looking for include file pthread.h
— Looking for include file pthread.h – found
— Looking for pthread_create
— Looking for pthread_create – not found
— Looking for pthread_create in pthreads
— Looking for pthread_create in pthreads – not found
— Looking for pthread_create in pthread
— Looking for pthread_create in pthread – found
— Found Threads: TRUE
— Looking for include file pthread.h
— Looking for include file pthread.h – found
— Atomic operations found
— Performing Test PTHREAD_SETAFFINITY
— Performing Test PTHREAD_SETAFFINITY – Success
— Could NOT find Boost
Boost >= 1.44 not found. Using minimal internal version. This may cause trouble if you plan on compiling/linking other software that uses Boost against Gromacs.
— Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.so
— Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.so – found
— Setting build user/date/host/cpu information
— Setting build user & time – OK
— Checking floating point format
— Checking floating point format – IEEE754 (LE byte, LE word)
— Checking for 64-bit off_t
— Checking for 64-bit off_t – present
— Checking for fseeko/ftello
— Checking for fseeko/ftello – present
— Checking for SIGUSR1
— Checking for SIGUSR1 – found
— Checking for pipe support
— Checking for isfinite
— Performing Test isfinite_compile_ok
— Performing Test isfinite_compile_ok – Success
— Checking for isfinite – yes
— Checking for _isfinite
— Performing Test _isfinite_compile_ok
— Performing Test _isfinite_compile_ok – Failed
— Checking for _isfinite – no
— Checking for _finite
— Performing Test _finite_compile_ok
— Performing Test _finite_compile_ok – Failed
— Checking for _finite – no
— Performing Test CXXFLAG_STD_CXX0X
— Performing Test CXXFLAG_STD_CXX0X – Success
— Performing Test GMX_CXX11_SUPPORTED
— Performing Test GMX_CXX11_SUPPORTED – Success
— Checking for system XDR support
— Checking for system XDR support – present
— Try C compiler SSE2 flag = [-msse2]
— Performing Test C_FLAG_msse2
— Performing Test C_FLAG_msse2 – Success
— Performing Test C_SIMD_COMPILES_FLAG_msse2
— Performing Test C_SIMD_COMPILES_FLAG_msse2 – Success
— Try C++ compiler SSE2 flag = [-msse2]
— Performing Test CXX_FLAG_msse2
— Performing Test CXX_FLAG_msse2 – Success
— Performing Test CXX_SIMD_COMPILES_FLAG_msse2
— Performing Test CXX_SIMD_COMPILES_FLAG_msse2 – Success
— Enabling SSE2 SIMD instructions
— Performing Test _callconv___vectorcall
— Performing Test _callconv___vectorcall – Failed
— Performing Test _callconv___regcall
— Performing Test _callconv___regcall – Failed
— Performing Test _callconv_
— Performing Test _callconv_ – Success
— checking for module ‘fftw3f’
— package ‘fftw3f’ not found
— pkg-config could not detect fftw3f, trying generic detection
Could not find fftw3f library named libfftw3f, please specify its location in CMAKE_PREFIX_PATH or FFTWF_LIBRARY by hand (e.g. -DFFTWF_LIBRARY=’/path/to/libfftw3f.so’)
CMake Error at cmake/gmxManageFFTLibraries.cmake:76 (MESSAGE):
Cannot find FFTW 3 (with correct precision – libfftw3f for mixed-precision
GROMACS or libfftw3 for double-precision GROMACS). Either choose the right
precision, choose another FFT(W) library (-DGMX_FFT_LIBRARY), enable the
advanced option to let GROMACS build FFTW 3 for you
(-GMX_BUILD_OWN_FFTW=ON), or use the really slow GROMACS built-in fftpack
library (-DGMX_FFT_LIBRARY=fftpack).
Call Stack (most recent call first):
CMakeLists.txt:733 (include)

— Configuring incomplete, errors occurred!
See also “/home/user/Downloads/gromacs-5.0.1/CMakeFiles/CMakeOutput.log”.
See also “/home/user/Downloads/gromacs-5.0.1/CMakeFiles/CMakeError.log”.

Lots of little things to address here. We’ll get to the Boost problem later. Meantime, you can see the critical error is in (1) the lack of FFTW3 and (2) the lack of my specifically asking for -DGMX_BUILD_OWN_FFTW=ON in the cmake process.

NOTE: If you try to fix the FFTW3 problem as described above, you’ll get the following error:

-GMX_BUILD_OWN_FFTW=ON

CMake Error: Could not create named generator MX_BUILD_OWN_FFTW=ON

Make sure to put the “D” in:

-DGMX_BUILD_OWN_FFTW=ON

4. If You Don’t Use DGMX_BUILD_OWN_FFTW=ON To Build FFTW3…

This is a skip-able section if you’re letting cmake do the dirty work (and letting cmake do it is preferred, at least for getting GROMACS built). In trying sudo apt-get install fftw*, you see (currently) the following: fftw2 fftw-dev fftw-docs

No good. So, the procedure is to build FFTW3 from source (which is just as easy as installing from .deb or .rpm files if you installed everything I mentioned above). That said, your attempts to build FFTW3 and build GROMACS may have run into several errors because of how you built FFTW3. Beginning with your extracting and prep for make:

user@PROTOTYPE:~/Downloads$ tar xvf fftw-3.3.4.tar 
user@PROTOTYPE:~/Downloads$ cd fftw-3.3.4/

Any of the combinations below produce the same error:

user@PROTOTYPE:~/Downloads/fftw-3.3.4$ ./configure 
user@PROTOTYPE:~/Downloads/fftw-3.3.4$ ./configure -enable-shared=yes
user@PROTOTYPE:~/Downloads/fftw-3.3.4$ ./configure --enable-threads --enable-float

checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes

config.status: executing depfiles commands
config.status: executing libtool commands

user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ cmake -DGMX_GPU=OFF
user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ cmake -DGMX_GPU=OFF -DFFTWF_LIBRARY='/usr/local/lib/libfftw3.a'

— The C compiler identification is GNU 4.8.2
— The CXX compiler identification is GNU 4.8.2
— Check for working C compiler: /usr/bin/cc

— Performing Test PTHREAD_SETAFFINITY
— Performing Test PTHREAD_SETAFFINITY – Success
— Could NOT find Boost
Boost >= 1.44 not found. Using minimal internal version. This may cause trouble if you plan on compiling/linking other software that uses Boost against Gromacs.
— Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.so
— Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.so – found

— checking for module ‘fftw3f’
— package ‘fftw3f’ not found
— pkg-config could not detect fftw3f, trying generic detection
Could not find fftw3f library named libfftw3f, please specify its location in CMAKE_PREFIX_PATH or FFTWF_LIBRARY by hand (e.g. -DFFTWF_LIBRARY=’/path/to/libfftw3f.so’)
CMake Error at cmake/gmxManageFFTLibraries.cmake:76 (MESSAGE):
Cannot find FFTW 3 (with correct precision – libfftw3f for mixed-precision
GROMACS or libfftw3 for double-precision GROMACS). Either choose the right
precision, choose another FFT(W) library (-DGMX_FFT_LIBRARY), enable the
advanced option to let GROMACS build FFTW 3 for you
(-GMX_BUILD_OWN_FFTW=ON), or use the really slow GROMACS built-in fftpack
library (-DGMX_FFT_LIBRARY=fftpack).
Call Stack (most recent call first):
CMakeLists.txt:733 (include)

— Configuring incomplete, errors occurred!
See also “/home/user/Downloads/gromacs-5.0.1/CMakeFiles/CMakeOutput.log”.
See also “/home/user/Downloads/gromacs-5.0.1/CMakeFiles/CMakeError.log”.

Including –enable-shared takes care of this error and gets you to a successful GROMACS build.

user@PROTOTYPE:~/Downloads/fftw-3.3.4$ ./configure --enable-threads --enable-float --enable-shared

— The C compiler identification is GNU 4.8.2
— The CXX compiler identification is GNU 4.8.2
— Check for working C compiler: /usr/bin/cc

— Performing Test PTHREAD_SETAFFINITY
— Performing Test PTHREAD_SETAFFINITY – Success
— Could NOT find Boost
Boost >= 1.44 not found. Using minimal internal version. This may cause trouble if you plan on compiling/linking other software that uses Boost against Gromacs.
— Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.so
— Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.so – found

— checking for module ‘fftw3f’
— found fftw3f, version 3.3.4
— Looking for fftwf_plan_r2r_1d in /usr/local/lib/libfftw3f.so
— Looking for fftwf_plan_r2r_1d in /usr/local/lib/libfftw3f.so – found
— Looking for fftwf_have_simd_avx in /usr/local/lib/libfftw3f.so
— Looking for fftwf_have_simd_avx in /usr/local/lib/libfftw3f.so – not found
— Looking for fftwf_have_simd_sse2 in /usr/local/lib/libfftw3f.so
— Looking for fftwf_have_simd_sse2 in /usr/local/lib/libfftw3f.so – not found
— Looking for fftwf_have_simd_avx in /usr/local/lib/libfftw3f.so
— Looking for fftwf_have_simd_avx in /usr/local/lib/libfftw3f.so – not found
— Looking for fftwf_have_simd_altivec in /usr/local/lib/libfftw3f.so
— Looking for fftwf_have_simd_altivec in /usr/local/lib/libfftw3f.so – not found
— Looking for fftwf_have_simd_neon in /usr/local/lib/libfftw3f.so
— Looking for fftwf_have_simd_neon in /usr/local/lib/libfftw3f.so – not found
— Looking for fftwf_have_sse2 in /usr/local/lib/libfftw3f.so
— Looking for fftwf_have_sse2 in /usr/local/lib/libfftw3f.so – not found
— Looking for fftwf_have_sse in /usr/local/lib/libfftw3f.so
— Looking for fftwf_have_sse in /usr/local/lib/libfftw3f.so – not found
— Looking for fftwf_have_altivec in /usr/local/lib/libfftw3f.so
— Looking for fftwf_have_altivec in /usr/local/lib/libfftw3f.so – not found
CMake Warning at cmake/gmxManageFFTLibraries.cmake:89 (message):
The fftw library found is compiled without SIMD support, which makes it
slow. Consider recompiling it or contact your admin
Call Stack (most recent call first):
CMakeLists.txt:733 (include)

— Using external FFT library – FFTW3
— Looking for sgemm_

— Configuring done
— Generating done
— Build files have been written to: /home/user/Downloads/gromacs-5.0.1

And out of a first-pass GROMACS build…

user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ cmake -DGMX_GPU=OFF

Scanning dependencies of target libgromacs
[0%] Building C object src/gromacs/CMakeFiles/libgromacs.dir/__/external/tng_io/src/compression/bwlzh.c.o
[0%] Building C object src/gromacs/CMakeFiles/libgromacs.dir/__/external/tng_io/src/compression/bwt.c.o

[100%] Building CXX object src/programs/CMakeFiles/gmx.dir/legacymodules.cpp.o
Linking CXX executable ../../bin/gmx
[100%] Built target gmx

5. But You Let cmake Build FFTW3. So, Continuing The Build Process

With all of the dependencies above installed, the one note I wanted to address was that for Boost:


— Performing Test PTHREAD_SETAFFINITY – Success
— Could NOT find Boost
Boost >= 1.44 not found. Using minimal internal version. This may cause trouble if you plan on compiling/linking other software that uses Boost against Gromacs.
— Looking for zlibVersion in /usr/lib/x86_64-linux-gnu/libz.so

It certainly isn’t a major issue, but I wanted to try to get an warning-free build. Installing Boost 1.56 produced the following negative result:

user@PROTOTYPE:~/Downloads/boost_1_56_0$ ./bootstrap.sh 

Building Boost.Build engine with toolset gcc… tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version… 2.7
Detecting Python root… /usr
Unicode/ICU support for Boost.Regex?… not found.
Generating Boost.Build configuration in project-config.jam…

Bootstrapping is done. To build, run:

./b2

To adjust configuration, edit ‘project-config.jam’.
Further information:

– Command line help:
./b2 –help

– Getting started guide:

http://www.boost.org/more/getting_started/unix-variants.html

– Boost.Build documentation:

http://www.boost.org/boost-build2/doc/html/index.html

user@PROTOTYPE:~/Downloads/boost_1_56_0$ sudo ./b2 install

Performing configuration checks

– 32-bit : no (cached)
– 64-bit : yes (cached)
– arm : no (cached)

…failed updating 58 targets…
…skipped 12 targets…
…updated 11322 targets…

user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ cmake -DGMX_GPU=ON -DGMX_DOUBLE=OFF
user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ make

[0%] Building NVCC (Device) object src/gromacs/gmxlib/cuda_tools/CMakeFiles/cuda_tools.dir//./cuda_tools_generated_copyrite_gpu.cu.o
[0%] Building NVCC (Device) object src/gromacs/gmxlib/cuda_tools/CMakeFiles/cuda_tools.dir//./cuda_tools_generated_pmalloc_cuda.cu.o

[7%] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/commandline/cmdlinehelpwriter.cpp.o
In file included from /home/user/Downloads/gromacs-5.0.1/src/gromacs/options/basicoptions.h:52:0,
from /home/user/Downloads/gromacs-5.0.1/src/gromacs/commandline/cmdlinehelpwriter.cpp:55:
/home/user/Downloads/gromacs-5.0.1/src/gromacs/options/../utility/gmxassert.h:47:57: fatal error: boost/exception/detail/attribute_noreturn.hpp: No such file or directory
#include
^
compilation terminated.
make[2]: *** [src/gromacs/CMakeFiles/libgromacs.dir/commandline/cmdlinehelpwriter.cpp.o] Error 1
make[1]: *** [src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2
make: *** [all] Error 2

Sadly, the solution is to then include -DGMX_EXTERNAL_BOOST=off and stick with the internal boost, which then “makes” just fine. One page references the use of -DGMX_INTERNAL_BOOST=on, but that produced the following:

CMake Warning:
Manually-specified variables were not used by the project:

GMX_INTERNAL_BOOST

— Build files have been written to: /home/user/Downloads/gromacs-5.0.1

There’s more on this issue at: gerrit.gromacs.org/#/c/1232/ and t24960.science-biology-gromacs-development.biotalk.us/compiling-boost-problem-and-error-with-icc-t24960.html, but I’ve opted not to worry about it.

So, with Boost installed, I simply ignore it (and have not installed Boost on my RealBox).

user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ cmake -DGMX_GPU=ON -DGMX_EXTERNAL_BOOST=off

6. Finishing Step If All Above Goes Well: CUDA-Based GROMACS Build

If everything else above has gone smoothly (and if you ignored the Boost install. If you didn’t, remember to add -DGMX_EXTERNAL_BOOST=off to the cmake below), you should be able to cleanly run a cmake for a GPU version of GROMACS (below, with the final result to be placed into /opt/gromacs_gpu. You then specify the $PATH after and run with it).

user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ cmake -DGMX_GPU=ON -DCMAKE_INSTALL_PREFIX=/opt/gromacs_gpu -DGMX_BUILD_OWN_FFTW=ON

— The C compiler identification is GNU 4.8.2
— The CXX compiler identification is GNU 4.8.2

— Generating done
— Build files have been written to: /home/damianallis/Downloads/gromacs-5.0.1

user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ make

The make starts with the FFTW3 download and build…

Scanning dependencies of target fftwBuild
[ 0%] Performing pre-download step for ‘fftwBuild’
— downloading…
src=’http://www.fftw.org/fftw-3.3.3.tar.gz’
dest=’/home/damianallis/Downloads/gromacs-5.0.1/src/contrib/fftw/fftw.tar.gz’
— [download 0% complete]

[100%] Building CXX object src/programs/CMakeFiles/gmx.dir/legacymodules.cpp.o
Linking CXX executable ../../bin/gmx
[100%] Built target gmx

Finally, your (sudo) make install places everything into /opt/gromacs_gpu.

user@PROTOTYPE:~/Downloads/gromacs-5.0.1$ sudo make install

— The GROMACS-managed build of FFTW 3 will configure with the following optimizations: –enable-sse2
— Configuring done
— Generating done
— Build files have been written to: /home/damianallis/Downloads/gromacs-5.0.1
[1%] Built target fftwBuild

[100%] Building CXX object src/programs/CMakeFiles/gmx.dir/legacymodules.cpp.o
Linking CXX executable ../../bin/gmx
[100%] Built target gmx

For The Windows-Specific: Sed For Windows And A .bat File To Get Gaussian09 Files Working With aClimax

Wednesday, September 3rd, 2014

Provided you’ve installed Sed For Windows and know its proper path, the .bat file below should make all the modifications you need to your Gaussian09 .out files (in differently-named files at that) to get them properly loading in aClimax (see the previous post for all the details). A few simple steps:

1. Download and install Sed for Windows. Currently available at: gnuwin32.sourceforge.net/packages/sed.htm

2. Find its location on your machine. Under XP (where I’m using aClimax), this should be C:\Program Files\GnuWin32\bin

3. Copy + paste the text below into Notepad and save that as “aClimax_converter.bat” or something. NOTE: The quotes are IMPORTANT! You risk saving the file as an aClimax_converter.bat.txt file otherwise. The pause is optional. If there’s something wrong with the conversion, keeping the pause will let you see the error. If, by some miracle, your Sed is installed elsewhere, change the PATH statement below. The .aclimaxconversion_step1 file will be deleted (just there for doing sequential Sed’ing in case additional modifications are needed in the future).

PATH=C:\Program Files\GnuWin32\bin;
sed.exe "s/  Atom  AN/ Atom AN /g" %1 > %1.aclimaxconversion_step1
sed.exe "s/ Atom   / Atom/g" %1.aclimaxconversion_step1 > %1.aClimaxable.out
del %1.aclimaxconversion_step1
pause

4. If the path is right, just drag + drop your .out files onto the .bat file (with a shortcut to the .bat file, or place a copy of the file in your working directory).

5. Finally, try opening one of the .aClimaxeable.out files in aClimax and report back if you’ve any problems.

Stupid-Simple (*nix-Specific) Sed Scripts To Get (All Current) Gaussian09 Output Files Working With aClimax

Monday, September 1st, 2014

The following three snippets of Gaussian output are for an optimization and normal mode analysis of simple olde methane (CH4).

...
 ******************************************
 Gaussian 03:  EM64L-G03RevE.01 11-Sep-2007
                31-Aug-2014 
 ******************************************
...
 incident light, reduced masses (AMU), force constants (mDyne/A),
 and normal coordinates:
                     1                      2                      3
                     T                      T                      T
 Frequencies --  1356.0070              1356.0070              1356.0070
 Red. masses --     1.1789                 1.1789                 1.1789
 Frc consts  --     1.2771                 1.2771                 1.2771
 IR Inten    --    14.1122                14.1122                14.1122
 Atom AN      X      Y      Z        X      Y      Z        X      Y      Z
   1   1     0.02  -0.42   0.43    -0.34  -0.13  -0.08    -0.36  -0.23  -0.23
   2   6     0.00   0.08  -0.09     0.00   0.09   0.08     0.12   0.00   0.00
...
 -------------------
 - Thermochemistry -
 -------------------
 Temperature   298.150 Kelvin.  Pressure   1.00000 Atm.
 Atom  1 has atomic number  1 and mass   1.00783
...
...
 ******************************************
 Gaussian 09:  EM64L-G09RevA.02 11-Jun-2009
                31-Aug-2014 
 ******************************************
...
 incident light, reduced masses (AMU), force constants (mDyne/A),
 and normal coordinates:
                     1                      2                      3
                     T                      T                      T
 Frequencies --  1356.0058              1356.0058              1356.0058
 Red. masses --     1.1789                 1.1789                 1.1789
 Frc consts  --     1.2771                 1.2771                 1.2771
 IR Inten    --    14.1123                14.1123                14.1123
  Atom  AN      X      Y      Z        X      Y      Z        X      Y      Z
     1   1    -0.03   0.42   0.43    -0.34  -0.14   0.07    -0.36  -0.23   0.23
     2   6     0.00  -0.08  -0.10     0.01   0.10  -0.08     0.12   0.00   0.00
...
-------------------
 - Thermochemistry -
 -------------------
 Temperature   298.150 Kelvin.  Pressure   1.00000 Atm.
 Atom     1 has atomic number  1 and mass   1.00783
...
...
 ******************************************
 Gaussian 09:  EM64L-G09RevD.01 24-Apr-2013
                31-Aug-2014 
 ******************************************
...
 incident light, reduced masses (AMU), force constants (mDyne/A),
 and normal coordinates:
                      1                      2                      3
                     ?A                     ?A                     ?A
 Frequencies --   1356.0132              1356.0132              1356.0132
 Red. masses --      1.1789                 1.1789                 1.1789
 Frc consts  --      1.2771                 1.2771                 1.2771
 IR Inten    --     14.1119                14.1119                14.1119
  Atom  AN      X      Y      Z        X      Y      Z        X      Y      Z
     1   1     0.02   0.42   0.43     0.34  -0.14   0.08    -0.36   0.23  -0.23
     2   6     0.00  -0.08  -0.09    -0.01   0.09  -0.08     0.12   0.00   0.00
...
 -------------------
 - Thermochemistry -
 -------------------
 Temperature   298.150 Kelvin.  Pressure   1.00000 Atm.
 Atom     1 has atomic number  1 and mass   1.00783
...

Two of these things are not like the other. The data’s nearly identical (and thank heavens. Unfortunately, Gaussian09 D.01 didn’t see the fully-optimized methane as belonging to the Td point group – despite all three versions being run with the same exact input file – but a rigorous re-symmetrization would have taken care of that), but there are some subtle formatting differences between all three versions (including differences between both Gaussian09 versions) that cause the venerable, all-encompassing aClimax program (developed by Timmy, the venerable, all-encompassing A. J. Ramirez-Cuesta) to throw out the following errors for all three cases when you use *.log files from a *nix (UNIX, Linux) machine.

Serious Error: A-CLIMAX has encountered an unhanded error. Please Save your data and contact support
aClimax: Quote Error Number 9
Error Loading File: Error reading data. Please check and try again.
aClimax: WARNING loaded file containing no frequencies

Problem number 1 is the existence of *nix newlines (carriage returns) in the *.log files coming off a *nix machine. Performing a conversion from *nix to DOS (for myself, using LineBreak in OSX, but tofrodos works just as well), the Gaussian03 file now opens just fine in aClimax:

File Loaded: Data Loaded Succesfully [sic].

This, unfortunately, does not improve the matter with the Gaussian09 files, which produce the following error:

Error: One of the numbers you have entered is of the wrong type.Please recheck and try again
Error Loading File: Error reading data. Please check and try again.

Given how little of the .log file aClimax actually needs to produce simulated inelastic neutron scattering (INS) spectra, I ran the methane normal mode analyses in three different Gaussian versions to determine what, in G09, was changed to make it just un-G03 enough to fail to load. With those changes figured out, I had a Perl script drafted up that would have converted everything back to the original G03 format. It was awesome. That said, after a small amount of testing to see where aClimax’s sensitivities lay, I discovered that very little of the .log file contents needed to be changed out, meaning that simple sed scripts would work just as well for those of us using our Windows boxes (or VirtualBox emulations) only for that “one stupid program” that keeps us having to log in (and, by that, I mean that we have sed already on our computers).

So, the problems between G09 and aClimax not related to carriage returns lie in two places.

1. The spacing of “Atom AN” – at the top of the eigenvector lists are the column labels, beginning with “Atom AN” – or something very close to “Atom AN” (the “|” in the boxes below mark the left edge of the output):

G03 E01 | Atom AN
G09 A02 |   Atom  AN
G09 D01 |  Atom  AN

Yes, the addition of a space or two results in a read error by aClimax. I would call this an… aggressive stringency in aClimax. That said, what did the original space in G03 versions not do that they do do in G09?

2. The spacing of “Atom N” – In the “Thermochemistry” section below the eigenvectors, atomic masses are listed as “Atom N” – or something very close to “Atom N” (again, the “|” in the boxes below mark the left edge of the output):

G03 E01 |  Atom  1
G09 A02 |    Atom     1
G09 D01 |   Atom     1

This change in spacing is also enough to cause aClimax to error out.

The Solution

A small sed script performs the necessary conversions on your *nix box (including OSX) for all .log files in a directory without issue:

#!/bin/sh

# This section converts all .log files to aClimax-friendly G03-ish format
find . -type f -name '*.log' -print | while read i
do
sed 's|  Atom  AN| Atom AN |g' $i > $i.aclimaxconversion_step1
sed 's| Atom   | Atom|g' $i.aclimaxconversion_step1 > $i.aClimaxable.log
rm $i.aclimaxconversion_step1
done

# This section converts all .out files to aClimax-friendly G03-ish format
find . -type f -name '*.out' -print | while read i
do
sed 's|  Atom  AN| Atom AN |g' $i > $i.aclimaxconversion_step1
sed 's| Atom   | Atom|g' $i.aclimaxconversion_step1 > $i.aClimaxable.out
rm $i.aclimaxconversion_step1
done

But Wait! Running G0* Jobs Under *nix? Convert To DOS Carriage Returns

The final problem halting your aClimax spectrum generation is the DOS carriage return (^M). For those running DOS-based Gaussian calculations (likely with a .out suffix), your conversion with the short script above (under *nix) likely (hopefully) worked just fine. For those running under *nix, you performed the conversion and still received the following aClimax error:

Serious Error: A-CLIMAX has encountered an unhanded error. Please Save your data and contact support
aClimax: Quote Error Number 9
Error Loading File: Error reading data. Please check and try again.
aClimax: WARNING loaded file containing no frequencies

The solution is an additional line in the sed script that will globally replace all *nix newlines with proper DOS carriage returns. The .out section remains the same.

#!/bin/sh

# This section converts all .log files to aClimax-friendly G03-ish format
find . -type f -name '*.log' -print | while read i
do
sed 's|  Atom  AN| Atom AN |g' $i > $i.aclimaxconversion_step1
sed 's| Atom   | Atom|g' $i.aclimaxconversion_step1 > $i.aclimaxconversion_step2
# This section converts your *nix newlines into DOS carriage returns
CR=`echo "\0015"`  # define the Carriage Return
sed -e "s/$/${CR}/g" $i.aclimaxconversion_step2 > $i.aClimaxable.log
done
# this cleans up your folder of temp files
rm *.aclimaxconversion_step1
rm *.aclimaxconversion_step2

# This section converts all .out files to aClimax-friendly G03-ish format
find . -type f -name '*.out' -print | while read i
do
sed 's|  Atom  AN| Atom AN |g' $i > $i.aclimaxconversion_step1
sed 's| Atom   | Atom|g' $i.aclimaxconversion_step1 > $i.aClimaxable.out
rm $i.aclimaxconversion_step1
done

Q. But what if I run the *nix-to-DOS version of the script on an already DOS-output file?

A1. The simple answer is that you’ll make your text file double-spaced (which is bad enough). aClimax will then provide the following error when you try to open it:

Error Reading File: Unexpected File End. File May be incorrect or corrupt.
Error Loading File: Error reading data. Please check and try again.

A2. I will assume that your problem is that you’re running the script in DOS to try to get your G09 to read more like G03. In this case (assuming you’re generating .out files), you’ll want to use a text editor to make the replacements described above (which is to say, that Perl script might makes it way to this page eventually. If you write a DOS .bat file or similar script for all OS’s, I’d be happy to link to it).

Generating Molecular Orbitals (And Visualizing Assorted Properties) With The Gaussian09 cubegen Utility

Saturday, June 7th, 2014

To begin, this post owes its existence to the efforts of Dr. Douglas Fox at Gaussian, Inc., who provided me with an alternative explanation of how the cubegen utility works. After much wailing and gnashing of teeth, I intend on taking Dr. Fox’s advice and asking Gaussian Support for assistance earlier in my endeavors. What follows below, I hope, will save you some significant frustration (and, given how little there is online that really describes the extra workings of cubegen in a clear and example’ed way, it is my expectation that this page appeared early in your search list).

What I wanted out of cubegen that I couldn’t figure out how to get:

The situation was simple. I wanted my molecule centered and bound within an arbitrarily-sized box (X,Z,Y) for making images and doing additional post-processing. Specifically, I wanted to be able to take many different molecules (from hydrogen gas to big biomolecules) defined within the same-sized box for layering and presentation (different boxes for each, but all the same size).

I am assuming for this that you’re using cubegen from a terminal (not within GaussView or the like) to produce .cub/.cube files for use in some kind of rendering-capable program (like VESTA or VMD) and that cubegen and formchk are in your PATH (either properly placed or by running the Gaussian install script). I’ll be demonstrating usage with benzene (C6H6) and the benzene cation (C6H6+).

1. The Checkpoint File

To extract any kind of data for making .cub/.cube files, you need a checkpoint file (.chk) from your run. This is performed by adding a %chk=FILENAME.chk line to the top of the input file (which, if you’re a Gaussian user, you likely already know). If you want additional properties cube’d, check the Gaussian Tech Document, specifically looking at the Pop keyword for most of the properties you’d want visualized (this data gets placed into the .chk file for .cub/.cube generation after the run). For the standard molecular orbitals, they’re already saved in the .chk file (or their coefficients, anyway).

For benzene.gjf:

%chk=benzene.chk
# b3lyp/6-31G(d,p)

Benzene

0 1
 C                  1.20809735    0.69749533   -0.00000000
 C                  0.00000000    1.39499067   -0.00000000
 C                 -1.20809735    0.69749533   -0.00000000
 C                 -1.20809735   -0.69749533   -0.00000000
 C                  0.00000000   -1.39499067   -0.00000000
 C                  1.20809735   -0.69749533   -0.00000000
 H                  2.16038781    1.24730049   -0.00000000
 H                  0.00000000    2.49460097   -0.00000000
 H                 -2.16038781    1.24730049   -0.00000000
 H                 -2.16038781   -1.24730049   -0.00000000
 H                  0.00000000   -2.49460097   -0.00000000
 H                  2.16038781   -1.24730049   -0.00000000

For benzenecation.gjf:

%chk=benzenecation.chk
# b3lyp/6-31G(d,p)

Benzene cation

1 2
 C                  1.20809735    0.69749533   -0.00000000
 C                  0.00000000    1.39499067   -0.00000000
 C                 -1.20809735    0.69749533   -0.00000000
 C                 -1.20809735   -0.69749533   -0.00000000
 C                  0.00000000   -1.39499067   -0.00000000
 C                  1.20809735   -0.69749533   -0.00000000
 H                  2.16038781    1.24730049   -0.00000000
 H                  0.00000000    2.49460097   -0.00000000
 H                 -2.16038781    1.24730049   -0.00000000
 H                 -2.16038781   -1.24730049   -0.00000000
 H                  0.00000000   -2.49460097   -0.00000000
 H                  2.16038781   -1.24730049   -0.00000000

2. Convert The .chk To .fchk With formchk

As per the Gaussian Tech Doc:

formchk converts the data in a Gaussian checkpoint file into a formatted form which is suitable for input into a variety of visualization software.

Basically, making the .chk file something that cubegen can manipulate to generate .cub/.cube files of orbitals, densities, electrostatic potentials, etc. This run is simple for most users (for the rest, see formchk).

formchk benzene.chk benzene.fchk
formchk benzenecation.chk benzenecation.fchk

3. Using cubegen

And now the fun begins. A typical cubegen run looks like the following:

cubegen 0 MO=HOMO benzene.fchk benzene_HOMO.cub 0 h

cubegen – run cubegen
0 – an old memory flag (must be there, but not important)
MO=HOMO – generate the highest occupied molecular orbital
benzene.fchk – the .fchk file
benzene_HOMO.cub – the generated .cub file
0 – use the default grid point specification (80*80*80 points total in the whole cube file)
h – write out the .cub file with headers

The output you find summarized in VESTA is below for this case.

DEFAULT:
OpenGL version: 2.1 INTEL-8.26.34
Video configuration: Intel HD Graphics 4000 OpenGL Engine
Maximum supported width and height of the viewport: 16384 x 16384
OpenGL depth buffer bit: 16

/Users/damianallis/benzene_HOMO_default_0.cub
====================================================================================
Title Benzene MO=HOMO
Dimensions 87 91 65

Lattice parameters

a b c alpha beta gamma
9.39704 9.82909 7.02078 90.0000 90.0000 90.0000

Unit-cell volume = 648.469273 Å^3

Total number of polygons and unique vertices on slices;
(1 0 0): 0 ( 0), 0 ( 0)
(0 1 0): 0 ( 0), 0 ( 0)
(0 0 1): 0 ( 0), 0 ( 0)
====================================================================================

====================================================================================
Title Benzene

Lattice type P
Space group name P 1
Space group number 1
Setting number 1

Lattice parameters

a b c alpha beta gamma
1.00000 1.00000 1.00000 90.0000 90.0000 90.0000

Unit-cell volume = 1.000000 Å^3

Structure parameters

x y z Occ. B Site Sym.
1 C C1 4.65450 6.23638 3.44640 1.000 1.000 1 –
2 C C2 5.86259 5.53889 3.44640 1.000 1.000 1 –
3 C C3 5.86259 4.14389 3.44640 1.000 1.000 1 –
4 C C4 4.65450 3.44640 3.44640 1.000 1.000 1 –
5 C C5 3.44640 4.14389 3.44640 1.000 1.000 1 –
6 C C6 3.44640 5.53889 3.44640 1.000 1.000 1 –
7 H H1 4.65450 7.33599 3.44640 1.000 1.000 1 –
8 H H2 6.81488 6.08869 3.44640 1.000 1.000 1 –
9 H H3 6.81488 3.59409 3.44640 1.000 1.000 1 –
10 H H4 4.65450 2.34679 3.44640 1.000 1.000 1 –
11 H H5 2.49411 3.59409 3.44640 1.000 1.000 1 –
12 H H6 2.49411 6.08869 3.44640 1.000 1.000 1 –
====================================================================================

Number of polygons and unique vertices on isosurface = 16904 (8460)
12 atoms, 12 bonds, 0 polyhedra; CPU time = 39 ms

For the coarse grid (-2) case:

cubegen 0 MO=HOMO benzene.fchk benzene_HOMO_default_m2.cub -2 h

The output you find summarized in VESTA is below for this case.

/Users/damianallis/benzene_HOMO_default_m2.cub
====================================================================================
Title Benzene MO=HOMO
Dimensions 54 56 40

Lattice parameters

a b c alpha beta gamma
9.52518 9.87796 7.05569 90.0000 90.0000 90.0000

Unit-cell volume = 663.865482 Å^3

Total number of polygons and unique vertices on slices;
(1 0 0): 0 ( 0), 0 ( 0)
(0 1 0): 0 ( 0), 0 ( 0)
(0 0 1): 0 ( 0), 0 ( 0)
====================================================================================

====================================================================================
Title Benzene

Lattice type P
Space group name P 1
Space group number 1
Setting number 1

Lattice parameters

a b c alpha beta gamma
1.00000 1.00000 1.00000 90.0000 90.0000 90.0000

Unit-cell volume = 1.000000 Å^3

Structure parameters

x y z Occ. B Site Sym.
1 C C1 4.65450 6.23638 3.44640 1.000 1.000 1 –
2 C C2 5.86259 5.53889 3.44640 1.000 1.000 1 –
3 C C3 5.86259 4.14389 3.44640 1.000 1.000 1 –
4 C C4 4.65450 3.44640 3.44640 1.000 1.000 1 –
5 C C5 3.44640 4.14389 3.44640 1.000 1.000 1 –
6 C C6 3.44640 5.53889 3.44640 1.000 1.000 1 –
7 H H1 4.65450 7.33599 3.44640 1.000 1.000 1 –
8 H H2 6.81488 6.08869 3.44640 1.000 1.000 1 –
9 H H3 6.81488 3.59409 3.44640 1.000 1.000 1 –
10 H H4 4.65450 2.34679 3.44640 1.000 1.000 1 –
11 H H5 2.49411 3.59409 3.44640 1.000 1.000 1 –
12 H H6 2.49411 6.08869 3.44640 1.000 1.000 1 –
====================================================================================

Number of polygons and unique vertices on isosurface = 6516 (3266)
12 atoms, 12 bonds, 0 polyhedra; CPU time = 10 ms

For the medium grid (-3) case:

cubegen 0 MO=HOMO benzene.fchk benzene_HOMO_default_m3.cub -3 h

The output you find summarized in VESTA is below for this case.

/Users/damianallis/benzene_HOMO_default_m3.cub
====================================================================================
Title Benzene MO=HOMO
Dimensions 107 111 79

Lattice parameters

a b c alpha beta gamma
9.43701 9.78980 6.96751 90.0000 90.0000 90.0000

Unit-cell volume = 643.703858 Å^3

Total number of polygons and unique vertices on slices;
(1 0 0): 0 ( 0), 0 ( 0)
(0 1 0): 0 ( 0), 0 ( 0)
(0 0 1): 0 ( 0), 0 ( 0)
====================================================================================

====================================================================================
Title Benzene

Lattice type P
Space group name P 1
Space group number 1
Setting number 1

Lattice parameters

a b c alpha beta gamma
1.00000 1.00000 1.00000 90.0000 90.0000 90.0000

Unit-cell volume = 1.000000 Å^3

Structure parameters

x y z Occ. B Site Sym.
1 C C1 4.65450 6.23638 3.44640 1.000 1.000 1 –
2 C C2 5.86259 5.53889 3.44640 1.000 1.000 1 –
3 C C3 5.86259 4.14389 3.44640 1.000 1.000 1 –
4 C C4 4.65450 3.44640 3.44640 1.000 1.000 1 –
5 C C5 3.44640 4.14389 3.44640 1.000 1.000 1 –
6 C C6 3.44640 5.53889 3.44640 1.000 1.000 1 –
7 H H1 4.65450 7.33599 3.44640 1.000 1.000 1 –
8 H H2 6.81488 6.08869 3.44640 1.000 1.000 1 –
9 H H3 6.81488 3.59409 3.44640 1.000 1.000 1 –
10 H H4 4.65450 2.34679 3.44640 1.000 1.000 1 –
11 H H5 2.49411 3.59409 3.44640 1.000 1.000 1 –
12 H H6 2.49411 6.08869 3.44640 1.000 1.000 1 –
====================================================================================

Number of polygons and unique vertices on isosurface = 25532 (12774)
12 atoms, 12 bonds, 0 polyhedra; CPU time = 51 ms

For the fine grid (-4) case:

cubegen 0 MO=HOMO benzene.fchk benzene_HOMO_default_m4.cub -4 h

The output you find summarized in VESTA is below for this case.

/Users/damianallis/benzene_HOMO_default_m4.cub
====================================================================================
Title Benzene MO=HOMO
Dimensions 212 221 157

Lattice parameters

a b c alpha beta gamma
9.34876 9.74564 6.92337 90.0000 90.0000 90.0000

Unit-cell volume = 630.786281 Å^3

Total number of polygons and unique vertices on slices;
(1 0 0): 0 ( 0), 0 ( 0)
(0 1 0): 0 ( 0), 0 ( 0)
(0 0 1): 0 ( 0), 0 ( 0)
====================================================================================

====================================================================================
Title Benzene

Lattice type P
Space group name P 1
Space group number 1
Setting number 1

Lattice parameters

a b c alpha beta gamma
1.00000 1.00000 1.00000 90.0000 90.0000 90.0000

Unit-cell volume = 1.000000 Å^3

Structure parameters

x y z Occ. B Site Sym.
1 C C1 4.65450 6.23638 3.44640 1.000 1.000 1 –
2 C C2 5.86259 5.53889 3.44640 1.000 1.000 1 –
3 C C3 5.86259 4.14389 3.44640 1.000 1.000 1 –
4 C C4 4.65450 3.44640 3.44640 1.000 1.000 1 –
5 C C5 3.44640 4.14389 3.44640 1.000 1.000 1 –
6 C C6 3.44640 5.53889 3.44640 1.000 1.000 1 –
7 H H1 4.65450 7.33599 3.44640 1.000 1.000 1 –
8 H H2 6.81488 6.08869 3.44640 1.000 1.000 1 –
9 H H3 6.81488 3.59409 3.44640 1.000 1.000 1 –
10 H H4 4.65450 2.34679 3.44640 1.000 1.000 1 –
11 H H5 2.49411 3.59409 3.44640 1.000 1.000 1 –
12 H H6 2.49411 6.08869 3.44640 1.000 1.000 1 –
====================================================================================

Number of polygons and unique vertices on isosurface = 100680 (50348)
12 atoms, 12 bonds, 0 polyhedra; CPU time = 155 ms

These all generate a file containing the highest occupied molecular orbital (or one of the degenerate HOMO’s in this case. Do I have to qualify that this doesn’t mean what 99.5% of the people coming to this page thinks this means?). The box is generated by something in cubegen to be 9.3ish x 9.7ish x 6.9ish Angstroms on a side and containing X points per Angstrom (and you can change the fineness of the grid points). The image below shows the four cases for the benzene HOMO. Click to see larger versions if you want to see the influence of grid fineness on the final image.

benzene_homo_gaussian_defaults_small

Click for a larger view.

Now, then, while the boxes are almost all identical, the same molecule and input gives four slightly different results. Fine for individual images, but not ideal for the obsessive-compulsive image maker. Also, you see how a box simply bounds the molecule, meaning no standardization of size if you needed that standardization for some reason.

   a        b        c       alpha    beta     gamma
 9.39704  9.82909  7.02078  90.0000  90.0000  90.0000 < - default (0)
 9.52518  9.87796  7.05569  90.0000  90.0000  90.0000 <- coarse (-2)
 9.43701  9.78980  6.96751  90.0000  90.0000  90.0000 <- medium (-3)
 9.34876  9.74564  6.92337  90.0000  90.0000  90.0000 <- fine (-4)

So, for a specific case - suppose I wanted this orbital in a box exactly 15 x 20 x 25 Angstroms on a side with the molecule offset from the center by -1.0 Angstrom in each direction.

I was pleased to finally discover that cubegen allows for that, although you have to ask Gaussian Support to find out how (until now, that is) and you need to do a little bit of math to get the placement right (or use the excel file I've linked in a .zip file found at 2014june7_cubegen_excel_file.xlsx).

You begin with the following:

cubegen 0 MO=HOMO benzene.fchk benzene_HOMO.cub -1 h

But for -1, Where do the numbers go?

From the Gaussian Tech Doc:

A value of -1 says to read the cube specification from the input stream, according to the following format:

IFlag, X0, Y0, Z0 Output unit number and initial point.
N1, X1, Y1, Z1 Number of points and step-size in the X-direction.
N2, X2, Y2, Z2 Number of points and step-size in the Y-direction.
N3, X3, Y3, Z3 Number of points and step-size in the Z-direction.

IFlag is the output unit number. If IFlag is less than 0, then a formatted file will be produced; otherwise, an unformatted file will be written.

Admittedly, “input stream” made no sense to me upon first and second read. I just knew that the program didn’t do anything when I ran it. Now obvious, this means you input the cube specifications by typing in (or, better, pasting in) the 16 numbers it asks for.

Continuing…

The -1 tells cubegen to “expect more input.” In this case, without explanation first, my input would look as below:

-12  -6.50000  -9.00000 -11.50000
 60   0.25000   0.00000   0.00000
 80   0.00000   0.25000   0.00000
100   0.00000   0.00000   0.25000

Which you just paste into your terminal at the new line (having pressed ENTER after typing out the cubegen line above).

How this works (and note the use of minus signs!):

-[# Atoms] -[Start Point For Box In X] -[Start Point For Box In Y] -[Start Point For Box In Z]
[Number of Points In X]   [Grid Fineness In X]   [Grid Fineness In Y]   [Grid Fineness In Z]
[Number of Points In Y]   [Grid Fineness In X]   [Grid Fineness In Y]   [Grid Fineness In Z]
[Number of Points In Y]   [Grid Fineness In X]   [Grid Fineness In Y]   [Grid Fineness In Z]

Assuming orthogonality in your box, the off-diagonals for the grid fineness matrix are zero.

-[# Atoms] -[Start Point For Box In X] -[Start Point For Box In Y] -[Start Point For Box In Z]
[Number of Points In X]  [Grid Fineness In X]   0.000   0.000
[Number of Points In Y]  0.000   [Grid Fineness In Y]   0.000
[Number of Points In Y]  0.000   0.000   [Grid Fineness In Z]

4. -6.5, -9, -11.5?

You build the box around your molecule in cubegen, which means you combine (1) where you want the molecule positions with (2) the number of grid points along each direction and (3) the fineness of the grid to generate the box. Here, I’m starting my hypothetical box at -6.5 in X, -9 in Y, and -11.5 in Z, then building out my molecule 121*.25 points in X, 161*.25 in Y, 201*.25 in Z. This will produce the intended box size with the molecule technically centered at the origin in the box (0,0,0), but the generation of all 121, 161, and 201 points in X, Y, and Z will result in the box going from -6.5 to 8.5, -9 to 11, and -11.5 to 13.5 (and there’s your asymmetry in the box). Alternatively, you could think of it as generating a box 15 x 20 x 25, then placing the center of the molecule at 6.5, 9, 11.5 (but you don’t specify the box size directly, instead relying on the relative position of the molecule and the fineness of the grid to determine the position (from which you could work back to get the number of points you needed in each direction if you knew the size of the box you wanted. Yes, you might have to re-read that a few times).

I demonstrate this below for a benzene orbital “walk” along X using direct output from VESTA. The rest of the numbers in my matrix above are the same except for the “-[Start Point For The Box In X]” value.

benzene_homo_walk

The benzene walk (numbers show the spacing based on the cubegen input above).

5. Formula For Boxes And Grid Points

You can, in fact, work from the box size you want and relative position of the molecule in that box with some simple math. That looks like the table below:

-(# Atoms)           -(X Position)  -(Y Position)  -(Z Position)
(Box Size / X Mesh)    X Mesh         0.00000        0.00000
(Box Size / Y Mesh)    0.00000        Y Mesh         0.00000
(Box Size / Z Mesh)    0.00000        0.00000        Z Mesh

You specify # Atoms, X Position, Y Position, Z Position, X Mesh, Y Mesh and Z Mesh, then decide on how big your box is going to be. Also, note that X Position, Y Position, Z Position all need to be 1/2 the size of your box if you want the molecule centered. A way to help force this is to force the molecule to have its center of mass shifted to the origin using Symm=COM in your input file.

As mentioned above, a simple excel file for performing this task is provided for download at 2014june7_cubegen_excel_file.xlsx.

6. Lastly, A Procedure For Scripting The Generation Of Many Orbitals

That first stone passed, everything about making custom .cub/.cube files finally made sense. But it lead to another problem. Suppose I want to generate many molecular orbitals. Does one have to paste in the IFlag…Z3 block each time?

Thankfully, this process can be scripted to automation as well, although it’s not just a matter of pasting IFlag…Z3 below each run of cubegen. Doing that produces the following…

Example:

This isn’t a cubegen problem, it’s a Linux issue with the interpretation of stdin. The cubegen script needs to be fed in the matrix in a file (say cubegen.dat if you always want the same .cub/.cube file generated) or via the use of an EOF call.

Cubegen.dat:

cubegen 0 MO=1 benzene.fchk benzene_MO1.cub -1 h < cubegen.dat
cubegen 0 MO=2 benzene.fchk benzene_MO2.cub -1 h < cubegen.dat
cubegen 0 MO=3 benzene.fchk benzene_MO3.cub -1 h < cubegen.dat
...

EOF

cubegen 0 MO=1 benzene.fchk benzene_MO1.cub -1 h << EOF
-12  -6.50000  -9.00000 -11.50000
 60   0.25000   0.00000   0.00000
 80   0.00000   0.25000   0.00000
100   0.00000   0.00000   0.25000
EOF
cubegen 0 MO=2 benzene.fchk benzene_MO2.cub -1 h << EOF
-12  -6.50000  -9.00000 -11.50000
 60   0.25000   0.00000   0.00000
 80   0.00000   0.25000   0.00000
100   0.00000   0.00000   0.25000
EOF
cubegen 0 MO=3 benzene.fchk benzene_MO3.cub -1 h << EOF
-12  -6.50000  -9.00000 -11.50000
 60   0.25000   0.00000   0.00000
 80   0.00000   0.25000   0.00000
100   0.00000   0.00000   0.25000
EOF
...

7. What’s The Deal With The Benzene Cation?

Nothing, except I saw a question in my perusing of cubegen problems and found one related to UHF wavefunctions. How do you render alpha spin orbitals and beta spin orbitals? The answer is you dig into the .log file for the orbital energies and count (to the best of my knowledge).

Benzene (21 alpha/beta-occupied)

 Alpha  occ. eigenvalues -- -10.18955 -10.18928 -10.18928 -10.18872 -10.18872
 Alpha  occ. eigenvalues -- -10.18845  -0.84761  -0.73971  -0.73971  -0.59595
 Alpha  occ. eigenvalues --  -0.59595  -0.51588  -0.45423  -0.43943  -0.41518
 Alpha  occ. eigenvalues --  -0.41518  -0.36090  -0.33862  -0.33862  -0.24750
 Alpha  occ. eigenvalues --  -0.24750
 Alpha virt. eigenvalues --   0.00266   0.00266   0.08636   0.14126   0.14126
 Alpha virt. eigenvalues --   0.16238   0.17957   0.17957   0.18681   0.29989
 Alpha virt. eigenvalues --   0.29989   0.31908   0.31908   0.46637   0.52628
 Alpha virt. eigenvalues --   0.54782   0.55099   0.56222   0.59294   0.60077
 Alpha virt. eigenvalues --   0.60077   0.60084   0.60084   0.62384   0.62384
 Alpha virt. eigenvalues --   0.66653   0.66653   0.74180   0.81178   0.81178
 Alpha virt. eigenvalues --   0.82134   0.83694   0.83694   0.91676   0.93745
 Alpha virt. eigenvalues --   0.93745   0.95812   1.08054   1.08054   1.12992
 Alpha virt. eigenvalues --   1.12992   1.20098   1.26111   1.30051   1.40786
 Alpha virt. eigenvalues --   1.40786   1.42585   1.42585   1.42914   1.42914
 Alpha virt. eigenvalues --   1.74102   1.76078   1.80542   1.87583   1.90680
 Alpha virt. eigenvalues --   1.90680   1.97195   1.97195   1.97924   1.97924
 Alpha virt. eigenvalues --   2.02762   2.07664   2.07664   2.29609   2.29609
 Alpha virt. eigenvalues --   2.34429   2.34429   2.35491   2.39944   2.40328
 Alpha virt. eigenvalues --   2.40328   2.44636   2.44636   2.48731   2.48731
 Alpha virt. eigenvalues --   2.50802   2.58538   2.58538   2.60300   2.65987
 Alpha virt. eigenvalues --   2.75521   2.80103   2.80103   3.03123   3.03123
 Alpha virt. eigenvalues --   3.18490   3.20485   3.21867   3.21867   3.37166
 Alpha virt. eigenvalues --   3.48298   3.48298   3.93339   4.13215   4.16289
 Alpha virt. eigenvalues --   4.16289   4.43754   4.43754   4.82384

RHF wave functions are easy as the alpha and beta spin orbitals are identical (so you just call one).

Benzene Cation (21 alpha occ, 20 beta occ)

 Alpha  occ. eigenvalues --  -10.44746 -10.44745 -10.44690 -10.44689 -10.41307
 Alpha  occ. eigenvalues --  -10.41306  -1.09893  -0.99649  -0.97270  -0.83278
 Alpha  occ. eigenvalues --   -0.83268  -0.74423  -0.68358  -0.67574  -0.65278
 Alpha  occ. eigenvalues --   -0.63494  -0.61047  -0.56837  -0.56618  -0.51141
 Alpha  occ. eigenvalues --   -0.47878
 Alpha virt. eigenvalues --   -0.25225  -0.22671  -0.10624  -0.07758  -0.05310
 Alpha virt. eigenvalues --   -0.04280  -0.01821  -0.00871   0.00401   0.08260
 Alpha virt. eigenvalues --    0.08579   0.09642   0.10056   0.25206   0.29439
 Alpha virt. eigenvalues --    0.31399   0.31852   0.34121   0.36475   0.36906
 Alpha virt. eigenvalues --    0.37451   0.38343   0.38500   0.39459   0.40284
 Alpha virt. eigenvalues --    0.43576   0.45334   0.52549   0.60260   0.60770
 Alpha virt. eigenvalues --    0.61287   0.62929   0.64337   0.70989   0.71650
 Alpha virt. eigenvalues --    0.71731   0.74333   0.85713   0.86949   0.90112
 Alpha virt. eigenvalues --    0.90952   0.98816   1.00856   1.05831   1.15646
 Alpha virt. eigenvalues --    1.17792   1.17972   1.18789   1.20601   1.20854
 Alpha virt. eigenvalues --    1.49713   1.52475   1.57000   1.65756   1.66784
 Alpha virt. eigenvalues --    1.68337   1.73545   1.74011   1.74167   1.74723
 Alpha virt. eigenvalues --    1.80258   1.82880   1.84586   2.04024   2.06015
 Alpha virt. eigenvalues --    2.12117   2.12667   2.14025   2.17682   2.18940
 Alpha virt. eigenvalues --    2.19096   2.22084   2.22451   2.24748   2.25480
 Alpha virt. eigenvalues --    2.28544   2.35165   2.36888   2.39005   2.41062
 Alpha virt. eigenvalues --    2.52629   2.57091   2.57724   2.79730   2.80863
 Alpha virt. eigenvalues --    2.95189   2.99029   2.99731   3.01110   3.14403
 Alpha virt. eigenvalues --    3.25310   3.26537   3.70063   3.88553   3.90763
 Alpha virt. eigenvalues --    3.92953   4.18629   4.20462   4.58339
  Beta  occ. eigenvalues --  -10.44304 -10.44303 -10.44252 -10.44250 -10.41463
  Beta  occ. eigenvalues --  -10.41462  -1.08758  -0.97673  -0.97028  -0.82708
  Beta  occ. eigenvalues --   -0.82377  -0.74165  -0.67883  -0.67164  -0.64793
  Beta  occ. eigenvalues --   -0.63478  -0.57727  -0.56637  -0.56323  -0.47270
  Beta virt. eigenvalues --   -0.41639  -0.21435  -0.21139  -0.10438  -0.05496
  Beta virt. eigenvalues --   -0.05056  -0.04232  -0.01054  -0.00739   0.00754
  Beta virt. eigenvalues --    0.08748   0.08784   0.10027   0.10356   0.25410
  Beta virt. eigenvalues --    0.30875   0.31655   0.33033   0.34430   0.37599
  Beta virt. eigenvalues --    0.38243   0.38423   0.38827   0.38857   0.40471
  Beta virt. eigenvalues --    0.40510   0.45633   0.45687   0.53548   0.60543
  Beta virt. eigenvalues --    0.61003   0.61366   0.63303   0.64325   0.71163
  Beta virt. eigenvalues --    0.71910   0.72371   0.74501   0.86611   0.87153
  Beta virt. eigenvalues --    0.90721   0.90982   0.99163   1.02443   1.07028
  Beta virt. eigenvalues --    1.17547   1.18130   1.19642   1.19672   1.20955
  Beta virt. eigenvalues --    1.21374   1.51458   1.52709   1.57335   1.66396
  Beta virt. eigenvalues --    1.67580   1.68460   1.73895   1.74747   1.75260
  Beta virt. eigenvalues --    1.75568   1.80924   1.84865   1.84936   2.06229
  Beta virt. eigenvalues --    2.06582   2.12479   2.12665   2.14334   2.18350
  Beta virt. eigenvalues --    2.18883   2.19283   2.22289   2.22978   2.25783
  Beta virt. eigenvalues --    2.25938   2.29233   2.36212   2.37068   2.39062
  Beta virt. eigenvalues --    2.42549   2.53376   2.57824   2.57840   2.79980
  Beta virt. eigenvalues --    2.80952   2.95964   2.99101   2.99875   3.01115
  Beta virt. eigenvalues --    3.14561   3.25632   3.26592   3.70353   3.89317
  Beta virt. eigenvalues --    3.92008   3.93146   4.19813   4.20623   4.58989

In the case of UHF wave functions, you specify alpha or beta using AMO= or BMO= when you run cubegen.

Compiling And Running GAMESS-US (1 May 2013(R1)) On 64-bit Ubuntu 12.X/13.X In SMP Mode

Saturday, April 5th, 2014

Author’s Note 1: It is my standard policy to put too much info into guides so that those who are searching for specific problems they come across will find the offending text in their searches. With luck, your “build error” search sent you here.

Author’s Note 2: It’s not as bad as it looks (I’ve included lots of output and error messages for easy searching)!

Author’s Note 3: I won’t be much help for you in diagnosing your errors, but am happy to tweak the text below if something is unclear.

Conventions: I include both the commands you type in your Terminal and some of the output from these commands, the output being where most of the errors appear that I work on in the discussion.

Input is formatted as below:

username – your username (check your prompt)
machinename – your hostname (type hostname or check your prompt)

Text you put in at the (also shown, so you see the directory structure) prompt (copy + paste should be fine)

Text you get out (for checking results and reproducing errors)

Having just recently downloaded the newest version of GAMESS-US (R1 2013), my first few passes at using it under Linux (specifically, Ubuntu 12.04) ran into a few walls that required some straightforward modifications and a little bit of system prep planning. As my first few passes before successful execution are likely the same exact problems you might have run into in your attempts to get GAMESS-US to run (after a successful compilation and linking), I’m posting my problems and solutions here.

Qualifier 1 – My concern at the moment has been to get GAMESS-US to run under 64-bit Ubuntu 12.04 on a multi-core board (ye olde symmetric multiprocessing (which I always called single multi-processor, or SMP)). While some answers may follow in what’s below, this post doesn’t cover MPI-specific builds (nothing through a router, that is). SMP is the only concern (which is to say, I likely won’t have good answers if you send along an MPI-specific question). Also, although I’m VERY interested in trying it, I’ve not yet attempted to build a GPU-capable version (but plan to in the near future).

Qualifier 2 – It is my standard policy to install apps into /opt, and my steps below will reflect that (specifically because there’s a permission issue that needs to be addressed when you first try to build components). You can default to whatever you like, but keep in mind my tweaks when you try to build your local copy.

So, with the qualifiers in mind…

1. Prepping The System (apt-get)

There are few things better than being able to apt-get everything you need to prep your machine for an install, and I’m pleased to report that the (current) process for putting the important files onto Ubuntu 12.X/13.X is easy. Assuming you’re not going the Intel / PGI / MKL route, you can do everything by installing gfortran (compiler, presently installing 4.4) and the blas and atlas math libraries.

username@machinename:~$ sudo apt-get install gfortran libblas-dev libatlas-base-dev

Note: your atlas libraries will be installed in /usr/lib64/atlas/ – this will matter when you run config.

After these finish, run the following to determine your installed gfortran version (will be asked for by the new GAMESS config)

username@machinename:~$ gfortran -dumpversion

GNU Fortran (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3 Copyright (C) 2010 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING

4.4 And you’re ready for GAMESS.

2. Downloading GAMESS-US, Placing Into /opt, And Changing Permissions

First, obviously, get the GAMESS source (click on the red text).

After downloading, copy/move gamess-current.tar.gz into /opt

username@machinename:~$ cd ~/Downloads
username@machinename:~/Downloads$ sudo cp gamess-current.tar.gz /opt
username@machinename:~/Downloads$ cd /opt
username@machinename:/opt$ sudo gunzip gamess-cuerent.tar.gz
username@machinename:/opt$ sudo tar xvd gamess-current.tar

gamess/ gamess/gms-files.csh gamess/tools/ ... gamess/misc/count.code gamess/misc/vbdum.src gamess/Makefile.in

At this point, if you go through the config process and get to the point of building ddikick.x, you will get an error when you first try to run ./compddi

username@machinename:/opt/gamess/ddi$ sudo ./compddi >& compddi.log &
[1] 4622 -bash: compddi.log: Permission denied

The problem is with the permission of the entire gamess folder:

drwxr-xr-x  4 root        root              4096 2014-04-04 21:43 . drwxr-xr-x 22 root        root              4096 2013-12-27 16:17 .. drwxr-xr-x 14 1300 504              4096 2014-04-04 21:43 gamess -rw-r--r-- 1 root        root         198481920 2014-04-04 21:42 gamess-current.tar

Which you remedy before running into this error by changing the permissions:

username@machinename:/opt$ sudo chown -R username gamess

The next step is recommended when you run config, so I’m performing the step here to get it out of the way. With the atlas libraries installed, generate two symbolic links.

username@machinename:/opt$ cd /usr/lib64/atlas
username@machinename:/usr/lib64/atlas$ sudo ln -s libf77blas.so.3.0 libf77blas.so
username@machinename:/usr/lib64/atlas$ sudo ln -s libatlas.so.3.0 libatlas.so

And, at this point, you’re ready to run the new (well, new to me) config script that preps your system install.

3. Building GAMESS-US

Back to the GAMESS-US folder.

username@machinename:/usr/lib64/atlas$ cd /opt/gamess
username@machinename:/opt/gamess$ sudo ./config
This script asks a few questions, depending on your computer system, to set up compiler names, libraries, message passing libraries, and so forth. You can quit at any time by pressing control-C, and then . Please open a second window by logging into your target machine, in case this script asks you to 'type' a command to learn something about your system software situation. All such extra questions will use the word 'type' to indicate it is a command for the other window. After the new window is open, please hit to go on.

You can open that second window or blindly assume that what I include below is all you need.

[enter]

GAMESS can compile on the following 32 bit or 64 bit machines: axp64 - Alpha chip, native compiler, running Tru64 or Linux cray-xt - Cray's massively parallel system, running CNL hpux32 - HP PA-RISC chips (old models only), running HP-UX hpux64 - HP Intel or PA-RISC chips, running HP-UX ibm32 - IBM (old models only), running AIX ibm64 - IBM, Power3 chip or newer, running AIX or Linux ibm64-sp - IBM SP parallel system, running AIX ibm-bg - IBM Blue Gene (P or L model), these are 32 bit systems linux32 - Linux (any 32 bit distribution), for x86 (old systems only) linux64 - Linux (any 64 bit distribution), for x86_64 or ia64 chips AMD/Intel chip Linux machines are sold by many companies mac32 - Apple Mac, any chip, running OS X 10.4 or older mac64 - Apple Mac, any chip, running OS X 10.5 or newer sgi32 - Silicon Graphics Inc., MIPS chip only, running Irix sgi64 - Silicon Graphics Inc., MIPS chip only, running Irix sun32 - Sun ultraSPARC chips (old models only), running Solaris sun64 - Sun ultraSPARC or Opteron chips, running Solaris win32 - Windows 32-bit (Windows XP, Vista, 7, Compute Cluster, HPC Edition) win64 - Windows 64-bit (Windows XP, Vista, 7, Compute Cluster, HPC Edition) winazure - Windows Azure Cloud Platform running Windows 64-bit type 'uname -a' to partially clarify your computer's flavor. please enter your target machine name:

We’re doing a linux64 build, so type the following at the prompt:

linux64
Where is the GAMESS software on your system? A typical response might be /u1/mike/gamess, most probably the correct answer is /opt/gamess GAMESS directory? [/opt/gamess]

Who is this mike and where is my folder u1? We’ll get to that in rungms. For now, I’m installing in /opt, so the default directory is fine:

[enter]

Setting up GAMESS compile and link for GMS_TARGET=linux64 GAMESS software is located at GMS_PATH=/opt/gamess Please provide the name of the build locaation. This may be the same location as the GAMESS directory. GAMESS build directory? [/opt/gamess]

Fine as selected.

[enter]

Please provide a version number for the GAMESS executable. This will be used as the middle part of the binary's name, for example: gamess.00.x Version? [00]

Is this important? Maybe, if you plan on building multiple versions of GAMESS-US (you might want a GPU-friendly version, one with a different compiler, one with MPI, etc.). Number as you wish and remember the number when it comes to rungms. That said, the actual linking step seems to really want to produce a 01 version (we’ll get to that). Meantime, default value is fine.

[enter]

Linux offers many choices for FORTRAN compilers, including the GNU compiler set ('g77' in old versions of Linux, or 'gfortran' in current versions), which are included for free in Unix distributions. There are also commercial compilers, namely Intel's 'ifort', Portland Group's 'pgfortran', and Pathscale's 'pathf90'. The last two are not common, and aren't as well tested as the others. type 'rpm -aq | grep gcc' to check on all GNU compilers, including gcc type 'which gfortran' to look for GNU's gfortran (a very good choice), type 'which g77' to look for GNU's g77, type 'which ifort' to look for Intel's compiler, type 'which pgfortran' to look for Portland Group's compiler, type 'which pathf90' to look for Pathscale's compiler. Please enter your choice of FORTRAN:

We’re using gfortran (currently 4.4.3):

gfortran

gfortran is very robust, so this is a wise choice. Please type 'gfortran -dumpversion' or else 'gfortran -v' to detect the version number of your gfortran. This reply should be a string with at least two decimal points, such as 4.1.2 or 4.6.1, or maybe even 4.4.2-12. The reply may be labeled as a 'gcc' version, but it is really your gfortran version. Please enter only the first decimal place, such as 4.1 or 4.6:
4.4

Alas, your version of gfortran does not support REAL*16, so relativistic integrals cannot use quadruple precision. Other than this, everything will work properly. hit to continue to the math library setup.

If this was my biggest concern I’d be a happy quantum chemist. Obviously you can try to install other flavors of gfortran and, possibly, by the time you need the procedure I’m following, a newer version of gfortran will be apt-gotten.

[enter]

Linux distributions do not include a standard math library. There are several reasonable add-on library choices, MKL from Intel for 32 or 64 bit Linux (very fast) ACML from AMD for 32 or 64 bit Linux (free) ATLAS from www.rpmfind.net for 32 or 64 bit Linux (free) and one very unreasonable option, namely 'none', which will use some slow FORTRAN routines supplied with GAMESS. Choosing 'none' will run MP2 jobs 2x slower, or CCSD(T) jobs 5x slower. Some typical places (but not the only ones) to find math libraries are Type 'ls /opt/intel/mkl' to look for MKL Type 'ls /opt/intel/Compiler/mkl' to look for MKL Type 'ls /opt/intel/composerxe/mkl' to look for MKL Type 'ls -d /opt/acml*' to look for ACML Type 'ls -d /usr/local/acml*' to look for ACML Type 'ls /usr/lib64/atlas' to look for Atlas Enter your choice of 'mkl' or 'atlas' or 'acml' or 'none':
atlas

Where is your Atlas math library installed? A likely place is /usr/lib64/atlas Please enter the Atlas subdirectory on your system:

Our location is, in fact, /usr/lib64/atlas, so we type it in accordingly.

NOTE: If you don’t type anything but [enter] below, the script closes (/usr/lib64/atlas is listed as the expected location, but it is not defaulted by the script. You need to type it in.

/usr/lib64/atlas
 
The linking step in GAMESS assumes that a softlink exists within the system's /usr/lib64/atlas from libatlas.so to a specific file like libatlas.so.3.0 from libf77blas.so to a specific file like libf77blas.so.3.0 config can carry on for the moment, but the 'root' user should chdir /usr/lib64/atlas ln -s libf77blas.so.3.0 libf77blas.so ln -s libatlas.so.3.0 libatlas.so prior to the linking of GAMESS to a binary executable. Math library 'atlas' will be taken from /usr/lib64/atlas please hit to compile the GAMESS source code activator

The symbolic linking was performed before the GAMESS steps.

[enter]

gfortran -o /home/username/gamess/tools/actvte.x actvte.f unset echo Source code activator was successfully compiled. please hit to set up your network for Linux clusters.
[enter]

If you have a slow network, like Gigabit Ethernet (GE), or if you have so few nodes you won't run extensively in parallel, or if you have no MPI library installed, or if you want a fail-safe compile/link and easy execution, choose 'sockets' to use good old reliable standard TCP/IP networking. If you have an expensive but fast network like Infiniband (IB), and if you have an MPI library correctly installed, choose 'mpi'. communication library ('sockets' or 'mpi')?

Again, I’m not building an mpi-friendly version, so am using sockets.

sockets

64 bit Linux builds can attach a special LIBCCHEM code for fast MP2 and CCSD(T) runs. The LIBCCHEM code can utilize nVIDIA GPUs, through the CUDA libraries, if GPUs are available. Usage of LIBCCHEM requires installation of HDF5 I/O software as well. GAMESS+LIBCCHEM binaries are unable to run most of GAMESS computations, and are a bit harder to create due to the additional CUDA/HDF5 software. Therefore, the first time you run 'config', the best answer is 'no'! If you decide to try LIBCCHEM later, just run this 'config' again. Do you want to try LIBCCHEM? (yes/no):
no

Your configuration for GAMESS compilation is now in /home/username/gamess/install.info Now, please follow the directions in /home/username/gamess/machines/readme.unix username@machinename:~/gamess$

At this stage, you’re ready to build ddikick.x and continue with the compiling.

4. Build ddikick.x

username@machinename:/opt/gamess$ cd ddi
username@machinename:/opt/gamess/ddi$ sudo ./compddi >& compddi.log &

Will dump output into compddi.log (which will now work with the correct permissions).

username@machinename:/opt/gamess/ddi$ sudo mv ddikick.x ..
username@machinename:/opt/gamess/ddi$ cd ..
username@machinename:/opt/gamess$ sudo ./compall >& compall.log &

Feel free to follow along as compall.log dumps results. You’re also welcome to follow the readme.unix advice:

This takes a while, so go for coffee, or check the SF Giants web page.

Upon completion, the last step is to link the executable.

Now, it used to be the case that you specified the version number in the lked step. So, if you wanted to stick with the 00 version from the config file, you’d type

username@machinename:/opt/gamess$ sudo ./lked gamess 00 >& lked.log &

When you do that at present, you get

[1] 7626 username@machinename:/opt/gamess$ [1]+ Stopped sudo ./lked gamess 00 &>lked.log

This then leads you to use the lked call from the readme.unix file.

username@machinename:/opt/gamess$ sudo ./lked gamess 01 >& lked.log &

Which then produces lked.log and gamess.01.x.

Now, if you run with 00 again, you get a successful linking of gamess.00.x . Not sure why this happens, but the version number isn’t important so long as you specify the right one when you use rungms (so I’ve not diagnosed it further).

At this point, you have a gamess.00.x and/or gamess.01.x executable in your /opt/gamess folder:

30828747 2014-04-04 22:41 gamess.01.x

I’m going to ignore the 00 issue out of the config file and use the gamess.01.x executable.

We’re ready to run calculations and work through the next set of errors you’ll receive if you don’t properly modify files.

5. PATH Setting

First, we copy rungms to our home folder, then add /opt/gamess to the PATH:

username@machinename:/opt/gamess$ cp rungms ~/
username@machinename:/opt/gamess$ cd ~/
username@machinename:~$ nano .bashrc

Add the following to the bottom of .bashrc (or extend your PATH)

PATH=$PATH:/opt/gamess

Quit nano and source.

username@machinename:~$ source .bashrc
[OPTIONAL] username@machinename:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:.../opt/gamess:

6. rungms (Probably Why You’re Here)

If you just go blindly into a run, you’ll get the following error:

username@machinename:~$ ./rungms test.inp

----- GAMESS execution script 'rungms' ----- This job is running on host machinename under operating system Linux at Fri Apr 4 22:47:55 EDT 2014 Available scratch disk space (Kbyte units) at beginning of the job is df: `/scr/username': No such file or directory df: no file systems processed GAMESS temporary binary files will be written to /scr/username GAMESS supplementary output files will be written to /home/username/scr Copying input file test.inp to your run's scratch directory... cp test.inp /scr/username/test.F05 cp: cannot create regular file `/scr/username/test.F05': No such file or directory unset echo /u1/mike/gamess/gms-files.csh: No such file or directory.

As is obvious, rungms needs some modifying.

username@machinename:~$ nano rungms

Scroll down until you see the following:

set TARGET=sockets set SCR=/scr/$USER set USERSCR=~$USER/scr set GMSPATH=/u1/mike/gamess

Given that it’s just me on the machine, I tend to simplify this by making SCR and USERSCR the same directory, and I make them both /tmp. If you intend on keeping all of the files, you’ll need to make rungms specific for each run case. My only concerns are .dat and .log, so /tmp dumping is fine. Furthermore, we must change GMSPATH from how the ever-helpful Mike Schmidt (he got me through some early issues when I started my GAMESS-US adventure 15ish years ago. Won’t complain about his continued default-ed presence in the scripts) has it set up at Iowa to how we want it on our own machines (in my case, /opt/gamess)

set TARGET=sockets set SCR=/tmp set USERSCR=/tmp set GMSPATH=/opt/gamess

With these modifications, your next run will be a bit more successful:

username@machinename:~$ ./rungms test.inp

----- GAMESS execution script 'rungms' ----- This job is running on host machinename under operating system Linux at Fri Apr 4 22:51:35 EDT 2014 Available scratch disk space (Kbyte units) at beginning of the job is Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 1905222596 249225412 1559217460 14% / GAMESS temporary binary files will be written to /tmp GAMESS supplementary output files will be written to /tmp Copying input file test.inp to your run's scratch directory... cp test.inp /tmp/test.F05 unset echo /opt/gamess/ddikick.x /opt/gamess/gamess.00.x test -ddi 1 1 machinename -scr /tmp Distributed Data Interface kickoff program. Initiating 1 compute processes on 1 nodes to run the following command: /opt/gamess/gamess.00.x test ****************************************************** * GAMESS VERSION = 1 MAY 2013 (R1) * * FROM IOWA STATE UNIVERSITY * * M.W.SCHMIDT, K.K.BALDRIDGE, J.A.BOATZ, S.T.ELBERT, * * M.S.GORDON, J.H.JENSEN, S.KOSEKI, N.MATSUNAGA, * * K.A.NGUYEN, S.J.SU, T.L.WINDUS, * * TOGETHER WITH M.DUPUIS, J.A.MONTGOMERY * * J.COMPUT.CHEM. 14, 1347-1363(1993) * **************** 64 BIT LINUX VERSION **************** ... INPUT CARD> DDI Process 0: shmget returned an error. Error EINVAL: Attempting to create 160525768 bytes of shared memory. Check system limits on the size of SysV shared memory segments. The file ~/gamess/ddi/readme.ddi contains information on how to display the current SystemV memory settings, and how to increase their sizes. Increasing the setting requires the root password, and usually a sytem reboot. DDI Process 0: error code 911 ddikick.x: application process 0 quit unexpectedly. ddikick.x: Fatal error detected. The error is most likely to be in the application, so check for input errors, disk space, memory needs, application bugs, etc. ddikick.x will now clean up all processes, and exit... ddikick.x: Sending kill signal to DDI processes. ddikick.x: Execution terminated due to error(s). unset echo ----- accounting info ----- Files used on the master node machinename were: -rw-r--r-- 1 username username 0 2014-04-04 22:51 /tmp/test.dat -rw-r--r-- 1 username username 1341 2014-04-04 22:51 /tmp/test.F05 ls: No match. ls: No match. ls: No match. Fri Apr 4 22:51:36 EDT 2014 0.0u 0.0s 0:01.08 9.2% 0+0k 0+8io 0pf+0w

Things worked, but with a memory error. This issue is discussed at the Baldridge Group wiki: ocikbapps.uzh.ch/kbwiki/gamess_troubleshooting.html

From the wiki:

If you are sure you are not asking for too much memory in the input file, check that your kernel parameters are not allowing enough memory to be requested. You might have to increase the SHMALL & SHMAX kernel memory values to allow GAMESS to run. (See http://www.pythian.com/news/245/the-mysterious-world-of-shmmax-and-shmall/ for a better explanation.)
For example, on a machine with 4GB of memory, you might add these to /etc/sysctl.conf:
# cat /etc/sysctl.conf | grep shm
kernel.shmmax = 3064372224
kernel.shmall = 748137
Then set the new settings like so:
# sysctl -p
Since they are in /etc/sysctl.conf, they will automatically be set each time the system is booted.

In our case, we modify sysctl.conf with the recommendations from the wiki:

username@machinename:~$ sudo nano /etc/sysctl.conf

Add the following to the bottom of the file:

kernel.shmmax = 3064372224 kernel.shmall = 748137

Save and exit.

username@machinename:~$ sudo sysctl -p

net.ipv4.ip_forward = 1 kernel.shmmax = 3064372224 kernel.shmall = 748137

These memory values will change depending on your system.

Now we empty the /tmp and rerun.

username@machinename:~$ rm /tmp/*
username@machinename:~$ ./rungms test.inp

If your input file is worth it’s salt, you’ll have successfully run your file on a single processor (single core, that is). If you run into additional memory errors, increase kernel.shmmax and kernel.shmall.

Now, onto the SMP part. My first attempt to run games in parallel (on 4 cores using version 00) produced the following error:

username@machinename:~$ rm /tmp/*
username@machinename:~$ ./rungms test.inp 00 4

----- GAMESS execution script 'rungms' ----- This job is running on host machinename under operating system Linux at Fri Apr 4 22:52:52 EDT 2014 Available scratch disk space (Kbyte units) at beginning of the job is Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 1905222596 249225416 1559217456 14% / GAMESS temporary binary files will be written to /tmp GAMESS supplementary output files will be written to /tmp Copying input file test.inp to your run's scratch directory... cp test.inp /tmp/test.F05 unset echo I do not know how to run this node in parallel.

I tried a number of stupid things to get the run to work, finally settling on modifying the rungms file properly. To make gamess know how to run the node in parallel, we need only make the following changes to our rungms file.

username@machinename:~$ nano rungms

Scroll down until you find the section below:

# 2. This is an example of how to run on a multi-core SMP enclosure, # where all CPUs (aka COREs) are inside a -single- NODE. # At other locations, you may wish to consider some of the examples # that follow below, after commenting out this ISU specific part. if ($NCPUS > 1) then switch (`hostname`) case se.msg.chem.iastate.edu: case sb.msg.chem.iastate.edu: if ($NCPUS > 2) set NCPUS=4 set NNODES=1

The change is simple. We remove the cases for $NCPUS > 1 in the file and add the hostname of our linux box (and if you don’t know this or it’s not in your prompt, simply type hostname at the prompt first). We’ll disable the two cases listed and add our hostname to the case list.

# 2. This is an example of how to run on a multi-core SMP enclosure, # where all CPUs (aka COREs) are inside a -single- NODE. # At other locations, you may wish to consider some of the examples # that follow below, after commenting out this ISU specific part. if ($NCPUS > 1) then switch (`hostname`) case machinename: # case se.msg.chem.iastate.edu: # case sb.msg.chem.iastate.edu: if ($NCPUS > 2) set NCPUS=4 set NNODES=1

This gives you parallel functionality, but it’s still not using the machine resources (cores) correctly when I ask for anything more than 2 cores (always using only 2 cores).

[minor complaint]
Admittedly, I don’t immediately get the logic of this section as currently coded, as one cannot get more than 2 cores to work in this case given how the if statements are written (so far as I can see now. I will assume I am the one missing something but have not decided to ask about it, instead changing the rungms text to the following). You can check this yourself by running top in another window. This is the most simple modification, and assumes you want to run N number of cores each time. Clearly, you can make this more elegant than it is (my modification, that is). Meantime, I want to run 4 cores on this machine, so I change the section to reflect a 4-core board (and commented out much of this section).
[/complaint]

# 2. This is an example of how to run on a multi-core SMP enclosure, # where all CPUs (aka COREs) are inside a -single- NODE. # At other locations, you may wish to consider some of the examples # that follow below, after commenting out this ISU specific part. if ($NCPUS > 1) then switch (`hostname`) case machinename # case se.msg.chem.iastate.edu: # case sb.msg.chem.iastate.edu: # if ($NCPUS > 2) set NCPUS=2 # set NNODES=1 # set HOSTLIST=(`hostname`:cpus=$NCPUS) # breaksw # case machinename # case br.msg.chem.iastate.edu: if ($NCPUS >= 4) set NCPUS=4 set NNODES=1 set HOSTLIST=(`hostname`:cpus=$NCPUS) breaksw case machinename # case cd.msg.chem.iastate.edu: # case zn.msg.chem.iastate.edu: # case ni.msg.chem.iastate.edu: # case co.msg.chem.iastate.edu: # case pb.msg.chem.iastate.edu: # case bi.msg.chem.iastate.edu: # case po.msg.chem.iastate.edu: # case at.msg.chem.iastate.edu: # case sc.msg.chem.iastate.edu: # if ($NCPUS > 4) set NCPUS=4 # set NNODES=1 # set HOSTLIST=(`hostname`:cpus=$NCPUS) # breaksw # case ga.msg.chem.iastate.edu: # case ge.msg.chem.iastate.edu: # case gd.msg.chem.iastate.edu: # if ($NCPUS > 6) set NCPUS=6 # set NNODES=1 # set HOSTLIST=(`hostname`:cpus=$NCPUS) # breaksw default: echo I do not know how to run this node in parallel. exit 20 endsw endif #

And, with this set of changes, I’m using all 4 cores on the board (but have some significant memory issues when running MP2 calks. But that’s for another post).

The typical user will never be able to do what the GAMESS group has done in making an excellent program that also happens to be free. That said, the need to make changes to the rungms file is something that would be greatly simplified by having N number of rungms scripts for each case instead of a monolithic file that is mostly useless text to users not using one of the system types. This, for instance, would make rungms modification much easier. If I streamline rungms for my specific system, I may post a new file accordingly.

Obligatory

  • CNYO

  • Sol. Sys. Amb.

  • Ubuntu 4 Nano

  • NMT Review

  • N-Fact. Collab.

  • T R P Nanosys

  • Nano Gallery

  • nano gallery
  • Aerial Photos

    More @ flickr.com

    Syracuse Scenes

    More @ flickr.com