0 | module Chem.QSAR.TPSA
3 | import Chem.Aromaticity
5 | import Chem.QSAR.Util
6 | import Data.Graph.Indexed.Ring.Util
7 | import Data.SortedMap
8 | import Derive.Prelude
10 | %language ElabReflection
13 | record Profile where
22 | %runElab derive "Profile" [Show,Eq,Ord]
24 | contribs : SortedMap Profile Double
27 | [ (P N 0 0 0 False $
BS 3 0 0, 3.24)
28 | , (P N 0 0 0 False $
BS 1 1 0, 12.36)
29 | , (P N 0 0 0 False $
BS 0 0 1, 23.79)
30 | , (P N 0 0 0 False $
BS 1 2 0, 11.68)
31 | , (P N 0 0 0 False $
BS 0 1 1, 13.6)
32 | , (P N 0 0 0 True $
BS 3 0 0, 3.01)
33 | , (P N 1 0 0 False $
BS 3 0 0, 12.03)
34 | , (P N 1 0 0 True $
BS 3 0 0, 21.94)
35 | , (P N 1 0 0 False $
BS 1 1 0, 23.85)
36 | , (P N 2 0 0 False $
BS 3 0 0, 26.02)
37 | , (P N 0 1 0 False $
BS 4 0 0, 0.0)
38 | , (P N 0 1 0 False $
BS 2 1 0, 3.01)
39 | , (P N 0 1 0 False $
BS 1 0 1, 4.36)
40 | , (P N 1 1 0 False $
BS 4 0 0, 4.44)
41 | , (P N 1 1 0 False $
BS 2 1 0, 13.97)
42 | , (P N 2 1 0 False $
BS 4 0 0, 16.61)
43 | , (P N 2 1 0 False $
BS 2 1 0, 25.59)
44 | , (P N 3 1 0 False $
BS 4 0 0, 27.64)
45 | , (P N 0 0 2 False $
BS 0 0 0, 12.89)
46 | , (P N 0 0 3 False $
BS 0 0 0, 4.41)
47 | , (P N 0 0 2 False $
BS 1 0 0, 4.93)
48 | , (P N 0 0 2 False $
BS 0 1 0, 8.39)
49 | , (P N 1 0 2 False $
BS 1 0 0, 15.79)
50 | , (P N 0 1 3 False $
BS 0 0 0, 4.1)
51 | , (P N 0 1 2 False $
BS 1 0 0, 3.88)
52 | , (P N 1 1 2 False $
BS 1 0 0, 14.14)
54 | , (P O 0 0 0 False $
BS 2 0 0, 9.23)
55 | , (P O 0 0 0 True $
BS 2 0 0, 12.53)
56 | , (P O 0 0 0 False $
BS 0 1 0, 17.07)
57 | , (P O 0 (-
1) 0 False $
BS 1 0 0, 23.06)
58 | , (P O 1 0 0 False $
BS 2 0 0, 20.23)
59 | , (P O 0 0 2 False $
BS 0 0 0, 13.14)
61 | , (P S 0 0 0 False $
BS 2 0 0, 25.3)
62 | , (P S 0 0 0 False $
BS 0 1 0, 32.09)
63 | , (P S 0 0 0 False $
BS 2 1 0, 19.21)
64 | , (P S 0 0 0 False $
BS 2 2 0, 8.38)
65 | , (P S 1 0 0 False $
BS 2 0 0, 38.8)
66 | , (P S 0 0 2 False $
BS 0 0 0, 28.24)
67 | , (P S 0 0 2 False $
BS 0 1 0, 21.7)
69 | , (P P 0 0 0 False $
BS 3 0 0, 13.59)
70 | , (P P 0 0 0 False $
BS 1 1 0, 34.14)
71 | , (P P 0 0 0 False $
BS 3 1 0, 9.81)
72 | , (P P 1 0 0 False $
BS 3 1 0, 23.47)
75 | parameters {0 b,e,p,r,t,ch,l : Type}
76 | {auto ce : Cast e Elem}
77 | {auto cb : Cast b BondOrder}
79 | (g : IGraph k (AromBond b) (Atom e Charge p r HCount t ch l))
81 | contrib : Elem -> Fin k -> Double
83 | let A a ns := adj g n
84 | implHs := a.hydrogen
85 | hc := cast implHs.value + countElems g H ns
86 | tm := inThreeMemberedRing g n
87 | pro := P el hc a.charge (count arom ns) tm (nonAromaticBonds implHs ns)
88 | in fromMaybe 0.0 $
lookup pro contribs
93 | tpsaContrib : Fin k -> Double
95 | case cast @{ce} $
elem $
lab g n of
106 | tpsa = foldl (\x,v => x + tpsaContrib v) 0.0 (nodes g)