Idealize OmegasLet's start with a simple task. Suppose we want to set all the backbone omega angles on a protein to 180°. Where do we begin? Because backbone torsion angles cross between residues libRosetta doesn't associate them with the residue. Much like classic Rosetta we can look them up from the protein by index, so we will need a loop over the protein. If we search Protein.hh for omega we find that there is a Protein::omega( Size const i ) member function that returns a reference to a TorsionAngle. We can assign angle values directly to a TorsionAngle, so we end up with this: for ( Size i = 1, e = protein.n_residue(); i < e; ++i ) { // No omega on last AA protein.omega( i ) = radians( 180.0 ); // Internal angles are in radians } Mass CentroidNow suppose we want to compute the mass centroid of an amino acid -- something that isn't currently used in Rosetta and that libRosetta doesn't provide. // Loop over atoms by index PointPosition mass_centroid( 0.0 ); Mass mass( 0.0 ); // Total mass (for normalization) for ( Size i = 1, e = aa.n_atom(); i <= e; ++i ) { Atom const & atom( aa.atom( i ) ); mass += atom.mass(); mass_centroid += atom.mass() * atom.position(); (In production code we would, of course, handle the n_atom() == 0 case.) [ Many more task cookbooks need to be added here. Suggestions welcomed.] |