<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 <span style="float
Step1:  Optional
Step2:  2. Read in a molecular structure
Let'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
Step3:  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
Step4:  3. Visualize it
MDT molecules have three built-in visualization methods - draw, draw2d, and draw3d. Try them out!
Step5:  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
Step6:  4. Simulate it
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.
Step7:  5. Minimize it
Next, 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 ...
Step8:  6. Write it
Step9:  7. Play with it
There are any number of directions to go from here. See how badly you can distort the geometry
<ASSISTANT_TASK:>
Python Code:
import moldesign as mdt
import moldesign.units as u
Explanation: <span style="float:right"><a href="http://moldesign.bionano.autodesk.com/" target="_blank" title="About">About</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://github.com/autodesk/molecular-design-toolkit/issues" target="_blank" title="Issues">Issues</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://bionano.autodesk.com/MolecularDesignToolkit/explore.html" target="_blank" title="Tutorials">Tutorials</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://autodesk.github.io/molecular-design-toolkit/" target="_blank" title="Documentation">Documentation</a></span>
</span>
<br>
<center><h1>Tutorial 1: Making a molecule</h1></center>
This notebook gets you started with MDT - you'll build a small molecule, visualize it, and run a basic calculation.
Contents
1. Import the toolkit
A. Optional: Set up your computing backend
2. Build it
3. View it
4. Simulate it
5. Minimize it
6. Write it
7. Examine it
1. Import the toolkit
This cell loads the toolkit and its unit system. To execute a cell, click on it, then press <kbd>shift</kbd> + <kbd>enter</kbd>. (If you're new to the notebook environment, you may want to check out this helpful cheat sheet).
End of explanation
mdt.configure()
Explanation: Optional: configuration options
If you'd like to set some basic MDT configuration options, you can execute the following cell to create a GUI configuration editor:
End of explanation
molecule = mdt.read('data/butane.xyz')
Explanation: 2. Read in a molecular structure
Let'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:
End of explanation
molecule
Explanation: 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:
End of explanation
viewer = molecule.draw()
viewer  # we tell Jupyter to draw the viewer by putting it on the last line of the cell
Explanation: 3. Visualize it
MDT molecules have three built-in visualization methods - draw, draw2d, and draw3d. Try them out!
End of explanation
print(viewer.selected_atoms)
Explanation: 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:
End of explanation
molecule.set_energy_model(mdt.models.RHF, basis='sto-3g')
properties = molecule.calculate()
print(properties.keys())
print('Energy: ', properties['potential_energy'])
molecule.draw_orbitals()
Explanation: 4. Simulate it
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.
End of explanation
mintraj = molecule.minimize()
mintraj.draw_orbitals()
Explanation: 5. Minimize it
Next, 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 ...
End of explanation
molecule.write('my_first_molecule.xyz')
mintraj.write('my_first_minimization.P.gz')
Explanation: 6. Write it
End of explanation
mdt.widgets.GeometryBuilder(molecule)
molecule.calculate_potential_energy()
Explanation: 7. Play with it
There are any number of directions to go from here. See how badly you can distort the geometry:
End of explanation
<END_TASK>