Of course no chemical database is complete, but I would like to create as large a list of MoleculePlots of pigments (organic or inorganic) as is available through the ChemicalData database, for instance:

ChemicalData["PigmentOrange43", "MoleculePlot"]

PigmentOrange43 molecule poot

The three big problems in this effort are that

  1. there is no reliable way to search the ChemicalData database for pigments
  2. a representative list of pigments, such as this, lists them in a form that is not directly usable to ChemicalData
  3. once you even find an appropriate representation (often by lots of trial and error with semantic input), one finds there is no such entry in the database.

In short: What is the most effective way to automate the search for pigments in ChemicalData that contain MoleculePlots?

  • 1
    $\begingroup$ Going by the definition of "inorganic" I am accustomed to, your example is not inorganic. $\endgroup$ – J. M.'s technical difficulties Mar 17 '19 at 20:00
  • $\begingroup$ @J.M.isslightlypensive: Fair enough. My example was just to show a ChemicalPlot. I'd be happier still if we could find organic and inorganic pigments. (I'll edit my question.) $\endgroup$ – David G. Stork Mar 17 '19 at 20:02
  • $\begingroup$ You may also want to expand your search to the term "dyes" in addition to pigments. As a chemist, I tend to think of organic soluble "dyes" and inorganic insoluble (dispersible) "pigments". See e.g. Wikipedia's List of dyes. $\endgroup$ – MarcoB Mar 18 '19 at 15:35
  • $\begingroup$ It's too bad there is no immediately accessible API for the Colour Index; as Jason notes, Wikipedia has a sizable, but not very extensive list. $\endgroup$ – J. M.'s technical difficulties Mar 24 '19 at 15:35

The number of these compounds in ChemicalData may be limited at the moment.

 StringContainsQ[CanonicalName[#], "Pigment"] &]

enter image description here

But you can use data from Wikipedia combined with a connection to PubChem to get data about pigments. Here I picked the organic pigments as they are more likely to be a single molecule, simpler than the inorganic solvents listed in the OP.

pigments = 
 WikipediaData["Category" -> "Organic pigments", "CategoryMembers"]

(* {"Paris green","Verdigris","Pigment Yellow 13",<<32>>,
      "Rose madder","Bistre","Alizarin"} *)

Now grab the pubchem CID number from the Wikipedia pages, and use this with ServiceExecute to get an SDF file for each pigment,

cidFromWikiPageTitle = 
  StringCases[WikipediaData[#, "SummaryWikicode"], 
    "PubChem = " ~~ cid : Longest[NumberString] :> cid] &;

pigmentCIDS = 
 Association[# -> cidFromWikiPageTitle[#] & /@ pigments] // 
   DeleteCases[{}] // Map[First]

(* <|"Paris green" -> "22833492", 
 "Pigment Yellow 13" -> "73462", "Pigment Yellow 12" -> "186342", 
 "Naphthol AS" -> "66719", "Pigment violet 23" -> "20813033", 
 "Dibromoanthanthrone" -> "78084", "Pigment yellow 185" -> "5489883", 
 "Pigment yellow 139" -> "5488898", "Perinone" -> "78141", 
 "Pigment Yellow 10" -> "21118695", "Pigment Yellow 81" -> "89597", 
 "Pigment yellow 83" -> "21733", "Pigment Yellow 16" -> "22288", 
 "Naphthol Red" -> "5359812", "Quinacridone" -> "13976", 
 "Indigo dye" -> "5318432", "Alizarin" -> "6293"|> *)

Now import SDF data for the pigments from PubChem,

pigmentSDFData =
      "CompoundSDF", {"CompoundID" -> #}]] & /@ pigmentCIDS;


(* {"EdgeRules", "EdgeTypes", "FormalCharges", "Graphics3D", \
"Header", "MassNumbers", "Metadata", "StructureDiagram", \
"VertexCoordinates", "VertexTypes", "MOL"} *)

The "Graphics3D" element for many of these is actually taken from 2D coordinates, but the rest of the data is computable

RandomChoice[pigmentSDFData]["Metadata"] // Short

(* {{"PUBCHEM_COMPOUND_CID"->13976,<<31>>,"PUBCHEM_BONDANNOTATIONS"->{{11,13,8},<<24>>,{8,9,8}}}} *)

ImageCollage[Flatten@Values@pigmentSDFData[[All, "StructureDiagram"]],
  Background -> White]

enter image description here

|improve this answer|||||
  • $\begingroup$ Thank you! (+1) . Let me wait for a day or two to see if there is a more extensive and complete solution, but if not, I'll accept this. $\endgroup$ – David G. Stork Mar 18 '19 at 2:48

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.