0 | module Chem.QSAR.RotatableBonds
2 | import Data.Graph.Indexed.Ring.Util
3 | import Data.SortedSet
5 | import Chem.QSAR.Util
9 | parameters {0 b,e,c,p,r,h,t,ch,l : Type}
10 | {auto ce : Cast e Elem}
11 | {auto cb : Cast b BondOrder}
13 | (ringBonds : EdgeSet k)
14 | (includeTerminals : Bool)
15 | (excludeAmides : Bool)
16 | (g : IGraph k b (Atom e c p r h t ch l))
28 | isRotatableBond : Edge k b -> Bool
29 | isRotatableBond (E x y l) =
31 | && not (isElem g H x || isElem g H y)
32 | && not (contains (E x y ()) ringBonds)
33 | && (maxBondOrder g x < Triple && maxBondOrder g y < Triple)
34 | && (includeTerminals || (heavyDegree g x > 1 && heavyDegree g y > 1))
35 | && (not $
excludeAmides && isAmideBond g x y)
41 | rotatableBondCount : Nat
42 | rotatableBondCount = count isRotatableBond (edges g)