Possible python interface and passing forces to cp2k

118 views
Skip to first unread message

Elizabeth Lee

unread,
Apr 13, 2021, 9:14:21 PM4/13/21
to cp2k
Hello everyone,

I was wondering if there is a way to pass positions & forces to and from cp2k MD integrator with some python interface?
It seems like cp2k has a "driver" mode that works with IPi as shown below:


But it is not clear to me what can be passed to and from cp2k when using in the driver mode.

Thank you.

Best,

Elizabeth

Vladimir Rybkin

unread,
Apr 15, 2021, 8:25:54 AM4/15/21
to cp2k
Dear Elizabeth,

ASE uses CP2K as calculator. 


i-PI is another MD software working with CP2K forces:


Yours, 

Vladimir

среда, 14 апреля 2021 г. в 03:14:21 UTC+2, elizam...@gmail.com:

hut...@chem.uzh.ch

unread,
Apr 15, 2021, 2:14:47 PM4/15/21
to cp...@googlegroups.com
Hi

you can also get some inspiration from

cp2k/tools/f77_interface

regards

Juerg Hutter
--------------------------------------------------------------
Juerg Hutter Phone : ++41 44 635 4491
Institut für Chemie C FAX : ++41 44 635 6838
Universität Zürich E-mail: hut...@chem.uzh.ch
Winterthurerstrasse 190
CH-8057 Zürich, Switzerland
---------------------------------------------------------------

-----cp...@googlegroups.com wrote: -----
To: "cp2k" <cp...@googlegroups.com>
From: "Elizabeth Lee"
Sent by: cp...@googlegroups.com
Date: 04/14/2021 03:14AM
Subject: [CP2K:15126] Possible python interface and passing forces to cp2k
--
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/40172e78-eb3e-4ad8-b087-b0b395422f5an%40googlegroups.com.

Tiziano Müller

unread,
Apr 16, 2021, 11:30:26 AM4/16/21
to Elizabeth Lee, cp...@googlegroups.com
Hi Elizabeth,

there are are also the libcp2k-based Python bindings you can build with
(required are numpy and cython):

make python-bindings

An example Python script to use them (and to get positions and forces
from a force_env), some tests and a README are in src/start/python/.

For running with MPI you will also need mpi4py.

Best regards,
Tiziano
> --
> You received this message because you are subscribed to the Google
> Groups "cp2k" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to cp2k+uns...@googlegroups.com
> <mailto:cp2k+uns...@googlegroups.com>.
> <https://groups.google.com/d/msgid/cp2k/40172e78-eb3e-4ad8-b087-b0b395422f5an%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Tiziano Müller
University of Zurich
Department of Chemistry
Winterthurerstrasse 190
CH-8057 Zürich

Tel: +41 44 63 54234
www.chem.uzh.ch
tiziano...@chem.uzh.ch

Elizabeth Lee

unread,
Apr 21, 2021, 2:04:47 AM4/21/21
to cp2k
Thank you so much, everyone, for your responses!
After looking at cp2k/src/f77_interface.F and cp2k/src/start/python, it seems like there are functions for returning forces acting on each atoms, e.g., get_force(). 
Are there functions that can be called via python where one could add external forces to cp2k at time t, and then have cp2k to output the new position, velocity, and forces at time t + delta t? 

Any insight on this is greatly appreciated.

Best,

Elizabeth

hut...@chem.uzh.ch

unread,
Apr 21, 2021, 4:14:02 AM4/21/21
to cp...@googlegroups.com
Hi

it seems to me what you are looking for is i-Pi (or ASE).

regards

Juerg Hutter
--------------------------------------------------------------
Juerg Hutter Phone : ++41 44 635 4491
Institut für Chemie C FAX : ++41 44 635 6838
Universität Zürich E-mail: hut...@chem.uzh.ch
Winterthurerstrasse 190
CH-8057 Zürich, Switzerland
---------------------------------------------------------------

-----cp...@googlegroups.com wrote: -----
To: "cp2k" <cp...@googlegroups.com>
From: "Elizabeth Lee"
Sent by: cp...@googlegroups.com
Date: 04/21/2021 08:05AM
Subject: Re: [CP2K:15170] Possible python interface and passing forces to cp2k
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cp2k/8390d9a8-f21b-4f8f-9601-61e89039cd18n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages