Home
Nanotubes Crystals
Matlab ChemDoodle
About Aviz

The ChemDoodle Web Components Library

The ChemDoodle Web Components Library is a JavaScript library for drawing 3D graphics of chemical structures.
In order to use the library you will need the ChemDoodleWeb.js file, which you can download here.
You can also use an html template which can be downloaded here. The following guide will explain how to use it.
If you are using Chrome and the file opens instead of downloading, simply click Ctrl+s and save the file in the desired directory.

Nanotube Visualization - Part 2

In this section you will learn how to visualize a nanotube using the line of code outputted by the xyz2chem.m script. See part 1 for an explanation on how to use the Matlab script.

In this example we will use the same code from part 1:

'1\n\n\n310450\n 0.0000 3.4273 34.0003 C\n 0.0000 3.4273 36.4461 C\n 0.0000 3.4273 14.4335 C\n 0.0000 3.4273 19.3252 C\n 0.0000 3.4273 4.6502 C\n 0.0000 3.4273 7.0960 C\n 0.0000 3.4273 9.5419 C\n 0.0000 3.4273 21.7711 C\n 0.0000 3.4273 24.2169 C\n 0.0000 3.4273 26.6627 C\n 0.0000 3.4273 29.1086 C\n 0.0000 3.4273 31.5544 C\n 0.0000 3.4273 11.9877 C\n 0.0000 3.4273 16.8794 C\n 0.0000 3.4273 38.8920 C\n 0.0760 4.1450 35.2232 C\n 0.0760 4.1450 37.6690 C\n 0.0760 4.1450 10.7648 C\n 0.0760 4.1450 15.6565 C\n 0.0760 4.1450 20.5481 C\n 0.0760 4.1450 5.8731 C\n 0.0760 4.1450 8.3189 C\n 0.0760 4.1450 13.2106 C\n 0.0760 4.1450 18.1023 C\n 0.0760 4.1450 22.9940 C\n 0.0760 4.1450 25.4398 C\n 0.0760 4.1450 27.8857 C\n 0.0760 4.1450 30.3315 C\n 0.0760 4.1450 32.7773 C\n 0.0760 4.1450 40.1149 C\n 0.2942 2.0381 4.6502 C\n 0.2942 2.0381 7.0960 C\n 0.2942 2.0381 9.5419 C\n 0.2942 2.0381 24.2169 C\n 0.2942 2.0381 26.6627 C\n 0.2942 2.0381 29.1086 C\n 0.2942 2.0381 31.5544 C\n 0.2942 2.0381 34.0003 C\n 0.2942 2.0381 21.7711 C\n 0.2942 2.0381 38.8920 C\n 0.2942 2.0381 41.3378 C\n 0.2942 2.0381 11.9877 C\n 0.2942 2.0381 14.4335 C\n 0.2942 2.0381 16.8794 C\n 0.2942 2.0381 19.3252 C\n 0.2942 2.0381 36.4461 C\n 0.6545 1.4128 37.6690 C\n 0.6545 1.4128 40.1149 C\n 0.6545 5.4417 25.4398 C\n 0.6545 1.4128 20.5481 C\n 0.6545 5.4417 32.7773 C\n 0.6545 5.4417 35.2232 C\n 0.6545 5.4417 40.1149 C\n 0.6545 1.4128 10.7648 C\n 0.6545 1.4128 13.2106 C\n 0.6545 1.4128 15.6565 C\n 0.6545 1.4128 18.1023 C\n 0.6545 1.4128 3.4273 C\n 0.6545 1.4128 5.8731 C\n 0.6545 1.4128 8.3189 C\n 0.6545 5.4417 8.3189 C\n 0.6545 5.4417 10.7648 C\n 0.6545 5.4417 13.2106 C\n 0.6545 5.4417 15.6565 C\n 0.6545 5.4417 18.1023 C\n 0.6545 5.4417 3.4273 C\n 0.6545 5.4417 5.8731 C\n 0.6545 5.4417 20.5481 C\n 0.6545 5.4417 22.9940 C\n 0.6545 5.4417 27.8857 C\n 0.6545 5.4417 30.3315 C\n 0.6545 1.4128 22.9940 C\n 0.6545 1.4128 25.4398 C\n 0.6545 1.4128 27.8857 C\n 0.6545 1.4128 30.3315 C\n 0.6545 1.4128 32.7773 C\n 0.6545 5.4417 37.6690 C\n 0.6545 1.4128 35.2232 C\n 1.1379 5.9777 26.6627 C\n 1.1379 5.9777 34.0003 C\n 1.1379 5.9777 36.4461 C\n 1.1379 5.9777 41.3378 C\n 1.1379 5.9777 4.6502 C\n 1.1379 5.9777 7.0960 C\n 1.1379 5.9777 9.5419 C\n 1.1379 5.9777 11.9877 C\n 1.1379 5.9777 14.4335 C\n 1.1379 5.9777 16.8794 C\n 1.1379 5.9777 19.3252 C\n 1.1379 5.9777 21.7711 C\n 1.1379 5.9777 24.2169 C\n 1.1379 5.9777 29.1086 C\n 1.1379 5.9777 31.5544 C\n 1.1379 5.9777 38.8920 C\n 1.7091 0.4618 13.2106 C\n 1.7091 0.4618 18.1023 C\n 1.7091 0.4618 22.9940 C\n 1.7091 0.4618 5.8731 C\n 1.7091 0.4618 8.3189 C\n 1.7091 0.4618 10.7648 C\n 1.7091 0.4618 40.1149 C\n 1.7091 0.4618 15.6565 C\n 1.7091 0.4618 20.5481 C\n 1.7091 0.4618 25.4398 C\n 1.7091 0.4618 27.8857 C\n 1.7091 0.4618 30.3315 C\n 1.7091 0.4618 32.7773 C\n 1.7091 0.4618 35.2232 C\n 1.7091 0.4618 37.6690 C\n 2.3682 6.6868 36.4461 C\n 2.3682 0.1677 38.8920 C\n 2.3682 6.6868 19.3252 C\n 2.3682 6.6868 24.2169 C\n 2.3682 6.6868 29.1086 C\n 2.3682 0.1677 11.9877 C\n 2.3682 0.1677 16.8794 C\n 2.3682 0.1677 21.7711 C\n 2.3682 6.6868 14.4335 C\n 2.3682 6.6868 4.6502 C\n 2.3682 6.6868 31.5544 C\n 2.3682 6.6868 34.0003 C\n 2.3682 6.6868 38.8920 C\n 2.3682 0.1677 4.6502 C\n 2.3682 0.1677 7.0960 C\n 2.3682 0.1677 9.5419 C\n 2.3682 6.6868 7.0960 C\n 2.3682 6.6868 9.5419 C\n 2.3682 6.6868 11.9877 C\n 2.3682 6.6868 16.8794 C\n 2.3682 0.1677 14.4335 C\n 2.3682 0.1677 19.3252 C\n 2.3682 0.1677 24.2169 C\n 2.3682 0.1677 26.6627 C\n 2.3682 0.1677 29.1086 C\n 2.3682 0.1677 31.5544 C\n 2.3682 0.1677 34.0003 C\n 2.3682 6.6868 21.7711 C\n 2.3682 6.6868 26.6627 C\n 2.3682 0.1677 36.4461 C\n 3.0742 6.8363 37.6690 C\n 3.0742 6.8363 8.3189 C\n 3.0742 6.8363 10.7648 C\n 3.0742 6.8363 15.6565 C\n 3.0742 6.8363 20.5481 C\n 3.0742 6.8363 25.4398 C\n 3.0742 6.8363 30.3315 C\n 3.0742 6.8363 5.8731 C\n 3.0742 6.8363 13.2106 C\n 3.0742 6.8363 18.1023 C\n 3.0742 6.8363 32.7773 C\n 3.0742 6.8363 35.2232 C\n 3.0742 6.8363 40.1149 C\n 3.0742 6.8363 22.9940 C\n 3.0742 6.8363 27.8857 C\n 3.7803 0.0182 31.5544 C\n 3.7803 0.0182 4.6502 C\n 3.7803 0.0182 7.0960 C\n 3.7803 0.0182 9.5419 C\n 3.7803 0.0182 11.9877 C\n 3.7803 0.0182 14.4335 C\n 3.7803 0.0182 16.8794 C\n 3.7803 0.0182 19.3252 C\n 3.7803 0.0182 21.7711 C\n 3.7803 0.0182 24.2169 C\n 3.7803 0.0182 38.8920 C\n 3.7803 0.0182 41.3378 C\n 3.7803 0.0182 26.6627 C\n 3.7803 0.0182 29.1086 C\n 3.7803 0.0182 34.0003 C\n 3.7803 0.0182 36.4461 C\n 4.4863 6.6868 35.2232 C\n 4.4863 6.6868 25.4398 C\n 4.4863 0.1677 20.5481 C\n 4.4863 0.1677 37.6690 C\n 4.4863 0.1677 40.1149 C\n 4.4863 0.1677 3.4273 C\n 4.4863 0.1677 5.8731 C\n 4.4863 0.1677 8.3189 C\n 4.4863 0.1677 10.7648 C\n 4.4863 0.1677 30.3315 C\n 4.4863 6.6868 5.8731 C\n 4.4863 6.6868 8.3189 C\n 4.4863 6.6868 10.7648 C\n 4.4863 6.6868 13.2106 C\n 4.4863 6.6868 15.6565 C\n 4.4863 6.6868 18.1023 C\n 4.4863 6.6868 22.9940 C\n 4.4863 6.6868 27.8857 C\n 4.4863 0.1677 13.2106 C\n 4.4863 0.1677 15.6565 C\n 4.4863 0.1677 18.1023 C\n 4.4863 0.1677 22.9940 C\n 4.4863 6.6868 20.5481 C\n 4.4863 6.6868 3.4273 C\n 4.4863 6.6868 30.3315 C\n 4.4863 6.6868 32.7773 C\n 4.4863 6.6868 37.6690 C\n 4.4863 6.6868 40.1149 C\n 4.4863 0.1677 25.4398 C\n 4.4863 0.1677 27.8857 C\n 4.4863 0.1677 32.7773 C\n 4.4863 0.1677 35.2232 C\n 5.1454 6.3927 26.6627 C\n 5.1454 6.3927 36.4461 C\n 5.1454 6.3927 7.0960 C\n 5.1454 6.3927 9.5419 C\n 5.1454 6.3927 11.9877 C\n 5.1454 6.3927 14.4335 C\n 5.1454 6.3927 16.8794 C\n 5.1454 6.3927 19.3252 C\n 5.1454 6.3927 21.7711 C\n 5.1454 6.3927 24.2169 C\n 5.1454 6.3927 29.1086 C\n 5.1454 6.3927 4.6502 C\n 5.1454 6.3927 31.5544 C\n 5.1454 6.3927 34.0003 C\n 5.1454 6.3927 38.8920 C\n 5.1454 6.3927 41.3378 C\n 5.7166 0.8768 13.2106 C\n 5.7166 0.8768 5.8731 C\n 5.7166 0.8768 8.3189 C\n 5.7166 0.8768 10.7648 C\n 5.7166 0.8768 27.8857 C\n 5.7166 0.8768 32.7773 C\n 5.7166 0.8768 15.6565 C\n 5.7166 0.8768 18.1023 C\n 5.7166 0.8768 20.5481 C\n 5.7166 0.8768 22.9940 C\n 5.7166 0.8768 25.4398 C\n 5.7166 0.8768 40.1149 C\n 5.7166 0.8768 30.3315 C\n 5.7166 0.8768 35.2232 C\n 5.7166 0.8768 37.6690 C\n 6.2000 5.4418 36.4461 C\n 6.2000 1.4128 11.9877 C\n 6.2000 5.4417 14.4335 C\n 6.2000 5.4417 19.3252 C\n 6.2000 5.4417 24.2169 C\n 6.2000 5.4417 29.1086 C\n 6.2000 5.4417 34.0003 C\n 6.2000 1.4128 16.8794 C\n 6.2000 1.4128 21.7711 C\n 6.2000 1.4128 38.8920 C\n 6.2000 1.4128 4.6502 C\n 6.2000 1.4128 7.0960 C\n 6.2000 1.4128 9.5419 C\n 6.2000 1.4128 26.6627 C\n 6.2000 1.4128 31.5544 C\n 6.2000 5.4417 4.6502 C\n 6.2000 5.4417 7.0960 C\n 6.2000 5.4417 9.5419 C\n 6.2000 5.4417 11.9877 C\n 6.2000 5.4417 16.8794 C\n 6.2000 5.4417 21.7711 C\n 6.2000 5.4417 26.6627 C\n 6.2000 1.4128 14.4335 C\n 6.2000 1.4128 19.3252 C\n 6.2000 1.4128 24.2169 C\n 6.2000 5.4417 31.5544 C\n 6.2000 5.4417 38.8920 C\n 6.2000 1.4128 29.1086 C\n 6.2000 1.4128 34.0003 C\n 6.2000 1.4128 36.4461 C\n 6.5603 4.8165 37.6690 C\n 6.5603 4.8165 15.6565 C\n 6.5603 4.8165 30.3315 C\n 6.5603 4.8165 35.2232 C\n 6.5603 4.8165 20.5481 C\n 6.5603 4.8165 25.4398 C\n 6.5603 4.8164 32.7773 C\n 6.5603 4.8164 40.1149 C\n 6.5603 4.8164 13.2106 C\n 6.5603 4.8164 18.1023 C\n 6.5603 4.8164 22.9940 C\n 6.5603 4.8164 27.8857 C\n 6.5603 4.8165 5.8731 C\n 6.5603 4.8165 8.3189 C\n 6.5603 4.8165 10.7648 C\n 6.7785 2.7096 31.5544 C\n 6.7785 2.7096 38.8920 C\n 6.7785 2.7096 21.7711 C\n 6.7785 2.7096 4.6502 C\n 6.7785 2.7096 7.0960 C\n 6.7785 2.7096 9.5419 C\n 6.7785 2.7096 11.9877 C\n 6.7785 2.7096 14.4335 C\n 6.7785 2.7096 29.1086 C\n 6.7785 2.7096 34.0003 C\n 6.7785 2.7096 16.8794 C\n 6.7785 2.7096 19.3252 C\n 6.7785 2.7096 24.2169 C\n 6.7785 2.7096 26.6627 C\n 6.7785 2.7096 41.3378 C\n 6.7785 2.7096 36.4461 C\n 6.8545 3.4273 30.3315 C\n 6.8545 3.4273 37.6690 C\n 6.8545 3.4273 20.5481 C\n 6.8545 3.4273 3.4273 C\n 6.8545 3.4273 5.8731 C\n 6.8545 3.4273 8.3189 C\n 6.8545 3.4273 10.7648 C\n 6.8545 3.4273 13.2106 C\n 6.8545 3.4273 40.1149 C\n 6.8545 3.4273 15.6565 C\n 6.8545 3.4273 18.1023 C\n 6.8545 3.4273 22.9940 C\n 6.8545 3.4273 27.8857 C\n 6.8545 3.4273 32.7773 C\n 6.8545 3.4273 25.4398 C\n 6.8545 3.4273 35.2232 C\n 1 16 1\n 1 29 1\n 1 38 1\n 2 16 1\n 2 17 1\n 2 46 1\n 3 19 1\n 3 23 1\n 3 43 1\n 4 20 1\n 4 24 1\n 4 45 1\n 5 21 1\n 5 31 1\n 6 21 1\n 6 22 1\n 6 32 1\n 7 18 1\n 7 22 1\n 7 33 1\n 8 20 1\n 8 25 1\n 8 39 1\n 9 25 1\n 9 26 1\n 9 34 1\n 10 26 1\n 10 27 1\n 10 35 1\n 11 27 1\n 11 28 1\n 11 36 1\n 12 28 1\n 12 29 1\n 12 37 1\n 13 18 1\n 13 23 1\n 13 42 1\n 14 19 1\n 14 24 1\n 14 44 1\n 15 17 1\n 15 30 1\n 15 40 1\n 16 52 1\n 17 77 1\n 18 62 1\n 19 64 1\n 20 68 1\n 21 67 1\n 22 61 1\n 23 63 1\n 24 65 1\n 25 69 1\n 26 49 1\n 27 70 1\n 28 71 1\n 29 51 1\n 30 53 1\n 31 58 1\n 31 59 1\n 32 59 1\n 32 60 1\n 33 54 1\n 33 60 1\n 34 72 1\n 34 73 1\n 35 73 1\n 35 74 1\n 36 74 1\n 36 75 1\n 37 75 1\n 37 76 1\n 38 76 1\n 38 78 1\n 39 50 1\n 39 72 1\n 40 47 1\n 40 48 1\n 41 48 1\n 42 54 1\n 42 55 1\n 43 55 1\n 43 56 1\n 44 56 1\n 44 57 1\n 45 50 1\n 45 57 1\n 46 47 1\n 46 78 1\n 47109 1\n 48101 1\n 49 79 1\n 49 91 1\n 50103 1\n 51 80 1\n 51 93 1\n 52 80 1\n 52 81 1\n 53 82 1\n 53 94 1\n 54100 1\n 55 95 1\n 56102 1\n 57 96 1\n 59 98 1\n 60 99 1\n 61 84 1\n 61 85 1\n 62 85 1\n 62 86 1\n 63 86 1\n 63 87 1\n 64 87 1\n 64 88 1\n 65 88 1\n 65 89 1\n 66 83 1\n 67 83 1\n 67 84 1\n 68 89 1\n 68 90 1\n 69 90 1\n 69 91 1\n 70 79 1\n 70 92 1\n 71 92 1\n 71 93 1\n 72 97 1\n 73104 1\n 74105 1\n 75106 1\n 76107 1\n 77 81 1\n 77 94 1\n 78108 1\n 79138 1\n 80121 1\n 81110 1\n 83119 1\n 84126 1\n 85127 1\n 86128 1\n 87118 1\n 88129 1\n 89112 1\n 90137 1\n 91113 1\n 92114 1\n 93120 1\n 94122 1\n 95115 1\n 95130 1\n 96116 1\n 96131 1\n 97117 1\n 97132 1\n 98123 1\n 98124 1\n 99124 1\n 99125 1\n100115 1\n100125 1\n101111 1\n102116 1\n102130 1\n103117 1\n103131 1\n104132 1\n104133 1\n105133 1\n105134 1\n106134 1\n106135 1\n107135 1\n107136 1\n108136 1\n108139 1\n109111 1\n109139 1\n110140 1\n110151 1\n111165 1\n112144 1\n112149 1\n113145 1\n113153 1\n114146 1\n114154 1\n115159 1\n116161 1\n117163 1\n118143 1\n118148 1\n119147 1\n120146 1\n120150 1\n121150 1\n121151 1\n122140 1\n122152 1\n123156 1\n124157 1\n125158 1\n126141 1\n126147 1\n127141 1\n127142 1\n128142 1\n128148 1\n129143 1\n129149 1\n130160 1\n131162 1\n132164 1\n133167 1\n134168 1\n135155 1\n136169 1\n137144 1\n137153 1\n138145 1\n138154 1\n139170 1\n140197 1\n141182 1\n142183 1\n143185 1\n144193 1\n145172 1\n146195 1\n147181 1\n148184 1\n149186 1\n150196 1\n151171 1\n152198 1\n153187 1\n154188 1\n155180 1\n155201 1\n156176 1\n156177 1\n157177 1\n157178 1\n158178 1\n158179 1\n159179 1\n159189 1\n160189 1\n160190 1\n161190 1\n161191 1\n162173 1\n162191 1\n163173 1\n163192 1\n164192 1\n164199 1\n165174 1\n165175 1\n166175 1\n167199 1\n167200 1\n168180 1\n168200 1\n169201 1\n169202 1\n170174 1\n170202 1\n171204 1\n171216 1\n172203 1\n172212 1\n173227 1\n174233 1\n175230 1\n177220 1\n178221 1\n179222 1\n180231 1\n181205 1\n181214 1\n182205 1\n182206 1\n183206 1\n183207 1\n184207 1\n184208 1\n185208 1\n185209 1\n186209 1\n186210 1\n187211 1\n187212 1\n188203 1\n188213 1\n189219 1\n190225 1\n191226 1\n192228 1\n193210 1\n193211 1\n194214 1\n195213 1\n195215 1\n196215 1\n196216 1\n197204 1\n197217 1\n198217 1\n198218 1\n199229 1\n200223 1\n201224 1\n202232 1\n203255 1\n204234 1\n205250 1\n206251 1\n207252 1\n208236 1\n209253 1\n210237 1\n211254 1\n212238 1\n213239 1\n214249 1\n215259 1\n216240 1\n217260 1\n219235 1\n219256 1\n220244 1\n220245 1\n221245 1\n221246 1\n222235 1\n222246 1\n223247 1\n223261 1\n224248 1\n224262 1\n225241 1\n225256 1\n226241 1\n226257 1\n227242 1\n227257 1\n228242 1\n228258 1\n229247 1\n229258 1\n230243 1\n231248 1\n231261 1\n232262 1\n232263 1\n233243 1\n233263 1\n234264 1\n234267 1\n235285 1\n236265 1\n236272 1\n237268 1\n237273 1\n238269 1\n238274 1\n239266 1\n239275 1\n240267 1\n240270 1\n241289 1\n242281 1\n243280 1\n244282 1\n245283 1\n246284 1\n247292 1\n248279 1\n249276 1\n250276 1\n250277 1\n251277 1\n251278 1\n252272 1\n252278 1\n253265 1\n253273 1\n254268 1\n254274 1\n255269 1\n255275 1\n256286 1\n257290 1\n258291 1\n259266 1\n259270 1\n260264 1\n260271 1\n261287 1\n262288 1\n263294 1\n264296 1\n265304 1\n266295 1\n267310 1\n268297 1\n269309 1\n270308 1\n271303 1\n272302 1\n273305 1\n274306 1\n275307 1\n276299 1\n277300 1\n278301 1\n279295 1\n279308 1\n280296 1\n280303 1\n281297 1\n281306 1\n282298 1\n282299 1\n283299 1\n283300 1\n284300 1\n284301 1\n285301 1\n285302 1\n286302 1\n286304 1\n287295 1\n287307 1\n288308 1\n288310 1\n289304 1\n289305 1\n290297 1\n290305 1\n291306 1\n291309 1\n292307 1\n292309 1\n293303 1\n294296 1\n294310 1\nM END\n';

To produce:

The first thing you will need to do in order for any ChemDoodle script to work is to reference is in your website, using the following line of code, which will be placed inside the <head> element:

<script type="text/javascript" src="[path]/ChemDoodleWeb.js"></script>
where [path] specifies the full path of the JavaScript file.

Now we can dive into the ChemDoodle script which will be placed inside the <body> element. The full script for the above nanotube model is:

1
2
3
4
5
6
7
8
9
10
11
12
13
<script>
var example = new ChemDoodle.TransformCanvas3D('example', 800, 400);
example.specs.set3DRepresentation('Ball and Stick');
example.specs.backgroundColor = 'white';
example.specs.atoms_useJMOLColors = false;
example.specs.atoms_color = '#C0392B';
example.specs.bonds_splitColor = false;
example.specs.bonds_color = '#C0392B';
var molFile = '1\n\n\n310450\n 0.0000 3.4273 34.0003 C\n 0.0000 3.4273 36.4461 C\n 0.0000 3.4273 14.4335 C\n 0.0000 3.4273 19.3252 C\n 0.0000 3.4273 4.6502 C\n 0.0000 3.4273 7.0960 C\n 0.0000 3.4273 9.5419 C\n 0.0000 3.4273 21.7711 C\n 0.0000 3.4273 24.2169 C\n 0.0000 3.4273 26.6627 C\n 0.0000 3.4273 29.1086 C\n 0.0000 3.4273 31.5544 C\n 0.0000 3.4273 11.9877 C\n 0.0000 3.4273 16.8794 C\n 0.0000 3.4273 38.8920 C\n 0.0760 4.1450 35.2232 C\n 0.0760 4.1450 37.6690 C\n 0.0760 4.1450 10.7648 C\n 0.0760 4.1450 15.6565 C\n 0.0760 4.1450 20.5481 C\n 0.0760 4.1450 5.8731 C\n 0.0760 4.1450 8.3189 C\n 0.0760 4.1450 13.2106 C\n 0.0760 4.1450 18.1023 C\n 0.0760 4.1450 22.9940 C\n 0.0760 4.1450 25.4398 C\n 0.0760 4.1450 27.8857 C\n 0.0760 4.1450 30.3315 C\n 0.0760 4.1450 32.7773 C\n 0.0760 4.1450 40.1149 C\n 0.2942 2.0381 4.6502 C\n 0.2942 2.0381 7.0960 C\n 0.2942 2.0381 9.5419 C\n 0.2942 2.0381 24.2169 C\n 0.2942 2.0381 26.6627 C\n 0.2942 2.0381 29.1086 C\n 0.2942 2.0381 31.5544 C\n 0.2942 2.0381 34.0003 C\n 0.2942 2.0381 21.7711 C\n 0.2942 2.0381 38.8920 C\n 0.2942 2.0381 41.3378 C\n 0.2942 2.0381 11.9877 C\n 0.2942 2.0381 14.4335 C\n 0.2942 2.0381 16.8794 C\n 0.2942 2.0381 19.3252 C\n 0.2942 2.0381 36.4461 C\n 0.6545 1.4128 37.6690 C\n 0.6545 1.4128 40.1149 C\n 0.6545 5.4417 25.4398 C\n 0.6545 1.4128 20.5481 C\n 0.6545 5.4417 32.7773 C\n 0.6545 5.4417 35.2232 C\n 0.6545 5.4417 40.1149 C\n 0.6545 1.4128 10.7648 C\n 0.6545 1.4128 13.2106 C\n 0.6545 1.4128 15.6565 C\n 0.6545 1.4128 18.1023 C\n 0.6545 1.4128 3.4273 C\n 0.6545 1.4128 5.8731 C\n 0.6545 1.4128 8.3189 C\n 0.6545 5.4417 8.3189 C\n 0.6545 5.4417 10.7648 C\n 0.6545 5.4417 13.2106 C\n 0.6545 5.4417 15.6565 C\n 0.6545 5.4417 18.1023 C\n 0.6545 5.4417 3.4273 C\n 0.6545 5.4417 5.8731 C\n 0.6545 5.4417 20.5481 C\n 0.6545 5.4417 22.9940 C\n 0.6545 5.4417 27.8857 C\n 0.6545 5.4417 30.3315 C\n 0.6545 1.4128 22.9940 C\n 0.6545 1.4128 25.4398 C\n 0.6545 1.4128 27.8857 C\n 0.6545 1.4128 30.3315 C\n 0.6545 1.4128 32.7773 C\n 0.6545 5.4417 37.6690 C\n 0.6545 1.4128 35.2232 C\n 1.1379 5.9777 26.6627 C\n 1.1379 5.9777 34.0003 C\n 1.1379 5.9777 36.4461 C\n 1.1379 5.9777 41.3378 C\n 1.1379 5.9777 4.6502 C\n 1.1379 5.9777 7.0960 C\n 1.1379 5.9777 9.5419 C\n 1.1379 5.9777 11.9877 C\n 1.1379 5.9777 14.4335 C\n 1.1379 5.9777 16.8794 C\n 1.1379 5.9777 19.3252 C\n 1.1379 5.9777 21.7711 C\n 1.1379 5.9777 24.2169 C\n 1.1379 5.9777 29.1086 C\n 1.1379 5.9777 31.5544 C\n 1.1379 5.9777 38.8920 C\n 1.7091 0.4618 13.2106 C\n 1.7091 0.4618 18.1023 C\n 1.7091 0.4618 22.9940 C\n 1.7091 0.4618 5.8731 C\n 1.7091 0.4618 8.3189 C\n 1.7091 0.4618 10.7648 C\n 1.7091 0.4618 40.1149 C\n 1.7091 0.4618 15.6565 C\n 1.7091 0.4618 20.5481 C\n 1.7091 0.4618 25.4398 C\n 1.7091 0.4618 27.8857 C\n 1.7091 0.4618 30.3315 C\n 1.7091 0.4618 32.7773 C\n 1.7091 0.4618 35.2232 C\n 1.7091 0.4618 37.6690 C\n 2.3682 6.6868 36.4461 C\n 2.3682 0.1677 38.8920 C\n 2.3682 6.6868 19.3252 C\n 2.3682 6.6868 24.2169 C\n 2.3682 6.6868 29.1086 C\n 2.3682 0.1677 11.9877 C\n 2.3682 0.1677 16.8794 C\n 2.3682 0.1677 21.7711 C\n 2.3682 6.6868 14.4335 C\n 2.3682 6.6868 4.6502 C\n 2.3682 6.6868 31.5544 C\n 2.3682 6.6868 34.0003 C\n 2.3682 6.6868 38.8920 C\n 2.3682 0.1677 4.6502 C\n 2.3682 0.1677 7.0960 C\n 2.3682 0.1677 9.5419 C\n 2.3682 6.6868 7.0960 C\n 2.3682 6.6868 9.5419 C\n 2.3682 6.6868 11.9877 C\n 2.3682 6.6868 16.8794 C\n 2.3682 0.1677 14.4335 C\n 2.3682 0.1677 19.3252 C\n 2.3682 0.1677 24.2169 C\n 2.3682 0.1677 26.6627 C\n 2.3682 0.1677 29.1086 C\n 2.3682 0.1677 31.5544 C\n 2.3682 0.1677 34.0003 C\n 2.3682 6.6868 21.7711 C\n 2.3682 6.6868 26.6627 C\n 2.3682 0.1677 36.4461 C\n 3.0742 6.8363 37.6690 C\n 3.0742 6.8363 8.3189 C\n 3.0742 6.8363 10.7648 C\n 3.0742 6.8363 15.6565 C\n 3.0742 6.8363 20.5481 C\n 3.0742 6.8363 25.4398 C\n 3.0742 6.8363 30.3315 C\n 3.0742 6.8363 5.8731 C\n 3.0742 6.8363 13.2106 C\n 3.0742 6.8363 18.1023 C\n 3.0742 6.8363 32.7773 C\n 3.0742 6.8363 35.2232 C\n 3.0742 6.8363 40.1149 C\n 3.0742 6.8363 22.9940 C\n 3.0742 6.8363 27.8857 C\n 3.7803 0.0182 31.5544 C\n 3.7803 0.0182 4.6502 C\n 3.7803 0.0182 7.0960 C\n 3.7803 0.0182 9.5419 C\n 3.7803 0.0182 11.9877 C\n 3.7803 0.0182 14.4335 C\n 3.7803 0.0182 16.8794 C\n 3.7803 0.0182 19.3252 C\n 3.7803 0.0182 21.7711 C\n 3.7803 0.0182 24.2169 C\n 3.7803 0.0182 38.8920 C\n 3.7803 0.0182 41.3378 C\n 3.7803 0.0182 26.6627 C\n 3.7803 0.0182 29.1086 C\n 3.7803 0.0182 34.0003 C\n 3.7803 0.0182 36.4461 C\n 4.4863 6.6868 35.2232 C\n 4.4863 6.6868 25.4398 C\n 4.4863 0.1677 20.5481 C\n 4.4863 0.1677 37.6690 C\n 4.4863 0.1677 40.1149 C\n 4.4863 0.1677 3.4273 C\n 4.4863 0.1677 5.8731 C\n 4.4863 0.1677 8.3189 C\n 4.4863 0.1677 10.7648 C\n 4.4863 0.1677 30.3315 C\n 4.4863 6.6868 5.8731 C\n 4.4863 6.6868 8.3189 C\n 4.4863 6.6868 10.7648 C\n 4.4863 6.6868 13.2106 C\n 4.4863 6.6868 15.6565 C\n 4.4863 6.6868 18.1023 C\n 4.4863 6.6868 22.9940 C\n 4.4863 6.6868 27.8857 C\n 4.4863 0.1677 13.2106 C\n 4.4863 0.1677 15.6565 C\n 4.4863 0.1677 18.1023 C\n 4.4863 0.1677 22.9940 C\n 4.4863 6.6868 20.5481 C\n 4.4863 6.6868 3.4273 C\n 4.4863 6.6868 30.3315 C\n 4.4863 6.6868 32.7773 C\n 4.4863 6.6868 37.6690 C\n 4.4863 6.6868 40.1149 C\n 4.4863 0.1677 25.4398 C\n 4.4863 0.1677 27.8857 C\n 4.4863 0.1677 32.7773 C\n 4.4863 0.1677 35.2232 C\n 5.1454 6.3927 26.6627 C\n 5.1454 6.3927 36.4461 C\n 5.1454 6.3927 7.0960 C\n 5.1454 6.3927 9.5419 C\n 5.1454 6.3927 11.9877 C\n 5.1454 6.3927 14.4335 C\n 5.1454 6.3927 16.8794 C\n 5.1454 6.3927 19.3252 C\n 5.1454 6.3927 21.7711 C\n 5.1454 6.3927 24.2169 C\n 5.1454 6.3927 29.1086 C\n 5.1454 6.3927 4.6502 C\n 5.1454 6.3927 31.5544 C\n 5.1454 6.3927 34.0003 C\n 5.1454 6.3927 38.8920 C\n 5.1454 6.3927 41.3378 C\n 5.7166 0.8768 13.2106 C\n 5.7166 0.8768 5.8731 C\n 5.7166 0.8768 8.3189 C\n 5.7166 0.8768 10.7648 C\n 5.7166 0.8768 27.8857 C\n 5.7166 0.8768 32.7773 C\n 5.7166 0.8768 15.6565 C\n 5.7166 0.8768 18.1023 C\n 5.7166 0.8768 20.5481 C\n 5.7166 0.8768 22.9940 C\n 5.7166 0.8768 25.4398 C\n 5.7166 0.8768 40.1149 C\n 5.7166 0.8768 30.3315 C\n 5.7166 0.8768 35.2232 C\n 5.7166 0.8768 37.6690 C\n 6.2000 5.4418 36.4461 C\n 6.2000 1.4128 11.9877 C\n 6.2000 5.4417 14.4335 C\n 6.2000 5.4417 19.3252 C\n 6.2000 5.4417 24.2169 C\n 6.2000 5.4417 29.1086 C\n 6.2000 5.4417 34.0003 C\n 6.2000 1.4128 16.8794 C\n 6.2000 1.4128 21.7711 C\n 6.2000 1.4128 38.8920 C\n 6.2000 1.4128 4.6502 C\n 6.2000 1.4128 7.0960 C\n 6.2000 1.4128 9.5419 C\n 6.2000 1.4128 26.6627 C\n 6.2000 1.4128 31.5544 C\n 6.2000 5.4417 4.6502 C\n 6.2000 5.4417 7.0960 C\n 6.2000 5.4417 9.5419 C\n 6.2000 5.4417 11.9877 C\n 6.2000 5.4417 16.8794 C\n 6.2000 5.4417 21.7711 C\n 6.2000 5.4417 26.6627 C\n 6.2000 1.4128 14.4335 C\n 6.2000 1.4128 19.3252 C\n 6.2000 1.4128 24.2169 C\n 6.2000 5.4417 31.5544 C\n 6.2000 5.4417 38.8920 C\n 6.2000 1.4128 29.1086 C\n 6.2000 1.4128 34.0003 C\n 6.2000 1.4128 36.4461 C\n 6.5603 4.8165 37.6690 C\n 6.5603 4.8165 15.6565 C\n 6.5603 4.8165 30.3315 C\n 6.5603 4.8165 35.2232 C\n 6.5603 4.8165 20.5481 C\n 6.5603 4.8165 25.4398 C\n 6.5603 4.8164 32.7773 C\n 6.5603 4.8164 40.1149 C\n 6.5603 4.8164 13.2106 C\n 6.5603 4.8164 18.1023 C\n 6.5603 4.8164 22.9940 C\n 6.5603 4.8164 27.8857 C\n 6.5603 4.8165 5.8731 C\n 6.5603 4.8165 8.3189 C\n 6.5603 4.8165 10.7648 C\n 6.7785 2.7096 31.5544 C\n 6.7785 2.7096 38.8920 C\n 6.7785 2.7096 21.7711 C\n 6.7785 2.7096 4.6502 C\n 6.7785 2.7096 7.0960 C\n 6.7785 2.7096 9.5419 C\n 6.7785 2.7096 11.9877 C\n 6.7785 2.7096 14.4335 C\n 6.7785 2.7096 29.1086 C\n 6.7785 2.7096 34.0003 C\n 6.7785 2.7096 16.8794 C\n 6.7785 2.7096 19.3252 C\n 6.7785 2.7096 24.2169 C\n 6.7785 2.7096 26.6627 C\n 6.7785 2.7096 41.3378 C\n 6.7785 2.7096 36.4461 C\n 6.8545 3.4273 30.3315 C\n 6.8545 3.4273 37.6690 C\n 6.8545 3.4273 20.5481 C\n 6.8545 3.4273 3.4273 C\n 6.8545 3.4273 5.8731 C\n 6.8545 3.4273 8.3189 C\n 6.8545 3.4273 10.7648 C\n 6.8545 3.4273 13.2106 C\n 6.8545 3.4273 40.1149 C\n 6.8545 3.4273 15.6565 C\n 6.8545 3.4273 18.1023 C\n 6.8545 3.4273 22.9940 C\n 6.8545 3.4273 27.8857 C\n 6.8545 3.4273 32.7773 C\n 6.8545 3.4273 25.4398 C\n 6.8545 3.4273 35.2232 C\n 1 16 1\n 1 29 1\n 1 38 1\n 2 16 1\n 2 17 1\n 2 46 1\n 3 19 1\n 3 23 1\n 3 43 1\n 4 20 1\n 4 24 1\n 4 45 1\n 5 21 1\n 5 31 1\n 6 21 1\n 6 22 1\n 6 32 1\n 7 18 1\n 7 22 1\n 7 33 1\n 8 20 1\n 8 25 1\n 8 39 1\n 9 25 1\n 9 26 1\n 9 34 1\n 10 26 1\n 10 27 1\n 10 35 1\n 11 27 1\n 11 28 1\n 11 36 1\n 12 28 1\n 12 29 1\n 12 37 1\n 13 18 1\n 13 23 1\n 13 42 1\n 14 19 1\n 14 24 1\n 14 44 1\n 15 17 1\n 15 30 1\n 15 40 1\n 16 52 1\n 17 77 1\n 18 62 1\n 19 64 1\n 20 68 1\n 21 67 1\n 22 61 1\n 23 63 1\n 24 65 1\n 25 69 1\n 26 49 1\n 27 70 1\n 28 71 1\n 29 51 1\n 30 53 1\n 31 58 1\n 31 59 1\n 32 59 1\n 32 60 1\n 33 54 1\n 33 60 1\n 34 72 1\n 34 73 1\n 35 73 1\n 35 74 1\n 36 74 1\n 36 75 1\n 37 75 1\n 37 76 1\n 38 76 1\n 38 78 1\n 39 50 1\n 39 72 1\n 40 47 1\n 40 48 1\n 41 48 1\n 42 54 1\n 42 55 1\n 43 55 1\n 43 56 1\n 44 56 1\n 44 57 1\n 45 50 1\n 45 57 1\n 46 47 1\n 46 78 1\n 47109 1\n 48101 1\n 49 79 1\n 49 91 1\n 50103 1\n 51 80 1\n 51 93 1\n 52 80 1\n 52 81 1\n 53 82 1\n 53 94 1\n 54100 1\n 55 95 1\n 56102 1\n 57 96 1\n 59 98 1\n 60 99 1\n 61 84 1\n 61 85 1\n 62 85 1\n 62 86 1\n 63 86 1\n 63 87 1\n 64 87 1\n 64 88 1\n 65 88 1\n 65 89 1\n 66 83 1\n 67 83 1\n 67 84 1\n 68 89 1\n 68 90 1\n 69 90 1\n 69 91 1\n 70 79 1\n 70 92 1\n 71 92 1\n 71 93 1\n 72 97 1\n 73104 1\n 74105 1\n 75106 1\n 76107 1\n 77 81 1\n 77 94 1\n 78108 1\n 79138 1\n 80121 1\n 81110 1\n 83119 1\n 84126 1\n 85127 1\n 86128 1\n 87118 1\n 88129 1\n 89112 1\n 90137 1\n 91113 1\n 92114 1\n 93120 1\n 94122 1\n 95115 1\n 95130 1\n 96116 1\n 96131 1\n 97117 1\n 97132 1\n 98123 1\n 98124 1\n 99124 1\n 99125 1\n100115 1\n100125 1\n101111 1\n102116 1\n102130 1\n103117 1\n103131 1\n104132 1\n104133 1\n105133 1\n105134 1\n106134 1\n106135 1\n107135 1\n107136 1\n108136 1\n108139 1\n109111 1\n109139 1\n110140 1\n110151 1\n111165 1\n112144 1\n112149 1\n113145 1\n113153 1\n114146 1\n114154 1\n115159 1\n116161 1\n117163 1\n118143 1\n118148 1\n119147 1\n120146 1\n120150 1\n121150 1\n121151 1\n122140 1\n122152 1\n123156 1\n124157 1\n125158 1\n126141 1\n126147 1\n127141 1\n127142 1\n128142 1\n128148 1\n129143 1\n129149 1\n130160 1\n131162 1\n132164 1\n133167 1\n134168 1\n135155 1\n136169 1\n137144 1\n137153 1\n138145 1\n138154 1\n139170 1\n140197 1\n141182 1\n142183 1\n143185 1\n144193 1\n145172 1\n146195 1\n147181 1\n148184 1\n149186 1\n150196 1\n151171 1\n152198 1\n153187 1\n154188 1\n155180 1\n155201 1\n156176 1\n156177 1\n157177 1\n157178 1\n158178 1\n158179 1\n159179 1\n159189 1\n160189 1\n160190 1\n161190 1\n161191 1\n162173 1\n162191 1\n163173 1\n163192 1\n164192 1\n164199 1\n165174 1\n165175 1\n166175 1\n167199 1\n167200 1\n168180 1\n168200 1\n169201 1\n169202 1\n170174 1\n170202 1\n171204 1\n171216 1\n172203 1\n172212 1\n173227 1\n174233 1\n175230 1\n177220 1\n178221 1\n179222 1\n180231 1\n181205 1\n181214 1\n182205 1\n182206 1\n183206 1\n183207 1\n184207 1\n184208 1\n185208 1\n185209 1\n186209 1\n186210 1\n187211 1\n187212 1\n188203 1\n188213 1\n189219 1\n190225 1\n191226 1\n192228 1\n193210 1\n193211 1\n194214 1\n195213 1\n195215 1\n196215 1\n196216 1\n197204 1\n197217 1\n198217 1\n198218 1\n199229 1\n200223 1\n201224 1\n202232 1\n203255 1\n204234 1\n205250 1\n206251 1\n207252 1\n208236 1\n209253 1\n210237 1\n211254 1\n212238 1\n213239 1\n214249 1\n215259 1\n216240 1\n217260 1\n219235 1\n219256 1\n220244 1\n220245 1\n221245 1\n221246 1\n222235 1\n222246 1\n223247 1\n223261 1\n224248 1\n224262 1\n225241 1\n225256 1\n226241 1\n226257 1\n227242 1\n227257 1\n228242 1\n228258 1\n229247 1\n229258 1\n230243 1\n231248 1\n231261 1\n232262 1\n232263 1\n233243 1\n233263 1\n234264 1\n234267 1\n235285 1\n236265 1\n236272 1\n237268 1\n237273 1\n238269 1\n238274 1\n239266 1\n239275 1\n240267 1\n240270 1\n241289 1\n242281 1\n243280 1\n244282 1\n245283 1\n246284 1\n247292 1\n248279 1\n249276 1\n250276 1\n250277 1\n251277 1\n251278 1\n252272 1\n252278 1\n253265 1\n253273 1\n254268 1\n254274 1\n255269 1\n255275 1\n256286 1\n257290 1\n258291 1\n259266 1\n259270 1\n260264 1\n260271 1\n261287 1\n262288 1\n263294 1\n264296 1\n265304 1\n266295 1\n267310 1\n268297 1\n269309 1\n270308 1\n271303 1\n272302 1\n273305 1\n274306 1\n275307 1\n276299 1\n277300 1\n278301 1\n279295 1\n279308 1\n280296 1\n280303 1\n281297 1\n281306 1\n282298 1\n282299 1\n283299 1\n283300 1\n284300 1\n284301 1\n285301 1\n285302 1\n286302 1\n286304 1\n287295 1\n287307 1\n288308 1\n288310 1\n289304 1\n289305 1\n290297 1\n290305 1\n291306 1\n291309 1\n292307 1\n292309 1\n293303 1\n294296 1\n294310 1\nM END\n';
var molecule = ChemDoodle.readMOL(molFile, 1);
example.loadMolecule(molecule);
example.startAnimation();
</script>

