def reduceToModel( self, xyz=None, reduce_profiles=1 ): """ Create a reduced PDBModel from coordinates. Atom profiles the source PDBModel are reduced by averaging over the grouped atoms. @param xyz: coordinte array (N_atoms x 3) or None (->use reference coordinates) @type xyz: array OR None @return: PDBModel with reduced atom set and profile 'mass' @rtype: PDBModel """ mass = self.m.atoms.get('mass') if xyz is None: xyz = self.m.getXyz() mProf = [ N0.sum( N0.take( mass, group ) ) for group in self.groups ] xyz = self.reduceXyz( xyz ) result = PDBModel() for k in self.atoms.keys(): result.atoms.set( k, self.atoms.valuesOf(k) ) ## result.setAtoms( self.atoms ) result.setXyz( xyz ) result.atoms.set( 'mass', mProf ) if reduce_profiles: self.reduceAtomProfiles( self.m, result ) result.residues = self.m.residues return result
def getPDBModel( self, index ): """ Get PDBModel object for a particular frame of the trajectory. :param index: frame index :type index: int :return: model :rtype: PDBModel """ s = PDBModel( self.ref, noxyz=1 ) s.setXyz( self.frames[ index ] ) return s
def avgModel( self ): """ Returna a PDBModel with coordinates that are the average of all frames. :return: PDBModel with average structure of trajectory (no fitting!) this trajectory's ref is the source of result model :rtype: PDBModel """ result = PDBModel( self.getRef(), noxyz=1 ) result.setXyz( N0.average( self.frames ) ) return result