Пример #1
0
def test_tailcorr_fluidum_exprep():
    natom = 64
    system = get_system_fluidum_grid(natom, ffatypes=['A', 'B', 'C'])
    nlist = NeighborList(system)
    scalings = Scalings(system)
    # Initialize parameters
    amps = np.array([2.0, 3.0, 4.0])
    bs = np.array([4.5, 4.6, 4.7]) / angstrom
    # Allocate some arrays for the pair potential
    assert len(system.ffatypes) == 3
    amp_cross = np.zeros((3, 3), float)
    b_cross = np.zeros((3, 3), float)
    amp_mix, amp_mix_coeff, b_mix, b_mix_coeff = 0, 0, 1, 0
    for tr in [None, Switch3(3.0 * angstrom)]:
        check_tailcorr_convergence(system,
                                   PairPotExpRep,
                                   'exp',
                                   system.ffatype_ids,
                                   amp_cross,
                                   b_cross,
                                   tr=tr,
                                   amps=amps,
                                   amp_mix=amp_mix,
                                   amp_mix_coeff=amp_mix_coeff,
                                   bs=bs,
                                   b_mix=b_mix,
                                   b_mix_coeff=b_mix_coeff)
Пример #2
0
def get_system(nmol, rho0=420.0 * kilogram / meter**3):
    # Initial density
    masses = np.ones((nmol, )) * (periodic[6].mass + 4 * periodic[1].mass)
    # Initial volume
    V0 = np.sum(masses) / rho0
    # Estimate intermolecular distance based on the volume per molecule
    l0 = (V0 / nmol)**(1.0 / 3.0)
    # Setup the system
    system = get_system_fluidum_grid(nmol, ffatypes=['CH4'], l0=l0)
    system.masses = masses
    return system
Пример #3
0
def test_tailcorr_fluidum_grimme():
    natom = 64
    system = get_system_fluidum_grid(natom)
    nlist = NeighborList(system)
    scalings = Scalings(system)
    r0s = np.ones((natom,))*1.1*angstrom
    r0s += np.random.normal(0.0,0.01*angstrom,r0s.shape[0])
    c6s = np.ones((natom,))*0.2*1e-3*kjmol*nanometer**6
    c6s += np.random.normal(0.0,0.01*angstrom,c6s.shape[0])
    for tr in [None,Switch3(3.0*angstrom)]:
        check_tailcorr_convergence(system, PairPotGrimme, 'r6', r0s, c6s, tr=tr)
Пример #4
0
def test_tailcorr_fluidum_lj():
    natom = 64
    system = get_system_fluidum_grid(natom)
    nlist = NeighborList(system)
    scalings = Scalings(system)
    sigmas = np.ones((natom,))*2.1*angstrom
    sigmas += np.random.normal(0.0,0.01*angstrom,sigmas.shape[0])
    epsilons = np.ones((natom,))*0.15*kcalmol
    epsilons += np.random.normal(0.0,0.001*kcalmol,epsilons.shape[0])
    for tr in [None,Switch3(3.0*angstrom)]:
        check_tailcorr_convergence(system, PairPotLJ, 'r6', sigmas, epsilons, tr=tr)
Пример #5
0
def test_tailcorr_fluidum_mm3():
    natom = 64
    system = get_system_fluidum_grid(natom)
    nlist = NeighborList(system)
    scalings = Scalings(system)
    sigmas = np.ones((natom,))*1.1*angstrom
    sigmas += np.random.normal(0.0,0.01*angstrom,sigmas.shape[0])
    epsilons = np.ones((natom,))*0.15*kcalmol
    epsilons += np.random.normal(0.0,0.001*kcalmol,epsilons.shape[0])
    for onlypauli,decay in zip([0,1],['r6','exp']):
        onlypaulis = np.ones((natom,),dtype=np.int32)*onlypauli
        for tr in [None,Switch3(3.0*angstrom)]:
            check_tailcorr_convergence(system, PairPotMM3, decay, sigmas, epsilons, onlypaulis, tr=tr)
Пример #6
0
def test_tailcorr_fluidum_grimme():
    natom = 64
    system = get_system_fluidum_grid(natom)
    nlist = NeighborList(system)
    scalings = Scalings(system)
    r0s = np.ones((natom, )) * 1.1 * angstrom
    r0s += np.random.normal(0.0, 0.01 * angstrom, r0s.shape[0])
    c6s = np.ones((natom, )) * 0.2 * 1e-3 * kjmol * nanometer**6
    c6s += np.random.normal(0.0, 0.01 * angstrom, c6s.shape[0])
    for tr in [None, Switch3(3.0 * angstrom)]:
        check_tailcorr_convergence(system,
                                   PairPotGrimme,
                                   'r6',
                                   r0s,
                                   c6s,
                                   tr=tr)
