Beispiel #1
0
    def recenter(self, selection=None, weights=None, syntaxis='mdtraj'):

        from molsysmt import select as _select
        from molsysmt import get as _get

        if selection is not None:
            atom_indices = _select(self.topology_mdtraj, selection, syntaxis)
        else:
            atom_indices = _np.arange(self.n_atoms, dtype=int)

        if weights == 'masses':
            weights_array = _get(self.topology_mdtraj,
                                 atom_indices,
                                 masses=True)
        elif weights is None:
            weights_array = _np.ones(atom_indices.shape[0], dtype=int)

        self.coordinates = _np.asfortranarray(self.coordinates,
                                              dtype='float64')
        _libcom.recenter(self.coordinates, atom_indices, weights_array,
                         self.n_structures, self.n_atoms,
                         atom_indices.shape[0])
        self.coordinates = _np.ascontiguousarray(self.coordinates)

        pass
Beispiel #2
0
    def unwrap(self,
               selection=None,
               minimum_image_reference=None,
               syntaxis='mdtraj'):

        from molsysmt import select as _select
        from molsysmt import get as _get
        from molsysmt.utils.fortran import listoflists2fortran as _listoflists2fortran

        molecules, bonds = _get(self.topology_mdtraj,
                                molecules=True,
                                bonded_atoms=True)

        if selection is not None:
            atom_indices = _select(self.topology_mdtraj, selection, syntaxis)
            molecules2unwrap = []
            for molecule in molecules:
                if len(_np.intersect1d(molecule, atom_indices)):
                    molecules2unwrap.append(molecule)
            molecules = molecules2unwrap

        molecules_array_all, molecules_array_starts = _listoflists2fortran(
            molecules, dtype='int64')
        bonds_array_all, bonds_array_starts = _listoflists2fortran(
            bonds, dtype='int64')

        self.coordinates = _np.asfortranarray(self.coordinates,
                                              dtype='float64')
        self.box = _np.asfortranarray(self.box, dtype='float64')
        self.invbox = _np.asfortranarray(self.invbox, dtype='float64')
        _libbox.unwrap(self.coordinates, molecules_array_all,
                       molecules_array_starts, bonds_array_all,
                       bonds_array_starts, self.box, self.invbox,
                       self.orthogonal, self.n_structures, self.n_atoms,
                       molecules_array_all.shape[0],
                       molecules_array_starts.shape[0],
                       bonds_array_all.shape[0], bonds_array_starts.shape[0])

        self.coordinates = _np.ascontiguousarray(self.coordinates)
        self.box = _np.ascontiguousarray(self.box)
        self.invbox = _np.ascontiguousarray(self.invbox)
        pass
Beispiel #3
0
def get_n_degrees_of_freedom_from_system(item,
                                         indices='all',
                                         structure_indices='all'):

    from molsysmt import get_degrees_of_freedom as _get
    return _get(item, indices=indices)
Beispiel #4
0
def get_n_atoms_from_system(item, indices='all', structure_indices='all'):

    from .api_openmm_Topology import get_n_atoms_from_system as _get
    return _get(item, indices=indices)
Beispiel #5
0
def get_net_charge_from_system(item, indices='all', structure_indices='all'):

    from molsysmt import get_net_charge as _get
    return _get(item, indices=indices)
Beispiel #6
0
def get_molecule_type_from_chain(item, indices='all', structure_indices='all'):

    from .api_openmm_Topology import get_molecule_type_from_chain as _get
    return _get(item, indices=indices)
Beispiel #7
0
def get_chain_id_from_group(item, indices='all', structure_indices='all'):

    from .api_openmm_Topology import get_chain_id_from_group as _get
    return _get(item, indices=indices)
Beispiel #8
0
def get_coordinates_from_atom(item, indices='all', structure_indices='all'):

    from .api_openmm_Positions import get_coordinates_from_atom as _get
    return _get(item, indices=indices)
Beispiel #9
0
def get_net_mass_from_atom(item, indices='all', structure_indices='all'):

    from molsysmt import get_net_mass as _get
    return _get(item, indices=indices)
Beispiel #10
0
def get_n_ions_from_atom(item, indices='all', structure_indices='all'):

    from .api_openmm_Topology import get_n_ions_from_atom as _get
    _get(item.topology, indices=indices)