Description
Is your feature request related to a problem? Please describe.
With the new tensor objects that we have added, like the NMR shielding tensor, I think it would be great if we can add these to the universe so they can be displayed on the UniverseWidget. This way we can show them right on the molecule.
Describe the solution you'd like
I've been playing around with it and I think this would work well as we already have the functionality to display the tensors when we have a tensor attribute.
def add_tensor(self, uni):
uni.tensor = self
Describe alternatives you've considered
Write to a file and them read them? This would be a terrible way to do it.
Additional context
The code outlined above would only work to add all of the tensors and does not allow the user to select which atoms to place them on or what frame. I would add additional keywords as they become needed to include these types of cases. Maybe like this
def add_tensor(self, uni, atom=None, frame=None):
frame = 0 if frame is None else frame
frame_grouped = self.groupby('frame').get_group(frame)
atom = frame_grouped['atom'] if atom is None else atom
uni.tensor = frame_grouped[frame_grouped.index.isin(atom.index)]
Then we might be able to extend this to show multiple frames as was suggested by @adamphil some time ago. This would all exist inside of the exatomic.core.tensor.Tensor
class