コード例 #1
0
ファイル: rmsd_vs_texec.py プロジェクト: chemreac/chemreac
def integrate(**kwargs):
    times_cpu, times_wal = [], []
    nrepeat = 21
    ndrop = 7
    for i in range(nrepeat):
        tout, yout, info, rmsd_over_atol, sys, rmsd = integrate_rd(**kwargs)
        times_cpu.append(info['time_cpu'])
        times_wal.append(info['time_wall'])
    for _ in range(ndrop):
        times_cpu.pop(times_cpu.index(max(times_cpu)))
        times_wal.pop(times_wal.index(max(times_wal)))
    times_cpu = np.array(times_cpu)
    times_wal = np.array(times_wal)
    info['time_cpu'] = avg_cpu = np.average(times_cpu)
    info['time_wall'] = avg_wal = np.average(times_wal)
    info['dtime_cpu'] = np.sqrt(
        np.sum((times_cpu - avg_cpu)**2 / (len(times_cpu) - 1)))
    info['dtime_wall'] = np.sqrt(
        np.sum((times_wal - avg_wal)**2 / (len(times_wal) - 1)))
    info['tout'] = tout
    # info['yout'] = yout
    info['rmsd'] = rmsd
    info['rmsd_over_atol'] = np.sqrt(np.sum(rmsd_over_atol**2))
    for k in default_varied:
        info[k] = kwargs[k]
    return info
コード例 #2
0
def _test_gaussian_diffusion(params, **kwargs):
    g, ly, lt, r, nspecies, nstencil = params
    tout, yout, info, ave_rmsd_over_atol, rd, rmsd = integrate_rd(
        geom=g, logt=lt, logy=ly, N=128, random=r, nspecies=nspecies,
        nstencil=nstencil, atol=1e-6, rtol=1e-6)
    assert info['success']
    for rmsd in ave_rmsd_over_atol:
        if r:
            forgiveness = 5 if nstencil < 7 else 50
            # Randomized grid has lower convergence order.
            for i in range(6):
                if np.all(rmsd > tol[nstencil]*forgiveness):
                    rmsd = integrate_rd(
                        geom=g, logt=lt, logy=ly, N=128, random=r,
                        nspecies=nspecies, nstencil=nstencil, atol=1e-6,
                        rtol=1e-6)[3]
                else:
                    break
            assert np.all(rmsd < tol[nstencil]*forgiveness)
        else:
            assert np.all(rmsd < tol[nstencil])
コード例 #3
0
def integrate(**kwargs):
    tout, yout, info, rmsd_over_atol, rd, rmsd = integrate_rd(**kwargs)
    info['rmsd'] = rmsd
    info['rmsd_over_atol'] = rmsd_over_atol
    return info