Ejemplo n.º 1
0
def check_water_hf_sto3g(scheme, expecting, needs_padb=True, **kwargs):
    if needs_padb:
        proatomdb = get_proatomdb_hf_sto3g()
        kwargs['proatomdb'] = proatomdb

    # Get the IOData
    fn_fchk = context.get_fn('test/water_sto3g_hf_g03.fchk')
    mol = IOData.from_file(fn_fchk)
    dm_full = mol.get_dm_full()

    # Create a grid for the partitioning
    rtf = ExpRTransform(5e-4, 2e1, 120)
    rgrid = RadialGrid(rtf)

    # Do the partitioning
    mode = 'only' if kwargs.get('local', True) else 'discard'
    grid = BeckeMolGrid(mol.coordinates,
                        mol.numbers,
                        mol.pseudo_numbers, (rgrid, 110),
                        random_rotate=False,
                        mode=mode)
    moldens = mol.obasis.compute_grid_density_dm(dm_full, grid.points)
    WPartClass = wpart_schemes[scheme]
    wpart = WPartClass(mol.coordinates, mol.numbers, mol.pseudo_numbers, grid,
                       moldens, **kwargs)
    names = wpart.do_all()
    check_names(names, wpart)
    assert abs(wpart['charges'] - expecting).max() < 2e-3
    assert abs(wpart['charges'] -
               wpart['cartesian_multipoles'][:, 0]).max() < 1e-3
    assert abs(wpart['charges'] - wpart['pure_multipoles'][:, 0]).max() < 1e-3

    check_proatom_splines(wpart)
    return wpart
Ejemplo n.º 2
0
def write_atomdb_sto3g(dn, do_deriv=True):
    padb = get_proatomdb_hf_sto3g()
    if not do_deriv:
        # remove the derivatives of the pro-atoms (ugly hack to test backward compatibility).
        for record in padb._records:
            record._deriv = None
    padb.to_file(os.path.join(dn, 'atoms.h5'))
Ejemplo n.º 3
0
def check_water_hf_sto3g(scheme, expecting, needs_padb=True, **kwargs):
    if needs_padb:
        proatomdb = get_proatomdb_hf_sto3g()
        kwargs['proatomdb'] = proatomdb

    # Get the IOData
    fn_fchk = context.get_fn('test/water_sto3g_hf_g03.fchk')
    mol = IOData.from_file(fn_fchk)
    dm_full = mol.get_dm_full()

    # Create a grid for the partitioning
    rtf = ExpRTransform(5e-4, 2e1, 120)
    rgrid = RadialGrid(rtf)

    # Do the partitioning
    mode = 'only' if kwargs.get('local', True) else 'discard'
    grid = BeckeMolGrid(mol.coordinates, mol.numbers, mol.pseudo_numbers, (rgrid, 110), random_rotate=False, mode=mode)
    moldens = mol.obasis.compute_grid_density_dm(dm_full, grid.points)
    WPartClass = wpart_schemes[scheme]
    wpart = WPartClass(mol.coordinates, mol.numbers, mol.pseudo_numbers, grid, moldens,  **kwargs)
    names = wpart.do_all()
    check_names(names, wpart)
    assert abs(wpart['charges'] - expecting).max() < 2e-3
    assert abs(wpart['charges'] - wpart['cartesian_multipoles'][:,0]).max() < 1e-3
    assert abs(wpart['charges'] - wpart['pure_multipoles'][:,0]).max() < 1e-3

    if kwargs.get('greedy', False):
        check_proatom_splines(wpart)

    return wpart
Ejemplo n.º 4
0
def write_atomdb_sto3g(dn, do_deriv=True):
    padb = get_proatomdb_hf_sto3g()
    if not do_deriv:
        # remove the derivatives of the pro-atoms (ugly hack to test backward compatibility).
        for record in padb._records:
            record._deriv = None
    padb.to_file(os.path.join(dn, 'atoms.h5'))
Ejemplo n.º 5
0
def check_water_hf_sto3g(scheme, expecting, needs_padb=True, **kwargs):
    if needs_padb:
        proatomdb = get_proatomdb_hf_sto3g()
        kwargs['proatomdb'] = proatomdb

    # Get the molecule
    fn_fchk = context.get_fn('test/water_sto3g_hf_g03.fchk')
    sys = System.from_file(fn_fchk)
    sys.wfn.update_dm('alpha')

    # Create a grid for the partitioning
    rtf = ExpRTransform(5e-4, 2e1, 120)
    rgrid = RadialGrid(rtf)

    # Do the partitioning
    mode = 'only' if kwargs.get('local', True) else 'discard'
    grid = BeckeMolGrid(sys, (rgrid, 110), random_rotate=False, mode=mode)
    WPartClass = wpart_schemes[scheme]
    wpart = WPartClass(sys, grid,  **kwargs)
    names = wpart.do_all()
    check_names(names, wpart)
    assert abs(wpart['charges'] - expecting).max() < 2e-3
    assert abs(wpart['charges'] - wpart['cartesian_multipoles'][:,0]).max() < 1e-3
    assert abs(wpart['charges'] - wpart['pure_multipoles'][:,0]).max() < 1e-3

    if kwargs.get('greedy', False):
        check_proatom_splines(wpart)