Reading a .mfsig file in Python, one block at a time
A .mfsig file is JSON. Load it with the standard library, print the top-level keys, then walk the identity, method, segment, moment and energy blocks.
Updated November 28, 2026
A .mfsig file is a JSON document that follows the mfsig/v1.0 schema. It opens with the Python standard library and no extra dependency. It holds the identity of the molecule, the geometry, the method, the per-segment data, the surface area, the σ-moments, the energies, the dipole norm, the package versions and a content SHA-256. This walkthrough reads each block in turn and says what to do with it. The exact key names are on the anatomy page, and the code below prints them before assuming anything.
Open it and print what is there
import json
with open("ethanol.mfsig", encoding="utf-8") as fh:
doc = json.load(fh)
print(type(doc).__name__)
for key, value in doc.items():
kind = type(value).__name__
size = len(value) if hasattr(value, "__len__") else ""
print(f"{key:20} {kind:8} {size}")Do this first on any file you have not seen before. The output is the table of contents. You will recognise the identity, geometry, method, segment, area, moments, energies, dipole, versions and hash blocks by name, and you will see which ones are dictionaries, which are lists and how long the lists are. Compare the list against the anatomy page rather than against memory, since field names are versioned with the schema.
Identity and method, the two blocks you read first
The identity block says what was computed. It carries the SMILES as written, the fragments that were dropped and the number of unassigned stereocentres. Read it before anything else. If the SMILES is not the one you submitted, the file is not the one you think it is. If the dropped list is not empty, a counter-ion or a solvent was removed. If the unassigned count is not zero, the geometry is one arbitrary stereoisomer.
The method block says how. It names the functional, the basis set, the auxiliary basis, the continuum model and its dielectric constant, the cavity construction and the convergence settings, and it carries the recipe version. For files from the current production recipe this is ωB97M-V with def2-SVP, density fitting with def2-svp-jkfit, C-PCM at ε = 80 and a cavity from modified Bondi radii scaled by 1.2. Two files should only be compared when their method blocks agree, see what a DFT recipe is.
Per-segment data, the heart of the file
The per-segment block lists the cavity segments. For each segment there is a position, an area and a σ value. The σ is the raw screening charge on that segment divided by its area, in e/Ų. It is not averaged over neighbours. Everything else about sigma profiles follows from this list.
Two checks are worth doing on first contact. Sum the segment areas and compare the sum with the surface area field, they should agree to within rounding. And compute the area-weighted mean of σ. For a neutral molecule it should be close to zero, because the total screening charge mirrors the total molecular charge. For an anion the mean is positive and for a cation negative.
import numpy as np
seg = doc[SEGMENT_KEY] # key names from the anatomy page
area = np.array([s[AREA_KEY] for s in seg])
sigma = np.array([s[SIGMA_KEY] for s in seg])
print("segments:", len(seg))
print("total area from segments:", area.sum())
print("surface area field:", doc[AREA_FIELD_KEY])
print("area-weighted mean sigma:", (area * sigma).sum() / area.sum())From here a σ-profile is a weighted histogram, as shown in the plotting guide. Before feeding anything to a COSMO-RS or COSMO-SAC implementation, remember that those parameterisations expect an averaged σ-profile, and the raw per-segment σ in this file must not be passed to them as if it were.
σ-moments, energies and dipole, the ready-made descriptors
The σ-moments block gives the variance, the skewness and the excess kurtosis of the σ distribution over the surface. They are computed from the same segments, so you can recompute them with numpy, weighting each segment by its area, and confirm that the file is self-consistent. The σ-moments guide explains how to read them.
The energies block gives the reaction-field energy, the HOMO and LUMO energies in solvent and the gap in electronvolts. The dipole block gives the norm of the dipole moment in debye. Units for the reaction-field energy and for the geometry are on the anatomy page. Check them before you multiply by anything. The units guide describes the usual bohr and ångström mistakes and how to catch them.
Versions and the content hash
The versions block records the package versions read at run time, which is what makes the result reproducible years later. The content SHA-256 identifies the file content independently of its name or location. Use it as the primary key in any database. How the hash is computed and how to recompute it are described on the anatomy page. A file whose recomputed hash does not match has been edited, and an edited file is no longer the result it claims to be.
What is not in the file
The file holds one conformer and one calculation. It does not hold an averaged σ-profile, an activity coefficient, a solubility or any mixture property. Those are downstream computations that take the raw segments as input and add their own assumptions. Keeping them out of the file keeps the file honest about what was measured and what was modelled afterwards.
Key points
- A .mfsig file is JSON, schema mfsig/v1.0, and opens with the standard library. Print the top-level keys first.
- Read the identity block before anything else, then the method block, and only compare files whose recipes agree.
- The per-segment σ is raw screening charge per area in e/Ų, not an averaged σ-profile. Build histograms from it yourself.
- The σ-moments, energies and dipole are descriptors you can verify from the segments.
- Use the content SHA-256 as the identifier of the result and check the exact key names on the anatomy page.
Questions people ask
- Is a .mfsig file plain JSON?
- Yes. It follows the mfsig/v1.0 schema and opens with the Python standard library. The blocks are identity, geometry, method, per-segment data, surface area, σ-moments, energies, dipole norm, package versions and a content SHA-256. The anatomy page lists the exact key names.
- Is the σ in the file already a σ-profile?
- No. The file carries the raw screening charge density per segment, in e/Ų, not averaged. A σ-profile is a histogram you build from it. The raw values are not the averaged σ-profile that COSMO-RS or COSMO-SAC parameterisations expect, and must not be fed to them as if they were.
- What units are the energies in?
- The HOMO and LUMO are reported in solvent, with the gap in electronvolts, and the dipole norm in debye. Check the units of the reaction-field energy and of the geometry on the anatomy page before using them, since bohr and ångström errors are the most common mistakes.
Further reading
In practice: A .mfsig file is JSON and reads with the standard library. Ordering is done on the site or through the API described in the docs, and AI agents can read the published samples through the MCP server at /mcp.
Generate a σ-profile from your SMILES
Free converter for a profile you already have, a reference-grade DFT run with its provenance record when it has to be defensible.