Wrapping cp2k

fawzi fa... at gmx.ch
Sat May 5 21:29:18 UTC 2007



On 4 Mag, 20:13, Toon <Toon.Ver... at gmail.com> wrote:
> Thanks for all the positive replies! Sorry for having ignored existing
> features. For GEMC, it will certainly be most wise to use the builtin
> features, but I'm still interested in the f77 interface anyway. I
> found a few examples in the tools directory.

well actually the f77_interface started out as a way to connect to c
and to python.
To make this possible you can, through the makefile, compile cp2k as
one big library.
But then I realized a couple of things:
* mpi passing between c and fortran is a littel complicated (but MPI
1.2 has a standard for it).
* to use MPI you have to compile python linking the MPI library

For these reasons I sort of stopped working on the python interface,
because what I wanted was also parallel runs.

The f77_interface evolved became very useful within cp2k itself, as
simple interface to create force environments.
A big advantage of the f77_interface (apart being simple), is that it
lets one avoid circular dpendencies between modules.
This is another reason we use it.
Basically if a force environment should contain other force
environments on can easily be trapped in circular dependencies when
evaluating the forces: either the eval_energy_force contains provisoin
for every recursive method (making that module grow bigger and
bigger), or you have a circular dependece.
Using a f77 function you can avoid it because a f77 function can be
called before being compiled.

Basically f77_interface is structured like this:
module f77_interface is a normal module that defines all the exported
functions.
Thes functions have a flat interface and use only integers (for
example to identify force_envs), reals(double precision), real arrays
(dimension(*)), and strings.
f77_low define the actual f77 functions that can be called from any
point in the program, or from external programs (both c and fortran).
As said c is more complex if you want to play with MPI (not if you
jous want to use mpi_world).

Actually, as I said the f77 interface evolved,  and I do not know if
python still works, but I can try to bring back the python interface,
now with numpy it should be even easier, but I will do only the single
processor, for MPI will need more work.

If you have further questions or need something special, ask me...

ciao
Fawzi




More information about the CP2K-user mailing list