Creating a vector1 of AtomID objects

Member Site Forums PyRosetta PyRosetta – General Creating a vector1 of AtomID objects

Viewing 8 reply threads
  • Author
    Posts
    • #978
      Anonymous

        I’m am unsure of how to do this. AtomID() does not fit any of the standard types in __init__.Vector1().

        For a double, you can do:

        vec1 = rosetta.utility.vector1_double()
        vec1.append(doubleX)

      • #5862
        Anonymous

          I assume the problem is that there isn’t an interface, (or we don’t know the interface), for doing C++ templating in python. In C++:

          utility::vector1< core::id::AtomID > my_vector;

          You may be able to circumvent this by extracting an AtomID vector from the code and modifying it – set a local variable equal to a return value that is a vector1, empty it, then put your own stuff in it? This is almost certainly not the best way to do it but it’s the first I can think of.

          The only function I can find that returns the right type is protocols::constraints_additional::SequenceProfileConstraint.atom_IDs().

        • #5863
          Anonymous

            TypeError: No Python class registered for C++ class utility::vector1 >

            Is the error I receive when I extract the vector.

          • #5864
            Anonymous

              The forum ate your code. Looking into the raw code of your post, it looks like this:

              TypeError: No Python class registered for C++ class utility::vector1< core::id::AtomID, std::allocator< core::id::AtomID > >

              I guess that means you need a manual wrapper class to get this to work. I’ve informed Sergey but I don’t know that this can be fixed remotely (or quickly).

            • #5865
              Anonymous

                Thanks.

                When I use the method pose.conformation().set_xyz(AtomID(),xyzVector) on 10,000 atoms, it takes about 60seconds. There are a few other method calls besides setting the internal and xyz coordinates. So, I am trying to use .batch_set_xyz() and that requires two vector1’s.

                Since that isn’t working right now, I will try and set the external and internal coords manually. Hopefuly that doesn’t break anything.

              • #5867
                Anonymous

                  Using:

                  pycoord = pose.residue(_residueNumber).xyz(_atomSpecies)
                  pycoord.x = 1.0
                  pycoord.y = 1.0
                  pycoord.z = 1.0
                  idx = pose.residue(_residueNumber).atom_index(_atomSpecies)
                  id = AtomID(idx,_residueNumber)
                  pose.atom_tree().set_xyz(id,pycoord)

                  takes about 0.4-0.6 seconds for all atoms. Not that I want to move them all to 1 1 1, but you get the idea.

                • #5869
                  Anonymous

                    Ok, I fixed this. In revisions starting with 43345 it should be possible to write this:

                    rosetta.Vector1( [rosetta.core.id.AtomID()] )

                    msellers, on which platform do you run this? Also, do you have access to developer versions?

                  • #5875
                    Anonymous

                      That was it, my jump was set incorrectly. Thanks.

                    • #5881
                      Anonymous

                        OK, new binaries are ready (only for ScientificLinux and Mac for now):

                        http://graylab.jhu.edu/pyrosetta/downloads/release/PyRosetta-r43353.linux.64Bit.tar.bz2
                        http://graylab.jhu.edu/pyrosetta/downloads/release/PyRosetta-r43382.darwin.64Bit.tar.bz2

                        Use the same password and user name that you used to download other releases.

                      • #5866
                        Anonymous

                          If you’ve got 10,000 atoms, why not read them in as a PDB? What format are they in already? set_xyz is not really set up to be used on that many residues, since it refolds after each one…

                        • #5872
                          Anonymous

                            Great, thanks. I have only have academic access to the Rosetta source and it’s running on Linux. I’m trying to avoid the conformation().set_xyz() slowdown, by setting atom.xyz() and atom_tree.set_xyz() instead. However, with Pyrosetta 2.0 I cannot get to this point.

                            I keep receiving: kinematics::Atom bad method call in Atom hierarchy!
                            ERROR:: Exit from: src/core/kinematics/tree/Atom_.cc line: 754

                            when I try to do a spin or randomize move.

                          • #5874
                            Anonymous

                              Tracing upwards from that error, I have to guess that you are trying to do something involving a jump (as spin or randomize would), except that the jump is set up wrong. That error is triggered when you try to do something involving a Jump on a class “BondedAtom”, which as far as I can tell just means a standard atom that isn’t involved in a Jump.

                              I would look for an error where the Jump you are trying to spin or randomize doesn’t match the one in the FoldTree/AtomTree; perhaps it got out-of-date somehow…?

                            • #5878
                              Anonymous

                                Sergey,

                                It would also be useful to create a vector1 of xyzVectors.

                              • #5880
                                Anonymous

                                  – got it! I will look it up, but it would be after a bit of time.

                                • #5895
                                  Anonymous

                                    Thanks. Yeah, to do the .batch_set_xyz() you need both a vector1 of AtomID’s and a vector1 of xyzVectors.

                                  • #6023
                                    Anonymous

                                      BUMP

                                    • #6025
                                      Anonymous

                                        The following functions for creating Vector1 is added:

                                        rosetta.utility.vector1_xyzVector_bool
                                        rosetta.utility.vector1_xyzVector_char
                                        rosetta.utility.vector1_xyzVector_double
                                        rosetta.utility.vector1_xyzVector_float
                                        rosetta.utility.vector1_xyzVector_int
                                        rosetta.utility.vector1_xyzVector_long
                                        rosetta.utility.vector1_xyzVector_uchar
                                        rosetta.utility.vector1_xyzVector_uint
                                        rosetta.utility.vector1_xyzVector_ulong

                                        Here the links to a new binary:
                                        http://graylab.jhu.edu/pyrosetta/downloads/release/PyRosetta.MacOSX.Lion-r44597.64Bit.tar.bz2
                                        http://graylab.jhu.edu/pyrosetta/downloads/release/PyRosetta.MacOSX.SnowLeopard-r44593.64Bit.tar.bz2
                                        http://graylab.jhu.edu/pyrosetta/downloads/release/PyRosetta.ScientificLinux-r44586.64Bit.tar.bz2

                                        Regarding the ‘.batch_set_xyz()’: I have not quite get what you mean, could you please elaborate this?

                                      • #6027
                                        Anonymous

                                          Sergey,

                                          .batch_set_xyz() is a method in Pose.cc that takes a vector of AtomID objects and a vector of XYZVectors, and calls a similar method in Conformation.cc to change the position of each atom. I haven’t tried it yet, but I am assuming it is much faster than .set_xyz() becuase it does not rebuild the internal coordinates (?) after each atom is moved. The batch method sets all coordinates in the list and then updates the internal things and fires events, etc.

                                          Right now looping over .set_xyz() for around 10,000 atoms takes upwards of 30seconds. I’m hoping this will save a lot of time.

                                          Thanks a lot for rebuilding these!

                                        • #6029
                                          Anonymous

                                            Oh, – but its already binded, just construct Pose object and you should be able to use pose.batch_set_xyz and pose.batch_get_xyz etc.

                                          • #6031
                                            Anonymous

                                              Yes, the ‘batch…’ methods have been binded for a while, but we could never construct their arguements in an IVector form. With this release incorporating IVector_xyzVector… and IVector_AtomID, you have fixed that.

                                              Happy to report that the batch methods are working nice and quick. Thanks.

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