Closed farhi closed 5 years ago
CP2K example with ASE
which is:
$ export ASE_CP2K_COMMAND="mpirun -n 2 cp2k_shell.popt"
$ python
>>> from ase.calculators.cp2k import CP2K
>>> from ase.build import molecule
>>> calc = CP2K()
>>> atoms = molecule('H2O', calculator=calc)
>>> atoms.center(vacuum=2.0)
>>> print(atoms.get_potential_energy())
-467.191035845
But fails with:
>>> calc = CP2K()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/ase/calculators/cp2k.py", line 170, in __init__
self._shell = Cp2kShell(self.command, self._debug)
File "/usr/local/lib/python2.7/dist-packages/ase/calculators/cp2k.py", line 436, in __init__
assert self.recv() == '* READY'
AssertionError
Requires fixing as MR, to be more relaxed when getting the CP2K version.
Can also look at:
The CP2K works mostly, when "get version" is not blocking, but the pseudo basis seems to be updated:
the example ends with CP2K error:
*********************************************************************
*** ERROR in read_gth_potential (MODULE external_potential_types) ***
*********************************************************************
*** The requested atomic potential <GTH-LDA> for element <H> was not ***
*** found in the potential file <POTENTIAL> ***
CP2K is now version 4.1. Ubuntu 16.04 provides 2.6 (from 2015). ASE requires version 3 or newer. CP2K 4 easy to install. Has a dependency solver (install in tools/toolchain).
Could make a Debian package ??
Pushed ASE MR https://gitlab.com/ase/ase/merge_requests/601 to update CP2K calculator and use version 2.6.
To use in iFit, remains, as specified in https://wiki.fysik.dtu.dk/ase/ase/calculators/cp2k.html:
MR was refused. Go towards a CP2K build version 4.1 for Ubuntu 14.04 and 16.04.
CP2K 4.1 compile:
CP2K version 4.1 compiles with OpenMPI, ScaLAPACK and BLACS, after installing the toolchain.Then the 'arch' file for the makefile dependencies is "local.popt":
CC = gcc
CXX = g++
CPP =
AR = ar -r
FC = mpif90
LD = mpif90
#
DFLAGS = -D__LIBXSMM -D__parallel -D__MPI_VERSION=2 -D__FFTW3 -D__LIBINT -D__LIBINT_MAX_AM=6 -D__LIBDERIV_MAX_AM1=5 -D__LIBXC -D__SCALAPACK
#
WFLAGS = -Werror=aliasing -Werror=ampersand -Werror=c-binding-type -Werror=intrinsic-shadow -Werror=intrinsics-std -Werror=line-truncation -Werror=tabs -Werror=realloc-lhs-all -Werror=target-lifetime -Werror=underflow -Werror=unused-but-set-variable -Werror=unused-variable -Werror=unused-dummy-argument -Werror=conversion -Werror=uninitialized -Wno-maybe-uninitialized
#
FCDEBFLAGS = -ffree-form -std=f2003 -fimplicit-none
CFLAGS = -march=native -fno-omit-frame-pointer -g -O3 -funroll-loops -ffast-math $(PROFOPT) -I'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/fftw-3.3.4/include' -I'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libint-1.1.4/include' -I'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libxc-2.2.2/include' -I'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libxsmm-1.4.4/include' $(DFLAGS)
FCFLAGS = -march=native -fno-omit-frame-pointer -g -O3 -funroll-loops -ffast-math $(PROFOPT) -I'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/fftw-3.3.4/include' -I'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libint-1.1.4/include' -I'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libxc-2.2.2/include' -I'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libxsmm-1.4.4/include' $(FCDEBFLAGS) $(WFLAGS) $(DFLAGS)
#
LDFLAGS = $(FCFLAGS) -Wl,--enable-new-dtags -L'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/fftw-3.3.4/lib' -Wl,-rpath='/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/fftw-3.3.4/lib' -L'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libint-1.1.4/lib' -Wl,-rpath='/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libint-1.1.4/lib' -L'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libxc-2.2.2/lib' -Wl,-rpath='/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libxc-2.2.2/lib' -L'/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libxsmm-1.4.4/lib' -Wl,-rpath='/home/farhi/Downloads/cp2k-4.1/tools/toolchain/install/libxsmm-1.4.4/lib'
LIBS = -lxsmmf -lxsmm -lxcf90 -lxc -lderiv -lint -lfftw3 -lstdc++ -lscalapack-openmpi -lblacs-openmpi -lblacsCinit-openmpi -lblas -llapack
making cp2k-4.1-trusty package...
Done. Debian packages available at http://packages.mccode.org/
KPoints keyword is missing in ASE/Calculators/cp2k
According to
the syntax should be something like:
&FORCE_EVAL
&DFT
&KPOINTS
SCHEME MONKHORST-PACK 3 3 1
FULL_GRID .TRUE.
&END KPOINTS
&END DFT
&END FORCE_EVAL
Not in ASE/CP2k either: smearing nbands etol that's bad.
Ole Schütt pushed a kpoints support for CP2K in his own branch of ASE:
see https://gitlab.com/oschuett/ase/commit/933b9863670f0bcc0673c1243fc53495d34c62b3
There is as well a test with Si. Should try.
ASE/CP2K requires 'cp2k_shell' to be found in the CP2K.command see https://wiki.fysik.dtu.dk/ase/ase/calculators/cp2k.html
The cp2k_shell is not part of the Debian packages. Must compile CP2K and create Debian package if this is a route to follow.
CP2K 2.6.2 Ubuntu 16.04 (from repo) does not seem to be functional with ASE as is. The '* READY' message is not detected and raises a stop.