MolecularNodes
MolecularNodes copied to clipboard
Add support for Atom Indices Import
Add support for importing atom indices import from MD / topology files from programs such as MDAnalysis and mdtraj.
If somebody can come up with a parser (one probably exists in a function in MDAnalysis or similar somewhere) that can parse the .ndx
files which provide the atom groups for GROMACS etc, then this can become at attribute on import and allow for inclusion of the atom groups inside of Molecular Nodes.
Hi Brady! I've never contributed before, so I don't know how to do it necessarily. I did however find this other project that seems to accomplish what you need.
https://gist.github.com/jbarnoud/09a22ac41fbd5969af51458eb89317e7
If you'd like, you can give me a little more specific guidance and I can try to add this, or else it looks like it has all the info you might need to do it yourself.
oooh thanks for pointing this out! I hadn't looked into it deeply yet, but it seems like this should be straightforward to implement.
Happy to support a PR, if you'd like to have a go at implementing it. I'd like to prioritise encouraging community contributions over doing everything myself.
In terms of contributing, I've got some minor details in the README about how to do it in terms of building your own Molecular Nodes. You'll want VSCode and a couple of specific addons for Blender addon development.
The function that does the MDAnalysis importing is here: https://github.com/BradyAJohnston/MolecularNodes/blob/7979e3821f6f68438f9208e7d79d2ca771c12df5/MolecularNodes/md.py#L65-L246
For this to be used, I imagine adding an extra argument to the function maybe file_idx
which defaults to None
. If a file is given, then use the code above to create a list of boolean selections, each of which can be applied as attributes, similarly to:
https://github.com/BradyAJohnston/MolecularNodes/blob/7979e3821f6f68438f9208e7d79d2ca771c12df5/MolecularNodes/md.py#L206-L218
The function is called in this operator: https://github.com/BradyAJohnston/MolecularNodes/blob/7979e3821f6f68438f9208e7d79d2ca771c12df5/MolecularNodes/ui.py#L78
so it will need to be updated, along with adding a new bpy.context.scene.*
property for the file, and displaying that in the UI.
If it's a bit much, then I'm happy to go about it as well. The code base I think still requires a bit of a refactor, and blender addons can be a bit overwhelming if you haven't worked with them before as well.
I'll give it a go as well. This isn't top priority for me at the moment, but I really like this project, and it's getting me to learn some more git and Blender, which I'm super happy about!
If you have questions about approach to take, please let me know! As a brief outline, you'll want to:
- Fork the repo into your github account.
- Download your fork onto you local computer.
- Tinker around with making the changes.
- Push your changes back to your fork of the repo.
- When you are ready to get some feedback on code / ideas, create a pull request to merge your fork back into my repo. That will allow me to do code review & give feedback.
- You can continue to make changes on your fork, which will be reflected in the pull request.
- Once it's all good, I'll merge it in to main and it's part of the package!
Brady thanks for the generous guide! I should have some time next week to start poking at this.