Skip to main content

Python Cyclic Voltammetry Simulator

Project description

Python Cyclic Voltammetry Simulation Software

This is a python wrapper for MECSim software. It works completely in python in a Linux environment. I wrote this while working on GPCV related work.

If you use this software in your work please cite the original MECSim software along with this repository:

@misc{pymecsim,
    author       = {Kiran Vaddi},
    title        = {{pyMECSim: A Python wrapper for MECSim}},
    month        = April,
    year         = 2020,
    version      = {1.0},
    publisher    = {github},
    url          = {https://github.com/kiranvad/pyMECSim}
    }

To install as a package, run

pip install git+https://github.com/kiranvad/pyMECSim#egg=pyMECSIM.` 

Dependencies will be checked and installed from the setup.py file.

To install the package locally:

git clone https://github.com/kiranvad/pyMECSim.git
cd pyMECSim
pip install -e .

There are two modes of usages:

Mode 1: Using pymecsim experiment interface

from pymecsim import * 

A = Specie('A', C0=1e-6)
B = Specie('B')
C = Specie('C')
D = Specie('D')
species = [A, B, C, D]

R1 = ChargeTransfer([(A,1),('e',1)],[(B,1)],E0=0.0, ks=1.0e1)
R2 = ChemicalReaction([(B,1),(C,1)],[(A,1),(D,1)], kf=1e8, kb=1e-5)

rxn = [R1, R2]

mech = Mechanism(rxn)
print(mech)

cv = DCVoltammetry(E_start = 0.5, E_rev=-0.5, nu=1.0e0)
volt = Voltammetry(objs=[cv])

exp = Experiment(mech, voltammetry=volt)

sim = MECSIM(exp=exp)
sim.plot() # plot the simulated CV curve

Mode 2: Using MECSim configuration file

If you are familiar with original MECSim software and its configuaraton files (.inp), you can also pass it as an input. Import pymecsim using the following:

from pymecsim import MECSIM, pysed

We can perform a simulation on a one electron transfer mechanism and visualize the effect of changing the formal potential using the following code:

import matplotlib.pyplot as plt
import numpy as np
import os

configfile  = '../mechanisms/cvexamples.sk'
E0 = [-0.25,0.0,0.25]
fig = plt.figure(figsize = (4,4))
ax = fig.add_subplot(111)
dirname = os.getcwd()
for i,e0 in enumerate(E0):
    outfile = dirname + '/outfile.sk'
    pysed('$E0', str(e0), configfile, outfile)
    model = MECSIM(configfile=outfile)
    ax = model.plot(ax = ax)
    ax.set_label("E0 = "+str(e0))
plt.legend([r'$E_0=0.5$',r'$E_0=0.1$',r'$E_0=1e-2$'],loc='lower right')
plt.show()

This will plot the following:

Notebooks

This repository is shipped few useful notebooks.

Notes

  • Please free to contribute to this repository both interms of code and documetation or simple example use cases in jupyter notebook. Submit a pull request and I would be happy to integrate into this repository.

  • api.md contains the detailed API of pymecsim (under construction)

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymecsim-1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymecsim-1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file pymecsim-1.0.tar.gz.

File metadata

  • Download URL: pymecsim-1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for pymecsim-1.0.tar.gz
Algorithm Hash digest
SHA256 b7054f78e00a8a6fed49ef985631e5e790299d57287981b4b421c2ed1c799940
MD5 7f59179148c0e764793e94bc5f80b490
BLAKE2b-256 20cb1eaffa4476c23eb48d7902b78b3a3f7e8c367964bce0229ecfb282728b73

See more details on using hashes here.

File details

Details for the file pymecsim-1.0-py3-none-any.whl.

File metadata

  • Download URL: pymecsim-1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for pymecsim-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42cb31313d8cf10576c8656ca59ac4bebc191f8bfb076a45a3cfbb09c5ea1a36
MD5 a3c39681cf142fec6f2882081137faf0
BLAKE2b-256 8a790a882c74a38bad1136c040728451177c8eb0666872cdc2ff4075f44e4c2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page