Difference between revisions of "CamCASP/Compilation"

From CUC3
Jump to navigation Jump to search
import>Ajs1
m
import>Ajs1
Line 69: Line 69:
 
<li>The file include/dftacfa.h declares the same common block twice. One declaration needs to be deleted.</li>
 
<li>The file include/dftacfa.h declares the same common block twice. One declaration needs to be deleted.</li>
 
<li>The entire code of dft/auxongrid.F is duplicated. One copy needs to be deleted.</li>
 
<li>The entire code of dft/auxongrid.F is duplicated. One copy needs to be deleted.</li>
  +
<li>Likewise dft/dzero.c.</li>
 
</ul>
 
</ul>
  +
Finally, the script bin/dalton needs to be edited to give the correct path to the executables. (Best written as, e.g., "$DALTON/bin/dalton.x".)
   
 
6. Building SAPT is troublesome, because file-names in Mac OS X are case-insensitive, so the shell script called SAPT in the SAPT bin directory gets confused with the SAPT executable called sapt. This can be worked around by renaming the SAPT script, e.g. as SAPT.sh, and commenting out the lines (around line 348) in Compall that change the first line of SAPT. (It doesn't need to be changed for Mac OS.) This must be done before attempting to run Compall -- otherwise the SAPT script will get overwritten by the sapt binary. Line 329 of Compall also needs to be changed to provide for the gfortran option. The current version of CamCASP doesn't use either SAPT or sapt unless 3rd-order energies are wanted.
 
6. Building SAPT is troublesome, because file-names in Mac OS X are case-insensitive, so the shell script called SAPT in the SAPT bin directory gets confused with the SAPT executable called sapt. This can be worked around by renaming the SAPT script, e.g. as SAPT.sh, and commenting out the lines (around line 348) in Compall that change the first line of SAPT. (It doesn't need to be changed for Mac OS.) This must be done before attempting to run Compall -- otherwise the SAPT script will get overwritten by the sapt binary. Line 329 of Compall also needs to be changed to provide for the gfortran option. The current version of CamCASP doesn't use either SAPT or sapt unless 3rd-order energies are wanted.

Revision as of 15:06, 9 January 2009

CamCASP => Compilation

Notes on compiling CamCASP

  • Gfortran

There seem to be problems with gfortran versions earlier than 4.3. I think it is because the preprocessor is not automatically used (even if -cpp is used, because only with version 4.4 is this option recognised). It may be possible to get around this, but for now, I've found it easier to download my own copy of GCC 4.4.

GCC 4.4 will reside in its own directory. Do not install it in with the other GCC compilers as it is still under development. Because it will reside in a non-standard location, you need to set some environment scripts to get the compilation going. I use the following scripts.

1. gcc_4.4.env

#!/bin/bash

gcc44="tmp/gcc-trunk"
export LD_RUN_PATH=${HOME}/$gcc44/lib64
echo $LD_RUN_PATH
export LD_LIBRARY_PATH=${HOME}/$gcc44/lib64:$LD_LIBRARY_PATH
export PATH=${HOME}/$gcc44/bin:$PATH

2. makeall

#!/bin/bash
source ./gcc_4.4.env
echo $LD_RUN_PATH
echo $LD_LIBRARY_PATH
gfortran -v

mymake='make COMPILER=gfortran MACHINE=tati '

${mymake} clean

${mymake} all

exit

These are really simple scripts. After compilation (when makeall exits) the default GCC flags will be reset, so your experimental version of GCC doesn't affect anything else.


  • Compiling on Mac OS X

1. Install Fink and FinkCommander. (See http://finkcommander.sourceforge.net.) You can build all the programs from the command line -- no need for Xcode.

2. Make sure you get the latest version of gfortran, from http://gcc.gnu.org/wiki/GFortranBinaries.

3. You need the full ATLAS lapack library.

4. The CamCASP programs should compile without any problems using the scripts above. Make sure that the -static flag is not specified, though.

5. For Dalton, the configure script must be edited to allow for the use of gfortran.

  • In line 200, add "gfortran" to the darwin complist.
  • Change line 744 to 'tab=$(echo "\t")'.
  • Copy the g77 section in lines 1072 to 1086 to follow l. 1091. In this copied section:
    • Change g77 to gfortran and set mcpu to "".
    • Remove the line 'LIB="-lcc_dynamic"' -- this flag isn't needed with current versions of gcc.
    • Change the definition of opt to 'opt="$copt2 -std=legacy"'.

Some minor code changes are also needed.

  • In cc/cc_pckutil.F, line 100, change z'C0000000' to transfer(z'C0000000',1)). A similar change is needed in lines 236 and 238.
  • In abacus/her2out.F, replace line 406 by
                PERCNT = real(100*N2WRIT,kind(1d0)) / real(NALL,kind(1d0))
    
  • The file include/dftacfa.h declares the same common block twice. One declaration needs to be deleted.
  • The entire code of dft/auxongrid.F is duplicated. One copy needs to be deleted.
  • Likewise dft/dzero.c.

Finally, the script bin/dalton needs to be edited to give the correct path to the executables. (Best written as, e.g., "$DALTON/bin/dalton.x".)

6. Building SAPT is troublesome, because file-names in Mac OS X are case-insensitive, so the shell script called SAPT in the SAPT bin directory gets confused with the SAPT executable called sapt. This can be worked around by renaming the SAPT script, e.g. as SAPT.sh, and commenting out the lines (around line 348) in Compall that change the first line of SAPT. (It doesn't need to be changed for Mac OS.) This must be done before attempting to run Compall -- otherwise the SAPT script will get overwritten by the sapt binary. Line 329 of Compall also needs to be changed to provide for the gfortran option. The current version of CamCASP doesn't use either SAPT or sapt unless 3rd-order energies are wanted.

7. Building Orient is fairly straightforward except for the link options.

  • Omit the -static option.
  • The ATLAS libraries need to be invoked by giving the full pathname of each library file in the gfortran link step -- otherwise the Mac version of ATLAS is scanned, leaving many unresolved references. That is, instead of "-llapack", specify e.g. "/usr/local/ATLAS/OSX_CORE2SSE2/lib/liblapack.a", and similarly for cblas, f77blas and atlas.
  • The OpenGL libraries are provided as standard in Mac OS X. To include them, specify "-Wl,-framework,OpenGL -Wl,-framework,GLUT" in the link step.