User Tools

Site Tools


howto:compile_on_mac

This is an old revision of the document!


How to Compile and Install CP2K on Windows with Cygwin

1.Acquiring the code

Visit CP2K download page and download the source code by any means you prefer.

1.1 Download from Sourceforge

If one get the distribution from Sourceforge website, after download cp2k-2.x.x.tar.bz2, unpack the archive files using the command given below

tar -xvf cp2k-2.x.x.tar.bz2

1.2 Download using SVN Access

The code in SVN is under constant development. Check the Dashboard for current issues.

The latest and all prior versions are available from the CP2K SVN repository.

Check out only a needed branch (the branch will then be in cp2k/cp2k).

  • current trunk:
    svn checkout http://svn.code.sf.net/p/cp2k/code/trunk cp2k

These branches can be updated to their latest version in the following way:

cd cp2k/cp2k
svn update

Alternatively, you may restrict the download to the folder cp2k/cp2k containing source code, tools, and test inputs, e.g. for the trunk version use

svn checkout http://svn.code.sf.net/p/cp2k/code/trunk/cp2k cp2k

Analogous checkouts work for the branch versions.

The Subversion (svn) program must be installed on your machine for this to work.

3.Compilation with Cygwin

An example CP2K ARCH file for a serial build of CP2K on Mac is as follows:

# With GCC 4.9 or later, for gcc and gfortran
# libxc is installed in LIBXC_INCLUDE_DIR / LIBXC_LIB_DIR
# libint is installed in LIBINT_LIB_DIR
CC       = gcc
CPP      =
FC       = gfortran
LD       = gfortran
AR       = ar -r
RANLIB   = ranlib
DFLAGS   = -D__NO_STATM_ACCESS -D__ACCELERATE
FCFLAGS  = -I $(LIBXC_INCLUDE_DIR) -O2 -ffast-math -funroll-loops \
           -ftree-vectorize -ffree-form $(DFLAGS)
LDFLAGS  = $(FCFLAGS)
LIBS     = -framework Accelerate

Remove the -DLIBXC -DLIBINT flag if you compile CP2K. Save it as Darwin-IntelMacintosh-gfortran.sopt in the cp2k-x.x.x/arch directory alongside the other ARCH files.
Launch the Terminal and change the working directory to cp2k-x.x.x/makefiles. Type make command as follows:

make ARCH=Darwin-IntelMacintosh-gfortran VERSION=sopt

It may take quite a while until a compilation is completed. If you have a multi-core machine you may use e.g. make -j 4 to compile in parallel with 4 tasks.
If you find cp2k.sopt in cp2k-x.x.x/exe directory, then compilation is successfully done.

howto/compile_on_mac.1523358033.txt.gz · Last modified: 2020/08/21 10:15 (external edit)