Esempio n. 1
0
def from_pytraj_Trajectory(item,
                           molecular_system=None,
                           atom_indices='all',
                           structure_indices='all'):

    from molsysmt.native.trajectory import Trajectory
    from molsysmt.api_forms.api_pytraj_Trajectory import get_frame_from_atom

    tmp_item = Trajectory()
    step, time, coordinates, box = get_frame_from_atom(
        item, indices=atom_indices, structure_indices=structure_indices)
    tmp_item.append_structures(step=step,
                               time=time,
                               coordinates=coordinates,
                               box=box)

    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
Esempio n. 2
0
def from_XYZ(item,
             molecular_system=None,
             atom_indices='all',
             structure_indices='all'):

    from molsysmt.native.trajectory import Trajectory
    from molsysmt.api_forms.api_XYZ import get_coordinates_from_atom
    tmp_item = Trajectory()
    coordinates = get_coordinates_from_atom(
        item, indices=atom_indices, structure_indices=structure_indices)
    tmp_item.append_structures(coordinates=coordinates)
    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
Esempio n. 3
0
def from_openexplorer_OpenExplorerReporter(item,
                                           molecular_system=None,
                                           atom_indices='all',
                                           structure_indices='all'):

    from molsysmt import box_shape_from_box_vectors
    from molsysmt.native.trajectory import Trajectory
    from numpy import array

    tmp_item = Trajectory()

    if item.step is not None:
        tmp_item.step = array(item.step, dtype=int)

    units = item.coordinates.unit
    tmp_item.coordinates = array(item.coordinates._value, dtype=float)
    if atom_indices is not 'all':
        tmp_item.coordinates = tmp_item.coordinates[:, atom_indices, :]
    if structure_indices is not 'all':
        tmp_item.coordinates = tmp_item.coordinates[structure_indices, :, :]
    tmp_item.coordinates = tmp_item.coordinates * units

    if item.box is not None:
        tmp_item.box = array(item.box._value, dtype=float)
        if structure_indices is not 'all':
            tmp_item.box = tmp_item.box[structure_indices, :, :]
        tmp_item.box = tmp_item.box * units
        tmp_item.box_shape = box_shape_from_box_vectors(tmp_item.box)

    tmp_item.n_structures = tmp_item.coordinates.shape[0]
    tmp_item.n_atoms = tmp_item.coordinates.shape[1]

    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