You are here

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

7 posts / 0 new
Last post
(1) Score pose, (2) move atom, (3) score pose
#1


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?

Post Situation: 
Fri, 2011-07-15 11:04
msellers

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....)

Fri, 2011-07-15 11:41
smlewis

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') ?

Fri, 2011-07-15 11:48
msellers

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.

Fri, 2011-07-15 12:00
smlewis


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.

Fri, 2011-07-15 11:56
msellers

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.

Fri, 2011-07-15 12:06
smlewis

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 );
}

Fri, 2011-07-15 12:11
msellers