[gmx-developers] Gromacs python api

Alexey Shvetsov alexxy at omrb.pnpi.spb.ru
Mon Oct 13 14:52:00 CEST 2014

Hi all!

Actually we want to implement basic analysis framework python api in 
near future that will generated using SIP from C++ trajectory analysis 
framework. This API will include basic classes such as 
trajectoryanalysis selection and may be some others. This will be first 

In next steps it will be good to have py api for core mdrun 
functionality and may be for some tools.

Why it may be needed for someone I think that writing some non-standart 
analysis tools are easier using scripted language such as python. So 
such tools may be implemented in future using C++ api.

Peter Kasson писал 13-10-2014 15:28:
> Hi!
> We (Kasson, Shirts, Abraham, Lindahl) have been planning a broader
> Gromacs API, but the spec isn't complete yet, and the project isn't
> fully staffed.  Speaking for myself at least, I would say that having
> some clean working code now is better than having beautiful plans.  So
> this sounds great!  A few comments below:
> 1.  Depending on how much you want to merge this into master and how
> much you want the code in master 2 years from now to look like your
> initial commits (i.e. future radical refactoring), please feel free to
> ignore the rest of what I say :).

I think that py api should be tightly coupled to c++ code, so it 
definitely will benefit if it will be merged to master. Current 
implementation uses sip api code generators to generate python3 api from 

> 2.  It's probably best to get an API spec reviewed before committing
> full code (or ideally before writing it).  If the code review
> consensus is that the design should look different, there's a lot less
> work that way.

That's why i post previous email to list. It will be good if we will 
have consensus about py api before it will be fully written.

> 3.  IMO the Python API should look a lot like the C++ API.  For most
> of Gromacs, the form of the C++ API isn't clear.  But for the analysis
> framework, Teemu has done a great job with that...

In its current state its generated from C++ analysis framework. In plans 
for near future we wanna have full analysis framework python api + 
selections api. Other parts will came later.

> 4.   Again, depending on your plans for how this code should relate to
> the Gromacs master, we should probably have a redmine discussion.

Since we use SIP codegenerators api fully depend on C++ code. I created 
redmine issue http://redmine.gromacs.org/issues/1625

> 5.  Coding style--we use the following guidelines, and they're the
> ones I would advocate:
> http://google-styleguide.googlecode.com/svn/trunk/pyguide.html [1]
> 6.  Directory structure should probably mirror the module import
> structure.
> Best,
> --Peter
> ----------------------------------------------------------------------
> Peter Kasson, MD, PhD
> Assistant Professor
> Departments of Molecular Physiology and Biological Physics
> and of Biomedical Engineering
> University of Virginia
> Links:
> ------
> [1] http://google-styleguide.googlecode.com/svn/trunk/pyguide.html

Best Regards,
Alexey 'Alexxy' Shvetsov, PhD
Department of Molecular and Radiation Biophysics
FSBI Petersburg Nuclear Physics Institute, NRC Kurchatov Institute,
Leningrad region, Gatchina, Russia
mailto:alexxyum at gmail.com
mailto:alexxy at omrb.pnpi.spb.ru

More information about the gromacs.org_gmx-developers mailing list