0 | module Text.Molfile.AtomType
3 | import Text.Molfile.Types
12 | {auto fld : Foldable f}
14 | -> Atom Isotope Charge p Radical h t c l
15 | -> Atom Isotope Charge p Radical HCount AtomType c l
16 | calcMolAtomType ns a =
17 | let bs := foldMap (toBonds . type) ns
18 | (hy,at) := atomTypeAndHydrogens (cast a.elem) a.radical a.charge bs
19 | in {type := at, hydrogen := hy} a
23 | perceiveMolAtomTypes : MolGraph -> MolGraphAT
24 | perceiveMolAtomTypes (G o g) =
25 | G o $
mapWithCtxt (\_,(A a ns) => calcMolAtomType ns a) g