Problem:
During the visualization, the translation is reset, i.e. after the creation of the NGLView-Widget the coordinates of the molecule are the same again as in the PDB file.
Example:
import MDAnalysis as mda
from MDAnalysis.transformations.translate import translate
import numpy as np
import nglview as nv
pdb_path = 'temp.pdb'
structure1 = mda.Universe(pdb_path)
print('Before translation:')
for atom in structure1.atoms:
print(atom.position)
translate(np.array([10,10,10]))(structure1.atoms)
print('After translation:')
for atom in structure1.atoms:
print(atom.position)
nv_widget_1 = nv.show_mdanalysis(structure1)
print('After visualization:')
for atom in structure1.atoms:
print(atom.position)
nv_widget_1
Setup:
Problem: During the visualization, the translation is reset, i.e. after the creation of the NGLView-Widget the coordinates of the molecule are the same again as in the PDB file.
Example:
The output is:
I used this PDB file:
Version report nglview version: 3.0.8 ipywidgets version: 8.1.1