openforcefield / openff-toolkit

The Open Forcefield Toolkit provides implementations of the SMIRNOFF format, parameterization engine, and other tools. Documentation available at http://open-forcefield-toolkit.readthedocs.io
http://openforcefield.org
MIT License
302 stars 88 forks source link

Bug in MoleculeNGLViewTrajectory? #1771

Closed hjuinj closed 7 months ago

hjuinj commented 7 months ago

I am using openff.toolkit version 0.14.4

I am seeing a weird behaviour when visualising an openff Molecule object in jupyter (via nglview). In a jupyter cell, if I do:

from openff.toolkit.topology import Molecule
from rdkit import Chem
from rdkit.Chem import AllChem

mol = Chem.AddHs(Chem.MolFromSmiles("CO"))
AllChem.EmbedMolecule(mol)
offmol = Molecule.from_rdkit(mol)

offmol.visualize(backend = "nglview")

The visualisation displays a normal alcohol.

But if I instead try to modify the atomic metadata records, with either residue number, id or chain id, the visualisation is corrupted (and the corruption differs by the value I assign to that particular metadata):

from openff.toolkit.topology import Molecule
from rdkit import Chem
from rdkit.Chem import AllChem

mol = Chem.AddHs(Chem.MolFromSmiles("CO"))
AllChem.EmbedMolecule(mol)
offmol = Molecule.from_rdkit(mol)
offmol.atoms[0].metadata["residue_name"] = "_" #!!! offending line!

offmol.visualize(backend = "nglview")

I am not quite sure if this is to be fixed with https://github.com/openforcefield/openff-toolkit/pull/1751 by @Yoshanuikabundi , also I am trying to convince myself that the underlying molecule object is still okay? So I thought I ought to file a report just to be 100% sure.

Thank you.

mattwthompson commented 7 months ago

I'm not seeing this:

image

hjuinj commented 7 months ago

Thank you, do you observe it if you do instead:

from openff.toolkit.topology import Molecule
from rdkit import Chem
from rdkit.Chem import AllChem

mol = Chem.AddHs(Chem.MolFromSmiles("CO"))
AllChem.EmbedMolecule(mol)
offmol = Molecule.from_rdkit(mol)
for atm in offmol.atoms:
    atm.metadata["chain_id"] = "1" #!!! offending line!

offmol.visualize(backend = "nglview")

Also which version of nglview and openff-toolkit are you using?

mattwthompson commented 7 months ago

Looks the same with = "1" on my end.

image

Here's my environment - could you also share yours?

