5
$\begingroup$

I am currently working on a project (turns out: a bigger project, than originally thought...) with all hypothetically "thinkable" products for a reaction with two given educts. These educts are Entity["Chemical", "AmmoniumPerchlorate"] and Entity["Chemical", "Aluminum"]. Yes, these are the main ingredients of a common solid rocket composite propellant, used in the Space Shuttle booster, for instance.

I gathered all compounds with Al, Cl, H, N, O as involved elements, together with Cl, H, N and O, I have 35 products in total. In a first approach, I restrict myself for a product combination of up to five products, yielding in 384,132 subsets. Further plausibility checks gave approx. 168,000 of such hypothetical reactions.

While I tried some preliminary tests (balancing with the built-in ReactionBalance as well as some basic linear algebra and Nullspace computations on the composition matrix) I saw, Mathematica is unable to declare specific reactions in the first place. Consider the (hypothetical, more precisely: impossible, due to "unbalanceability") reaction:

ChemicalReaction[<|Entity["Chemical", "AmmoniumPerchlorate"] -> 1, Entity["Chemical", "Aluminum"] -> 1|> -> <|Entity["Chemical", "AluminumChloride"] -> 1, Entity["Chemical", "AluminumNitrate"] -> 1, Entity["Chemical", "Diazine"] -> 1|>]

The output:

enter image description here

My first suspect was, Entity["Chemical", "Diazine"] has no Hill formula or Hill formula string, but it has. However: EntityProperty["Chemical", "Formula"] -> Missing["NotAvailable"] and EntityProperty["Chemical", "FormulaString"] -> Missing["NotAvailable"] (part of a PropertyAssociation request). So, I had to add this entity value manually, which sounds easier than it is:

Entity["Chemical", "Diazine"][EntityProperty["Chemical", "Formula"]] = "N2H2"

does not work:

enter image description here

And even if there's a workaround for adding own content to built-in entities, my concern is, that ReactionBalance would fail in any case, due to possible side effects.

How can I use ReactionBalance on chemicals which do not have "Formula" in their corresponding Entity?

(Side note to Jason B.: fantastic work in the chemistry department! Brilliant, and a big step for mathematical chemistry with Mathematica. Makes me feel small...)

$\endgroup$
3
  • $\begingroup$ Once again I would just like to point out that StackExchange is a site for questions and answers, not for comments and discussions :) I have slightly edited your post to more clearly emphasize the question and make it properly "answerable". $\endgroup$
    – Domen
    Commented May 2 at 13:24
  • $\begingroup$ I thought the preliminary remarks were useful to clarify the motivation behind my question. Sometimes it is appropriate to anticipate the "why" in order not to provoke workarounds that do not fit the planned workflow. But thank you for your valuable insights. $\endgroup$ Commented May 2 at 13:37
  • $\begingroup$ Oh, I wasn't referring to your introductory text, but to the final part where you wrote "Comments?" :) $\endgroup$
    – Domen
    Commented May 2 at 13:39

2 Answers 2

6
$\begingroup$

I don't know why "Diazine" is missing its formula, I will update the database and after the next knowledgebase update it should work.

It will work just fine if you convert all the entities into molecules though:

Map[KeyMap[Molecule], 
 ChemicalReaction[<|Entity["Chemical", "AmmoniumPerchlorate"] -> 1, 
    Entity["Chemical", "Aluminum"] -> 1|> -> <|
    Entity["Chemical", "AluminumChloride"] -> 1, 
    Entity["Chemical", "AluminumNitrate"] -> 1, 
    Entity["Chemical", "Diazine"] -> 1|>], {2}]

As a side note - is that right? From searching it looks like the proper spelling is diazene

$\endgroup$
2
  • $\begingroup$ Yes, I would prefer diazene too. $\endgroup$ Commented May 2 at 18:23
  • $\begingroup$ Thanks again Jason, but well, not quite... I had to unflag this as a solution. Entity["Chemical", "Aluminum"] is translated to AlH3 (the Molecule procedure obviously always tries to saturate valences with H, so also in your example). Aluminum hydride is of course not my desired reactant. I will see if I can make do with Chemical Formula for the time being. BTW, FindIsomers[ChemicalFormula["N2H2"], "Entity"] gives no result. Strange. $\endgroup$ Commented May 2 at 22:40
3
$\begingroup$

You can use ChemicalFormula instead of an entity.

ReactionBalance[ChemicalReaction[<|ChemicalFormula["H2"] -> 1, 
 ChemicalFormula["N2"] -> 1|> -> <|ChemicalFormula["NH3"] -> 1|>]]
(* ChemicalReaction[<|ChemicalFormula[{"H" -> 2}] -> 3, 
   ChemicalFormula[{"N" -> 2}] -> 1|> -> <|ChemicalFormula[{"N" -> 1, "H" -> 3}] -> 2|>] *)

ReactionBalance[
 ChemicalReaction[<|Entity["Chemical", "AmmoniumPerchlorate"] -> 1, 
    Entity["Chemical", "Aluminum"] -> 1|> -> <|
    Entity["Chemical", "AluminumChloride"] -> 1, 
    Entity["Chemical", "AluminumNitrate"] -> 1, 
    ChemicalFormula["NH2"] -> 1|>]]
(* ReactionBalance::nosln: The reaction cannot be balanced. *)
$\endgroup$
2
  • $\begingroup$ Nice! That should be suitable for the reaction balance calculations. In the next steps, however, I would like to filter out the reactions with a positive sum of enthalpy values in order to allow only exothermic reactions. At this point, I would have to change to entity constructs again (or declare corresponding replacement rules). $\endgroup$ Commented May 2 at 13:51
  • 1
    $\begingroup$ I guess in such case you could store the entities that you had to convert to ChemicalFormula in an association, then get them back from the ChemicalFormula after balancing the reaction ... $\endgroup$
    – Domen
    Commented May 2 at 14:14

Your Answer

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

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