-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use an MDA Universe as a "data twin" to the blender objects #455
Comments
I haven't dug into the implementation of the MDAnalysisSession object (in I am a bit worried that the MDA session is dumped to a pickle file. Although very useful for this and many other usecases, pickle files have pretty serious security vulnerabilities. So implementing any functionality around dumping/loading pickle files should be handled very carefully. |
This is already currently the case (kind of). There is a persistent handler that is added when you load an MD trajectory, which maintains the connection between the MDAnalysis MolecularNodes/molecularnodes/io/parse/mda.py Line 785 in 930006e
This could definitely be extended to do the same for selections. The same way that currently we have a list of possible selections that can be applied when importing, we could have a list of selections that are updated each frame. the handler could take the list, generate relevant boolean arrays, then update the named attributes on the mesh.
I am unfamiliar with such vulnerabilities, but I am also unfamiliar with |
I only became aware of the vulnerabilities of The real power of AFAIK, there are no other python serialization modules that can write most objects to storage. It depends on what data structure you are trying to save. If the object is a data table or dictionary, then pickle doesn't need to be used; just use
I'd be interested in using the MDAnalysis Universe for all import methods. In cases of multi-frame pdbs fetched from RCSB or loaded from local, you could still use the This isn't a high priority task for me, but I'll try to spin up a simple working example to demonstrate potential usecases. In the end, this might not be a feature that gets added to MN but a user-adapted helper script that could be run when restarting a blender instance. |
Implemented in the new |
This is a bit inspired by the idea of a "digital twin" for computer-aided manufacturing/architecture/etc but is a bit different. So here goes:
Currently, once the MolecularNodes instantiated blender object(s) are created, the associated Molecule object(s) will disappear at EOF for a script or upon killing the python interpreter panel. The Molecule object(s) are never accessible if the gui panels are used to create the blender objects. The blender objects as the final output from MN's IO and file parsing architecture. This blender object is the "visualization twin".
Currently, physical attributes associated with atoms are encoded to the blender object using biotite or MDAnalysis, depending on input files. These modules are used to gather atomic positions as well as other physical properties and encode them into the blender Object's vertices' attributes. A few of these vertex attributes, such as
is_backbone
,is_solvent
, etc, are boolean arrays denoting regularly used atom selections. But, there are instances where more dynamic selections might be desired. Getting the indices associated with atoms for complex or dynamic selections can be challenging without the use of MDAnalysis, mdtraj, biotite, or similar libraries.It could be really useful to have access to, for example, a MDAnalysis Universe object even after the blender object has been created. This "data twin" to the blender object could mirror all relevant changes to the blender object's attributes, such as updated atomic positions after translation/rotation. But maybe more helpful, MDA's atom_selection() could be used to dynamically select atoms, gather those atom indices, and create an attribute for the blender object's vertices that can be used in the MN geometry nodes to visualize specific selections.
Something like this "data twin" implementation would bring blender/MN up to par with pymol/VMD that have their own built-in atom selection->visualization capabilities.
The text was updated successfully, but these errors were encountered: