5
$\begingroup$

I would like to build a (large) molecular model of the nanotubes that make up VANTAblack, which consists of a sheet of hexagonally connected carbon atoms all rolled into a (teeny) tube.

I can easily do this with Graphics3D using Spheres and Tube segments. However, I would like to retain the graphics style used in other MoleculePlots.

There seem to be two approaches:

  1. Create the model and render it in Graphics3D and try to mimic, by hand, the style of MoleculePlots. I'm not eager to do that, because the styles never quite match. (Might there be some compiled "chemical structure" graphics style?)

  2. Somehow create the (large) molecular structure and use MoleculePlot to render it.

Any suggestions on how to best proceed?

$\endgroup$
7
$\begingroup$

This answer uses the web-based front end for TubeGen to generate an XYZ file, and then Import it.

I think it would be a fun project to write a more direct link to the program, source code here, but this works in a pinch.

Be aware this is hitting a free web-based service, and don't overload it.

template = StringTemplate @ "https://turin.nss.udel.edu/cgi-bin/tubegen-online?n-value=`n`&m-value=`m`&element-1=C&element-2=C&bond=1.4210&shape=`shape`&x-gutter=1.6735&y-gutter=1.6735&z-gutter=0.0000&x-count=`x`&y-count=`y`&z-count=`z`&format=xyz&units=angstrom&relax_tube=on";
default = <|
    "x" -> 1, "z" -> 10, "y" -> 1, "shape" -> "hexagonal", "n" -> 3, "m" -> 3
|>;
nanotube[params_Association : <||>, return_String : "Graphics3D"] := Module[
    {url = template @ Join[default, params]},
    Import[url, {"XYZ", return}]
];

For the usage we have

nanotube[]

enter image description here

or

nanotube[<|"n" -> 6, "m" -> 6|>]

enter image description here

or

nanotube[<|"z" -> 13, "shape" -> "planar"|>]

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Oh this is so very helpful. Thanks. (of course +1). But the only additional step I need is to get the style like my other styles, as illustrated: ChemicalData["Caffeine", "MoleculePlot"]. Is there any way to impose that style? After all, this is really a wonderful way to create the model, but not the style, which is my central issue. $\endgroup$ – David G. Stork Sep 17 at 20:55
  • $\begingroup$ Oh... wait... it seems that because there are only carbon atoms, everything is black. So yes... you solved it. ($\checkmark$) $\endgroup$ – David G. Stork Sep 17 at 21:01
  • 1
    $\begingroup$ It should have the same styling as that, it calls the system MoleculePlot3D function, but all the atoms are carbon and so they are all slate gray. So you could call SetOptions[MoleculePlot3D, ColorRules -> {"C" -> Purple}] before running this and the atoms are all purple. The web interface has an option for using non-carbon atoms, but I haven't played around with it yet. I think you'd modify the string template where it says "element-1=C&element-2=C" and put alternate atoms there. $\endgroup$ – Jason B. Sep 17 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.