We will break down the script line by line.
Lines 1 and 13 specify the beginning and ending of the script.
Line 2 creates a variable named example which contains the 3D canvas on which the model will be drawn and specifies its dimensions, which in our case are 800x400.
Line 3 specifies the type of 3D representation of the model. The allowed values are 'Ball and Stick’, 'Stick', ‘van der Waals Spheres’, 'Wireframe' and 'Line'.
Line 4 specifies the background color.
Line 5 specifies whether to use default atom colors, which is usefull for models that contain more than one type of atoms.
Line 6 specifies the atom color in the case where the previous line is set to false.
Line 7 specifies whether to use default bond colors.
Line 8 specifies the bond color in the case where the previous line is set to false.
Line 9 creates a variable named molFile which value is the line of code you learned to create in part 1 of the nanotube visualization guide.
Lines 10 through 12 load and start the animation of the molecule.
That's it! Copy the above script inside the <body> element of your website, change the value of molFile in line 9 to the disired molecule, change the atoms', bonds' and background's colors and dimensions if needed and load the page to view the 3D interactive model of your molecule.

Using the HTML template

If you are unfamilliar to html, you can use an html template file which you can download here.
Open the file using your favorite text editor. In order for the model to work you will need to replace [path] on line 3 with the path where the ChemDoodleWeb.js file has been saved and add the matlab-generated line of code to line 14. That it! If you have done everything correctly you can open the html file in any browser and view the model.

What to do if the model represented incorrectly or doesn't show at all?

If the model is represented incorrectly, first make sure that the atoms coordinates are correct. Go back to part 1 and generate a code for the same molecule but without any bonds (do this by entering 0 in both the lower and upper bounds of the bonds length). Create the bond-less molecule and check that the molecule is shown as desired. If not, there is probably a mistake in the xyz file used.

If the atoms are shown correctly but not the bonds, try setting different bounds on the bonds' length.

If the model doesn't show at all one possible reason could be that the molecule is too big. 4-digit number of atoms or bonds would result in an error in the chemdoodle code.
Another reason could be that illegal atom names have been used.