kill(all)$

reaction equation : Basic molecular topologies, version 1.0
peter.vlasschaert@gmail.com,17/10/2019

number Valence Electron: Ve
nπ : number π pairs
nσ : number σ pairs
nl   : number lone pairs ( = unused pairs are lone pairs)

p1: Ve = nπ + nσ + nl;

rem : general atom : 4 pairs  , 'octet structure' = 4*q
          except              Hydrogen atom : 1 pair    =1*h  
----------------------------------------------------------------------
q :heavy atoms
h : light   atoms
----------------------------------------------------------------------

p2: V = Ve/2;

V :'half of the sum of valence electrons' of  'all' atoms in the molecule.

p3:(4*q+h) - (nπ+nσ) = V;

number of  π bounds in the molecule 
============================

p3a:solve(p3,nπ)[1];

find :cyclic structure
example :  ozon : o[3]
=>   3 atoms  →  3 σ bounds

p4:nσ = h+q ;

(c)yclic structure
---------------------

p4a:nπ[c] = subst([p4,p2],rhs(p3a));

find :(n)o (c)yclic structure
example :  water : H2O
=>   3 atoms  →  2 σ bounds

p5:nσ = h+q -1; 

(n)o (c)yclic structure  (linear structure)
-----------------------------------------------------

p5a:nπ[nc] = subst([p5,p2],rhs(p3a));

rem :
q : non hydrogen atoms

example :  NO  (linear structure)
--------------------------------------------
valence N :  5 
valence O :  6

→    use 'p5a'

p1a :Ve = (5+6);
p1b: q = 2    /*two heavy atoms */;

p1c:lhs(p5a) = float(subst([p1a,p1b],rhs(p5a)));

result : nπ  ( = one π bound)
             nl   ( = one electron) =>  radical

example :  HCN  (linear structure)
----------------------------------------------
valence N :  5 
valence C :  4
valence H  : 1 , ' no heavy atom'

→    use 'p5a'

p2a :Ve = (5+4+1);
p2b: q = 2    /*two heavy atoms,one light atom */;

p2c:lhs(p5a) = float(subst([p2a,p2b],rhs(p5a)));

result : nπ  ( = two π bound)        ' between   C  and  N'

example : ClF3  (linear structure)
----------------------------------------------
valence Cl :  7
valence F :   7    (*3)

→    use 'p5a'

p3a :Ve = (7+3*7);
p3b: q = 4    /*two heavy atoms,one light atom */;

p3c:lhs(p5a) = float(subst([p3a,p3b],rhs(p5a)));

rem : neg value ,too many pairs,extra lone pair around  Cl.

example : CH4  (linear structure)
----------------------------------------------
valence C :  4
valence H :  1     (*4)

→    use 'p5a'

p4aa :Ve = (4+1*4);
p4bb: q = 1    /*one heavy atoms,four light atoms */;

p4c:lhs(p5a) = float(subst([p4aa,p4bb],rhs(p5a)));

rem : 0.0 only  4  nσ  bounds around  C

example : O3  (cyclic structure)
----------------------------------------------
valence O :  6  (*3)

→    use 'p4a'

p5aa :Ve = (6+6+6);
p5bb: q = 3    /*three heavy atoms,zero light atom */;

p5cc:lhs(p4a) = float(subst([p5aa,p5bb],rhs(p4a)));

rem : 0.0 only  3  nσ  between each other  O