Reply To: Using pose.set_xyz() to move chains causes increase in only pro_close energy

Member Site Forums PyRosetta PyRosetta – General Using pose.set_xyz() to move chains causes increase in only pro_close energy Reply To: Using pose.set_xyz() to move chains causes increase in only pro_close energy

#5905
Anonymous

    Once again, Steven, your advice saved me hours of digging. Thank you.

    For anyone interested, I found a quick and semi-clean solution. Rosetta.src.core.Conformation.cc:

    ///////////////////////////////////////////////////////////////////////////////
    ///@details
    /// @note This could be rewritten to avoid a refold using set_bond_angle, etc might be safer since
    /// by-xyz ignores possibility of propagating dependencies from the moving atoms...
    void
    Conformation::rebuild_residue_connection_dependent_atoms( Size const seqpos, Size const connid )
    {
    // assumes no interpendencies among the atoms being built
    update_residue_coordinates();
    Residue const & rsd( residue_(seqpos) );
    for ( Size i=1, ie=rsd.natoms(); i<= ie; ++i ) {
    if ( rsd.icoor(i).depends_on_residue_connection( connid ) ) {
    set_xyz( AtomID(i,seqpos), rsd.icoor(i).build( rsd, *this ) );
    }
    }
    }

    From this you can pull out the “set_xyz” line, which is creating an AtomID for whatever atom in the residue you’d like and then using the “build(residue,conformation())” method to get its ideal coordinate. To move a virtual atom, simply create an AtomID for it and grab a Residue.icoor(idx).build(residue,conformation()) vector. Both of these go into the pose.conformation().set_xyz(AtomID,xyzVector) method.

    In my case I needed to move the virtual atom ‘NV’ (found in minirosetta_database/chemical/residue_type_sets/fa_standard/residue_types/l-caa/AMINOACID.param) on a Proline, after I had moved the rest of the atoms in the residue.