z = min([ abs(a1['z'] - clay_zlo), abs(a1['z'] - clay_zhi), abs(a1['z'] + lz - clay_zlo), abs(a1['z'] + lz - clay_zhi), abs(a1['z'] - lz - clay_zlo), abs(a1['z'] - lz - clay_zhi) ]) z = round(z * multip, 0) try: profile[z][0] += dr profile[z][1] += 1 except KeyError: profile[z] = [dr, 1] if system_name == 'L': f = open('logs/atomic_mobility_L', 'w') for k in sorted(profile.keys()): print(k, profile[k][0] / profile[k][1], file=f) xs = sorted(profile.keys()) ys = [profile[x][0] / profile[x][1] for x in xs] xs = [x / multip for x in xs] plot_data(xs, ys=ys, out_fname='atomic_mobility_L.pdf') elif system_name == 'pa6x20': vals = profile.values() ave_dr = sum(v[0] for v in vals) / sum(v[1] for v in vals) print(ave_dr) else: raise NotImplementedError
] clay_idcs = set() for idx in range(9): clay_idcs.update(set(range(1 + idx * 5380, 721 + idx * 5380))) kwargs = {'clay_idcs': clay_idcs, 'multip': multip} plot_kwargs = { 'out_fname': 'atoms_mob_L.eps', } profile_agg = {} f = open('logs/atomic_mobility_L', 'w') dfc_last = DatafileContent(fnames[0]) dfc_next = DatafileContent(fnames[-1]) profile = atomic_mobility_profile(dfc_last, dfc_next, **kwargs) xs = sorted(profile.keys()) ys = [profile[x][0] / profile[x][1] for x in xs] plot_data(xs, ys=ys, **plot_kwargs) elif system_name == 'S': # Too small data raise NotImplementedError() elif system_name == 'mix': raise NotImplementedError() elif system_name == 'seg': raise NotImplementedError() elif system_name == 'pa6x20': from utils.monomers_cms import monomers_cms from plotters.plot_data import plot_data data_dir = ('/media/anton/Seagate Expansion Drive/' 'md_new_data/pa6x20/3507904_500K_pz100/datafiles') fnames = [ '{0}/pa6x20.{1}.data'.format(data_dir, idx * 50000) for idx in range(1, 51) ]
density_agg[k]['modifier'] = v['modifier'] density_agg[k]['polymer'] = v['polymer'] except KeyError: density_agg[k] = { 'clay': v['clay'], 'modifier': v['modifier'], 'polymer': v['polymer'] } plot_kwargs['legends'] = [ 'MMT', 'Модификатор', 'Полимер', 'Все компоненты' ] plot_kwargs['y_limits'] = [0, 6] plot_kwargs['legend_location'] = 'upper right' xs = sorted(density_agg.keys()) ys_clay = [density_agg[x]['clay'] / len(fnames) for x in xs] ys_modifier = [density_agg[x]['modifier'] / len(fnames) for x in xs] ys_polymer = [density_agg[x]['polymer'] / len(fnames) for x in xs] ys_all = [(density_agg[x]['clay'] + density_agg[x]['modifier'] + density_agg[x]['polymer']) / len(fnames) for x in xs] xs = [x / multip - plot_kwargs['x_limits'][0] for x in xs] plot_kwargs['x_limits'] = [ 0, plot_kwargs['x_limits'][1] - plot_kwargs['x_limits'][0] ] plot_data(xs, yss=[ys_clay, ys_modifier, ys_polymer, ys_all], **plot_kwargs)
for k in current.keys(): dx = abs(current[k]['x_cm'] - starting[k]['x_cm']) dy = abs(current[k]['y_cm'] - starting[k]['y_cm']) dz = abs(current[k]['z_cm'] - starting[k]['z_cm']) dx = min(dx, lx - dx) dy = min(dy, ly - dy) dz = min(dz, lz - dz) delta += (dx**2 + dy**2 + dz**2)**0.5 delta /= len(current) xs.append(time) ys.append(delta) print(idx + 1, '/', delta, len(current)) print(time, delta, file=f) log_xs = [math.log(x) for x in xs[1:]] log_ys = [math.log(y) for y in ys[1:]] plot_data(xs, ys=ys, **plot_kwargs) plot_data(log_xs, ys=log_ys, **plot_log_kwargs) elif system_name == 'S': # Too small data raise NotImplementedError() elif system_name == 'mix': raise NotImplementedError() elif system_name == 'seg': raise NotImplementedError() elif system_name == 'pa6x20': from utils.monomers_cms import monomers_cms from plotters.plot_data import plot_data from utils.gyration_polymer import gyration_polymer data_dir = ('/media/anton/Seagate Expansion Drive/' 'md_new_data/pa6x20/3507904_500K/datafiles') fnames = [ '{0}/pa6x20.{1}.data'.format(data_dir, idx * 50000)