#!/usr/bin/env python

from nanotechsoftware.base import *
from nanotechsoftware.chemistry import *
from nanotechsoftware.chemistry.framework import *
from nanotechsoftware.chemistry.core import *
from nanotechsoftware.chemistry.processor import *
from nanotechsoftware.chemistry.io import *

from itertools import *

import os

class AtomWeight:
      def __init__(self, weight):
        self.weight = weight
      def __call__(self, a):
        return a.getElement().getAtomicWeight() > self.weight 
                



mol = fromSmiles("c1c(C)c(O)c(N)cc1")

AssignIndexProcessor()(mol)

for atom in ifilter(AtomWeight(12), CompositeIteratorFactory.create(Atom, mol)):
    print "Atom with index ", atom.getIndex(), " and weight ", \
          atom.getElement().getAtomicWeight(), "has a weight > 12."
    

