def project(self, *args, **kwargs): """ Project molecule. Parameters ---------- mol : :class:`Molecule <htmd.molecule.molecule.Molecule>` A :class:`Molecule <htmd.molecule.molecule.Molecule>` object to project. Returns ------- data : np.ndarray An array containing the projected data. """ # -------------- DEPRECATION PATCH -------------- if isinstance(self, np.ndarray) or isinstance(self, Molecule): from warnings import warn warn('Static use of the project method will be deprecated in the next version of HTMD. ' 'Please change your projection code according to the tutorials on www.htmd.org') data = _MetricRmsdOld.project(self, *args, **kwargs) logger.warning('Static use of the project method will be deprecated in the next version of HTMD. ' 'Please change your projection code according to the tutorials on www.htmd.org') return data # ------------------ CUT HERE ------------------- mol = args[0] mol = mol.copy() (trajalnsel, trajrmsdsel, centersel) = self._getSelections(mol) if self._pbc: mol.wrap() #mol.coords = self._wrapPositions(mol.box, mol.coords, centersel) mol.align(sel=trajalnsel, refmol=self._refmol, refsel=self._refalnsel) return molRMSD(mol, self._refmol, trajrmsdsel, self._refrmsdsel)
def project(self, *args, **kwargs): """ Project molecule. Parameters ---------- mol : :class:`Molecule <htmd.molecule.molecule.Molecule>` A :class:`Molecule <htmd.molecule.molecule.Molecule>` object to project. Returns ------- data : np.ndarray An array containing the projected data. """ # -------------- DEPRECATION PATCH -------------- if isinstance(self, np.ndarray) or isinstance(self, Molecule): from warnings import warn warn('Static use of the project method will be deprecated in the next version of HTMD. ' 'Please change your projection code according to the tutorials on www.htmd.org') data = _MetricRmsdOld.project(self, *args, **kwargs) logger.warning('Static use of the project method will be deprecated in the next version of HTMD. ' 'Please change your projection code according to the tutorials on www.htmd.org') return data # ------------------ CUT HERE ------------------- mol = args[0] mol = mol.copy() (trajalnsel, trajrmsdsel, centersel) = self._getSelections(mol) if self._pbc: mol.wrap(centersel) #mol.coords = self._wrapPositions(mol.box, mol.coords, centersel) mol.align(sel=trajalnsel, refmol=self._refmol, refsel=self._refalnsel) return molRMSD(mol, self._refmol, trajrmsdsel, self._refrmsdsel)
def _processTraj(self, mol): (trajalnsel, trajrmsdsel, centersel) = self._getSelections(mol) mol = mol.copy() if self._pbc: mol.wrap() #mol.coords = self._wrapPositions(mol.box, mol.coords, centersel) mol.align(sel=trajalnsel, refmol=self._refmol, refsel=self._refalnsel) return molRMSD(mol, self._refmol, trajrmsdsel, self._refrmsdsel)
def project(self, mol): """ Project molecule. Parameters ---------- mol : :class:`Molecule <htmd.molecule.molecule.Molecule>` A :class:`Molecule <htmd.molecule.molecule.Molecule>` object to project. Returns ------- data : np.ndarray An array containing the projected data. """ mol = mol.copy() (trajalnsel, trajrmsdsel, centersel) = self._getSelections(mol) if self._pbc: mol.wrap(centersel) #mol.coords = self._wrapPositions(mol.box, mol.coords, centersel) mol.align(sel=trajalnsel, refmol=self._refmol, refsel=self._refalnsel) return molRMSD(mol, self._refmol, trajrmsdsel, self._refrmsdsel)
def foo(mol, ref): from htmd.molecule.util import molRMSD mol.wrap('protein') mol.align('protein and name CA', refmol=ref) return molRMSD(mol, ref, mol.atomselect('protein and name CA'), ref.atomselect('protein and name CA'))