Пример #7
0
def test_tailcorr_fluidum_lj():
    natom = 64
    system = get_system_fluidum_grid(natom)
    nlist = NeighborList(system)
    scalings = Scalings(system)
    sigmas = np.ones((natom, )) * 2.1 * angstrom
    sigmas += np.random.normal(0.0, 0.01 * angstrom, sigmas.shape[0])
    epsilons = np.ones((natom, )) * 0.15 * kcalmol
    epsilons += np.random.normal(0.0, 0.001 * kcalmol, epsilons.shape[0])
    for tr in [None, Switch3(3.0 * angstrom)]:
        check_tailcorr_convergence(system,
                                   PairPotLJ,
                                   'r6',
                                   sigmas,
                                   epsilons,
                                   tr=tr)
Пример #8
0
def test_tailcorr_fluidum_ljcross():
    system = get_system_fluidum_grid(64, ffatypes=['A','B','C','D'])
    nlist = NeighborList(system)
    scalings = Scalings(system)
    assert system.nffatype == 4
    eps_cross = np.array([[1.0,3.5,4.6,9.4],
                          [3.5,2.0,4.4,4.1],
                          [4.6,4.4,5.0,3.3],
                          [9.4,4.1,3.3,0.1]])*kcalmol
    sig_cross = np.array([[0.2,0.5,1.6,1.4],
                          [0.5,1.0,2.4,1.1],
                          [1.6,2.4,1.0,2.3],
                          [1.4,1.1,2.3,0.9]])
    assert np.all( np.abs( sig_cross - np.transpose(sig_cross) ) < 1e-15 )
    assert np.all( np.abs( eps_cross - np.transpose(eps_cross) ) < 1e-15 )
    for tr in [None,Switch3(3.0*angstrom)]:
        check_tailcorr_convergence(system, PairPotLJCross, 'r6',
            system.ffatype_ids, eps_cross, sig_cross, tr=tr)
Пример #9
0
def test_tailcorr_fluidum_exprep():
    natom = 64
    system = get_system_fluidum_grid(natom, ffatypes=['A','B','C'])
    nlist = NeighborList(system)
    scalings = Scalings(system)
    # Initialize parameters
    amps = np.array([2.0,3.0,4.0])
    bs = np.array([4.5,4.6,4.7])/angstrom
    # Allocate some arrays for the pair potential
    assert len(system.ffatypes) == 3
    amp_cross = np.zeros((3, 3), float)
    b_cross = np.zeros((3, 3), float)
    amp_mix, amp_mix_coeff, b_mix, b_mix_coeff = 0,0,1,0
    for tr in [None,Switch3(3.0*angstrom)]:
        check_tailcorr_convergence(system, PairPotExpRep, 'exp',
            system.ffatype_ids, amp_cross, b_cross, tr=tr,
            amps=amps, amp_mix=amp_mix, amp_mix_coeff=amp_mix_coeff,
            bs=bs, b_mix=b_mix, b_mix_coeff=b_mix_coeff)
Пример #10
0
def test_tailcorr_fluidum_mm3():
    natom = 64
    system = get_system_fluidum_grid(natom)
    nlist = NeighborList(system)
    scalings = Scalings(system)
    sigmas = np.ones((natom, )) * 1.1 * angstrom
    sigmas += np.random.normal(0.0, 0.01 * angstrom, sigmas.shape[0])
    epsilons = np.ones((natom, )) * 0.15 * kcalmol
    epsilons += np.random.normal(0.0, 0.001 * kcalmol, epsilons.shape[0])
    for onlypauli, decay in zip([0, 1], ['r6', 'exp']):
        onlypaulis = np.ones((natom, ), dtype=np.int32) * onlypauli
        for tr in [None, Switch3(3.0 * angstrom)]:
            check_tailcorr_convergence(system,
                                       PairPotMM3,
                                       decay,
                                       sigmas,
                                       epsilons,
                                       onlypaulis,
                                       tr=tr)
Пример #11
0
def test_tailcorr_fluidum_ljcross():
    system = get_system_fluidum_grid(64, ffatypes=['A', 'B', 'C', 'D'])
    nlist = NeighborList(system)
    scalings = Scalings(system)
    assert system.nffatype == 4
    eps_cross = np.array([[1.0, 3.5, 4.6, 9.4], [3.5, 2.0, 4.4, 4.1],
                          [4.6, 4.4, 5.0, 3.3], [9.4, 4.1, 3.3, 0.1]
                          ]) * kcalmol
    sig_cross = np.array([[0.2, 0.5, 1.6, 1.4], [0.5, 1.0, 2.4, 1.1],
                          [1.6, 2.4, 1.0, 2.3], [1.4, 1.1, 2.3, 0.9]])
    assert np.all(np.abs(sig_cross - np.transpose(sig_cross)) < 1e-15)
    assert np.all(np.abs(eps_cross - np.transpose(eps_cross)) < 1e-15)
    for tr in [None, Switch3(3.0 * angstrom)]:
        check_tailcorr_convergence(system,
                                   PairPotLJCross,
                                   'r6',
                                   system.ffatype_ids,
                                   eps_cross,
                                   sig_cross,
                                   tr=tr)