OpenBioSim / biosimspace

An interoperable Python framework for biomolecular simulation.
https://biosimspace.openbiosim.org
GNU General Public License v3.0
71 stars 11 forks source link

ValueError: setting an array element with a sequence. #177

Closed velocirraptor23 closed 11 months ago

velocirraptor23 commented 11 months ago

I have tested the code in y enviroment. just wondering why i got this error in funnel definition in the nethadynamics funnel tutorial. The step I am doing is •••••••••••••••••••

Load the system.

system = BSS.IO.readMolecules( ["solvated.rst7", "solvated.prm7"] )

Create the funnel parameters.

p0, p1 = BSS.Metadynamics.CollectiveVariable.makeFunnel(system)

Define the collective variable.

funnel_cv = BSS.Metadynamics.CollectiveVariable.Funnel(p0, p1)

Create a view.

view = BSS.Metadynamics.CollectiveVariable.viewFunnel(system, funnel_cv)

view.molecules([1, 0, -1])

•••••••••••••••••••••••••

Error: •••••••••••••••••••••••••• ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /cluster/ddu/cmmartinez001/miniconda3/envs/openbiosim-dev/lib/python3.9/site-packages/sire/units │ │ /init.py:359 in generalunitfloat │ │ │ │ 356 │ │ │ 357 │ def generalunitfloat(obj): │ │ 358 │ │ if not obj.is_dimensionless(): │ │ ❱ 359 │ │ │ raise TypeError( │ │ 360 │ │ │ │ f"You cannot convert the dimensioned value {obj} " │ │ 361 │ │ │ │ "to a dimensionless floating point number." │ │ 362 │ │ │ ) │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ TypeError: You cannot convert the dimensioned value 35.0168 Å to a dimensionless floating point number.

The above exception was the direct cause of the following exception:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ in :13 │ │ │ │ 10 funnel_cv = BSS.Metadynamics.CollectiveVariable.Funnel(p0, p1) │ │ 11 │ │ 12 # Create a view. │ │ ❱ 13 view = BSS.Metadynamics.CollectiveVariable.viewFunnel(system, funnel_cv) │ │ 14 │ │ 15 view.molecules([1, 0, -1]) │ │ 16 │ │ │ │ /cluster/ddu/cmmartinez001/miniconda3/envs/openbiosim-dev/lib/python3.9/site-packages/BioSimSpac │ │ e/Metadynamics/CollectiveVariable/_funnel.py:1139 in viewFunnel │ │ │ │ 1136 │ import numpy as _np │ │ 1137 │ │ │ 1138 │ # Calculate the vector defined by points p0 and p1. │ │ ❱ 1139 │ vec = _np.array(com1, dtype=float) - _np.array(com0, dtype=float) │ │ 1140 │ │ │ 1141 │ # BEWARE: inconsistency with linalg, if vec is a list and not an array! │ │ 1142 │ # Make it a unit vector. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ValueError: setting an array element with a sequence. •••••••••••••••••••••••••••••• This is with the example you provided.

Thanks a lot

Cesar

lohedges commented 11 months ago

Could you confirm that you are using the latest development version of the code since I thought this issue had been fixed.

I can check later this afternoon.

velocirraptor23 commented 11 months ago

I installed this previously, 5 months ago, Probably it is not the latest. Is ther any way to update the code? or Do I need to create my enviroment again.

Thanks a lot,

Cesar

lohedges commented 11 months ago

I can confirm that this indeed works with the latest version of the code. In future, can you please follow the issue template guidelines when posting and don't delete the checkboxes that you are asked to complete, one of which is confirming whether the issue is present with the latest development version. We have limited time to dedicate to fixing issues, so we need to make best use of it.

Is ther any way to update the code? or Do I need to create my enviroment again.

Generally we recommend creating a fresh environment, rather than trying to upgrade BioSimSpace. The conda solver often struggles to resolve updates for a complex environment. Just follow the instructions in the README or on our website. If you want to keep the old environment, just give the new one a different name.