spin.py
def modelE(model, nodes, node_qty, I, T):
    """    
    Seeks to calculate the energy of the system after a user determined number (I) updates to the model.
    Args:
        model: an instance of a Model object.
        nodes: a dictionary of node objects.
        node_qty: an integer, quantity of nodes within model.
        I: an integer, user input dictating number of updates to the model prior to determing final system energy.
        T: a float, non zero temperature for the Boltzmann distribution probability formula.
    Returns:
        mE: an integer indicating energy of the system according to the Hamiltonian specifed in the Test Introduction.
    """
    mE = 0
    for i in range(I):
        update(model, nodes, node_qty, T) # Invokes an update to the model.
    for w in model.getJs(): # Iterates over a list of tuples of nodes joined by an edge.
        mE += nodes[w[0]].getSpin() * nodes[w[1]].getSpin() * w[2] # Sums product of spins with shared edges and edge weights.
    for w in model.geths(): # Iterates over a list of tuples of nodes with resepctive field weights.
        mE += nodes[w[0]].getSpin() * w[1] # Sums product of spins and weights.
    return -mE
    
    Seeks to calculate the energy of the system after a user determined number (I) updates to the model.
    Args:
        model: an instance of a Model object.
        nodes: a dictionary of node objects.
        node_qty: an integer, quantity of nodes within model.
        I: an integer, user input dictating number of updates to the model prior to determing final system energy.
        T: a float, non zero temperature for the Boltzmann distribution probability formula.
    Returns:
        mE: an integer indicating energy of the system according to the Hamiltonian specifed in the Test Introduction.
    
Seeks to calculate the energy of the system after a user determined number (I) updates to the model.
Seeks to calculate the energy of the system after a user determined number ( I ) updates to the model .
def modelE(model, nodes, node_qty, I, T):
    mE = 0
    for i in range(I):
        update(model, nodes, node_qty, T) 
    for w in model.getJs(): 
        mE += nodes[w[0]].getSpin() * nodes[w[1]].getSpin() * w[2] 
    for w in model.geths(): 
        mE += nodes[w[0]].getSpin() * w[1] 
    return -mE
def modelE ( model , nodes , node_qty , I , T ) : mE = 0 for i in range ( I ) : update ( model , nodes , node_qty , T ) for w in model . getJs ( ) : mE += nodes [ w [ 0 ] ] . getSpin ( ) * nodes [ w [ 1 ] ] . getSpin ( ) * w [ 2 ] for w in model . geths ( ) : mE += nodes [ w [ 0 ] ] . getSpin ( ) * w [ 1 ] return - mE
Seeks to calculate the energy of the system after a user determined number (I) updates to the model.
Seeks to calculate the energy of the system after a user determined number ( I ) updates to the model .
"""    
    Seeks to calculate the energy of the system after a user determined number (I) updates to the model.
    Args:
        model: an instance of a Model object.
        nodes: a dictionary of node objects.
        node_qty: an integer, quantity of nodes within model.
        I: an integer, user input dictating number of updates to the model prior to determing final system energy.
        T: a float, non zero temperature for the Boltzmann distribution probability formula.
    Returns:
        mE: an integer indicating energy of the system according to the Hamiltonian specifed in the Test Introduction.
    """ # Invokes an update to the model. # Iterates over a list of tuples of nodes joined by an edge. # Sums product of spins with shared edges and edge weights. # Iterates over a list of tuples of nodes with resepctive field weights. # Sums product of spins and weights.
an integer indicating energy of the system according to the Hamiltonian specifed in the Test Introduction.
an integer indicating energy of the system according to the Hamiltonian specifed in the Test Introduction .
mE
model
an instance of a Model object.
an instance of a Model object .
nodes
a dictionary of node objects.
a dictionary of node objects .
node_qty
an integer, quantity of nodes within model.
an integer quantity of nodes within model .
I
an integer, user input dictating number of updates to the model prior to determing final system energy.
an integer user input dictating number of updates to the model prior to determing final system energy .
T
a float, non zero temperature for the Boltzmann distribution probability formula.
a float non zero temperature for the Boltzmann distribution probability formula .