Moved files and reformatted some
This commit is contained in:
@ -21,13 +21,13 @@ calling :func:`~mdevaluate.utils.runningmean` as shown below.
|
||||
|
||||
from functools import partial
|
||||
import matplotlib.pyplot as plt
|
||||
import mdevaluate as md
|
||||
from src import mdevaluate as md
|
||||
import tudplot
|
||||
|
||||
OW = md.open('/data/niels/sim/water/bulk/260K', trajectory='out/*.xtc').subset(atom_name='OW')
|
||||
|
||||
t, Fqt = md.correlation.shifted_correlation(
|
||||
partial(md.correlation.isf, q=22.7),
|
||||
t, Fqt = src.mdevaluate.correlation.shifted_correlation(
|
||||
partial(src.mdevaluate.correlation.isf, q=22.7),
|
||||
OW,
|
||||
average=False,
|
||||
window=0.2,
|
||||
|
@ -8,23 +8,23 @@ Additionally a KWW function is fitted to the results.
|
||||
from functools import partial
|
||||
import matplotlib.pyplot as plt
|
||||
from scipy.optimize import curve_fit
|
||||
import mdevaluate as md
|
||||
from src import mdevaluate as md
|
||||
import tudplot
|
||||
|
||||
OW = md.open('/data/niels/sim/water/bulk/260K', trajectory='out/*.xtc').subset(atom_name='OW')
|
||||
t, S = md.correlation.shifted_correlation(
|
||||
partial(md.correlation.isf, q=22.7),
|
||||
t, S = src.mdevaluate.correlation.shifted_correlation(
|
||||
partial(src.mdevaluate.correlation.isf, q=22.7),
|
||||
OW,
|
||||
average=True
|
||||
)
|
||||
# Only include data-points of the alpha-relaxation for the fit
|
||||
mask = t > 3e-1
|
||||
fit, cov = curve_fit(md.functions.kww, t[mask], S[mask])
|
||||
tau = md.functions.kww_1e(*fit)
|
||||
fit, cov = curve_fit(src.mdevaluate.functions.kww, t[mask], S[mask])
|
||||
tau = src.mdevaluate.functions.kww_1e(*fit)
|
||||
|
||||
tudplot.activate()
|
||||
plt.figure()
|
||||
plt.plot(t, S, '.', label='ISF of Bulk Water')
|
||||
plt.plot(t, md.functions.kww(t, *fit), '-', label=r'KWW, $\tau$={:.2f}ps'.format(tau))
|
||||
plt.plot(t, src.mdevaluate.functions.kww(t, *fit), '-', label=r'KWW, $\tau$={:.2f}ps'.format(tau))
|
||||
plt.xscale('log')
|
||||
plt.legend()
|
||||
|
@ -8,7 +8,7 @@ In this case the bins describe the shortest distance of an oxygen atom to any wa
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import mdevaluate as md
|
||||
from src import mdevaluate as md
|
||||
import tudplot
|
||||
from scipy import spatial
|
||||
from scipy.optimize import curve_fit
|
||||
@ -73,7 +73,7 @@ wall_atoms = wall_atoms[dist < 0.35]
|
||||
SW = traj.subset(indices = wall_atoms)
|
||||
|
||||
from functools import partial
|
||||
func = partial(md.correlation.isf, q=22.7)
|
||||
func = partial(src.mdevaluate.correlation.isf, q=22.7)
|
||||
|
||||
#selector function to choose liquid oxygens with a certain distance to wall atoms
|
||||
def selector_func(coords, lindices, windices, dmin, dmax):
|
||||
@ -93,9 +93,9 @@ for i in range(len(bins)-1):
|
||||
selector = partial(selector_func,lindices=LO.atom_subset.indices[0],
|
||||
windices=SW.atom_subset.indices[0],dmin=bins[i],
|
||||
dmax = bins[i+1])
|
||||
t, S[i] = md.correlation.shifted_correlation(
|
||||
t, S[i] = src.mdevaluate.correlation.shifted_correlation(
|
||||
func, traj,segments=50, skip=0.1,average=True,
|
||||
correlation=md.correlation.subensemble_correlation(selector),
|
||||
correlation=src.mdevaluate.correlation.subensemble_correlation(selector),
|
||||
description=str(bins[i])+','+str(bins[i+1]))
|
||||
|
||||
taus = np.zeros(len(S))
|
||||
@ -105,10 +105,10 @@ for i,s in enumerate(S):
|
||||
pl = plt.plot(t, s, '.', label='d = ' + str(binpos[i]) + ' nm')
|
||||
#only includes the relevant data for 1/e fitting
|
||||
mask = s < 0.6
|
||||
fit, cov = curve_fit(md.functions.kww, t[mask], s[mask],
|
||||
fit, cov = curve_fit(src.mdevaluate.functions.kww, t[mask], s[mask],
|
||||
p0=[1.0,t[t>1/np.e][-1],0.5])
|
||||
taus[i] = md.functions.kww_1e(*fit)
|
||||
plt.plot(t, md.functions.kww(t, *fit), c=pl[0].get_color())
|
||||
taus[i] = src.mdevaluate.functions.kww_1e(*fit)
|
||||
plt.plot(t, src.mdevaluate.functions.kww(t, *fit), c=pl[0].get_color())
|
||||
plt.xscale('log')
|
||||
plt.legend()
|
||||
#plt.show()
|
||||
|
@ -6,7 +6,7 @@ This example reads an Gromacs energy file and plots the evolultion and mean of t
|
||||
"""
|
||||
|
||||
from matplotlib import pyplot as plt
|
||||
import mdevaluate as md
|
||||
from src import mdevaluate as md
|
||||
import tudplot
|
||||
|
||||
tudplot.activate()
|
||||
|
Reference in New Issue
Block a user