gemmi
A fast library for macromolecular files (mmCIF, PDB), density maps and symmetry.
Tool 089 of 100 in the MolForge directory of open-source tools. Every fact below was read from the repository's host on 2026-11-28.

What gemmi is
gemmi is a C++ library with Python bindings and a command-line tool for handling the files of structural biology and crystallography. It reads and writes mmCIF (and the CIF syntax in general), PDB and mmJSON coordinate files, MTZ and mmCIF reflection files, and CCP4/MRC density maps, and it handles unit cells, space groups and symmetry operations, including neighbour searches across symmetry images. It is developed by Global Phasing in collaboration with CCP4.
In Python, a structure loads into a model, chain, residue and atom hierarchy that can be edited and written back; reflection data loads into arrays suitable for NumPy; maps can be computed from structure factors by FFT. The gemmi command has subcommands for conversion between formats, extracting fields from many mmCIF files, contact analysis, adding hydrogens from a monomer library and preparing restraints. It is used inside CCP4 tools such as Servalcat.
gemmi is a building block, not an application: it performs no refinement, structure solution or visualisation, and its value lies in reliable parsing and symmetry handling for programs that do.
Features
- Parsing and writing of CIF/mmCIF, PDB and mmJSON with a documented object model
- Unit cells, space-group tables and symmetry operations, with fractional-orthogonal conversion
- Reflection data: MTZ read and write, conversion to and from mmCIF structure factors
- Density maps in CCP4/MRC format, structure-factor to map by FFT, and masks
- Neighbour search and contact analysis including symmetry-related copies
- Monomer library support for adding hydrogens and generating restraints
- Command-line tool with subcommands such as convert, grep, contact and sf2map
What it is for
- Convert between PDB and mmCIF, including structures too large for the PDB format
- Extract specific mmCIF fields across thousands of entries with gemmi grep
- Read MTZ data and compute an electron-density map in Python
- Analyse contacts and symmetry-related neighbours in a crystal
- Prepare a model with hydrogens and restraints before refinement
Verified facts
| Family | Crystallography |
|---|---|
| Language or basis | C++, Python |
| Repository | https://github.com/project-gemmi/gemmi (GitHub) |
| Licence | MPL-2.0 (SPDX identifier as declared in the repository) |
| Main language on GitHub | C++ |
| Last commit | 2026-11-26 |
| Latest release | v0.7.5 (2026-03-02) |
| Stars | 401 on 2026-11-28 |
| Open issues and pull requests | 36 on 2026-11-28 |
| Repository created | 2017-02-02 |
| Verified | 2026-11-28 by MolForge's checking script, against the host's API |
Where gemmi fits
Symmetry, diffraction and macromolecular file handling.
Questions people ask
- How is gemmi different from Biopython's PDB module?
- Scope. Bio.PDB is a pure-Python parser aimed at sequence and structure analysis of coordinate files. gemmi is a C++ library with Python bindings that also covers reflection data, density maps, crystallographic symmetry and full mmCIF semantics, and it offers a command-line tool. For crystallographic work gemmi is the more complete choice; for general bioinformatics Biopython fits.
- Can gemmi read reflection data?
- Yes. It reads and writes MTZ files, converts between MTZ and mmCIF structure-factor files, and can turn structure factors into a density map by Fourier transform or compute structure factors from a model. Column access from Python returns arrays usable with NumPy.
- Is gemmi only for Python?
- No. gemmi is a header-only C++ library that can be included in other programs, a Python module installed with pip or conda, and a standalone command-line program. The three share the same code, so a workflow prototyped in Python can move to C++ without changing behaviour.
- Does gemmi refine structures or display them?
- Neither. gemmi provides parsing, symmetry, maps and model utilities that refinement programs such as Servalcat and REFMAC and viewers such as Mol* or Coot can build on. It does include tools that prepare models for refinement, such as adding hydrogens and generating restraints from a monomer library.
- Is gemmi open source?
- Yes. The repository declares the MPL-2.0 licence (SPDX identifier read from the host on 2026-11-28). Read the licence text in the repository before redistributing or embedding it.
- Where is the gemmi source code?
- At https://github.com/project-gemmi/gemmi (GitHub). This is the address the host reported on the day of verification; renamed repositories are followed to their new home.
- Is gemmi still maintained?
- The last commit was pushed on 2026-11-26 and the latest tagged release is v0.7.5 from 2026-03-02; the repository had 36 open issues and pull requests on 2026-11-28.
- Does MolForge use gemmi?
- No. MolForge runs nine of the hundred tools in this directory (RDKit, OpenMM, AutoDock Vina, Open Babel, MDTraj, pymbar and NGL, plus PySCF and xTB in MFsig); gemmi is listed because of its place in crystallography, not because we run it.
Our comments on gemmi
MolForge does not run gemmi in production. This page is a verified pointer, not a review: the facts above come from the repository on the date shown, the description is ours, and we make no claim about accuracy or speed that we have not measured. If you maintain gemmi and something here is wrong or out of date, write to hello@molforge.ai and we will correct the source file.
Test status
Not tested by MolForge. To check gemmi yourself: clone the repository, follow the installation section of its README, and run the test suite the project ships before trusting a result; the last-commit date and the open issue count above tell you how alive the project is.