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

import os

def buildRefmol():

    a = 3.57
    
    c = StaticAtom()
    c.setElement(getElements().fetchElement("C"))
    
    c1 = StaticAtom()
    c1.setElement(getElements().fetchElement("C"))
    
    c2 = StaticAtom()
    c2.setElement(getElements().fetchElement("C"))
    
    c3 = StaticAtom()
    c3.setElement(getElements().fetchElement("C"))
    
    c4 = StaticAtom()
    c4.setElement(getElements().fetchElement("C"))
    
    c1.setPosition(Vector3(a/4,a/4,a/4))
    c2.setPosition(Vector3(0,a/2,a/2))
    c3.setPosition(Vector3(a/2,0,a/2))
    c4.setPosition(Vector3(a/2,a/2,0))
    
    mol = Molecule()
    
    mol.insert(c)
    mol.insert(c1)
    mol.insert(c2)
    mol.insert(c3)
    mol.insert(c4)
    
    b1 = Bond(c, c1)
    b2 = Bond(c, c2)
    b3 = Bond(c, c3)
    b4 = Bond(c, c4)

    return mol


         + 'connectedcomponents.py.out', 'w')

mol = XYZ(os.environ['EXAMPLESPATH'] + os.sep + 'diamond.xyz')

AssignIndexProcessor()(mol)
BuildBondsProcessor()(mol)

pg = createPredicateGraphFromSmartsString("[CX4]~[C](~[C])(~[C])(~[C])")
g = createGraph(createGraphEdit(mol))

p = RMSDeviationProcessor(buildRefmol())
for m in matchTotalUniqueFromPredicateGraph(pg, g):
    if p(m) &lt; 0.1:
        print "Atoms ",
        for a in ComponentIteratorFactory.create(Atom, m):
            print a.getIndex(),
        print


