Opened 6 years ago

Closed 6 years ago

#2926 closed defect (not a bug)

Adding coord sets

Reported by: tony.schaefer@… Owned by: Tom Goddard
Priority: normal Milestone:
Component: MD/Ensemble Analysis Version:
Keywords: Cc: pett
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Windows-10-10.0.17763
ChimeraX Version: 0.92 (2020-03-03)
Description
I'm not sure if this is a bug or if I need to add something to my code. I've had issues adding coordsets to molecules. When I open 'freq.out', I'm adding coordsets to it using `mdl.add_coordsets`. I'm doing the same thing in my tool to reset the coordinate sets (again using `mdl.add_coordsets`). Each time I set the coordsets, I print the coordset array to the reply log. It looks the same both times. The issue is that the second time I add the coordsets, it doesn't seem to work. I can open the shell and grab the coordsets (using `mdl.coordsets(1).xyzs`). However, the atom coordinates do not match the coordset (`mdl.atoms[i].coord`). The molecule also appears very different. 

The only thing I've gotten to work to overwrite coordsets with my tool is 
```
mdl.remove_coordsets()
for i, coordset in enumerate(coordsets):
    mdl.add_coordset(i+1, coordsets)
    mdl.active_coordset_id = i + 1
    for atom, coord in zip(mdl.atoms, coordset):
        atom.coord = coord
```
where mdl is the model and coordsets in the coordset array (equal to the one I used when opening the molecule). 

Like I said, I've tried using `mdl.add_coordsets` here. I've also tried just looping over the coordset array and doing `mdl.add_coordset`. I've tried both of these with and without mdl.remove_coordsets(). Without the `for atom, coord` loop, the coordinate sets don't do what I expect. The atom coordinates seem to all get set to zero, but never updated to what's in coordsets. I'm not sure why I wouldn't be able to just use mdl.add_coordsets(x, replace=True). 

I've attached a session with two models: a freshly-opened 'freq.out', and a 'freq.out' where I've tried to overwrite the coordsets with mdl.add_coordsets. 

Log:
> cd "C:\Users\Tony Schaefer/Desktop"

Current working directory is: C:\Users\Tony Schaefer\Desktop  
UCSF ChimeraX version: 0.92 (2020-03-03)  
© 2016-2020 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  
Successfully installed 'ChimAARON-0.1-py3-none-any.whl'  
Looking in indexes: https://pypi.org/simple,
https://cxtoolshed.rbvi.ucsf.edu/pypi/  
Processing c:\users\tony
schaefer\appdata\local\ucsf\chimerax\cache\0.92\installers\chimaaron-0.1-py3-none-
any.whl  
Requirement already satisfied, skipping upgrade: ChimeraX-Core>=0.1 in
d:\chimerax\bin\lib\site-packages (from ChimAARON==0.1) (0.92)  
Requirement already satisfied, skipping upgrade: scipy in
d:\chimerax\bin\lib\site-packages (from ChimAARON==0.1) (1.4.1)  
Requirement already satisfied, skipping upgrade: numpy in
d:\chimerax\bin\lib\site-packages (from ChimAARON==0.1) (1.17.4+mkl)  
Installing collected packages: ChimAARON  
Attempting uninstall: ChimAARON  
Found existing installation: ChimAARON 0.1  
Uninstalling ChimAARON-0.1:  
Successfully uninstalled ChimAARON-0.1  
Successfully installed ChimAARON-0.1  
Lock 2950636499272 acquired on C:\Users\Tony
Schaefer\AppData\Local\UCSF\ChimeraX\Cache\0.92\toolshed\bundle_info.cache.lock  
Lock 2950636499272 released on C:\Users\Tony
Schaefer\AppData\Local\UCSF\ChimeraX\Cache\0.92\toolshed\bundle_info.cache.lock  
  

> open "C:\Users\Tony Schaefer\Desktop\freq.out"

Summary of feedback from opening C:\Users\Tony Schaefer\Desktop\freq.out  
---  
notes | there are 5 coordsets  
0 float64  
[[ 0. 0. 0.68769]  
[ 0. 0. -0.53966]  
[ 0. 0.93947 -1.1318 ]  
[ 0. -0.93947 -1.1318 ]]  
1 float64  
[[ 0. -0. 0.672927]  
[-0. 0. -0.532651]  
[ 0. 0.945975 -1.127923]  
[ 0. -0.945975 -1.127923]]  
2 float64  
[[ 0. 0. 0.670659]  
[-0. 0. -0.528855]  
[ 0. 0.947362 -1.128687]  
[ 0. -0.947362 -1.128687]]  
3 float64  
[[ 0. -0. 0.671777]  
[-0. -0. -0.527821]  
[ 0. 0.946536 -1.129763]  
[ 0. -0.946536 -1.129763]]  
4 float64  
[[-0. 0. 0.673041]  
[ 0. 0. -0.526642]  
[-0. 0.945072 -1.130984]  
[-0. -0.945072 -1.130984]]  
  
Opened C:\Users\Tony Schaefer\Desktop\freq.out as a out file  

> toolshed show "Managed Models"

