7 | module Chem.QSAR.HAcceptor
10 | import Chem.Aromaticity
11 | import Chem.QSAR.Util
15 | parameters {0 b,e,p,r,h,t,c,l : Type}
16 | {auto cst : Cast e Elem}
18 | (g : IGraph k (AromBond b) (Atom e Charge p r h t c l))
20 | isAromEther : AssocList k (AromBond b) -> Bool
21 | isAromEther bs = countNonHs g bs > 1 && any (isAromatic g) (keys bs)
30 | isHAcceptor : Fin k -> Bool
32 | let A atm ns := adj g n
33 | in case cast @{cst} (elem atm) of
34 | N => charge atm <= 0 && not (hasElem g O ns)
35 | O => charge atm <= 0 && not (hasElem g N ns || isAromEther ns)
42 | hAcceptorCount : Nat
43 | hAcceptorCount = count isHAcceptor $
nodes g