def keep_protein_only(self, os=None, o=None, on=None, compact=False,<EOL>groupname="<STR_LIT>", **kwargs):
force = kwargs.pop('<STR_LIT>', self.force)<EOL>suffix = '<STR_LIT>'<EOL>newtpr = self.outfile(self.infix_filename(os, self.tpr, '<STR_LIT:_>'+suffix))<EOL>newxtc = self.outfile(self.infix_filename(o, self.xtc, '<STR_LIT:_>'+suffix))<EOL>newndx = self.outfile(self.infix_filename(on, self.tpr, '<STR_LIT:_>'+suffix, '<STR_LIT>'))<EOL>selection_ndx = suffix+"<STR_LIT>"    <EOL>if compact:<EOL><INDENT>TRJCONV = trj_compact<EOL>_input = kwargs.get('<STR_LIT:input>', ['<STR_LIT>'])<EOL>kwargs['<STR_LIT:input>'] = [_input[<NUM_LIT:0>], groupname]  <EOL>del _input<EOL><DEDENT>else:<EOL><INDENT>TRJCONV = gromacs.trjconv<EOL>kwargs['<STR_LIT:input>'] = [groupname]<EOL><DEDENT>selections = ['<STR_LIT:@>'+sel for sel in ['<STR_LIT>'] + kwargs.pop('<STR_LIT>',[])]<EOL>with utilities.in_dir(self.dirname):<EOL><INDENT>if not self.check_file_exists(newxtc, resolve="<STR_LIT>", force=force):<EOL><INDENT>B = IndexBuilder(struct=self.tpr, selections=selections,<EOL>ndx=self.ndx, out_ndx=selection_ndx)<EOL>B.combine(name_all=groupname, operation="<STR_LIT:|>", defaultgroups=True)<EOL>logger.info("<STR_LIT>".format(**vars()))<EOL>gromacs.tpbconv(s=self.tpr, o=newtpr, n=selection_ndx, input=[groupname])<EOL>logger.info("<STR_LIT>".format(**vars()))<EOL>gromacs.make_ndx(f=newtpr, o=newndx, input=['<STR_LIT:q>'], stderr=False, stdout=False)<EOL>logger.info("<STR_LIT>".format(**vars()))<EOL>kwargs['<STR_LIT:s>'] = self.tpr<EOL>kwargs['<STR_LIT:f>'] = self.xtc<EOL>kwargs['<STR_LIT:n>'] = selection_ndx<EOL>kwargs['<STR_LIT:o>'] = newxtc<EOL>TRJCONV(**kwargs)<EOL>logger.info("<STR_LIT>")<EOL>for ext in '<STR_LIT>', '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>kwargs['<STR_LIT:o>'] = self.filename(newtpr, ext=ext)<EOL>TRJCONV(dump=<NUM_LIT:0>, stdout=False, stderr=False, **kwargs)  <EOL><DEDENT>except:<EOL><INDENT>logger.exception("<STR_LIT>"<EOL>"<STR_LIT>" % vars())<EOL><DEDENT><DEDENT><DEDENT>logger.info("<STR_LIT>")<EOL><DEDENT>self.proteinonly[self.rp(newxtc)] = Transformer(dirname=self.dirname, s=newtpr,<EOL>f=newxtc, n=newndx, force=force)<EOL>return {'<STR_LIT>':self.rp(newtpr), '<STR_LIT>':self.rp(newxtc), '<STR_LIT>':self.rp(newndx)}<EOL>
Write xtc and tpr only containing the protein.

        :Keywords:
           *os*
              Name of the output tpr file; by default use the original but
              insert "proteinonly" before suffix.
           *o*
              Name of the output trajectory; by default use the original name but
              insert "proteinonly" before suffix.
           *on*
              Name of a new index file.
           *compact*
              ``True``: write a compact and centered trajectory
              ``False``: use trajectory as it is [``False``]
           *groupname*
              Name of the protein-only group.
           *keepalso*
              List of literal make_ndx selections of additional groups that should
              be kept, e.g. ['resname DRUG', 'atom 6789'].
           *force* : Boolean
             - ``True``: overwrite existing trajectories
             - ``False``: throw a IOError exception
             - ``None``: skip existing and log a warning [default]
           *kwargs*
              are passed on to :func:`gromacs.cbook.trj_compact` (unless the
              values have to be set to certain values such as s, f, n, o
              keywords). The *input* keyword is always mangled: Only the first
              entry (the group to centre the trajectory on) is kept, and as a
              second group (the output group) *groupname* is used.

        :Returns:
              dictionary with keys *tpr*, *xtc*, *ndx* which are the names of the
              the new files

        .. warning:: The input tpr file should *not* have *any position restraints*;
                     otherwise Gromacs will throw a hissy-fit and say

                     *Software inconsistency error: Position restraint coordinates are
                     missing*

                     (This appears to be a bug in Gromacs 4.x.)