Пример #1
0
            f.seek(lastPosition)
            table = np.genfromtxt(f,
                                  dtype=float,
                                  unpack=True,
                                  invalid_raise=False)

            datadict[task][item].append(title)
            for col in table:
                datadict[task][item].append(col)

# === Plotting ===

p = Plotter(show=True,
            pgf=True,
            pdf=True,
            latex=False,
            sfile=(8, 3),
            directory='./report/plots/',
            loc=2)
f = Fitter()

# 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]
Пример #2
0
    amp = getAmplitude(x,v,a,t)
    x_s.append([array_t, array_x, r'$\omega = %.2f$'%w])
    v_s.append([array_t, array_v, r'$\omega = %.2f$'%w])
    a_s.append([array_t, array_a, r'$\omega = %.2f$'%w])
    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 ---
Пример #3
0
    'LDA': [np.array([]), np.array([]),
            np.array([])],
    'GGA': [np.array([]), np.array([]),
            np.array([])]
}
patternE = re.compile(r"(?P<txt>Total =.*?)(?P<energy>[-+]?[0-9]*\.?[0-9]+)")
patternV = re.compile(
    r"(?P<txt>Cell volume =.*?)(?P<volume>[-+]?[0-9]*\.?[0-9]+)")
patternM = re.compile(r"(?P<txt>Begin CG move =.*?)(?P<move>[0-9]+)")
patternL = re.compile(
    r"(?P<txt>LatticeConstant.*?)(?P<lattice>[-+]?[0-9]*\.?[0-9]+)")

p = Plotter(show=True,
            pgf=True,
            pdf=False,
            latex=False,
            sfile=(8, 3.5),
            directory='../report/plots/',
            loc=4)

# ==== SETUP ====
if GenerateNewConf:
    for item in os.listdir('./'):
        if not item in ['LDA', 'GGA']:
            continue

        for l in latticeConstants[item]:
            path = './' + item + '/%.3s' % (l * 100)
            if not os.path.isdir(path):
                shutil.copytree('./' + item + '/raw', path)
                fdf = glob.glob(path + '/*.fdf')[0]
Пример #4
0
GenerateNewConf = True
GenerateNewData = True
RunCalculations = True

latticeConstants =  {'LDA': [4.95,5.05,5.15,5.25,5.0,5.1,5.2,5.3,5.4,5.43,5.5,5.6,5.7,5.8,5.9],
    'GGA': [5.35,5.25,5.0,5.1,5.2,5.3,5.4,5.43,5.5,5.6,5.7,5.8,5.9]}


datadict = {'LDA': [np.array([]),np.array([]),np.array([])],
    'GGA' : [np.array([]),np.array([]),np.array([])]}
patternE = re.compile(r"(?P<txt>Total =.*?)(?P<energy>[-+]?[0-9]*\.?[0-9]+)")
patternV = re.compile(r"(?P<txt>Cell volume =.*?)(?P<volume>[-+]?[0-9]*\.?[0-9]+)")
patternM = re.compile(r"(?P<txt>Begin CG move =.*?)(?P<move>[0-9]+)")
patternL = re.compile(r"(?P<txt>LatticeConstant.*?)(?P<lattice>[-+]?[0-9]*\.?[0-9]+)")

p = Plotter(show = True, pgf = True, pdf = False, latex=False, sfile=(8,3.5), directory='../report/plots/', loc = 4)

# ==== SETUP ====
if GenerateNewConf:
    for item in os.listdir('./'):
        if not item in ['LDA','GGA']:
            continue

        for l in latticeConstants[item]:
            path = './'+item+'/%.3s'%(l*100)
            if not os.path.isdir(path):
                shutil.copytree('./'+item+'/raw',path)
                fdf = glob.glob(path+'/*.fdf')[0]
                for line in fileinput.FileInput(fdf,inplace=1):
                    line = re.sub(patternL,r'\g<txt>%.2f'%l,line,count=1)
                    print line,
Пример #5
0
    amp = getAmplitude(x, v, a, t)
    x_s.append([array_t, array_x, r'$\omega = %.2f$' % w])
    v_s.append([array_t, array_v, r'$\omega = %.2f$' % w])
    a_s.append([array_t, array_a, r'$\omega = %.2f$' % w])
    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')
Пример #6
0
                if not matchComment:
                    lastPosition = f.tell()-len(line)
                    break

                line = f.readline()

            f.seek(lastPosition)
            table = np.genfromtxt(f, dtype=float, unpack=True, invalid_raise = False)

            datadict[task][item].append(title)
            for col in table:
                datadict[task][item].append(col)

# === Plotting ===

p = Plotter(show = True, pgf = True, pdf = True, latex=False, sfile=(8,3), directory='./report/plots/', loc = 2)
f = Fitter()

# 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]