Click me # packages in environment at /Users/mattthompson/mambaforge/envs/openff-toolkit-test: # # Name Version Build Channel ambertools 23.3 py311hb11241e_6 conda-forge amberutils 21.0 pypi_0 pypi anyio 4.0.0 pyhd8ed1ab_0 conda-forge appnope 0.1.3 pyhd8ed1ab_0 conda-forge argon2-cffi 23.1.0 pyhd8ed1ab_0 conda-forge argon2-cffi-bindings 21.2.0 py311h2725bcf_4 conda-forge arpack 3.8.0 nompi_hb44a6d1_101 conda-forge arrow 1.3.0 pyhd8ed1ab_0 conda-forge asttokens 2.4.1 pyhd8ed1ab_0 conda-forge astunparse 1.6.3 pyhd8ed1ab_0 conda-forge async-lru 2.0.4 pyhd8ed1ab_0 conda-forge attrs 23.1.0 pyh71513ae_1 conda-forge aws-c-auth 0.7.5 hc3630cc_4 conda-forge aws-c-cal 0.6.9 h49e9720_1 conda-forge aws-c-common 0.9.8 h10d778d_0 conda-forge aws-c-compression 0.2.17 hff1f2c8_6 conda-forge aws-c-event-stream 0.3.2 hb6e475e_6 conda-forge aws-c-http 0.7.14 h950a07a_1 conda-forge aws-c-io 0.13.35 hb98174f_8 conda-forge aws-c-mqtt 0.9.9 h5e4a26e_0 conda-forge aws-c-s3 0.3.22 hebde1ec_3 conda-forge aws-c-sdkutils 0.1.12 hff1f2c8_5 conda-forge aws-checksums 0.1.17 hff1f2c8_5 conda-forge aws-crt-cpp 0.24.5 h788c88f_3 conda-forge aws-sdk-cpp 1.11.182 h8f92232_5 conda-forge babel 2.13.1 pyhd8ed1ab_0 conda-forge backports 1.0 pyhd8ed1ab_3 conda-forge backports.functools_lru_cache 1.6.5 pyhd8ed1ab_0 conda-forge beautifulsoup4 4.12.2 pyha770c72_0 conda-forge bleach 6.1.0 pyhd8ed1ab_0 conda-forge blosc 1.21.5 heccf04b_0 conda-forge brotli 1.1.0 h0dc2134_1 conda-forge brotli-bin 1.1.0 h0dc2134_1 conda-forge brotli-python 1.1.0 py311hdf8f085_1 conda-forge bson 0.5.9 py_0 conda-forge bzip2 1.0.8 h10d778d_5 conda-forge c-ares 1.21.0 h10d778d_0 conda-forge c-blosc2 2.11.2 h354e526_0 conda-forge ca-certificates 2023.08.22 hecd8cb5_0 cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge cachetools 5.3.2 pyhd8ed1ab_0 conda-forge cairo 1.18.0 h99e66fa_0 conda-forge certifi 2023.7.22 pyhd8ed1ab_0 conda-forge cffi 1.16.0 py311hc0b63fd_0 conda-forge cfgv 3.4.0 pypi_0 pypi charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge click 8.1.7 unix_pyh707e725_0 conda-forge click-option-group 0.5.6 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge comm 0.1.4 pyhd8ed1ab_0 conda-forge contourpy 1.2.0 py311h7bea37d_0 conda-forge coverage 7.3.2 py311h2725bcf_0 conda-forge cycler 0.12.1 pyhd8ed1ab_0 conda-forge debugpy 1.8.0 py311hdf8f085_1 conda-forge decorator 5.1.1 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge distlib 0.3.7 pypi_0 pypi edgembar 0.2 pypi_0 pypi entrypoints 0.4 pyhd8ed1ab_0 conda-forge exceptiongroup 1.1.3 pyhd8ed1ab_0 conda-forge execnet 2.0.2 pyhd8ed1ab_0 conda-forge executing 2.0.1 pyhd8ed1ab_0 conda-forge expat 2.5.0 hf0c8a7f_1 conda-forge fftw 3.3.10 nompi_h4fa670e_108 conda-forge filelock 3.13.1 pyhd8ed1ab_0 conda-forge font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 3.000 h77eed37_0 conda-forge font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge font-ttf-ubuntu 0.83 hab24e00_0 conda-forge fontconfig 2.14.2 h5bb23bf_0 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge fonttools 4.44.0 py311he705e18_0 conda-forge fqdn 1.5.1 pyhd8ed1ab_0 conda-forge freetype 2.12.1 h60636b9_2 conda-forge freetype-py 2.3.0 pyhd8ed1ab_0 conda-forge fsspec 2023.10.0 pyhca7485f_0 conda-forge gettext 0.21.1 h8a4c099_0 conda-forge gflags 2.2.2 hb1e8313_1004 conda-forge glog 0.6.0 h8ac2a54_0 conda-forge gmp 6.3.0 h93d8f39_0 conda-forge gmpy2 2.1.2 py311hc5b4402_1 conda-forge greenlet 3.0.1 py311hd39e593_0 conda-forge h5py 3.10.0 nompi_py311he02c01d_100 conda-forge hdf4 4.2.15 h8138101_7 conda-forge hdf5 1.14.2 nompi_hedada53_100 conda-forge icu 73.2 hf5e326d_0 conda-forge identify 2.5.31 pypi_0 pypi idna 3.4 pyhd8ed1ab_0 conda-forge importlib-metadata 6.8.0 pyha770c72_0 conda-forge importlib_metadata 6.8.0 hd8ed1ab_0 conda-forge importlib_resources 6.1.1 pyhd8ed1ab_0 conda-forge iniconfig 2.0.0 pyhd8ed1ab_0 conda-forge ipdb 0.13.13 pypi_0 pypi ipykernel 6.26.0 pyh3cd1d5f_0 conda-forge ipython 8.17.2 pyh31c8845_0 conda-forge ipywidgets 8.1.1 pyhd8ed1ab_0 conda-forge isoduration 20.11.0 pyhd8ed1ab_0 conda-forge jedi 0.19.1 pyhd8ed1ab_0 conda-forge jinja2 3.1.2 pyhd8ed1ab_1 conda-forge joblib 1.3.2 pyhd8ed1ab_0 conda-forge json5 0.9.14 pyhd8ed1ab_0 conda-forge jsonpointer 2.4 py311h6eed73b_3 conda-forge jsonschema 4.19.2 pyhd8ed1ab_0 conda-forge jsonschema-specifications 2023.7.1 pyhd8ed1ab_0 conda-forge jsonschema-with-format-nongpl 4.19.2 pyhd8ed1ab_0 conda-forge jupyter-lsp 2.2.0 pyhd8ed1ab_0 conda-forge jupyter_client 8.6.0 pyhd8ed1ab_0 conda-forge jupyter_core 5.5.0 py311h6eed73b_0 conda-forge jupyter_events 0.9.0 pyhd8ed1ab_0 conda-forge jupyter_server 2.10.1 pyhd8ed1ab_0 conda-forge jupyter_server_terminals 0.4.4 pyhd8ed1ab_1 conda-forge jupyterlab 4.0.8 pyhd8ed1ab_0 conda-forge jupyterlab_pygments 0.2.2 pyhd8ed1ab_0 conda-forge jupyterlab_server 2.25.1 pyhd8ed1ab_0 conda-forge jupyterlab_widgets 3.0.9 pyhd8ed1ab_0 conda-forge khronos-opencl-icd-loader 2023.04.17 hb7f2c08_0 conda-forge kiwisolver 1.4.5 py311h5fe6e05_1 conda-forge krb5 1.21.2 hb884880_0 conda-forge lcms2 2.15 hd6ba6f3_3 conda-forge lerc 4.0.0 hb486fe8_0 conda-forge libabseil 20230802.1 cxx17_h048a20a_0 conda-forge libaec 1.1.2 he965462_1 conda-forge libarrow 14.0.1 hcf474e5_1_cpu conda-forge libarrow-acero 14.0.1 hc222712_1_cpu conda-forge libarrow-dataset 14.0.1 hc222712_1_cpu conda-forge libarrow-flight 14.0.1 ha1803ca_1_cpu conda-forge libarrow-flight-sql 14.0.1 h8ec153b_1_cpu conda-forge libarrow-gandiva 14.0.1 heeebe7c_1_cpu conda-forge libarrow-substrait 14.0.1 h8ec153b_1_cpu conda-forge libblas 3.9.0 19_osx64_openblas conda-forge libboost 1.82.0 hf0c313a_6 conda-forge libboost-python 1.82.0 py311hd5c4f45_6 conda-forge libbrotlicommon 1.1.0 h0dc2134_1 conda-forge libbrotlidec 1.1.0 h0dc2134_1 conda-forge libbrotlienc 1.1.0 h0dc2134_1 conda-forge libcblas 3.9.0 19_osx64_openblas conda-forge libcrc32c 1.1.2 he49afe7_0 conda-forge libcurl 8.4.0 h726d00d_0 conda-forge libcxx 16.0.6 hd57cbcb_0 conda-forge libdeflate 1.19 ha4e1b8e_0 conda-forge libedit 3.1.20191231 h0678c8f_2 conda-forge libev 4.33 haf1e3a3_1 conda-forge libevent 2.1.12 ha90c15b_1 conda-forge libexpat 2.5.0 hf0c8a7f_1 conda-forge libffi 3.4.2 h0d85af4_5 conda-forge libgfortran 5.0.0 13_2_0_h97931a8_1 conda-forge libgfortran5 13.2.0 h2873a65_1 conda-forge libglib 2.78.1 h6d9ecee_0 conda-forge libgoogle-cloud 2.12.0 hc0857f6_4 conda-forge libgrpc 1.59.2 ha7f534c_0 conda-forge libiconv 1.17 hac89ed1_0 conda-forge libjpeg-turbo 3.0.0 h0dc2134_1 conda-forge liblapack 3.9.0 19_osx64_openblas conda-forge libllvm15 15.0.7 he4b1e75_3 conda-forge libnetcdf 4.9.2 nompi_h6a32802_112 conda-forge libnghttp2 1.58.0 h64cf6d3_0 conda-forge libopenblas 0.3.24 openmp_h48a4ad5_0 conda-forge libparquet 14.0.1 h27bd29f_1_cpu conda-forge libpng 1.6.39 ha978bb4_0 conda-forge libprotobuf 4.24.4 h0ee05dc_0 conda-forge libre2-11 2023.06.02 h4694dbf_0 conda-forge libsodium 1.0.18 hbcb3906_1 conda-forge libsqlite 3.44.0 h92b6c6a_0 conda-forge libssh2 1.11.0 hd019ec5_0 conda-forge libthrift 0.19.0 h064b379_1 conda-forge libtiff 4.6.0 h684deea_2 conda-forge libutf8proc 2.8.0 hb7f2c08_0 conda-forge libuv 1.46.0 h0c2f820_0 conda-forge libwebp-base 1.3.2 h0dc2134_0 conda-forge libxcb 1.15 hb7f2c08_0 conda-forge libxml2 2.11.5 h3346baf_1 conda-forge libzip 1.10.1 hc158999_3 conda-forge libzlib 1.2.13 h8a1eda9_5 conda-forge lightning-utilities 0.9.0 pyhd8ed1ab_0 conda-forge llvm-openmp 17.0.4 hb6ac08f_0 conda-forge lz4-c 1.9.4 hf0c8a7f_0 conda-forge markdown-it-py 3.0.0 pyhd8ed1ab_0 conda-forge markupsafe 2.1.3 py311h2725bcf_1 conda-forge matplotlib-base 3.8.1 py311hd316c10_0 conda-forge matplotlib-inline 0.1.6 pyhd8ed1ab_0 conda-forge mdtraj 1.9.9 py311h8f92aaa_0 conda-forge mdurl 0.1.0 pyhd8ed1ab_0 conda-forge mistune 3.0.2 pyhd8ed1ab_0 conda-forge mkl 2022.2.1 h44ed08c_16952 conda-forge mmpbsa-py 16.0 pypi_0 pypi mongo-types 0.15.1 pypi_0 pypi mpc 1.3.1 h81bd1dd_0 conda-forge mpfr 4.2.1 h0c69b56_0 conda-forge mpmath 1.3.0 pyhd8ed1ab_0 conda-forge msgpack-python 1.0.6 py311h5fe6e05_0 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge mypy 1.7.0 py311he705e18_0 conda-forge mypy_extensions 1.0.0 pyha770c72_0 conda-forge nbclient 0.8.0 pyhd8ed1ab_0 conda-forge nbconvert-core 7.11.0 pyhd8ed1ab_0 conda-forge nbformat 5.9.2 pyhd8ed1ab_0 conda-forge nbval 0.10.0 pyhd8ed1ab_0 conda-forge ncurses 6.4 h93d8f39_2 conda-forge nest-asyncio 1.5.8 pyhd8ed1ab_0 conda-forge netcdf-fortran 4.6.1 nompi_ha9164e6_102 conda-forge networkx 3.2.1 pyhd8ed1ab_0 conda-forge nglview 3.0.8 pyh1da8cd4_0 conda-forge nodeenv 1.8.0 pypi_0 pypi notebook-shim 0.2.3 pyhd8ed1ab_0 conda-forge numexpr 2.8.7 py311h1eadf79_4 conda-forge numpy 1.26.0 py311hc44ba51_0 conda-forge ocl_icd_wrapper_apple 1.0.0 hbcb3906_0 conda-forge openeye-toolkits 2023.1.1 py311_0 openeye openff-amber-ff-ports 0.0.4 pyhca7485f_0 conda-forge openff-forcefields 2023.11.0 pyhca7485f_0 conda-forge openff-interchange 0.3.17+13.g3e60d6e7 pypi_0 pypi openff-models 0.1.1 pyhca7485f_0 conda-forge openff-nagl-base 0.3.0 pyhd8ed1ab_0 conda-forge openff-nagl-models 0.1.0 pyhd8ed1ab_0 conda-forge openff-test-parameter-plugins 0.0.0 pypi_0 pypi openff-toolkit 0.14.5+7.g9a39d2dd dev_0 openff-units 0.2.0 pyh1a96a4e_2 conda-forge openff-utilities 0.1.11 pyhd8ed1ab_0 conda-forge openjpeg 2.5.0 ha4da562_3 conda-forge openmm 8.0.0 py311h6a72b20_4_khronos conda-forge openssl 3.1.4 hd75f5a5_0 conda-forge orc 1.9.0 hd1092d7_4 conda-forge overrides 7.4.0 pyhd8ed1ab_0 conda-forge packaging 23.2 pyhd8ed1ab_0 conda-forge packmol 20.010 h508aa58_0 conda-forge packmol-memgen 2023.2.24 pypi_0 pypi pandas 2.1.2 py311h1eadf79_0 conda-forge pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge parmed 4.2.2 py311hd39e593_1 conda-forge parso 0.8.3 pyhd8ed1ab_0 conda-forge pcre2 10.40 h1c4e4bc_0 conda-forge pdb4amber 22.0 pypi_0 pypi pdbfixer 1.9 pyh1a96a4e_0 conda-forge perl 5.32.1 4_h0dc2134_perl5 conda-forge pexpect 4.8.0 pyh1a96a4e_2 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 10.1.0 py311hea5c87a_0 conda-forge pint 0.21 pyhd8ed1ab_0 conda-forge pip 23.3.1 pyhd8ed1ab_0 conda-forge pixman 0.42.2 he965462_0 conda-forge pkgutil-resolve-name 1.3.10 pyhd8ed1ab_1 conda-forge platformdirs 3.11.0 pyhd8ed1ab_0 conda-forge plotly 5.18.0 pyhd8ed1ab_0 conda-forge pluggy 1.3.0 pyhd8ed1ab_0 conda-forge pre-commit 3.5.0 pypi_0 pypi prometheus_client 0.18.0 pyhd8ed1ab_1 conda-forge prompt-toolkit 3.0.40 pyha770c72_0 conda-forge prompt_toolkit 3.0.40 hd8ed1ab_0 conda-forge psutil 5.9.5 py311h2725bcf_1 conda-forge pthread-stubs 0.4 hc929b4f_1001 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge py-cpuinfo 9.0.0 pyhd8ed1ab_0 conda-forge pyarrow 14.0.1 py311h98a0319_1_cpu conda-forge pycairo 1.25.1 py311h389a0fd_0 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pydantic 1.10.13 py311he705e18_1 conda-forge pygments 2.16.1 pyhd8ed1ab_0 conda-forge pymsmt 22.0 pypi_0 pypi pyobjc-core 10.0 py311hf110eff_0 conda-forge pyobjc-framework-cocoa 10.0 py311hf110eff_1 conda-forge pyparsing 3.1.1 pyhd8ed1ab_0 conda-forge pysocks 1.7.1 pyha2e5f31_6 conda-forge pytables 3.9.1 py311h3cee394_0 conda-forge pytest 7.4.3 pyhd8ed1ab_0 conda-forge pytest-cov 4.1.0 pyhd8ed1ab_0 conda-forge pytest-rerunfailures 12.0 pyhd8ed1ab_0 conda-forge pytest-xdist 3.4.0 pyhd8ed1ab_0 conda-forge python 3.11.6 h30d4d87_0_cpython conda-forge python-constraint 1.4.0 py_0 conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-fastjsonschema 2.18.1 pyhd8ed1ab_0 conda-forge python-json-logger 2.0.7 pyhd8ed1ab_0 conda-forge python-tzdata 2023.3 pyhd8ed1ab_0 conda-forge python_abi 3.11 4_cp311 conda-forge pytorch 2.1.0 cpu_mkl_py311h5cbed28_100 conda-forge pytorch-lightning 2.1.0 pyhd8ed1ab_0 conda-forge pytraj 2.0.6 pypi_0 pypi pytz 2023.3.post1 pyhd8ed1ab_0 conda-forge pyyaml 6.0.1 py311h2725bcf_1 conda-forge pyzmq 25.1.1 py311he3804a1_2 conda-forge rdkit 2023.09.2 py311hf9bb1d1_0 conda-forge re2 2023.06.02 hd34609a_0 conda-forge readline 8.2 h9e318b2_1 conda-forge referencing 0.30.2 pyhd8ed1ab_0 conda-forge reportlab 4.0.7 py311he705e18_0 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge rfc3339-validator 0.1.4 pyhd8ed1ab_0 conda-forge rfc3986-validator 0.1.1 pyh9f0ad1d_0 conda-forge rich 13.6.0 pyhd8ed1ab_0 conda-forge rlpycairo 0.2.0 pyhd8ed1ab_0 conda-forge rpds-py 0.12.0 py311h5e0f0e4_0 conda-forge sander 22.0 pypi_0 pypi scipy 1.11.3 py311h16c3c4d_1 conda-forge send2trash 1.8.2 pyhd1c38e8_0 conda-forge setuptools 68.2.2 pyhd8ed1ab_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge sleef 3.5.1 h6db0672_2 conda-forge smirnoff99frosst 1.1.0 pyh44b312d_0 conda-forge snappy 1.1.10 h225ccf5_0 conda-forge sniffio 1.3.0 pyhd8ed1ab_0 conda-forge soupsieve 2.5 pyhd8ed1ab_1 conda-forge sqlalchemy 2.0.23 py311he705e18_0 conda-forge stack_data 0.6.2 pyhd8ed1ab_0 conda-forge sympy 1.12 pypyh9d50eac_103 conda-forge tbb 2021.10.0 h1c7c39f_2 conda-forge tenacity 8.2.3 pyhd8ed1ab_0 conda-forge terminado 0.18.0 pyh31c8845_0 conda-forge tinycss2 1.2.1 pyhd8ed1ab_0 conda-forge tk 8.6.13 h1abcd95_1 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge torchmetrics 1.2.0 pyhd8ed1ab_0 conda-forge tornado 6.3.3 py311h2725bcf_1 conda-forge tqdm 4.66.1 pyhd8ed1ab_0 conda-forge traitlets 5.13.0 pyhd8ed1ab_0 conda-forge types-python-dateutil 2.8.19.14 pyhd8ed1ab_0 conda-forge types-pyyaml 6.0.12.12 pypi_0 pypi types-setuptools 68.2.0.1 pypi_0 pypi types-toml 0.10.8.7 pypi_0 pypi typing-extensions 4.8.0 hd8ed1ab_0 conda-forge typing_extensions 4.8.0 pyha770c72_0 conda-forge typing_utils 0.1.0 pyhd8ed1ab_0 conda-forge tzdata 2023c h71feb2d_0 conda-forge uri-template 1.3.0 pyhd8ed1ab_0 conda-forge urllib3 2.0.7 pyhd8ed1ab_0 conda-forge virtualenv 20.24.6 pypi_0 pypi wcwidth 0.2.9 pyhd8ed1ab_0 conda-forge webcolors 1.13 pyhd8ed1ab_0 conda-forge webencodings 0.5.1 pyhd8ed1ab_2 conda-forge websocket-client 1.6.4 pyhd8ed1ab_0 conda-forge wheel 0.41.3 pyhd8ed1ab_0 conda-forge widgetsnbextension 4.0.9 pyhd8ed1ab_0 conda-forge xmltodict 0.13.0 pyhd8ed1ab_0 conda-forge xorg-kbproto 1.0.7 h35c211d_1002 conda-forge xorg-libice 1.1.1 h0dc2134_0 conda-forge xorg-libsm 1.2.4 h0dc2134_0 conda-forge xorg-libx11 1.8.7 hbd0b022_0 conda-forge xorg-libxau 1.0.11 h0dc2134_0 conda-forge xorg-libxdmcp 1.1.3 h35c211d_0 conda-forge xorg-libxext 1.3.4 hb7f2c08_2 conda-forge xorg-libxt 1.3.0 h0dc2134_1 conda-forge xorg-xextproto 7.3.0 hb7f2c08_1003 conda-forge xorg-xproto 7.0.31 h35c211d_1007 conda-forge xz 5.2.6 h775f41a_0 conda-forge yaml 0.2.5 h0d85af4_2 conda-forge zeromq 4.3.5 h93d8f39_0 conda-forge zipp 3.17.0 pyhd8ed1ab_0 conda-forge zlib 1.2.13 h8a1eda9_5 conda-forge zlib-ng 2.0.7 hb7f2c08_0 conda-forge zstd 1.5.5 h829000d_0 conda-forge
hjuinj commented 7 months ago