there are 5 coordsets  
0 float64  
[[ 0. 0. 0.68769]  
[ 0. 0. -0.53966]  
[ 0. 0.93947 -1.1318 ]  
[ 0. -0.93947 -1.1318 ]]  
1 float64  
[[ 0. -0. 0.672927]  
[-0. 0. -0.532651]  
[ 0. 0.945975 -1.127923]  
[ 0. -0.945975 -1.127923]]  
2 float64  
[[ 0. 0. 0.670659]  
[-0. 0. -0.528855]  
[ 0. 0.947362 -1.128687]  
[ 0. -0.947362 -1.128687]]  
3 float64  
[[ 0. -0. 0.671777]  
[-0. -0. -0.527821]  
[ 0. 0.946536 -1.129763]  
[ 0. -0.946536 -1.129763]]  
4 float64  
[[-0. 0. 0.673041]  
[ 0. 0. -0.526642]  
[-0. 0.945072 -1.130984]  
[-0. -0.945072 -1.130984]]  

> toolshed show Shell




OpenGL version: 3.3.0 NVIDIA 441.87
OpenGL renderer: GeForce RTX 2070/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation
File attachment: coordsets.cxs

coordsets.cxs

Attachments (5)

coordsets.cxs (2.8 KB ) - added by tony.schaefer@… 6 years ago.
Added by email2trac
test_add_coordset.py (299 bytes ) - added by goddard@… 6 years ago.
Added by email2trac
untitled-part.html (250 bytes ) - added by goddard@… 6 years ago.
Added by email2trac
remove_atoms_add_coords.py (2.7 KB ) - added by tony.schaefer@… 6 years ago.
Added by email2trac
untitled-part-1.html (206 bytes ) - added by tony.schaefer@… 6 years ago.
Added by email2trac

Download all attachments as: .zip

Change History (10)

by tony.schaefer@…, 6 years ago

Attachment: coordsets.cxs added

Added by email2trac

comment:1 by pett, 6 years ago

Cc: pett added
Component: UnassignedMD/Ensemble Analysis
Owner: set to Tom Goddard
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionAdding coord sets

comment:2 by Tom Goddard, 6 years ago

More details on this ticket appear in #2934.

in reply to:  4 comment:3 by goddard@…, 6 years ago

I attach a simple test program that adds a coordinate set to a molecule to see if the atoms get the expected coordinate set coordinates (original coordinates with 1.0 added).  When I run it with today's ChimeraX it works as expected.

If you can, please provide a simple standalone test example like this which demonstrates your case where it does not work and gives all coordinates = 0 as you describe in the ticket.

coords [[15.491 7.05 17.165]
[14.946 7.55 15.888]
[16.011 7.604 14.814]
[17.199 7.619 15.115]
[15.573 7.664 13.56 ]]

added coords [[16.491 8.05 18.165]
[15.946 8.55 16.888]
[17.011 8.604 15.814]
[18.199 8.619 16.115]
[16.573 8.664 14.56 ]]
executed test_add_coordset.py

test_add_coordset.py

untitled-part.html

by goddard@…, 6 years ago

Attachment: test_add_coordset.py added

Added by email2trac

by goddard@…, 6 years ago

Attachment: untitled-part.html added

Added by email2trac

in reply to:  7 ; comment:4 by tony.schaefer@…, 6 years ago

Sorry that this got split into multiple reports. Apparently all ChimeraX emails (except when the bug report status changes) ended up in my junk folder. 

As I mentioned in #2934, the issue only happened when I added and deleted atoms from a pre-existing model. What my tool did is comparable to the first ~60 lines of the attached script. When I submitted this report, all coordinates were zero because all atoms got replaced (a new atom was added and the old atom is deleted). In the attached script, only one atom is getting replaced. 

I was confused because the new atoms' `coord` attributes did not match what I thought were the corresponding values in the coordset (note the `print` statements on lines 59 and 60). With a better understanding of how coordsets work (from the explanations in #2934), I realize that what I was doing was not compatible with how coordsets work. I've made the necessary changes to my tools. 
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu <mailto:ChimeraX-bugs-admin@cgl.ucsf.edu>>
Sent: Thursday, March 5, 2020 11:53 PM
Cc: Anthony James Schaefer <tony.schaefer@uga.edu <mailto:tony.schaefer@uga.edu>>
Subject: Re: [ChimeraX] #2926: ChimeraX bug report submission
 
[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


#2926: ChimeraX bug report submission
--------------------------------------+--------------------
          Reporter:  tony.schaefer@…  |      Owner:  (none)
              Type:  defect           |     Status:  new
          Priority:  normal           |  Milestone:
         Component:  Unassigned       |    Version:
        Resolution:                   |   Keywords:
        Blocked By:                   |   Blocking:
Notify when closed:                   |
--------------------------------------+--------------------
Changes (by tony.schaefer@…):

 * Attachment "coordsets.cxs" added.

 Added by email2trac

--
Ticket URL: <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/2926 <https://plato.cgl.ucsf.edu/trac/ChimeraX/ticket/2926>>
ChimeraX <http://www.rbvi.ucsf.edu/chimerax/ <http://www.rbvi.ucsf.edu/chimerax/>>
ChimeraX Issue Tracker

remove_atoms_add_coords.py

untitled-part-1.html

by tony.schaefer@…, 6 years ago

Attachment: remove_atoms_add_coords.py added

Added by email2trac

by tony.schaefer@…, 6 years ago

Attachment: untitled-part-1.html added

Added by email2trac

comment:5 by Tom Goddard, 6 years ago

Resolution: not a bug
Status: assignedclosed

Ok, so it was just a misunderstanding how ChimeraX handles coordinate sets. If there is a way we could make the behavior more obvious or a place we could document its behavior that would have helped you, let us know.

Note: See TracTickets for help on using tickets.