Skip to content
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

T019: AttributeError: 'numpy.ndarray' object has no attribute 'unit' #298

Closed
Tracked by #296
dominiquesydow opened this issue Dec 27, 2022 · 0 comments · Fixed by #306 or #296
Closed
Tracked by #296

T019: AttributeError: 'numpy.ndarray' object has no attribute 'unit' #298

dominiquesydow opened this issue Dec 27, 2022 · 0 comments · Fixed by #306 or #296
Assignees
Labels
dependency Update/fix dependencies

Comments

@dominiquesydow
Copy link
Collaborator

dominiquesydow commented Dec 27, 2022

T019 fails with the traceback below.

Actions to be taken after running T019 locally:

  • Change openmm import because of Warning: importing 'simtk.openmm' is deprecated. Import 'openmm' instead.
  • openmmforcefields install fails under MacOS/M1 with
    $ mamba install -q -y -c conda-forge openmmforcefields
    Could not solve for environment specs
    Encountered problems while solving:
      - nothing provides ambertools >=20.0 needed by openmmforcefields-0.10.0-pyhd8ed1ab_0
    The environment can't be solved, aborting the operation
    
    Can be fixed with a CONDA_SUBDIR=osx-64 in front of the conda command
  • Change atom.unit to atom.units
____ teachopencadd/talktorials/T019_md_simulation/talktorial.ipynb::Cell 12 ____
[gw0] linux -- Python 3.9.15 /usr/share/miniconda/envs/teachopencadd/bin/python
Notebook cell execution failed
Cell 12: Cell execution caused an exception

Input:
omm_ligand = rdkit_to_openmm(rdkit_ligand, ligand_name)

Traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /usr/share/miniconda/envs/teachopencadd/lib/python3.9/site-packages/pint/facets/numpy/quantity.py:228, in NumpyQuantity.__getattr__(self, item)
    227 try:
--> 228     return getattr(self._magnitude,item)
    229 except AttributeError:

AttributeError: 'numpy.ndarray' object has no attribute 'unit'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
Cell In[13], line 1
----> 1 omm_ligand = rdkit_to_openmm(rdkit_ligand,ligand_name)

Cell In[12], line 41, in rdkit_to_openmm(rdkit_mol, name)
     39 # convert units from Ångström to Nanometers
     40 for atom in mol_positions:
---> 41     coords = atom / atom.unit
     42     atom = (coords / 10.0) * unit.nanometers  # since openmm works in nm
     44 # combine topology and positions in modeller object

File /usr/share/miniconda/envs/teachopencadd/lib/python3.9/site-packages/pint/facets/numpy/quantity.py:230, in NumpyQuantity.__getattr__(self, item)
    228     return getattr(self._magnitude, item)
    229 except AttributeError:
--> 230     raise AttributeError(
    231         "Neither Quantity object nor its magnitude ({}) "
    232         "has attribute '{}'".format(self._magnitude, item)
    233     )

AttributeError: Neither Quantity object nor its magnitude ([14.734 33.5[59](https://github.com/volkamerlab/teachopencadd/actions/runs/3793382330/jobs/6450440241#step:8:60) 13.1[61](https://github.com/volkamerlab/teachopencadd/actions/runs/3793382330/jobs/6450440241#step:8:62)]) has attribute 'unit'
@dominiquesydow dominiquesydow self-assigned this Dec 27, 2022
@dominiquesydow dominiquesydow added the dependency Update/fix dependencies label Dec 27, 2022
This was linked to pull requests Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Update/fix dependencies
Projects
None yet
1 participant