Wrapping cp2k

Toon Toon.Ver... at gmail.com
Mon May 7 10:35:47 CEST 2007


Hi Fawzi,

Currently I don't have much time to work on a python wrapper, but I
hope to pick the topic at a later time. Right now, I think there are a
few interesting ideas to spread around.


On 5 mei, 23:29, fawzi <f.... at gmx.ch> wrote:
> 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

There are a few python-mpi bindings that do not require python to be
recompiled. I'm not sure whether they might be helpful in this
context:

Pypar: http://datamining.anu.edu.au/~ole/pypar/
MYMPI: http://peloton.sdsc.edu/~tkaiser/mympi/

I have only a little fortran and hardly any MPI experience. I do most
of my programming work (related to developing force fields, robust
regularization techniques) in python, because the implementation takes
much longer than computing part. Since the cp2k community is mainly
fortran-focused, here are a few ideas that would make a python-cp2k
binding interesting from the development point-of-view:

* Unit tests are well supported in python. They are a valuable
addition to regtests. A few advantages: Unit tests only test a small
part of the program instead of a complete execution. This gives them a
closer relation to reported/fixed bugs. They survive changes in the
output format. They focus on reusing (parts of) existing tests to
write new ones, which allows one to create a whole bunch of tests with
a limited amount of code. One only has to write the tests, the
complete framework around them is already provided.

* Even if the final purpose is to implement each run_type in cp2k
itself, the python-cp2k binding would allow fast prototyping. It
lowers the barrier for researchers with good theoretical skills to
start implementing their ideas. It is by far much easier to write a
relatively small python script, than hacking a big unfamiliar fortran
beast, even when one is already accustomed to fortran and still has to
learn python. (Ok, this is maybe a bald statement.)

have a nice day,

Toon




More information about the CP2K-user mailing list