Opened 7 years ago

Closed 7 years ago

#1182 closed defect (fixed)

Error in addh at coordination sites

Reported by: Tristan Croll Owned by: Eric Pettersen
Priority: major Milestone:
Component: Structure Editing Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Traceback:

  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/cmd_line/tool.py", line 205, in execute
    cmd.run(cmd_text)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/core/commands/cli.py", line 2561, in run
    result = ci.function(session, **kw_args)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/atomic/addh/cmd.py", line 55, in cmd_addh
    add_h_func(session, structures, in_isolation=in_isolation, **prot_schemes)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/atomic/addh/cmd.py", line 130, in simple_add_hydrogens
    idatm_type, invert, coordinations.get(atom, []))
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/atomic/addh/simple.py", line 34, in add_hydrogens
    _alt_loc_add_hydrogens(atom, alt_loc_atom, *args, **kw)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/atomic/addh/simple.py", line 104, in _alt_loc_add_hydrogens
    positions.remove(coord_pos)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Amending the offending lines (94-102) of simple.py to pop by index appears to do the trick:

        if coordinations:
            coord_i = None
            for i, pos in enumerate(positions):
                d = distance_squared(pos, toward)
                if coord_i is None or d < lowest:
                    coord_i = i
                    lowest = d
            positions.pop(coord_i)

Change History (2)

comment:1 by Eric Pettersen, 7 years ago

Status: assignedaccepted

comment:2 by Eric Pettersen, 7 years ago

Resolution: fixed
Status: acceptedclosed

I have committed a different fix for this. It works as far as I know, but since you didn't mention what structure you were having this problem with, I can't test it for your specific use case. So you could either test out the next build, or let me know what the structure was and I can test it.

--Eric

Note: See TracTickets for help on using tickets.