<jupyter_start><jupyter_text>About&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Issues&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tutorials&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Documentation![Molecular Design Toolkit](img/Top.png)Tutorial 1: Making a moleculeThis notebook gets you started with MDT - you'll build a small molecule, visualize it, and run a basic calculation. Contents=======---   - [1. Import the toolkit](1.-Import-the-toolkit)     - [A. Optional: Set up your computing backend](A.-Optional:-Set-up-your-computing-backend)   - [2. Build it](2.-Read-in-the-molecule)   - [3. View it](3.-Visualize-it)   - [4. Simulate it](4.-Simulate-it)   - [5. Minimize it](5.-Minimize-it)   - [6. Write it](6.-Write-it)   - [7. Examine it](7.-Examine-it)  1. Import the toolkitThis 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](https://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/docs/source/examples/Notebook/Notebook%20Basics.ipynb)).<jupyter_code>import moldesign as mdt
import moldesign.units as u<jupyter_output><empty_output><jupyter_text>Optional: configuration optionsIf you'd like to set some basic MDT configuration options, you can execute the following cell to create a GUI configuration editor:<jupyter_code>mdt.configure()<jupyter_output><empty_output><jupyter_text>2. Read in a molecular structureLet's get started by reading in a molecular structure file.When you execute this cell, you'll use `mdt.read` function to parse an XYZ-format file to create an MDT molecule object named, appropriately enough, `molecule`:<jupyter_code>molecule = mdt.read('data/butane.xyz')<jupyter_output><empty_output><jupyter_text>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:<jupyter_code>molecule<jupyter_output><empty_output><jupyter_text>3. Visualize itMDT molecules have three built-in visualization methods - `draw`, `draw2d`, and `draw3d`. Try them out!<jupyter_code>viewer = molecule.draw()
viewer  # we tell Jupyter to draw the viewer by putting it on the last line of the cell<jupyter_output><empty_output><jupyter_text>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:<jupyter_code>print(viewer.selected_atoms)<jupyter_output><empty_output><jupyter_text>4. Simulate itSo far, we've created a 3D molecular structure and visualized it right in the notebook.If you sat through [VSEPR theory](https://en.wikipedia.org/wiki/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.<jupyter_code>molecule.set_energy_model(mdt.models.RHF, basis='sto-3g')
properties = molecule.calculate()
print(properties.keys())
print('Energy: ', properties['potential_energy'])
molecule.draw_orbitals()<jupyter_output><empty_output><jupyter_text>5. Minimize itNext, an energy minimization - that is, we're going to move the atoms around in order to find a minimum energy conformation. This is a great way to start cleaning up the messy structure we started with. The calculation might take a second or two ...<jupyter_code>mintraj = molecule.minimize()
mintraj.draw_orbitals()<jupyter_output><empty_output><jupyter_text>6. Write it<jupyter_code>molecule.write('my_first_molecule.xyz')
mintraj.write('my_first_minimization.P.gz')<jupyter_output><empty_output><jupyter_text>7. Play with itThere are any number of directions to go from here. See how badly you can distort the geometry:<jupyter_code>mdt.widgets.GeometryBuilder(molecule)
molecule.calculate_potential_energy()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10294840294840295, 'fraction_numerical': 0.0068796068796068794, 'mean_word_length': 6.1421052631578945, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '71529', 'license': 'Apache-2.0', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1229, 'n_words': 401, 'path': 'moldesign/_notebooks/Tutorial 1. Making a molecule.ipynb', 'repo_name': 'Autodesk/molecular-design-toolkit', 'size': '4070'}