Computer-Aided Drug Design at the Durrant Lab › Forums › Pyrite › Bone generation fails on large trajectory file.
- This topic has 2 replies, 1 voice, and was last updated 4 years, 7 months ago by Jacob Durrant.
- AuthorPosts
- April 23, 2020 at 4:15 am #13337Brady JohnstonGuest
Firstly, thanks for making such a great addon!
I am however currently have trouble with import of some trajectories (~1000 frames, so proving to be problematic)
Loading frame 994...
Loading frame 995...
Loading frame 996...
Traceback (most recent call last):
File "C:\Users\BradyJohnston\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\pyrite-Pyrite_1_1_0\DurBlend\background_job.py", line 52, in modal
response = self.run_step(context, event)
File "C:\Users\BradyJohnston\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\pyrite-Pyrite_1_1_0\TrajectoryProcessing.py", line 115, in run_step
self.position_empties_at_atom_locs()
File "C:\Users\BradyJohnston\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\pyrite-Pyrite_1_1_0\TrajectoryProcessing.py", line 299, in position_empties_at_atom_locs
coors = self.current_frame.get_coordinates()[sel]
IndexError: index 15 is out of bounds for axis 0 with size 0location: <unknown location>:-1
location: <unknown location>:-1
Error: Traceback (most recent call last):
File "C:\Users\BradyJohnston\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\pyrite-Pyrite_1_1_0\DurBlend\background_job.py", line 52, in modal
response = self.run_step(context, event)
File "C:\Users\BradyJohnston\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\pyrite-Pyrite_1_1_0\TrajectoryProcessing.py", line 115, in run_step
self.position_empties_at_atom_locs()
File "C:\Users\BradyJohnston\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\pyrite-Pyrite_1_1_0\TrajectoryProcessing.py", line 299, in position_empties_at_atom_locs
coors = self.current_frame.get_coordinates()[sel]
IndexError: index 15 is out of bounds for axis 0 with size 0location: <unknown location>:-1
That is the console output. I can still finish the remaining steps by cannibalising your scripts and running them through the scripting interface to generate move and parent the bones. The deformation seems to not work as nicely though.
The .pdb trajectory file that I am using has just been generated from saving states of a molecular in PyMol (trajectories were loaded from .xtc file).
The actual .pdb file itself is as you would expect for trajectories, but something is breaking on the import. It still imports positions and keyframes all of the empties correctly but breaks when getting to the addition of the bones.
The cannibilised script that manages to successfully add the bones is as follows:
import bpyselected_atoms = bpy.context.selected_objects
bpy.ops.object.add(type='ARMATURE', enter_editmode=True)
object = bpy.context.object
object.name = 'Pyrite_Armature'
armature = object.data
armature.name = 'Frame'for index in range(len(selected_atoms)):
selected_atoms[index].name = "Pyrite_empty"+str(index)for i in selected_atoms:
print(i)# Add bones
for index in range(len(selected_atoms)):
bone_name = 'Pyrite_bone' + str(index)
bone = armature.edit_bones.new(bone_name)
bone.head = (0, 0, 0)
bone.tail = (0, 0, 2)
bone.envelope_weight = 1.0 # Needed for envelope-based mesh
# vertex weighting.
bone.envelope_distance = 5.0Now constrain them to the locations of the empty objects (which are
animated).
bpy.ops.object.mode_set(mode='POSE')
armature = bpy.data.objects["Pyrite_Armature"]for index in range(len(selected_atoms)):
bone = armature.pose.bones['Pyrite_bone' + str(index)]
constraint = bone.constraints.new(type="COPY_LOCATION")
constraint.target = bpy.data.objects["Pyrite_empty" + str(index)]
# Now make sure the pose at frame 0 is set as the rest pose (so youcan do automatic weights later...)
bpy.context.scene.frame_set(0)
bpy.ops.pose.armature_apply()Parent the mesh to that armature
for obj in bpy.data.objects: obj.select_set(state=False)
#self.macromolecular_obj.select_set(state=True)
armature.select_set(state=True)
bpy.context.view_layer.objects.active = armature
bpy.ops.object.parent_set(type="ARMATURE_AUTO")Zoom in on armature
bpy.ops.object.mode_set(mode='OBJECT')
#except: passbpy.context.view_layer.objects.active = bpy.data.objects['Pyrite_Armature']
#bpy.ops.view3d.view_selected(use_all_regions=False)
Again, thanks for the fantastic Pyritte and BlendMol plugins, and I look forward to hearing from you!
Cheers,
Brady - May 2, 2020 at 7:33 pm #13418Jacob DurrantKeymaster
Hi Brady. Very happy to hear that you’re getting good use out of BlendMol and Pyrite. I wonder if there’s something unusual in the way that PyMol saves the PDB trajectory files. Would it be possible for you to send me enough of the PDB trajectory for me to test it on my system? If I can reproduce the error, I’ll be better able to fix it. Thanks again!
- May 17, 2020 at 12:49 am #13532Jacob DurrantKeymaster
Hi Brady. I spent some time looking into this error today and was able to debug it using the multi-frame 2jse.pdb structure from the PDB. I’ll spare you the details, but bottom line is that the bug has been fixed with version 1.1.1, which I just pushed to the git repository: https://git.durrantlab.pitt.edu/jdurrant/pyrite
Much thanks for bringing this issue to my attention! Take care.
- AuthorPosts
- The topic ‘Bone generation fails on large trajectory file.’ is closed to new replies.