lime/ToBeErased/FranckCondon/RecursiveModes_Zeros.py
def depthFirstSearch(threshold, Modes, values, E_electronic):
    """ Threshold is the threshold Franck-Condon after which we assign the value 0. 
        Modes is a list of modes.
        values is a list of values the modes can have (e.g. n = 0,1,2,3)

        Returns a tuple (ListOfEnergies, ListOfIntensities).
    """
    ListOfIntensites = []
    ListOfEnergies = []
    fringe = Stack()
    mode0 = Modes[0]
    print "NumModes =", len(Modes)
    for n in values:
        FC = mode0.FrankCondons[n]
        if FC >= threshold:
            energy = E_electronic + mode0.excitedEnergy(n) - mode0.groundEnergy
            node = Node(0, mode0.FrankCondons[n], energy)
            fringe.push(node)
          #  print "Mode 0, n ", n, "FC = ", FC
        #else:
          #  print "Mode 0, n ", n, "FC = ", FC, "below threshold"
    while True:
        if fringe.isEmpty():
           break
        node = fringe.pop()
        if (node.modeIndex+1) < len(Modes):
           # print "NumModes =", len(Modes), "next mode index =", (node.modeIndex+1)
            nextMode = Modes[node.modeIndex+1]
            for n in values:
                FC = nextMode.FrankCondons[n]
                energy = (nextMode.excitedEnergy(n)-
                          nextMode.groundEnergy)
                if node.product >= threshold:
                    newNode = Node(node.modeIndex+1,
                                   nextMode.FrankCondons[n]*node.product,
                                   node.energy+energy)
                    fringe.push(newNode)
                else:
                    newNode = Node(node.modeIndex+1,
                                   0,
                                   node.energy+energy)
                    fringe.push(newNode)
        else:
            
            ListOfIntensites += [node.product**2]
            ListOfEnergies += [node.energy]

    return (ListOfEnergies, ListOfIntensites)
 Threshold is the threshold Franck-Condon after which we assign the value 0. 
        Modes is a list of modes.
        values is a list of values the modes can have (e.g. n = 0,1,2,3)

        Returns a tuple (ListOfEnergies, ListOfIntensities).
    
Threshold is the threshold Franck-Condon after which we assign the value 0.
Modes is a list of modes.
values is a list of values the modes can have


Threshold is the threshold Franck - Condon after which we assign the value 0 . Modes is a list of modes . values is a list of values the modes can have
def depthFirstSearch(threshold, Modes, values, E_electronic):
    ListOfIntensites = []
    ListOfEnergies = []
    fringe = Stack()
    mode0 = Modes[0]
    print "NumModes =", len(Modes)
    for n in values:
        FC = mode0.FrankCondons[n]
        if FC >= threshold:
            energy = E_electronic + mode0.excitedEnergy(n) - mode0.groundEnergy
            node = Node(0, mode0.FrankCondons[n], energy)
            fringe.push(node)
          , "below threshold"
    while True:
        if fringe.isEmpty():
           break
        node = fringe.pop()
        if (node.modeIndex+1) < len(Modes):
            nextMode = Modes[node.modeIndex+1]
            for n in values:
                FC = nextMode.FrankCondons[n]
                energy = (nextMode.excitedEnergy(n)-
                          nextMode.groundEnergy)
                if node.product >= threshold:
                    newNode = Node(node.modeIndex+1,
                                   nextMode.FrankCondons[n]*node.product,
                                   node.energy+energy)
                    fringe.push(newNode)
                else:
                    newNode = Node(node.modeIndex+1,
                                   0,
                                   node.energy+energy)
                    fringe.push(newNode)
        else:
            ListOfIntensites += [node.product**2]
            ListOfEnergies += [node.energy]
    return (ListOfEnergies, ListOfIntensites)
def depthFirstSearch ( threshold , Modes , values , E_electronic ) : ListOfIntensites = [ ] ListOfEnergies = [ ] fringe = Stack ( ) mode0 = Modes [ 0 ] print "NumModes =" , len ( Modes ) for n in values : FC = mode0 . FrankCondons [ n ] if FC >= threshold : energy = E_electronic + mode0 . excitedEnergy ( n ) - mode0 . groundEnergy node = Node ( 0 , mode0 . FrankCondons [ n ] , energy ) fringe . push ( node ) while True : if fringe . isEmpty ( ) : break node = fringe . pop ( ) if ( node . modeIndex + 1 ) < len ( Modes ) : nextMode = Modes [ node . modeIndex + 1 ] for n in values : FC = nextMode . FrankCondons [ n ] energy = ( nextMode . excitedEnergy ( n ) - nextMode . groundEnergy ) if node . product >= threshold : newNode = Node ( node . modeIndex + 1 , nextMode . FrankCondons [ n ] * node . product , node . energy + energy ) fringe . push ( newNode ) else : newNode = Node ( node . modeIndex + 1 , 0 , node . energy + energy ) fringe . push ( newNode ) else : ListOfIntensites += [ node . product ** 2 ] ListOfEnergies += [ node . energy ] return ( ListOfEnergies , ListOfIntensites )
Threshold is the threshold Franck-Condon after which we assign the value 0.
Threshold is the threshold Franck - Condon after which we assign the value 0 .
""" Threshold is the threshold Franck-Condon after which we assign the value 0. 
        Modes is a list of modes.
        values is a list of values the modes can have (e.g. n = 0,1,2,3)

        Returns a tuple (ListOfEnergies, ListOfIntensities).
    """ #  print "Mode 0, n ", n, "FC = ", FC #else: #  print "Mode 0, n ", n, "FC = ", FC, "below threshold" # print "NumModes =", len(Modes), "next mode index =", (node.modeIndex+1)
threshold
Modes
values
E_electronic