this is super weird,

I created a minimal env:

name: foo
channels:
  - conda-forge
dependencies:
  - nglview
  - openff-toolkit
  - rdkit

and I have micromamba to create env.

The resulting env has the following versions:

List of packages in environment: "/micromamba/envs/to_delete"

  Name                           Version       Build                Channel    
─────────────────────────────────────────────────────────────────────────────────
  _libgcc_mutex                  0.1           conda_forge          conda-forge
  _openmp_mutex                  4.5           2_gnu                conda-forge
  ambertools                     23.3          py311h9fea076_6      conda-forge
  annotated-types                0.6.0         pyhd8ed1ab_0         conda-forge
  anyio                          4.0.0         pyhd8ed1ab_0         conda-forge
  argon2-cffi                    23.1.0        pyhd8ed1ab_0         conda-forge
  argon2-cffi-bindings           21.2.0        py311h459d7ec_4      conda-forge
  arpack                         3.8.0         nompi_h0baa96a_101   conda-forge
  arrow                          1.3.0         pyhd8ed1ab_0         conda-forge
  asttokens                      2.4.1         pyhd8ed1ab_0         conda-forge
  astunparse                     1.6.3         pyhd8ed1ab_0         conda-forge
  async-lru                      2.0.4         pyhd8ed1ab_0         conda-forge
  attrs                          23.1.0        pyh71513ae_1         conda-forge
  babel                          2.13.1        pyhd8ed1ab_0         conda-forge
  backports                      1.0           pyhd8ed1ab_3         conda-forge
  backports.functools_lru_cache  1.6.5         pyhd8ed1ab_0         conda-forge
  beautifulsoup4                 4.12.2        pyha770c72_0         conda-forge
  bleach                         6.1.0         pyhd8ed1ab_0         conda-forge
  blosc                          1.21.5        h0f2a231_0           conda-forge
  brotli                         1.1.0         hd590300_1           conda-forge
  brotli-bin                     1.1.0         hd590300_1           conda-forge
  brotli-python                  1.1.0         py311hb755f60_1      conda-forge
  bson                           0.5.9         py_0                 conda-forge
  bzip2                          1.0.8         hd590300_5           conda-forge
  c-ares                         1.21.0        hd590300_0           conda-forge
  c-blosc2                       2.11.2        hb4ffafa_0           conda-forge
  ca-certificates                2023.7.22     hbcca054_0           conda-forge
  cached-property                1.5.2         hd8ed1ab_1           conda-forge
  cached_property                1.5.2         pyha770c72_1         conda-forge
  cachetools                     5.3.2         pyhd8ed1ab_0         conda-forge
  cairo                          1.18.0        h3faef2a_0           conda-forge
  certifi                        2023.7.22     pyhd8ed1ab_0         conda-forge
  cffi                           1.16.0        py311hb3a22ac_0      conda-forge
  charset-normalizer             3.3.2         pyhd8ed1ab_0         conda-forge
  colorama                       0.4.6         pyhd8ed1ab_0         conda-forge
  comm                           0.1.4         pyhd8ed1ab_0         conda-forge
  contourpy                      1.2.0         py311h9547e67_0      conda-forge
  cudatoolkit                    11.8.0        h4ba93d1_12          conda-forge
  cycler                         0.12.1        pyhd8ed1ab_0         conda-forge
  debugpy                        1.8.0         py311hb755f60_1      conda-forge
  decorator                      5.1.1         pyhd8ed1ab_0         conda-forge
  defusedxml                     0.7.1         pyhd8ed1ab_0         conda-forge
  entrypoints                    0.4           pyhd8ed1ab_0         conda-forge
  exceptiongroup                 1.1.3         pyhd8ed1ab_0         conda-forge
  executing                      2.0.1         pyhd8ed1ab_0         conda-forge
  expat                          2.5.0         hcb278e6_1           conda-forge
  fftw                           3.3.10        nompi_hc118613_108   conda-forge
  font-ttf-dejavu-sans-mono      2.37          hab24e00_0           conda-forge
  font-ttf-inconsolata           3.000         h77eed37_0           conda-forge
  font-ttf-source-code-pro       2.038         h77eed37_0           conda-forge
  font-ttf-ubuntu                0.83          hab24e00_0           conda-forge
  fontconfig                     2.14.2        h14ed4e7_0           conda-forge
  fonts-conda-ecosystem          1             0                    conda-forge
  fonts-conda-forge              1             0                    conda-forge
  fonttools                      4.44.3        py311h459d7ec_0      conda-forge
  fqdn                           1.5.1         pyhd8ed1ab_0         conda-forge
  freetype                       2.12.1        h267a509_2           conda-forge
  freetype-py                    2.3.0         pyhd8ed1ab_0         conda-forge
  gettext                        0.21.1        h27087fc_0           conda-forge
  greenlet                       3.0.1         py311hb755f60_0      conda-forge
  hdf4                           4.2.15        h2a13503_7           conda-forge
  hdf5                           1.14.2        nompi_h4f84152_100   conda-forge
  icu                            73.2          h59595ed_0           conda-forge
  idna                           3.4           pyhd8ed1ab_0         conda-forge
  importlib-metadata             6.8.0         pyha770c72_0         conda-forge
  importlib_metadata             6.8.0         hd8ed1ab_0           conda-forge
  importlib_resources            6.1.1         pyhd8ed1ab_0         conda-forge
  ipykernel                      6.26.0        pyhf8b6a83_0         conda-forge
  ipython                        8.17.2        pyh41d4057_0         conda-forge
  ipywidgets                     8.1.1         pyhd8ed1ab_0         conda-forge
  isoduration                    20.11.0       pyhd8ed1ab_0         conda-forge
  jedi                           0.19.1        pyhd8ed1ab_0         conda-forge
  jinja2                         3.1.2         pyhd8ed1ab_1         conda-forge
  joblib                         1.3.2         pyhd8ed1ab_0         conda-forge
  json5                          0.9.14        pyhd8ed1ab_0         conda-forge
  jsonpointer                    2.4           py311h38be061_3      conda-forge
  jsonschema                     4.20.0        pyhd8ed1ab_0         conda-forge
  jsonschema-specifications      2023.11.1     pyhd8ed1ab_0         conda-forge
  jsonschema-with-format-nongpl  4.20.0        pyhd8ed1ab_0         conda-forge
  jupyter-lsp                    2.2.0         pyhd8ed1ab_0         conda-forge
  jupyter_client                 8.6.0         pyhd8ed1ab_0         conda-forge
  jupyter_core                   5.5.0         py311h38be061_0      conda-forge
  jupyter_events                 0.9.0         pyhd8ed1ab_0         conda-forge
  jupyter_server                 2.10.1        pyhd8ed1ab_0         conda-forge
  jupyter_server_terminals       0.4.4         pyhd8ed1ab_1         conda-forge
  jupyterlab                     4.0.8         pyhd8ed1ab_0         conda-forge
  jupyterlab_pygments            0.2.2         pyhd8ed1ab_0         conda-forge
  jupyterlab_server              2.25.1        pyhd8ed1ab_0         conda-forge
  jupyterlab_widgets             3.0.9         pyhd8ed1ab_0         conda-forge
  keyutils                       1.6.1         h166bdaf_0           conda-forge
  kiwisolver                     1.4.5         py311h9547e67_1      conda-forge
  krb5                           1.21.2        h659d440_0           conda-forge
  lcms2                          2.15          hb7c19ff_3           conda-forge
  ld_impl_linux-64               2.40          h41732ed_0           conda-forge
  lerc                           4.0.0         h27087fc_0           conda-forge
  libaec                         1.1.2         h59595ed_1           conda-forge
  libblas                        3.9.0         19_linux64_openblas  conda-forge
  libboost                       1.82.0        h6fcfa73_6           conda-forge
  libboost-python                1.82.0        py311h92ebd52_6      conda-forge
  libbrotlicommon                1.1.0         hd590300_1           conda-forge
  libbrotlidec                   1.1.0         hd590300_1           conda-forge
  libbrotlienc                   1.1.0         hd590300_1           conda-forge
  libcblas                       3.9.0         19_linux64_openblas  conda-forge
  libcurl                        8.4.0         hca28451_0           conda-forge
  libdeflate                     1.19          hd590300_0           conda-forge
  libedit                        3.1.20191231  he28a2e2_2           conda-forge
  libev                          4.33          h516909a_1           conda-forge
  libexpat                       2.5.0         hcb278e6_1           conda-forge
  libffi                         3.4.2         h7f98852_5           conda-forge
  libgcc-ng                      13.2.0        h807b86a_3           conda-forge
  libgfortran-ng                 13.2.0        h69a702a_3           conda-forge
  libgfortran5                   13.2.0        ha4646dd_3           conda-forge
  libglib                        2.78.1        h783c2da_1           conda-forge
  libgomp                        13.2.0        h807b86a_3           conda-forge
  libiconv                       1.17          h166bdaf_0           conda-forge
  libjpeg-turbo                  3.0.0         hd590300_1           conda-forge
  liblapack                      3.9.0         19_linux64_openblas  conda-forge
  libnetcdf                      4.9.2         nompi_h80fb2b6_112   conda-forge
  libnghttp2                     1.58.0        h47da74e_0           conda-forge
  libnsl                         2.0.1         hd590300_0           conda-forge
  libopenblas                    0.3.24        pthreads_h413a1c8_0  conda-forge
  libpng                         1.6.39        h753d276_0           conda-forge
  libsodium                      1.0.18        h36c2ea0_1           conda-forge
  libsqlite                      3.44.0        h2797004_0           conda-forge
  libssh2                        1.11.0        h0841786_0           conda-forge
  libstdcxx-ng                   13.2.0        h7e041cc_3           conda-forge
  libtiff                        4.6.0         ha9c0a0a_2           conda-forge
  libuuid                        2.38.1        h0b41bf4_0           conda-forge
  libwebp-base                   1.3.2         hd590300_0           conda-forge
  libxcb                         1.15          h0b41bf4_0           conda-forge
  libxml2                        2.11.5        h232c23b_1           conda-forge
  libzip                         1.10.1        h2629f0a_3           conda-forge
  libzlib                        1.2.13        hd590300_5           conda-forge
  lz4-c                          1.9.4         hcb278e6_0           conda-forge
  lzo                            2.10          h516909a_1000        conda-forge
  markupsafe                     2.1.3         py311h459d7ec_1      conda-forge
  matplotlib-base                3.8.1         py311h54ef318_0      conda-forge
  matplotlib-inline              0.1.6         pyhd8ed1ab_0         conda-forge
  mda-xdrlib                     0.2.0         pyhd8ed1ab_0         conda-forge
  mdtraj                         1.9.9         py311h90fe790_1      conda-forge
  mistune                        3.0.2         pyhd8ed1ab_0         conda-forge
  munkres                        1.1.4         pyh9f0ad1d_0         conda-forge
  nbclient                       0.8.0         pyhd8ed1ab_0         conda-forge
  nbconvert-core                 7.11.0        pyhd8ed1ab_0         conda-forge
  nbformat                       5.9.2         pyhd8ed1ab_0         conda-forge
  ncurses                        6.4           h59595ed_2           conda-forge
  nest-asyncio                   1.5.8         pyhd8ed1ab_0         conda-forge
  netcdf-fortran                 4.6.1         nompi_hacb5139_102   conda-forge
  networkx                       3.2.1         pyhd8ed1ab_0         conda-forge
  nglview                        3.0.8         pyh1da8cd4_0         conda-forge
  nomkl                          1.0           h5ca1d4c_0           conda-forge
  notebook                       7.0.6         pyhd8ed1ab_0         conda-forge
  notebook-shim                  0.2.3         pyhd8ed1ab_0         conda-forge
  numexpr                        2.8.7         py311h039bad6_104    conda-forge
  numpy                          1.26.0        py311h64a7726_0      conda-forge
  ocl-icd                        2.3.1         h7f98852_0           conda-forge
  ocl-icd-system                 1.0.0         1                    conda-forge
  openff-amber-ff-ports          0.0.4         pyhca7485f_0         conda-forge
  openff-forcefields             2023.11.0     pyhca7485f_0         conda-forge
  openff-interchange             0.3.18        pyhd8ed1ab_0         conda-forge
  openff-interchange-base        0.3.18        pyhd8ed1ab_0         conda-forge
  openff-models                  0.1.1         pyhca7485f_0         conda-forge
  openff-toolkit                 0.14.5        pyhd8ed1ab_1         conda-forge
  openff-toolkit-base            0.14.5        pyhd8ed1ab_1         conda-forge
  openff-units                   0.2.1         pyh1a96a4e_0         conda-forge
  openff-utilities               0.1.11        pyhd8ed1ab_0         conda-forge
  openjpeg                       2.5.0         h488ebb8_3           conda-forge
  openmm                         8.0.0         py311h9766050_4      conda-forge
  openssl                        3.1.4         hd590300_0           conda-forge
  overrides                      7.4.0         pyhd8ed1ab_0         conda-forge
  packaging                      23.2          pyhd8ed1ab_0         conda-forge
  packmol                        20.010        h86c2bf4_0           conda-forge
  pandas                         2.1.3         py311h320fe9a_0      conda-forge
  pandocfilters                  1.5.0         pyhd8ed1ab_0         conda-forge
  panedr                         0.7.2         pyhd8ed1ab_0         conda-forge
  parmed                         4.2.2         py311hb755f60_1      conda-forge
  parso                          0.8.3         pyhd8ed1ab_0         conda-forge
  pbr                            6.0.0         pyhd8ed1ab_0         conda-forge
  pcre2                          10.42         hcad00b1_0           conda-forge
  perl                           5.32.1        4_hd590300_perl5     conda-forge
  pexpect                        4.8.0         pyh1a96a4e_2         conda-forge
  pickleshare                    0.7.5         py_1003              conda-forge
  pillow                         10.1.0        py311ha6c5da5_0      conda-forge
  pint                           0.21          pyhd8ed1ab_0         conda-forge
  pip                            23.3.1        pyhd8ed1ab_0         conda-forge
  pixman                         0.42.2        h59595ed_0           conda-forge
  pkgutil-resolve-name           1.3.10        pyhd8ed1ab_1         conda-forge
  platformdirs                   4.0.0         pyhd8ed1ab_0         conda-forge
  prometheus_client              0.18.0        pyhd8ed1ab_1         conda-forge
  prompt-toolkit                 3.0.41        pyha770c72_0         conda-forge
  prompt_toolkit                 3.0.41        hd8ed1ab_0           conda-forge
  psutil                         5.9.5         py311h459d7ec_1      conda-forge
  pthread-stubs                  0.4           h36c2ea0_1001        conda-forge
  ptyprocess                     0.7.0         pyhd3deb0d_0         conda-forge
  pure_eval                      0.2.2         pyhd8ed1ab_0         conda-forge
  py-cpuinfo                     9.0.0         pyhd8ed1ab_0         conda-forge
  pycairo                        1.25.1        py311h8feb60e_0      conda-forge
  pycparser                      2.21          pyhd8ed1ab_0         conda-forge
  pydantic                       2.5.1         pyhd8ed1ab_0         conda-forge
  pydantic-core                  2.14.3        py311h46250e7_0      conda-forge
  pyedr                          0.7.2         pyhd8ed1ab_0         conda-forge
  pygments                       2.16.1        pyhd8ed1ab_0         conda-forge
  pyparsing                      3.1.1         pyhd8ed1ab_0         conda-forge
  pysocks                        1.7.1         pyha2e5f31_6         conda-forge
  pytables                       3.9.1         py311h10c7f7f_0      conda-forge
  python                         3.11.6        hab00c5b_0_cpython   conda-forge
  python-constraint              1.4.0         py_0                 conda-forge
  python-dateutil                2.8.2         pyhd8ed1ab_0         conda-forge
  python-fastjsonschema          2.19.0        pyhd8ed1ab_0         conda-forge
  python-json-logger             2.0.7         pyhd8ed1ab_0         conda-forge
  python-tzdata                  2023.3        pyhd8ed1ab_0         conda-forge
  python_abi                     3.11          4_cp311              conda-forge
  pytz                           2023.3.post1  pyhd8ed1ab_0         conda-forge
  pyyaml                         6.0.1         py311h459d7ec_1      conda-forge
  pyzmq                          25.1.1        py311h34ded2d_2      conda-forge
  rdkit                          2023.09.2     py311h4c2f14b_0      conda-forge
  readline                       8.2           h8228510_1           conda-forge
  referencing                    0.31.0        pyhd8ed1ab_0         conda-forge
  reportlab                      4.0.7         py311h459d7ec_0      conda-forge
  requests                       2.31.0        pyhd8ed1ab_0         conda-forge
  rfc3339-validator              0.1.4         pyhd8ed1ab_0         conda-forge
  rfc3986-validator              0.1.1         pyh9f0ad1d_0         conda-forge
  rlpycairo                      0.2.0         pyhd8ed1ab_0         conda-forge
  rpds-py                        0.13.0        py311h46250e7_0      conda-forge
  scipy                          1.11.3        py311h64a7726_1      conda-forge
  send2trash                     1.8.2         pyh41d4057_0         conda-forge
  setuptools                     68.2.2        pyhd8ed1ab_0         conda-forge
  six                            1.16.0        pyh6c4a22f_0         conda-forge
  smirnoff99frosst               1.1.0         pyh44b312d_0         conda-forge
  snappy                         1.1.10        h9fff704_0           conda-forge
  sniffio                        1.3.0         pyhd8ed1ab_0         conda-forge
  soupsieve                      2.5           pyhd8ed1ab_1         conda-forge
  sqlalchemy                     2.0.23        py311h459d7ec_0      conda-forge
  stack_data                     0.6.2         pyhd8ed1ab_0         conda-forge
  terminado                      0.18.0        pyh0d859eb_0         conda-forge
  tinycss2                       1.2.1         pyhd8ed1ab_0         conda-forge
  tk                             8.6.13        noxft_h4845f30_101   conda-forge
  tomli                          2.0.1         pyhd8ed1ab_0         conda-forge
  tornado                        6.3.3         py311h459d7ec_1      conda-forge
  tqdm                           4.66.1        pyhd8ed1ab_0         conda-forge
  traitlets                      5.13.0        pyhd8ed1ab_0         conda-forge
  types-python-dateutil          2.8.19.14     pyhd8ed1ab_0         conda-forge
  typing-extensions              4.8.0         hd8ed1ab_0           conda-forge
  typing_extensions              4.8.0         pyha770c72_0         conda-forge
  typing_utils                   0.1.0         pyhd8ed1ab_0         conda-forge
  tzdata                         2023c         h71feb2d_0           conda-forge
  uri-template                   1.3.0         pyhd8ed1ab_0         conda-forge
  urllib3                        2.1.0         pyhd8ed1ab_0         conda-forge
  wcwidth                        0.2.10        pyhd8ed1ab_0         conda-forge
  webcolors                      1.13          pyhd8ed1ab_0         conda-forge
  webencodings                   0.5.1         pyhd8ed1ab_2         conda-forge
  websocket-client               1.6.4         pyhd8ed1ab_0         conda-forge
  wheel                          0.41.3        pyhd8ed1ab_0         conda-forge
  widgetsnbextension             4.0.9         pyhd8ed1ab_0         conda-forge
  xmltodict                      0.13.0        pyhd8ed1ab_0         conda-forge
  xorg-kbproto                   1.0.7         h7f98852_1002        conda-forge
  xorg-libice                    1.1.1         hd590300_0           conda-forge
  xorg-libsm                     1.2.4         h7391055_0           conda-forge
  xorg-libx11                    1.8.7         h8ee46fc_0           conda-forge
  xorg-libxau                    1.0.11        hd590300_0           conda-forge
  xorg-libxdmcp                  1.1.3         h7f98852_0           conda-forge
  xorg-libxext                   1.3.4         h0b41bf4_2           conda-forge
  xorg-libxrender                0.9.11        hd590300_0           conda-forge
  xorg-libxt                     1.3.0         hd590300_1           conda-forge
  xorg-renderproto               0.11.1        h7f98852_1002        conda-forge
  xorg-xextproto                 7.3.0         h0b41bf4_1003        conda-forge
  xorg-xproto                    7.0.31        h7f98852_1007        conda-forge
  xz                             5.2.6         h166bdaf_0           conda-forge
  yaml                           0.2.5         h7f98852_2           conda-forge
  zeromq                         4.3.5         h59595ed_0           conda-forge
  zipp                           3.17.0        pyhd8ed1ab_0         conda-forge
  zlib                           1.2.13        hd590300_5           conda-forge
  zlib-ng                        2.0.7         h0b41bf4_0           conda-forge
  zstd                           1.5.5         hfc55251_0           conda-forge

