Beispiel #1
0
def to_molsysmt_MolSys(item,
                       atom_indices='all',
                       structure_indices='all',
                       check=True):

    if check:

        digest_item(item, 'parmed.Structure')
        atom_indices = digest_atom_indices(atom_indices)
        structure_indices = digest_structure_indices(structure_indices)

    from molsysmt.native.molsys import MolSys
    from . import to_molsysmt_Topology
    from . import to_molsysmt_Structures

    tmp_item = MolSys()

    tmp_item.topology = to_molsysmt_Topology(item,
                                             atom_indices=atom_indices,
                                             check=False)
    tmp_item.structures = to_molsysmt_Structures(
        item,
        atom_indices=atom_indices,
        structure_indices=structure_indices,
        check=False)

    return tmp_item
Beispiel #2
0
def from_openmm_Simulation(item,
                           molecular_system=None,
                           atom_indices='all',
                           structure_indices='all'):

    from molsysmt.native.molsys import MolSys
    from molsysmt.native.io.topology import from_openmm_Simulation as molsysmt_Topology_from_openmm_Simulation
    from molsysmt.native.io.trajectory import from_openmm_Simulation as molsysmt_Structures_from_openmm_Simulation

    tmp_item = MolSys()
    tmp_item.topology, _ = molsysmt_Topology_from_openmm_Simulation(
        item,
        molecular_system,
        atom_indices=atom_indices,
        structure_indices=structure_indices)
    tmp_item.trajectory, _ = molsysmt_Structures_from_openmm_Simulation(
        item,
        molecular_system,
        atom_indices=atom_indices,
        structure_indices=structure_indices)
    if tmp_molecular_system is not None:
        tmp_molecular_system = molecular_system.combine_with_items(
            tmp_item,
            atom_indices=atom_indices,
            structure_indices=structure_indices)
    else:
        tmp_molecular_system = None

    return tmp_item, tmp_molecular_system
Beispiel #3
0
def to_molsysmt_MolSys(item,
                       selection='all',
                       structure_indices='all',
                       syntaxis='MolSysMT'):

    if check:

        try:
            is_openmm_PDBFile(item)
        except:
            raise WrongFormError('openmm.PDBFile')

        try:
            atom_indices = digest_atom_indices(atom_indices)
        except:
            raise WrongAtomIndicesError()

        try:
            structure_indices = digest_structure_indices(structure_indices)
        except:
            raise WrongStructureIndicesError()

    from molsysmt.native.molsys import MolSys
    from .to_molsysmt_Topology import to_molsysmt_Topology
    from .to_molsysmt_Structures import to_molsysmt_Structures

    tmp_item = MolSys()
    tmp_item.topology = to_molsysmt_Topology(
        item,
        atom_indices=atom_indices,
        structure_indices=structure_indices,
        check=False)
    tmp_item.structures = to_molsysmt_Structures(
        item,
        atom_indices=atom_indices,
        structure_indices=structure_indices,
        check=False)

    return tmp_item
Beispiel #4
0
def from_pytraj_Trajectory(item,
                           molecular_system=None,
                           atom_indices='all',
                           structure_indices='all'):

    from molsysmt.native.molsys import MolSys
    from molsysmt.native.io.topology import from_pytraj_Trajectory as pytraj_Trajectory_to_molsysmt_Topology
    from molsysmt.native.io.trajectory import from_pytraj_Trajectory as pytraj_Trajectory_to_molsysmt_Structures

    tmp_item = MolSys()
    tmp_item.topology, _ = pytraj_Trajectory_to_molsysmt_Topology(
        item, atom_indices=atom_indices, structure_indices=structure_indices)
    tmp_item.trajectory, _ = pytraj_Trajectory_to_molsysmt_Structures(
        item, atom_indices=atom_indices, structure_indices=structure_indices)
    if molecular_system is not None:
        tmp_molecular_system = molecular_system.combine_with_items(
            tmp_item,
            atom_indices=atom_indices,
            structure_indices=structure_indices)
    else:
        tmp_molecular_system = None

    return tmp_item, tmp_molecular_system
Beispiel #5
0
def to_molsysmt_MolSys(item, atom_indices='all', coordinates=None, box=None, check=True):

    if check:

        try:
            is_openmm_Topology(item)
        except:
            raise WrongFormError('openmm.Topology')

        try:
            atom_indices = digest_atom_indices(atom_indices)
        except:
            raise WrongAtomIndicesError()

        try:
            coordinates = digest_coordinates(coordinates)
        except:
            raise WrongCoordinatesError()

        try:
            box = digest_box(box)
        except:
            raise WrongBoxError()

    from molsysmt.native.molsys import MolSys
    from molsysmt.native.structures import Structures
    from . import to_molsysmt_Topology as to_molsysmt_Topology
    from . import get_box_from_system

    tmp_item = MolSys()
    tmp_item.topology = to_molsysmt_Topology(item, atom_indices=atom_indices, check=False)
    tmp_item.structures = Structures()
    if box is None:
        box = get_box_from_system(item)
    tmp_item.structures.append_structures(coordinates=coordinates, box=box)

    return tmp_item