Discussion:
[BlueObelisk-discuss] Chemistry::Harmonia
Aleksander Gorohovski
2011-06-25 18:24:50 UTC
Permalink
Hi all,

It will be possible to somebody interesting.

I have written Perl-module Chemistry::Harmonia.

http://search.cpan.org/dist/Chemistry-Harmonia/lib/Chemistry/Harmonia.pm

The module provides the necessary subroutines to solve some
puzzles of the general inorganic and physical chemistry.
The methods implemented in this module, are all oriented to known
rules and laws of general and physical chemistry.

Now Chemistry::Harmonia provides these subroutines:
-------------------------------------
oxidation_state --- returns a hierarchical hash-reference of hash integer
oxidation state
(key 'OS') and hash with the number of atoms for each element (key 'num')
for the
inorganic formula of substance.
For Example:
for 'Fe3O4'

$VAR1 = {
'O' => {
'num' => [ 4 ],
'OS' => [ [ -2 ] ]
},
'Fe' => {
'num' => [ 3 ],
'OS' => [ [ 2, 3, 3 ] ]
}
};


for '[Cr(CO(NH2)2)6]4[Cr(CN)6]3'

$VAR1 = {
'H' => { 'num' => [ 96 ],
'OS' => [ [ 1 ] ]
},
'O' => { 'num' => [ 24 ],
'OS' => [ [ -2 ] ]
},
'N' => { 'num' => [ 48, 18 ],
'OS' => [ [ -3 ], [ -3 ] ]
},
'C' => { 'num' => [ 24, 18 ],
'OS' => [ [ 4 ], [ 2 ] ]
},
'Cr' => { 'num' => [ 4, 3 ],
'OS' => [ [ 3 ], [ 2 ] ]
}
};

Now oxidation_state() is checked over 6200 unique inorganic substances.

-------------------------------------
parse_chem_mix --- parses mix of_substances (usually chemical equation) to
arrays of
the reactants (initial substances) and products (substances formed in
the chemical reaction).

-------------------------------------
good_formula --- parses 'abracadabra' to array reference of "good"
chemical formula(s).
The "good" formula it does NOT mean chemically correct. The subroutine
oxidation_state() will help with a choice chemically correct formula.

-------------------------------------
prepare_mix --- forms the chemical mix (equation) from ref to array of
arrays
reactants and products, i.e. is parse_chem_mix antipode.

-------------------------------------
class_cir_brutto --- calculates Unique Common Identifier of Reaction
with stoichiometry coefficients and brutto (gross) formulas of substances.

For example: $reaction = '1 H2O + 1 CO2 --> 1 H2CO3';

$VAR1 = [
'CHO',
1334303561,
{
'H2CO3' => 'C1H2O3',
'CO2' => 'C1O2',
'H2O' => 'H2O1'
}
];


CIR is a 32 bit CRC of normalized chemical equation, generating the same
CRC value as the POSIX GNU cksum program. The returned CIR will always be
a non-negative integer in the range 0..2^32-1, i.e. 0..4,294,967,295.

The class_cir_brutto() protesting CLASS-CIR over 22,100 unique inorganic
reactions.

-------------------------------------
ttc_reaction --- calculates Tactico-Technical characteristics (TTC) of
reaction,
i.e. quantity SAR: (s)ubstance, (a)toms and (r)ank of reaction.

Thanks,
Alessandro Gorohovski

Loading...