And I always get something that looks like this in my vscode jupyter session:

image
mattwthompson commented 7 months ago

Hard to say; if you can reproduce this without OpenFF code (i.e. just a PDB file) and narrow it down, Hai might be able to help you over at the NGLview repo. Otherwise the common debugging strategies involve trying a different browser, clearing various caches, using a different Jupyter provider (notebooks vs. JupyterLab vs. etc. etc.) or tinkering with what other widgets and extensions are installed. If you search elsewhere you'll find other ideas as well; OpenFF's use of NGLview attempts to be direct and not do anything too crazy.

mattwthompson commented 7 months ago

I take that back - without OpenEye in my environment I can reproduce what you're seeing. No need to shift the blame to others.

image

Josh (the author of that PR you found) is out for a bit, when they're back I'll defer to them for the authoritative word on this.

hjuinj commented 7 months ago

yeah looking at the source code it is the case that without openeye, writing out mol2 file string for nglview is not possible, so PDB format is being used, and I remember seeing another issue in nglview https://github.com/nglviewer/ngl/pull/977 that says something about over-generously putting bonds with pdb.

So would you agree with me this most likely does not damage the integrity of the underlying openff mol object? it is a visualisation hiccup?

mattwthompson commented 7 months ago

So would you agree with me this most likely does not damage the integrity of the underlying openff mol object? it is a visualisation hiccup?

Completely agree; visualization is just a funky transformation between models. If the toolkit objects are otherwise behaving well, there's nothing (besides the obvious) to be worried about with a quirky visualization.

j-wags commented 7 months ago

It looks like that NGLView PR got merged, and presumably this is resolved. Thanks for opening the report, @hjuinj, and thanks @mattwthompson for following up. Please feel free to reopen if this continues to be a problem!