orex / supercell

The program allows you to create regular structure supercell from cif file with partial occupancy and/or substitutions.
GNU General Public License v2.0
97 stars 56 forks source link

Internal representation of structures and programmatic usage (Python) #10

Closed blokhin closed 6 years ago

blokhin commented 6 years ago

Dear Kirill @orex,

so far the only possibility to use supercell is via CIF files. However, integrating into a programmatic pipeline (e.g. for high-throughput) does not necessarily implies CIF, moreover, generating and writing CIFs even in P1 assumes some redundant I/O-overhead.

Could you point me to the internal handling of structures? Something like this: https://github.com/atztogo/spglib/blob/master/example/example.c (see lattice, position etc.)

Or would you recommend to dive in from the Open Babel's side?

My ultimate goal would be to create e.g. a Python module, however currently I'm not able to estimate the required efforts adequately.

orex commented 6 years ago

Dear Eugeny,

The current version of supercell program uses a lot from OpenBabel package, but, in principal, the code is not need OpenBabel much. I had an idea to remove openbabel from the code to make it much more flexible, but this will require a lot of work. The supercell program is quite well structured, therefore you can split the functionality easily. Please start from https://github.com/orex/supercell/blob/master/src/core/d2o_main_class.cpp#L1670 where you can find step-by-step structure processing. The input and output file format can be changed to any format, supported by OB, without any problem. As for high IO, I don't think that Python code can process the output structures faster, that supercell program does it now.

Conclusion: 1) Extracting the functionality you need from supercell code will be quite time consuming. Your code should be a part of supercell code, otherwise you should manually synchronize your code with all bugfixes and improvements from supercell code.
2) The easiest way to integrate it is to wrap around the current code. It is not an elegant way, but this will work quite efficient. Supercell program is fully controled by CLI (easy to wrap) and available for Linux and MacOS. It can be also compiled for Windows, because new stable version of OpenBabel now is fully compatible with supercell code.

Best, Kirill.

P.S. Don't forget about GPL (not LGPL) license.