Skip to content

Core Views

A quick overview of all possible views within qcio.

from qcio import ProgramOutput, view
# Defaults changed just to fit the examples within the narrow documentation layout
view.DEFAULT_WIDTH = 400
view.DEFAULT_HEIGHT = 300

xtb_opt = ProgramOutput.open("U1-_180_mmff94s-opt-xtb.json")
terachem_opt = ProgramOutput.open("U1-_mmff94s_180-opt-terachem-thf.json")
crest_confsearch = ProgramOutput.open("U1-_confsearch-crest.json")

Structure Views

Basic Structure

Pass in a structure to visualize it. If structure.ids.name or structure.ids.smiles is set this will be used automatically for a title. Subtitles can be passed manually.

view.view(
    xtb_opt.input_data.structure, 
    subtitles=["My Awesome Subtitle"]
)

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

Pass view_2d=True for a 2D image of the molecule.

view.view(
    xtb_opt.input_data.structure, 
    view_2d=True, 
    subtitles=["My Awesome Subtitle"]
)

U1- 180

No description has been provided for this image

My Awesome Subtitle

Multi-Structure

Pass multiple Structure objects to view.view(...) and it will create a grid of Structure objects. Pass titles and subtitles as desired. show_indices=True will display the indices for each atom.

view.view(
    xtb_opt.input_data.structure, xtb_opt.results.final_structure, 
    titles=['Initial Structure', 'Final Structure'], 
    subtitles=["First Subtitle", "Second Subtitle"],
    show_indices=True,
)

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

Overlay Structures

Set same_viewer=True to overlay two (or more) Structure objects in the same viewer.

view.view(
    xtb_opt.input_data.structure, xtb_opt.results.final_structure, 
    same_viewer=True,
    subtitles=["First and Last Structure"],
)

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

Animation

Pass one or more list of Structure objects to view.view(...) and each list will be animated. The .results.structures objects passed belows are lists of Structure.

view.view(
    xtb_opt.results.structures, terachem_opt.results.structures, 
    titles=['xtb Opt', 'TeraChem Opt'],
    subtitles=['Successful Trajectory', 'Failed Opt Trajectory'],
)

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

Program Output Views

Simply pass any ProgramOutput object to view.view(...) to see a visualization of the results.

Single Point Calculation

view.view(
    xtb_opt.results.trajectory[0], 
    subtitles=["A Subtitle for the Structure"]
)
Structure Name Success Wall Time Calculation Type Program Model Keywords
U1- 180 True 00.09s gradient xtb 22.1 method='GFN2xTB'
solvent13

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

Result Value
energy-107.07214860598548
gradient[[5.94e-02 -6.73e-04 -1.02e-02] [1.54e-02 -1.44e-03 -1.14e-02] [2.13e-02 8.42e-04 1.78e-03] ... [-1.21e-03 7.30e-04 6.00e-03] [5.60e-03 -4.61e-04 -3.16e-03] [-2.50e-03 -7.75e-04 -5.17e-03]]
wavefunctionscf_eigenvalues_a=array([-8.78e-01, -8.76e-01, -8.76e-01, ..., 5.85e-01, 6.02e-01, 7.60e-01])
scf_dipole_moment[1.8777798514342063, -0.021687969861866857, -0.4637756180825757]

Optimization

May pass animate=False if the animations are slowing down the browser.

view.view(
    xtb_opt, 
    animate=True, 
    subtitles=["Some nice subtitle"], 
    titles_extra=["Optimization Trajectory"]
)
Structure Name Success Wall Time Calculation Type Program Model Keywords Subprogram Subprogram Model Subprogram Keywords
U1- 180 True 33.29s optimization geometric 1.0.2 None
transitionFalse
xtb method='GFN2xTB'
solvent13

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

Energy Optimization by Cycle

If you have too many molecule viewers or animations running and your browser is slowing down, pass view_2d=True to any view to substitute a static 2D molecule image.

view.view(
    xtb_opt, 
    animate=False, 
    view_2d=True,
)
Structure Name Success Wall Time Calculation Type Program Model Keywords Subprogram Subprogram Model Subprogram Keywords
U1- 180 True 33.29s optimization geometric 1.0.2 None
transitionFalse
xtb method='GFN2xTB'
solvent13

U1- 180 (Final Structure)

No description has been provided for this image

Energy Optimization by Cycle
view.view(crest_confsearch)
Structure Name Success Wall Time Calculation Type Program Model Keywords
None True 15m:23.10s conformer_search crest 3.0.1 method='gfn2'

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