Skip to content

Structure

Easily view and interact with any structure

from qcio import Structure, view
# Defaults changed just to fit within narrow documentation layout
view.DEFAULT_WIDTH = 400
view.DEFAULT_HEIGHT = 300
caffeine = Structure.from_smiles('CN1C=NC2=C1C(=O)N(C(=O)N2C)C')
view.view(caffeine)

3Dmol.js failed to load for some reason. Please check your browser console for error messages.

Pass any number of objects (of any type) to view

serotonin = Structure.from_smiles("C1=CC2=C(C=C1O)C(=CN2)CCN")
dopamine = Structure.from_smiles("NCCc1cc(O)c(O)cc1")
view.view(serotonin, dopamine)

3Dmol.js failed to load for some reason. Please check your browser console for error messages.

Titles are generated automatically from identifier information

serotonin.add_identifiers({"name": "Serotonin"})
dopamine.add_identifiers({"name": "Dopamine"})
view.view(serotonin, dopamine)

3Dmol.js failed to load for some reason. Please check your browser console for error messages.

Or manually add titles or subtitles

epinephrine = Structure.from_smiles("CNC[C@H](O)c1ccc(O)c(O)c1")
glutamate = Structure.from_smiles("C(CC(=O)O)[C@@H](C(=O)[O-])N")
view.view(
    epinephrine,
    glutamate,
    titles=["Good morning ☀️", "Glutamate 🧪"],
    subtitles=["", f"Charge: {glutamate.charge} Multiplicity: {glutamate.multiplicity}"],
)

3Dmol.js failed to load for some reason. Please check your browser console for error messages.