Hello!
First of all I’d like to thank you for this addon as a computational chemist I thank you from the bottom of my heart.
Now to my question: Is there a way to have bonds formation/creation during an animation?
To be more specific, I have a multi frame xyz from a molecular dynamics simulation which I can load using your addon but there are no bonds (of course it’s xyz) . I was wondering if there was a way to add the bonds (I don’t mind doing some python scripting like calculating distances and adding bonds within a cutoff if it’s necessary) for each frame.
I’m sorry, I have to disappoint you so far, however, read the end. So, a priori, there is no algorithm included to search for possible bonds, as it is done, e.g., in the Avogadro software. Furthermore, the file format xyz does not describe the bonds as you write yourself. From this, there is no way of including your ‘dynamic’ bonding.
For including this ‘dynamic’ bonding, you have to ‘hard code’ the sticks into your structure after its import. And this needs to be done for each frame. This requires some real hard work and good skills in Blender Python programming! If you want to try, you need to know how to create the sticks. In the PDB importer (see code), you find the definition build_stick(radius, length, sectors, element_name). Then, you have to iterate over all frames and search the atoms that shall be connected. This is probably the hardest task to do (to find the correct atoms). All this should be possible, but requires some time.
Otherwise, you could write a Python script that imports each structure described in a PDB file (with sticks mentioned via CONECT!) and to assign this structure to a frame. So, when you have 100 frames you need 100 PDB files. All this should be indeed possible and requires only a bit knowledge of the Blender Python environment.
So, what you need to import a PDB structure into Blender is the definition:
Just to be sure I understood correctly, If I have a xyz file what I should do is:
1)Create a PDB file for each “frame” (it should be easy with openbabel)
2)Import each PDB file as frame via blender python scripting
3) Setting up the scene as I want
4)Render
Yes. Step 2) requires some scripting work in Blender Python. You have to import, say, 100 PDB snapshot structures and assign each of them to one frame. The principle definition for the import and the handling of the frames after you have imported the 100 snapshots are mentioned above.
No, it’s okay, just keep me (us) informed here what you have done. If you have found a solution, then, plz, post the code here in the thread, I and others could possibly use it. Thanks in advance.
By the way. In the Python script, you call the definitions via an operator like:
bpy.ops.import_mesh.pdb(<options>)
In the script, you have to basically do:
list_objects_snapshots = []
for file in list_files:
bpy.ops.import_mesh.pdb(<options>)
list_objects_snapshots.apped( <selected object> )
Here then: create frames with `list_objects_snapshots`
… and that’s it.
PS: You can execute a python script via calling blender in the terminal, with Blender -P <script>
Sorry for bothering you but I have some problems using the operators.
After taking a good look at the code I’ve realized that to select types (Ball_type, radiustype … etc) you use strings like ‘0’ ‘1’ and so on, True or False to activate and deactivate functions such as bonds and int/float for the rest.
PS: By the way, in the Python console of Blender, typing bpy. and then pressing the key ‘TAB’ shows you all possible sub commands and its options with some explanations if existant. <= This is very useful !!!
For the Blender version 3.1, which will appear in the first week of March 2022 (see here) , the add-on has been entirely revised such that a full functionality of the add-on can be guaranteed. Current bug removal, improvements and changes can be followed here: Link. The current manual for the add-on can be found here: manual
ChemHG. I know this is like years later, but I had the same issue and I was able to solve it. You just need to either type n while you have blender open to open that utility panel or, in the topright of the screen, you will see a little < sign. It will be right by the datum that shows the axis. It’s very small. Then open the Create tab to get the Utilities panel open.
@German_Barcenas: I have the same issue, but I still don’t succeed in making the Atomic Blender Utilities Panel visible.
If I press n or click the < sign as you described, I just get the usual sidebar opened at the right side of the 3D Viewport window, but nothing similar to the panel which is shown here.
You wrote that the Create tab should be opened, but I’m unable (or maybe too dumb) to find that either. The sidebar has only the tabs Item, Tool and View.
BTW, I’m using Blender version 3.1.2, and installing and activating both addons (Atomic Blender PDB/XYZ and Atomic Blender - Utilities) went smoothly. They both show up in the preferences. I can import PDB or XYZ format structures, but even with such a structure imported in blender, I don’t get the panel.
I can’t post pictures unfortunately. When you open that panel with n or by clicking <, you’ll see some column pop up right? There will be some new Active Tool panel that opens. Look to the right of that panel. You will see 3 tabs that are vertical with letters that are sideways. It will be open on Tools already. Look down a couple of tabs and you will see Create. Select that tab. A new panel will open up with the Atomic Blender Utilities. Open it. For some reason it is created close. That’s it(: Hope I could help.
thanks a lot for the kind explanation. I have opened up a new panel with the Atomic Blender Utilities. But the problem is I am still not able to import a pdb file…
sorry for being late. - I think that you all now know how to find the Atomic Blender panel … so far so good. In future, I will put some text into the documentation, remember, the latter is here.
Xuefepan, please, can you supply the PDB file? Otherwise, it is almost impossible to find out where the problem is. Thanks.