Ejemplo n.º 1
0
def test_index_fragments():
    ipoles = list(range(1, 11))
    fragments = [1, 1, 1, 2, 2, 3, 3, 4, 4, 4]

    pole_index_by_fragment = util.index_fragments(fragments, ipoles)[0]

    print(pole_index_by_fragment)
    print(len(pole_index_by_fragment))

    expected_index = np.array([
        np.array([1, 2, 3]),
        np.array([4, 5]),
        np.array([6, 7]),
        np.array([8, 9, 10])],
        dtype=object)

    assert len(expected_index) == len(pole_index_by_fragment)

    for i in range(len(expected_index)):
        assert np.array_equal(pole_index_by_fragment[i], expected_index[i])
Ejemplo n.º 2
0
    print(F'Probe pole indices {probe_pole_indices}')

    # Get the atom and pole numbers for the molecules/residues of interest.
    atoms_pole_numbers = []
    if args.bymol:
        by_type = 'molecule'
        fragment_list = molecules
    elif args.byres:
        by_type = 'residue'
        fragment_list = residues
    else:
        by_type = 'atom'
        # We are interested in all of the atoms.
        fragment_list = list(range(1, natoms_engine + 1))

    atoms_pole_numbers, from_fragment = index_fragments(fragment_list, ipoles)

    elapsed = time.time() - start
    print(F'Bookkeeping:\t {elapsed}')

    ###########################################################################
    #
    #   Send Probe Information to Tinker
    #
    ###########################################################################
    start = time.time()
    # Inform Tinker of the probe atoms
    for comm in engine_comm:
        mdi.MDI_Send_Command(">NPROBES", comm)
        mdi.MDI_Send(len(probes), 1, mdi.MDI_INT, comm)
        mdi.MDI_Send_Command(">PROBES", comm)