# Updating Coords

Member Site Forums PyRosetta PyRosetta – General Updating Coords

• This topic has 0 replies, 1 voice, and was last updated 13 years, 10 months ago by Anonymous.
• Author
Posts
• #451 Anonymous

This is a communication I had last week that deals with updating coordinates within Rosetta. Hopefully, this helps anyone else who has the same problem.

Hello.

My name is ____. We are trying to develop a good ab initio protocol using PyRosetta. I am very happy with the flexibility PyRosetta allows, however I have a question about some strange outputs from the program.

To give you a background, I am trying to use a disulfide bond constraint in which after a fold, if an incorrect disulfide bond has been formed, the program reverts to the pose that existed before the particular move.

In order to do this, I am using a manual calculation of bond length using ‘sulfera.xyz – sulferc.xyz’ in order to get the distance between each x y z coordinates, and then using the 3 Dimensional Pythagorean theorem to calculate bond distance. My Code looks like this:

sulfidefour = pose.residue(4).atom(“SG”)
sulfidesix = pose.residue(6).atom(“SG”)

currectdisulfide=True

def disulfidecheck():

correctdisulfide=True
if disulfides != 0:

print sulfidefour.xyz()
print sulfidesix.xyz()
print sulfidefifte.xyz()
print sulfide_23.xyz()
print sulfide_25.xyz()
print sulfide_36.xyz()

SSbond = sulfidefour.xyz() – sulfidesix.xyz()
xD = SSbond.x
yD = SSbond.y
zD = SSbond.z
dSquared = (xD**2) + (yD**2) + (zD**2)
d = math.sqrt(dSquared)
print d
if d < 2.11:
correctdisulfide = False

SSbond = sulfidefour.xyz() – sulfidefifte.xyz()
xD = SSbond.x
yD = SSbond.y
zD = SSbond.z
dSquared = (xD**2) + (yD**2) + (zD**2)
d = math.sqrt(dSquared)
print d
if d < 2.11:
correctdisulfide = False

(etc.)

The problem I am having is that sometimes after a move, a single x y or z coordinate jumps to an insane number, after which the program cannot handle the number, and discontinues.

As an example, the last time I tried to run the program a sulfer atom jumped from:

7.214785689331332E-313 2.398900546303664E-312 2.139682428053075E-314

to

5.740792175477635E+198 2.407337605170826E-312 2.139682428053075E-314

The coord. are in angstroms, so how is this possible? Is this a known issue?

Thank you for taking the time to read this email.

Jeff:
hm. are you in full-atom mode or centroid mode? in centroid mode those atoms might not exist.

the pose should know to update the coords before giving you the xyz values…I think…

you might also try calling the side-chain packer to do a rotamer-pack of the sc coords

Phil:
I’m not too familiar with the python, but in C++ you could possibly get some funny behavior if you are holding onto atom/xyz references over periods of time during which the pose has been modified by certain operations such as repacking or residue replacement. In general, it’s safer to get residue/atom info from the pose via calls to pose.residue(seqpos) or pose.xyz(atomid) as needed rather than storing returned (const) references to internal data for extended periods. This ensures that everything gets updated properly. The pose will update xyz coords following torsion angle changes and internal coords following xyz changes, but for efficiency reasons it does this in a lazy updating scheme triggered by access to the residue/xyz info. Once you get a const reference to an xyzVector from the pose, there’s no further communication mechanism that tells the pose you might have read coordinates from the vector at some later time.

Not sure how coordinate access is handled in python, but did you try getting residue/atom information from the pose anew? I’m worried that the problem is old references to position information either going out of date or not triggering appropriate updating calls.
-Phil

Phil,

I think I know what you meant. I changed the call to pose.xyz call of coordinates:

sulfidefour = AtomID(4, 4)
sulfidesix = AtomID(4, 6)

def disulfidecheck():

correctdisulfide=True
if disulfides != 0:
print pose.xyz(sulfidefour)
print pose.xyz(sulfidesix)
print pose.xyz(sulfidefifte)
print pose.xyz(sulfide_23)
print pose.xyz(sulfide_25)
print pose.xyz(sulfide_36)

SSbond = pose.xyz(sulfidefour) – pose.xyz(sulfidesix)

xD = SSbond.x
yD = SSbond.y
zD = SSbond.z
dSquared = (xD**2) + (yD**2) + (zD**2)
d = math.sqrt(dSquared)
print d
if d < 2.11:
correctdisulfide = False

Problem seems solved. I guess for this call, the coordinates are now updated from all of the moves..Thanks for your help.

I hope this helps anyone in the same situation, or has questions about the updating of a pose.

-J