mathchem 0.1.0

Mathchem is a free open source Python package for calculating topological indices and other invariants of molecular graphs. Currently it has version 0.1.0. This means that the package is on a very early stage of development. It was not fully tested and any feedback is welcome.

The sources are hosted by Github: <https: github.com="" hamster3d="" mathchem-package="">

The package was tested under Mac OS X. Since the package contains no compiled code it is cross-platform and could be used in any operating system compatible with Python.

##Usage

After successfull installation you can immediately use **mathchem** in Python or Sage

Currently the package consists of two modules: **mathchem** and **utilites**.

The first one contains the class *Mol*. In a current state the only way to initialize the Mol instance object with structure data is to give a *graph6* string as an argument: `m = mc.Mol('GhCH?_')`. Support of *SMILES* and *SDF* formats will be added later.

The second module **utilites** contains some useful functions. Currently there is only one function `batch_process(infile, outfile, function)` which allows to easily read a text file sting by string, pass read data to a function and write return value to another file. Here is an axample of use:

After executing this code we can find calculated laplacian energy for all graphs listed in *'graphs.g6'* file as *graph6* strings in *'result.txt'*. In fact, we just applied function *calculate_laplacian_energy* to each line of file *'graphs.g6'* and wrote the result in *'result.txt'*.

For performance reasons we calculate data only when it is needed and then we save the results.

For instance we want to calculate three indices based on distance, let say, *Eccentric Connectivity Index*, *Balaban J index* and *Wiener Index*. This means that we need a *distance matrix*, which we calculate only once and then use it:

The *distance matrix* will be calculated only once - before calculating the first index.

##About

Mathchem package written by Alexander Vasilyev, PhD student of University of Primorska under supervision of prof. Dragan Stevanović.
All contacts details can be found at the homepage of the project: <https: github.com="" hamster3d="" mathchem-package="">