How to Create a 3D Printable Molecular Model from Scratch

Invited submission:
W. Tandy Grubbs, Professor & Chair, Department of Chemistry & Biochemistry at Stetson University

   

molecular models

 

stetson name

Overview:

 

The creation of a 3D printable molecular model can be accomplished in a few short steps.  Briefly, you will first download and make use of a free molecular editing software tool called Avogadro to draw the chemical structure of interest.  You will subsequently make use of the geometry optimization utility within Avogadro, which will vary the bond lengths and bond angles within your chemical structure so that the lowest energy (optimized) geometry is achieved.  The resultant chemical structure can be saved as a .mol2 file (a common chemical file format).  That same .mol2 file can then be opened within another free, downloadable molecular visualization tool called the Python Molecular Viewer (PMV).  You will then instruct the PMV to display the chemical structure as ‘Sticks and Balls,’ and then save the structure as an .stl file.  The .stl file can be scaled to the desired size and printed using your favorite 3D printing software application.

Step-by-Step Guide:

  1. If you do not already have access to the molecular editing software Avogadro, download it from https://avogadro.cc/ and install it on your computer.  While we will be using Avogadro in this tutorial, please note that there are other free molecular editors available for drawing molecules that you might try (for example, IQmol is another package that we have successfully used).


  2. Spend a little time browsing through the Avogadro website.  In particular, look through the Introduction section here which will give you a more complete idea about all the things that Avogadro is capable of doing.
  3. IMPORTANT:  To learn how to draw a molecule, make sure you work through the Drawing Molecules section.
  4. As a working example, let’s look at the steps involved in using Avogadro to draw a 3D representation of the compound shown below, isopropyl alcohol; C3H7OH (aka rubbing alcohol):

       

    isopropyl alcohol

    1. Open Avogadro on your computer (screenshots shown below correspond to Avogadro Version 1.2.0 running on a Windows computer).   Ordinarily the ‘Draw Tool’ is already active when Avogadro is started (if it isn’t, click on the  icon).  Also note that the element ‘Carbon’ comes up as the default atom that will be drawn.

         

      step4a

    2. Position the pointer over the blank workspace, left-click the mouse, drag a short distance, and release the mouse button.  This will create two carbons connected by a single bond.  Avogadro will also automatically add bonds to atoms that terminate in a hydrogen atom (doing so in this case out of recognition that carbon ordinarily likes to form four bonds).  At this stage, your workspace should look something like the following screenshot:

         

      step4b

    3. Left-click on one of the existing carbon atoms, drag a short distance, and release the mouse button to add a third carbon to the structure.  At this point, you have completed the carbon backbone structure of isopropyl alcohol.  Now all you need to do is edit the existing structure so that an oxygen atom is inserted in place of one of the hydrogen atoms on the middle carbon.  To accomplish this, select ‘Oxygen’ from the Element menu (shown below).

         

      step4c

    4. Now, left-click on one of the hydrogens on the middle carbon atom.  This action will not only replace that hydrogen atom with an oxygen atom, but will also add one hydrogen to oxygen (because oxygen atoms ordinarily like to form a total of two bonds).  Your structure should now look something like what is shown in the following screenshot:

         

      step4d

    5. As currently depicted, the isopropyl alcohol molecule is probably distorted relative to the true 3D geometry of the molecule (i.e., the bond lengths and bond angles are not close to the true values).  Fortunately, Avogadro has a built-in geometry optimization utility that will vary the bond lengths and bond angles in an iterative fashion until the lowest energy conformation is detected.  If you would like to learn more about geometry optimization, you can look here.  For brevity sake, we will simple make use of the geometry optimization utility in Avogadro and not worry about how it works.

    6. To obtain the optimum 3D geometry of isopropyl alcohol, select the Optimize Geometry option within the Extensions menu (see below).  For small molecules like this one, the optimization process will take place within just a few seconds.  The second screenshot immediately below illustrates what the isopropyl alcohol molecule might look like after the optimization is complete.

      Select the Optimize Geometry utility:

         

      step4f

      After optimization:

         

      step4f2

    7. The molecule is now ready to save.  As shown below, go to the File menu, select Save As, and make sure you select the *.mol2 file designation under the Save as type menu.  Give the file a meaningful name (such as propyl_alcohol.mol2) and then Save the file to a folder on your computer.

         

      step4g

      step4g2


  5. As mentioned before, we will be using the Python Molecular Viewer (PMV) software to convert the .mol2 file into an .stl file that can be 3D printed.  The PMV is included as part of MGLTools (a suite of software applications developed at the Molecular Graphics Laboratory (MGL) of The Scripps Research Institute).  If the PMV is not already installed on your computer, download and install the full MGLTools package from [lik-external="http://mgltools.scripps.edu/downloads"]here. Windows version of the PMV is demonstrated here, there are Linux and Mac versions available too.  Be aware that if you opt to use the Mac version of PMV, you will also need to download and install the latest version of the X.Org X Window System (X11.app) from here.


  6. To convert a .mol2 file to a ball-and-stick rendered structure that can be saved as an .stl file, first open the PMV application (if there is no icon on the desktop – and assuming you are working on a Windows computer - go to the Start menu, click on All Programs, look inside the MGLTools folder, and you should find the PMV there).  Once the PMV is open, select Read Molecule from the File menu (shown below).

       

    step6

    1. Continuing with the working example of isopropyl alcohol that was started above - Open the propyl_alcohol.mol2 file that was created earlier.  The molecule will subsequently be rendered in the workspace as a simple stick structure (see below).

         

      step6a

    2. To display the molecule as a ball-and-stick structure, click on the Display menu and select Sticks And Balls.

         

      step6b

    3. In the pop-up window that appears, make sure you click on the Sticks and Balls selector.  You can also increase/decrease the radii of the ‘sticks’ and ‘balls’ by clicking and dragging (left or right) on the corresponding roller dials.  For the example shown here, we are using a stick radius of 0.50 and a ball radii of 0.7 (the remaining options in the pop-up window can be left at their default values).  Once the radii values have been adjusted, click on OK.

         

      step6c

    4. At this stage, your isopropyl alcohol molecule should looks something like what is shown in the next screenshot.  Be aware that you can rotate (tumble) the molecule in space by left-clicking and dragging in the workspace (try it).

         

      step6d

    5. We are now ready to save the molecule as an .stl file.  To do so, click on the File menu, select Save, and then select Write STL from the options that are available.  A small STL Options window will appear that can be used to adjust the resolution of the .stl file.  While you are encouraged to experiment with the resolution values, we have found that the default values for Sphere quality and Cylinder quality work fine.  Click OK in the STL Options window, type an appropriate file name such as propyl_alcohol.stl, and then Save the file to a folder on your computer.

       

         

      step6e


  7. If all went well, you should now have a 3D printable molecular model saved to your computer.  Instructions for 3D printing the .stl file will not be given here.  In general though, be aware that you will need to adjust the size (scale) of the .stl model once you have opened it up in your 3D printing application software.  Try to make the 3D print size large enough so that the model will easily fit in the palm of your hand, yet not so large that the printing time is over several hours.  Shown below are screenshot/photos whereby the isopropyl alcohol model was 3D printed on an Ultimaker 2+ Extended printer (and using the Ultimaker Cura Software).

     

       

    step7

     

    printing molecule

     

    printed molecule


  8. A few final words of advice.  Those who have a lot of experience is creating digital graphics files for 3D printing know that sometimes .stl files may be generated that contain unintended holes or other errors.  Attempts to 3D print these flawed .stl files often lead to failed print jobs.  Fortunately, there are several 3D graphics software utilities available that can be used to check .stl files for errors and fix them (i.e., by detecting holes in the polygonal mesh and subsequently filling them).  MeshLab is a useful and free 3D mesh processing utility that can detect/fill holes – if you want to try it out, Meshlab can be downloaded from http://www.meshlab.net/.


