A hierarchical, component based molecule builder
Clone or download
justinGilmer and summeraz Attempt to fix coverage dependency issue (#466)
* Attempt to fix coverage dependency issue

Currently, the most recent version of python-coveralls requires
`coverage==4.0.3`, while pytest-cov requires `Coverage>=4.4`.

The current fix seems to be to pin `pytest-cov` to a previous
version. This can be changed once:

has been resolved.

* Hotfix for MDTraj MOL2 file issues

MDTraj has merged a fix for MOL2 file reading

However, it has not been included in a new release on
`conda` yet.

Pinning to an older version without the MOL2 fixes

* Forgot to update Appveyor build script
Latest commit 0d4a582 Oct 15, 2018


mBuild: a hierarchical, component based molecule builder

Linux Build Status Windows Build status PyPI Version Binstar Badge Coverage Status

With just a few lines of mBuild code, you can assemble reusable components into complex molecular systems for molecular dynamics simulations.

  • mBuild is designed to minimize or even eliminate the need to explicitly translate and orient components when building systems: you simply tell it to connect two pieces!
  • mBuild keeps track of the system's topology so you don't have to worry about manually defining bonds when constructing chemically bonded structures from smaller components.

To learn more, get started or contribute, check out our website.

If you use this package, please cite our paper. The BibTeX reference is

      author = "Klein, Christoph and Sallai, János and Jones, Trevor J. and Iacovella, Christopher R. and McCabe, Clare and Cummings, Peter T.",
      title = "A Hierarchical, Component Based Approach to Screening Properties of Soft Matter",
      booktitle = "Foundations of Molecular Modeling and Simulation",
      series = "Molecular Modeling and Simulation: Applications and Perspectives",
      year = "2016",
      doi = "http://dx.doi.org/10.1007/978-981-10-1128-3_5" 


Interactive tutorials can be found here:


Components in dashed boxes are drawn by hand using, e.g., Avogadro or generated elsewhere. Each component is wrapped as a simple python class with user defined attachment sites, or ports. That's the "hard" part! Now mBuild can do the rest. Each component further down the hierarchy is, again, a simple python class that describes which piece should connect to which piece.

Ultimately, complex structures can be created with just a line or two of code. Additionally, this approach seamlessly exposes tunable parameters within the hierarchy so you can actually create whole families of structures simply by adjusting a variable:

import mbuild as mb
from mbuild.examples import PMPCLayer

pattern = mb.Random2DPattern(20)  # A random arrangement of 20 pieces on a 2D surface.
pmpc_layer = PMPCLayer(chain_length=20, pattern=pattern, tile_x=3, tile_y=2)

Zwitterionic brushes on beta-cristobalite substrate


Various sub-portions of this library may be independently distributed under different licenses. See those files for their specific terms.

This material is based upon work supported by the National Science Foundation under grants NSF CBET-1028374 and NSF ACI-1047828. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.