Пример #1
0
CV = {} # heat capacity
S = {} # entropy

# we want to keep our methods distinct from our golden
if golden in methods:
    methods.remove(golden)

fig_size = (6,4.5)
plt.figure('u',figsize=fig_size)
plt.figure('hc',figsize=fig_size)
plt.figure('s',figsize=fig_size)
plt.figure('u_err',figsize=fig_size)
plt.figure('hc_err',figsize=fig_size)
plt.figure('s_err',figsize=fig_size)

array_len = len(readandcompute.u_cv_s(ww, ff, N, methods[0], seeds[0])[0])

for method in [golden]+methods:

    U[method] = numpy.zeros(array_len)
    CV[method] = numpy.zeros(array_len)
    S[method] = numpy.zeros(array_len)
    for seed in seeds:
        u_cv_s = readandcompute.u_cv_s(ww, ff, N, method, seed)
        U[method] += u_cv_s[0] # internal energy
        CV[method] += u_cv_s[1] # heat capacity
        S[method] += u_cv_s[2] # entropy
    U[method] /= len(seeds)
    CV[method] /= len(seeds)
    S[method] /= len(seeds)
Пример #2
0
    tex.write(string.join([" & %d " % samples[m][i] for m in methods]))
    tex.write("\\\\\n")

tex.write(r"""\end{tabular}
""")

######################################################################
# error scaling figures
######################################################################

u_errors = {}
cv_errors = {}
s_errors = {}

for N in all_Ns:
    u_cv_s = readandcompute.u_cv_s(ww, ff, N, golden)
    if u_cv_s != None:
        for method in methods:
            u_cv_s_method = readandcompute.u_cv_s(ww, ff, N, method, seed)
            if u_cv_s_method != None:
                du = abs(u_cv_s_method[0]-u_cv_s[0]).max()
                if method not in u_errors:
                    u_errors[method] = numpy.array([[N, du]])
                else:
                    u_errors[method] = numpy.vstack([u_errors[method], [N, du]])
                dcv = abs(u_cv_s_method[1]-u_cv_s[1]).max()
                if method not in cv_errors:
                    cv_errors[method] = numpy.array([[N, dcv]])
                else:
                    cv_errors[method] = numpy.vstack([u_errors[method], [N, dcv]])
                ds = abs(u_cv_s_method[2]-u_cv_s[2]).max()
Пример #3
0
    tex.write(string.join([" & %d " % samples[m][i] for m in methods]))
    tex.write("\\\\\n")

tex.write(r"""\end{tabular}
""")

######################################################################
# error scaling figures
######################################################################

u_errors = {}
cv_errors = {}
s_errors = {}

for N in all_Ns:
    u_cv_s = readandcompute.u_cv_s(ww, ff, N, golden)
    if u_cv_s != None:
        for method in methods:
            u_cv_s_method = readandcompute.u_cv_s(ww, ff, N, method, seed)
            if u_cv_s_method != None:
                du = abs(u_cv_s_method[0] - u_cv_s[0]).max()
                if method not in u_errors:
                    u_errors[method] = numpy.array([[N, du]])
                else:
                    u_errors[method] = numpy.vstack(
                        [u_errors[method], [N, du]])
                dcv = abs(u_cv_s_method[1] - u_cv_s[1]).max()
                if method not in cv_errors:
                    cv_errors[method] = numpy.array([[N, dcv]])
                else:
                    cv_errors[method] = numpy.vstack(
Пример #4
0
# input: ["data/periodic-ww%04.2f-ff%04.2f-N%i-tmmc-golden-%s.dat" % (ww, ff, N, data) for data in ["E","lnw"]]

max_T = 1.4
T_bins = 1e3
dT = max_T / T_bins
T_range = numpy.arange(dT, max_T, dT)
min_T = 0  # we will adjust this

# make dictionaries which we can index by method name
U = {}  # internal energy
CV = {}  # heat capacity
S = {}  # entropy

for method in set(methods + [golden]):

    u_cv_s = readandcompute.u_cv_s(ww, ff, N, method)
    if u_cv_s != None:
        U[method] = u_cv_s[0]  # internal energy
        CV[method] = u_cv_s[1]  # heat capacity
        S[method] = u_cv_s[2]  # entropy

    plt.figure('u')
    plt.plot(T_range,
             U[method] / N,
             styles.plot(method),
             label=styles.title(method))

    plt.figure('hc')
    plt.plot(T_range,
             CV[method] / N,
             styles.plot(method),
Пример #5
0
CV = {}  # heat capacity
S = {}  # entropy

# we want to keep our methods distinct from our golden
if golden in methods:
    methods.remove(golden)

fig_size = (6, 4.5)
plt.figure('u', figsize=fig_size)
plt.figure('hc', figsize=fig_size)
plt.figure('s', figsize=fig_size)
plt.figure('u_err', figsize=fig_size)
plt.figure('hc_err', figsize=fig_size)
plt.figure('s_err', figsize=fig_size)

array_len = len(readandcompute.u_cv_s(ww, ff, N, methods[0], seeds[0])[0])

for method in [golden] + methods:

    U[method] = numpy.zeros(array_len)
    CV[method] = numpy.zeros(array_len)
    S[method] = numpy.zeros(array_len)
    for seed in seeds:
        u_cv_s = readandcompute.u_cv_s(ww, ff, N, method, seed)
        U[method] += u_cv_s[0]  # internal energy
        CV[method] += u_cv_s[1]  # heat capacity
        S[method] += u_cv_s[2]  # entropy
    U[method] /= len(seeds)
    CV[method] /= len(seeds)
    S[method] /= len(seeds)
Пример #6
0
# input: ["data/periodic-ww%04.2f-ff%04.2f-N%i-tmmc-golden-%s.dat" % (ww, ff, N, data) for data in ["E","lnw"]]

max_T = 1.4
T_bins = 1e3
dT = max_T/T_bins
T_range = numpy.arange(dT,max_T,dT)
min_T = 0 # we will adjust this

# make dictionaries which we can index by method name
U = {} # internal energy
CV = {} # heat capacity
S = {} # entropy

for method in set(methods+[golden]):

    u_cv_s = readandcompute.u_cv_s(ww, ff, N, method)
    if u_cv_s != None:
        U[method] = u_cv_s[0] # internal energy
        CV[method] = u_cv_s[1] # heat capacity
        S[method] = u_cv_s[2] # entropy

    plt.figure('u')
    plt.plot(T_range,U[method]/N,styles.plot(method),label=styles.title(method))

    plt.figure('hc')
    plt.plot(T_range,CV[method]/N,styles.plot(method),label=styles.title(method))

    plt.figure('s')
    plt.plot(T_range,S[method]/N,styles.plot(method),label=styles.title(method))

for method in methods: