This is an old revision of the document!
Table of Contents
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 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.
4.Installation CP2K on Windows PC which not installed Cygwin
By using either cygcheck command (cygcheck /home/user/(cp2k directory)/exe/(ARCH directory)/cp2k.sopt) or an executable parser such as Dependency Walker (depends.exe), you can find DLLs that the built cp2k.sopt depends on.
The following six DLLs may be required to run the cp2k.sopt without Cygwin installation, but it may differ on your system.(Windows system modules are unnecessary here)
- cygwin\lib\lapack\cygblas-0.dll
- cygwin\bin\cygwin1.dll
- cygwin\bin\cyggfortran-3.dll
- cygwin\bin\cygquadmath-0.dll
- cygwin\bin\cyggcc_s-1.dll
- cygwin\lib\lapack\cyglapack-0.dll
Copy these DLLs (except Windows system DLLs) to the same directory as cp2k.sopt
.
Pressing SHIFT key right-click cp2k.sopt
directory icon and select “Open Command Window Here” menu.
And you type on the command prompt:
> cp2k.sopt --version
Then you might see:
CP2K version 2.X SVN source code revision svn:XXXXX
Congratulations! You can now run CP2K on Windows.