11
$\begingroup$

I can use the following command to produce the HOMO (highest occupied molecular orbital) in chemistry:

Clear["Global`*"];
cm = 72/2.54;

datapath = "ExampleData/Pyridinecarbonitrile_MO_25_29.cub";
g1 = Import[
   datapath,
   "Graphics3D",
   Contours -> {-0.02, 0.02},
   
   ContourStyle -> {{Blue, Opacity[0.6]}, {Red, Opacity[0.6]}},
   Background -> None,
   (*MeshStyle->Gray,*)
   (*Mesh->Automatic,*)
   ImageSize -> {8 cm, 6 cm}
   ] // First

enter image description here

It looks pretty good, but compared to IboView, it's not as beautiful. Here are some images of the IboView:

enter image description here

enter image description here

enter image description here

This color scheme is really nice! So how do I get the same color scheme in Wolfram as IboView?

=========upgrate=========

by Specularity and Lighting function,change some

Clear["Global`*"];
cm = 72/2.54;

datapath = "ExampleData/Pyridinecarbonitrile_MO_25_29.cub";
g1 = Import[
   datapath,
   "Graphics3D",
   Contours -> {-0.02, 0.02},
   
   ContourStyle -> {
     {
      RGBColor["#c593fc"],
      Opacity[0.6],
      Specularity[Lighter@RGBColor["#9053e2"], 50]
      },
     {
      RGBColor["#8ab6f4"],
      Opacity[0.6],
      Specularity[Lighter@RGBColor["#5f9bf0"], 50]
      }
     },
   Lighting -> "ThreePoint",
   Method -> {"RelieveDPZFighting" -> True},
   Background -> None
   (*MeshStyle->Gray,
   Mesh->Automatic*)
   ] // First

enter image description here

It's a little closer to the color scheme.Then I tried the Glow function

enter image description here

I can use ImageData function get image color data

i = Import[
  "https://cdn.jsdelivr.net/gh/wxyhgk/paper-picture/202207231113165.\
png"]
Flatten[ImageData[ColorConvert[i, "RGB"]], 1]
BubbleChart[
 Append @@@ 
  Tally[Round[
    Flatten[ImageData[ColorConvert[i, "LAB"]], 1][[All, {2, 3}]], 
    10^-1]], ColorFunction -> (LABColor[.6, ##] &), 
 ColorFunctionScaling -> False, BubbleSizes -> {0.01, 0.1}]

enter image description here

Perhaps this color data can be used for ContourStyle? What do I do next, I don't know

$\endgroup$
10
  • 2
    $\begingroup$ Good question. Btw, as a matter of principle, I find it a bit problematic to have Import statements that run code from some other place because it could be dangerous, but maybe the mods allow it. $\endgroup$
    – user293787
    Commented Jul 22, 2022 at 13:30
  • 1
    $\begingroup$ You've imported the data from the external source "https://github.com/wxyhgk/molecular/releases/download/cube/Ar-I_\ mo40.cub", that's the dangerous part. Also, even if the data is safe, there's no guarentee that the link won't be broken in the future. It's better to use ExampleData as in document page instead. $\endgroup$
    – xzczd
    Commented Jul 22, 2022 at 13:47
  • 1
    $\begingroup$ @xzczd I have change datapath $\endgroup$ Commented Jul 22, 2022 at 13:56
  • 1
    $\begingroup$ I don't share the paranoia here - I regularly put code on this site that contains Import["http. Uploading a file to github so it can be an example here is completely appropriate $\endgroup$
    – Jason B.
    Commented Jul 22, 2022 at 14:37
  • 1
    $\begingroup$ @JasonB. The risk isn't high of course, but link breaking did happen in the past: mathematica.stackexchange.com/posts/167368/revisions $\endgroup$
    – xzczd
    Commented Jul 22, 2022 at 14:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.