Contour section
Instead of a 3D isosurface, the difference map is drawn as line-only contours in the best-fit molecular plane — the traditional way density is presented in print. No plane fill is drawn, so the viewer background stays clean. Typical applications: deformation density figures, comparing density along a bond.
Reproduce it
html
<cifview-widget
src="coordinates-and-reflections.cif"
options='{
"differenceDensity": {"autoLoad": true},
"contourLines": {
"enabled": true,
"plane": {"atoms": ["C1", "O1", "N1"]},
"contourCount": 20
}
}'>
</cifview-widget>js
import { CrystalViewer } from 'cifvis';
const viewer = new CrystalViewer(container, {
differenceDensity: { autoLoad: true },
contourLines: {
enabled: true,
plane: { mode: 'best-fit' }, // or { atoms: ['C1','O1','N1'] }
contourCount: 20,
},
});
await viewer.loadCIF(cifText);
// Move the section afterwards without recalculating the field:
viewer.updateContourLineOptions({
plane: { coordinateSystem: 'fractional', origin: [0, 0, 0.5], normal: [0, 0, 1] },
});Related docs
- Widget → Density maps
- Library → Density maps
- Options Reference → Density — the
contourLines.*options