Esempio n. 1
0
def test_residue_map():
    ethane = pmd.load_file(get_fn('ethane.mol2'), structure=True)
    ethane *= 2
    oplsaa = Forcefield(name='oplsaa')
    topo, NULL = generate_topology(ethane)
    with_map = pmd.openmm.load_topology(
        topo, oplsaa.createSystem(topo, use_residue_map=True))
    without_map = pmd.openmm.load_topology(
        topo, oplsaa.createSystem(topo, use_residue_map=False))
    for atom_with, atom_without in zip(with_map.atoms, without_map.atoms):
        assert atom_with.type == atom_without.type
        b_with = atom_with.bond_partners
        b_without = atom_without.bond_partners
        assert [a0.type for a0 in b_with] == [a1.type for a1 in b_without]
        assert [a0.idx for a0 in b_with] == [a1.idx for a1 in b_without]
Esempio n. 2
0
def test_residue_map():
    ethane = pmd.load_file(get_fn('ethane.mol2'), structure=True)
    ethane *= 2
    oplsaa = Forcefield(name='oplsaa')
    topo, NULL = generate_topology(ethane)
    topo_with = oplsaa.run_atomtyping(topo, use_residue_map=True)
    topo_without = oplsaa.run_atomtyping(topo, use_residue_map=False)
    assert all([a.id for a in topo_with.atoms()][0])
    assert all([a.id for a in topo_without.atoms()][0])
    struct_with = pmd.openmm.load_topology(topo_with, oplsaa.createSystem(topo_with))
    struct_without = pmd.openmm.load_topology(topo_without, oplsaa.createSystem(topo_without))
    for atom_with, atom_without in zip(struct_with.atoms, struct_without.atoms):
        assert atom_with.type == atom_without.type
        b_with = atom_with.bond_partners
        b_without = atom_without.bond_partners
        assert [a0.type for a0 in b_with] == [a1.type for a1 in b_without]
        assert [a0.idx for a0 in b_with] == [a1.idx for a1 in b_without]
Esempio n. 3
0
def test_residue_map():
    ethane = pmd.load_file(get_fn('ethane.mol2'), structure=True)
    ethane *= 2
    oplsaa = Forcefield(name='oplsaa')
    topo, NULL = generate_topology(ethane)
    topo_with = oplsaa.run_atomtyping(topo, use_residue_map=True)
    topo_without = oplsaa.run_atomtyping(topo, use_residue_map=False)
    assert all([a.id for a in topo_with.atoms()][0])
    assert all([a.id for a in topo_without.atoms()][0])
    struct_with = pmd.openmm.load_topology(topo_with,
                                           oplsaa.createSystem(topo_with))
    struct_without = pmd.openmm.load_topology(
        topo_without, oplsaa.createSystem(topo_without))
    for atom_with, atom_without in zip(struct_with.atoms,
                                       struct_without.atoms):
        assert atom_with.type == atom_without.type
        b_with = atom_with.bond_partners
        b_without = atom_without.bond_partners
        assert [a0.type for a0 in b_with] == [a1.type for a1 in b_without]
        assert [a0.idx for a0 in b_with] == [a1.idx for a1 in b_without]
Esempio n. 4
0
    ethane = oplsaa.apply(untyped_ethane, references_file='ethane.bib')

    print("Atoms:")
    for atom in ethane.atoms:
        print('Atom {} is typed as {}'.format(atom, atom.type))

    print("Bonds:")
    for bond in ethane.bonds:
        print('{} '.format(bond))

    print("Angles:")
    for angle in ethane.angles:
        print('{} '.format(angle))

    print("Dihedrals:")
    for dihedral in ethane.dihedrals:
        print('{} '.format(dihedral))

    # Save to GROMACS
    ethane.save('ethane.gro')
    ethane.save('ethane.top')

    # Within the `Forcefield.apply` method, an intermediate OpenMM system is
    # created. If you wish to use OpenMM, e.g. for use of potential forms not
    # yet supported by ParmEd, you can simply stop the conversion process
    # after the OpenMM System creation by directly invoking the internal
    # method calls:
    from foyer.forcefield import generate_topology
    omm_topology, positions = generate_topology(untyped_ethane)
    omm_system = oplsaa.createSystem(topology=omm_topology)