Esempio n. 1
0
p.new(xlabel=r'time [ps]',
      ylabel=r'number of hydrogen bonds',
      name='hbnum',
      loc=3)
n = 0
for medium, values in sorted(datadict['hbnum'].iteritems()):
    t = values[1]
    num = values[2]

    i = t > 30
    m = [np.mean(num[i]), np.mean(num[i])]
    x = [t[i][0], t[i][-1]]

    print medium + ": %f" % m[0]

    p.plot(t, num, c[n] + '-', alpha=0.2, label=medium + ', mean: %f' % m[0])
    p.plot(x, m, c[n] + '-', lw=2)
    n += 1

# msd
p.new(xlabel=r'time [ps]',
      ylabel=r'mean square displacement [nm$^2$]',
      name='msd',
      xscale='log',
      yscale='log')
n = 0
for medium, values in sorted(datadict['msd'].iteritems()):
    p.plot(values[1], values[2], c[n] + '-', label=medium)
    n += 1

# diffusion
Esempio n. 2
0
    E_s.append([array_t, array_E, r'$\omega = %.2f$'%w])

w_s = np.arange(0.001,2,0.1)
amp_s = []

for w in w_s:
    F = lambda t: Fmax*np.sin(w*t)
    amp = getAmplitude(x,v,a,t)
    amp_s.append(amp)

# === Plotting ===
p = Plotter(show = True, pgf = False, pdf = False, loc=1)

# --- Auslenkung ---
p.new(title='Auslenkung',xlabel='t',ylabel='x')
for v,w,name in x_s: p.plot(v,w,label=name)

# --- Auslenkung ---
p.new(title='Plots für ausgeschaltete Anregung',xlabel='t')
v,w,name = x_s[0]
p.plot(v,w,label='Auslenkung x')
v,w,name = v_s[0]
p.plot(v,w,label='Geschwindigkeit v')
v,w,name = a_s[0]
p.plot(v,w,label='Beschleunigung a')

# --- Energie ---
p.new(title='Gesamte Energie', yscale='log',xlabel='t',ylabel='E')
for v,w,name in E_s: p.plot(v,w,label=name)

# --- Amplitude ---
Esempio n. 3
0
        datadict[type][0] = np.append(datadict[type][0], volume)
        datadict[type][1] = np.append(datadict[type][1], energy)
        datadict[type][2] = np.append(datadict[type][2], lattice)

        print "%s, run %2s) lattice constant = %f, cell volume = %f, total energy = %f \n" % (
            type, runnumber, lattice, volume, energy)

    with open('data.pkl', 'wb') as f:
        pickle.dump(datadict, f)

else:
    with open('data.pkl', 'rb') as f:
        datadict = pickle.load(f)

# ==== PLOT ====
for type, [volume, energy, lattice] in datadict.items():
    sort = np.argsort(volume)
    lattice = np.array(lattice)[sort]
    volume = np.array(volume)[sort]
    energy = np.array(energy)[sort]
    p.new(xlabel=r'cell volume [Ang$^3$]',
          ylabel=r'total energy [eV]',
          name=type + "_energy")
    p.plot(volume, energy, '-', label=type)
    p.new(xlabel=r'cell volume [Ang$^3$]',
          ylabel=r'lattice constant [Ang]',
          name=type + "_lattice")
    p.plot(volume, lattice, 'x', label=type)

p.make(ncols=2)
Esempio n. 4
0
            energy = float(e)
            lattice = float(l)
        except:
            continue

        datadict[type][0] = np.append(datadict[type][0], volume)
        datadict[type][1] = np.append(datadict[type][1], energy)
        datadict[type][2] = np.append(datadict[type][2], lattice)

        print "%s, run %2s) lattice constant = %f, cell volume = %f, total energy = %f \n"%(type,
            runnumber,lattice,volume,energy)

    with open('data.pkl', 'wb') as f:
        pickle.dump(datadict, f)

else:
    with open('data.pkl', 'rb') as f:
        datadict = pickle.load(f)

# ==== PLOT ====
for type, [volume,energy,lattice] in datadict.items():
    sort = np.argsort(volume)
    lattice = np.array(lattice)[sort]
    volume = np.array(volume)[sort]
    energy = np.array(energy)[sort]
    p.new(xlabel=r'cell volume [Ang$^3$]', ylabel=r'total energy [eV]',name=type+"_energy")
    p.plot(volume, energy, '-', label=type)
    p.new(xlabel=r'cell volume [Ang$^3$]',ylabel=r'lattice constant [Ang]',name=type+"_lattice")
    p.plot(volume, lattice, 'x', label=type)

p.make(ncols = 2)
Esempio n. 5
0
w_s = np.arange(0.001, 2, 0.1)
amp_s = []

for w in w_s:
    F = lambda t: Fmax * np.sin(w * t)
    amp = getAmplitude(x, v, a, t)
    amp_s.append(amp)

# === Plotting ===
p = Plotter(show=True, pgf=False, pdf=False, loc=1)

# --- Auslenkung ---
p.new(title='Auslenkung', xlabel='t', ylabel='x')
for v, w, name in x_s:
    p.plot(v, w, label=name)

# --- Auslenkung ---
p.new(title='Plots für ausgeschaltete Anregung', xlabel='t')
v, w, name = x_s[0]
p.plot(v, w, label='Auslenkung x')
v, w, name = v_s[0]
p.plot(v, w, label='Geschwindigkeit v')
v, w, name = a_s[0]
p.plot(v, w, label='Beschleunigung a')

# --- Energie ---
p.new(title='Gesamte Energie', yscale='log', xlabel='t', ylabel='E')
for v, w, name in E_s:
    p.plot(v, w, label=name)
Esempio n. 6
0
# hbnum
print "=== hbnum ==="
p.new(xlabel=r'time [ps]', ylabel=r'number of hydrogen bonds',name='hbnum', loc = 3)
n = 0
for medium, values in sorted(datadict['hbnum'].iteritems()):
    t = values[1]
    num = values[2]

    i = t > 30
    m = [np.mean(num[i]), np.mean(num[i])]
    x = [t[i][0],t[i][-1]]

    print medium+": %f"%m[0]

    p.plot(t, num, c[n]+'-', alpha=0.2, label=medium+', mean: %f'%m[0])
    p.plot(x, m, c[n]+'-',lw=2)
    n+=1

# msd
p.new(xlabel=r'time [ps]', ylabel=r'mean square displacement [nm$^2$]',name='msd', xscale='log',yscale='log')
n = 0
for medium, values in sorted(datadict['msd'].iteritems()):
    p.plot(values[1], values[2], c[n]+'-', label=medium)
    n += 1

# diffusion
print "=== diffusion ==="
p.new(xlabel=r'time [ps]', ylabel=r'diffusion coefficient [10$^{-5}$ cm$^2$/s]',name='diffusion')
n = 0
for medium, values in sorted(datadict['msd'].iteritems()):