a guest Apr 30th, 2012 138 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- class Molecule(object):
- def __init__(self,name=None,smiles=None):
- self.name = name # molecule name
- self.atomlist = someParserGoesHere(smiles) # list of atoms, perhaps list of atom objects???
- self.structure = someParserGoesHere(smiles) # 'structure' attribute should be a 2D connectivity matrix
- self.functionalgroups = ...
- def determineFunctionalGroups(self):
- # Figure out how to get functional groups for visual highlighting.
- def mutateMethod(self,mutate_instruction):
- # some function that adds or removes atoms to the molecule
- # based on some defined syntax, e.g. "add Carbon to C7"
- class Atom(object): # or should it be Atom(Molecule), a subclass
- def __init__(self,atomtype=None):
- self.atomtype = atomtype
- # For the variables below I would have some dictionary/function to give these values based on atomtype
- self.mass = massdict['atomtype']
- self.atomicnum = atomicnum...
- self.charge = charge...
- self.numbonds = numbonds... # can be checked to make sure valence is correct
- def printAttributes(self):
- print "Atomtype: %s" % self.atomtype
- print "Mass: %f" % self.mass
- # yadda yadda yadda
- class Bond(Molecule):
- class FunctionalGroup(Molecule):
RAW Paste Data