def DM_Sum(DMvec, qlist):
    """Helper function to matrix dot product the DM matrix with a qvector
    Assumes that DMVec is the same length as qlist
    """
    sum = 0
    for j in range(len(DMvec)):
        sum += DMvec[j]*qlist[j]
    return sum