(1) Score pose, (2) move atom, (3) score pose

Member Site Forums PyRosetta PyRosetta – General (1) Score pose, (2) move atom, (3) score pose

Viewing 4 reply threads
  • Author
    Posts
    • #977
      Anonymous


        from rosetta import *
        import sys

        init()

        pose = Pose()
        scorefxn = create_score_function_ws_patch('standard','score12')

        pose_from_pdb(pose,'config.pdb')
        scorePose = scorefxn(pose)
        print scorePose
        coord = pose.residue(740).atom('N').xyz()
        print coord
        coord.x = 100.0
        print coord
        scorePose = scorefxn(pose)
        print scorePose

        Returns:


        ...
        core.pack.task: Packer task: initialize from command line()
        core.scoring.dunbrack: Dunbrack library took 0.01 seconds to load from binary
        -1347.47520146
        -30.36600000000000 14.16400000000000 -17.65900000000000
        100.0000000000000 14.16400000000000 -17.65900000000000
        -1347.47520146

        Is this something I’m doing wrong, or do I need to trigger some kind of neighbor list update after moving an atom?

      • #5856
        Anonymous

          coord is not a reference, it is a local copy. You haven’t modified the coordinate of residue 740 atom N, you’ve made a local copy of that coordinate and then modified THAT.

          You’ll need to make a local copy of the Residue object for residue 740, modify that, and replace the Pose’s 740 with your new 740 (if you really wanted to do that to it, anyway….)

        • #5857
          Anonymous

            So there is no way to get access to an atom’s mutable position vector?

            I can’t set an atom’s position through:

            atom = pose.residue(5).atom(‘N’) ?

          • #5858
            Anonymous


              coord = pose.residue(740).atom('N').xyz()
              print coord
              coord.x = 100.0
              print pose.residue(740).atom('N').xyz()

              …should prove that this is a pointer. It looks like there are two sets of coordinates kept. One in the atomtree and one elsewhere, and I may need to trigger an update somehow.

            • #5861
              Anonymous

                It looks like the set_xyz method is the way to go…


                void
                Conformation::set_xyz(
                AtomID const & id,
                PointPosition const & position
                )
                {
                // update atomtree coords
                if ( !atom_tree_.empty() ) atom_tree_.set_xyz( id, position );

                // update residue coords
                residues_[ id.rsd() ]->set_xyz( id.atomno(), position );

                // notify scoring
                set_xyz_moved( id );
                }

              • #5859
                Anonymous

                  Try pose.set_xyz(AtomID, PointPosition). AtomID is composed of a residue and atom number, I forget in what order. PointPosition is probably an alias for a coordinate triplet.

                • #5860
                  Anonymous

                    A) The code is written such that it handles all the automatic updating for you.

                    B) The traditional way to force a coordinate update, (before we had all the automatic updating working well), was pose.residue(1). Since you’re already calling pose.residue, it’s going to try to do the update.

                    C) It’s possible there’s something broken in between the C++ and Python layers here.

                Viewing 4 reply threads
                • You must be logged in to reply to this topic.