Comments and Acknowledgements:

  • Inquiries about this exercise should be directed to Tandy Grubbs; wgrubbs@stetson.edu.

  • Special thanks to all the contributors of the open source Avogadro project.

  • Similarly, special thanks to the developers of the Python Molecular Viewer.  Michel F. Sanner. Python: A Programming Language for Software Integration and Development. J. Mol. Graphics Mod., 1999, Vol 17, February. pp 57-61.



    If you would like to learn more about the use of 3D printing in support of chemical education - specifically, how to use computational chemistry software to create more sophisticated chemical representations - then you are encouraged to read the following two book chapters:  (a) Luciano E. H. Violante, Daniel A. Nunez, Susan M. Ryan, and W. Tandy Grubbs; "3D Printing in the Chemistry Curriculum:  Inspiring Millennial Students to be Creative Innovators" in Addressing the Millennial Student: New Pedagogy and Approaches to Improve Student Learning Outcomes in Undergraduate Chemistry, Potts, G., Dockery, C., Eds.; ACS Symposium Series, Volume 1180; American Chemical Society: Washington, DC, 2014 and (b) Ryan, Susan M. and W. Tandy Grubbs, “Curricular Collaborations: Using Emerging Technologies to Foster Innovative Partnerships” in Doherty, Brian, ed., Technology-Centered Academic Library Partnerships and Collaborations, Hershey, PA: IGI Global, 2016.

  • For financial support, we wish to thank Betty Drees Johnson for her ongoing donations in support

Index
Support