moleculekit.viewer.molstar.serialize module#
Serialize a Molecule into the MoleculeKitDict shape consumed by the viewer-frontend (moleculeToCIF.ts).
- moleculekit.viewer.molstar.serialize.molecule_to_dict(mol, frame=0)#
Return a JSON-serializable MoleculeKitDict for a single frame.
The returned dict holds the per-atom fields, bonds/bond types and a flat coordinate vector for the requested frame, plus the atom and frame counts. Multi-frame trajectories are sent separately as a binary blob via /coords/<slot>/<topohash>.
- Parameters:
- Returns:
out – A JSON-serializable dict with the per-atom topology fields,
bonds,bondtype, a flat float32coordslist forframe(ordered[x0..xN, y0..yN, z0..zN]), and integernumAtoms/numFrames.- Return type: