This cell loads the toolkit and its unit system. To execute a cell, click on it, then press shift + enter. (If you're new to the notebook environment, you may want to check out this helpful cheat sheet).
In [ ]:import moldesign as mdt import moldesign.units as u
In [ ]:mdt.configure()
In [ ]:molecule = mdt.read('data/butane.xyz')
Jupyter notebooks will automatically print out the value of the last statement in any cell. When you evaluate a
Molecule, as in the cell below, you'll get some quick summary data:
In [ ]:molecule
In [ ]:viewer = molecule.draw() viewer # we tell Jupyter to draw the viewer by putting it on the last line of the cell
Try clicking on some of the atoms in the visualization you've just created.
Afterwards, you can retrieve a list of the Python objects representing the atoms you clicked on:
In [ ]:print(viewer.selected_atoms)
So far, we've created a 3D molecular structure and visualized it right in the notebook.
If you sat through VSEPR theory in P. Chem, you might notice this molecule (butane) is looking decidedly non-optimal. Luckily, we can use simulation to predict a better structure.
We're specifically going to run a basic type of Quantum Chemistry calculation called "Hartree-Fock", which will give us information about the molecule's orbitals and energy.
In [ ]:molecule.set_energy_model(mdt.models.RHF, basis='sto-3g') properties = molecule.calculate()
In [ ]:print(properties.keys()) print('Energy: ', properties['potential_energy'])
In [ ]:molecule.draw_orbitals()
In [ ]:mintraj = molecule.minimize()
In [ ]:mintraj.draw_orbitals()
In [ ]:molecule.write('my_first_molecule.xyz')
In [ ]:mintraj.write('my_first_minimization.P.gz')
In [ ]:mdt.widgets.GeometryBuilder(molecule)
In [ ]:molecule.calculate_potential_energy()
In [ ]: