Path C - Module 28: The MolSysBuilder API#

In the SARS-CoV-2 Mpro site, some water molecules are so important that they are considered part of the “active site architecture”. In this module, you will learn to build a custom “Bridging Water” molecule at a specific coordinate to stabilize the inhibitor.

While editing, msm.get(builder, ...) can inspect the complete chemical/topological and structural state stored by the builder. Molecular-mechanics data and per-structure chemical-state associations are added to the materialized MolSys, not stored in the builder.

Conversions among MolSys, MolSysBuilder, and MolSysDict report fidelity exhaustively. In selected exports, atom order is canonical and structure_indices retains the requested order; strict=True rejects detected reduced-schema loss.

import numpy as np
import molsysmt as msm
from molsysmt import pyunitwizard as puw

builder = msm.MolSysBuilder()
oxygen = builder.add_atom(atom_name='OW', atom_type='O')
group = builder.add_group([oxygen], group_name='HOH', group_type='water')
molecule = builder.add_molecule([group], molecule_name='Bridging Water', molecule_type='water')
builder.add_entity([molecule], entity_name='Bridging Water', entity_type='water')
builder.set_coordinates(puw.quantity(np.array([[0.5, 0.5, 0.5]]), 'nm'))
bridging_water = builder.build()
print("Manual structural component built.")