From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Sep 22 2016 - 15:14:12 CDT

Brian,
  The only scenario I can contemplate would be a case where only one
or two atoms have NaN coordinates, which might arise in external software
and in such a case I would want VMD to emit warnings about
this but allow the structure to be loaded anyway, with the user's understanding
that atoms with bogus coordinates would thus prevent some analyses from
being run until they are fixed. I could see a scenario where a user loads
a molecular structure with some bad atoms, and they then overwrite the
bad coordinates and do a "mol reanalyze" and then VMD would be perfectly
happy again. This is definitely an unusual case, but NaNs are already used in
some volumetric (density map) file formats intentionally, so it makes sense
to have at least a little bit of sanity checking for this in the
molecular structure analysis parts of VMD also.

Cheers,
  John

On Thu, Sep 22, 2016 at 06:28:07PM +0000, Bennion, Brian wrote:
> Hello John,
>
> Thank you jumping on this issue. Is there a use case where continuing to start vmd with a meaningless structure be of benefit?
> I think the molecule should be aborted. Just my 2cents.
>
> Brian
>
> ________________________________________
> From: John Stone [johns_at_ks.uiuc.edu]
> Sent: Thursday, September 22, 2016 10:05 AM
> To: Bennion, Brian
> Cc: vmd-l_at_ks.uiuc.edu
> Subject: Re: vmd-l: pdb reader plugin error checking
>
> Hi Brian,
> I've added a new safety check to the automatic bond determination code
> that correctly catches scenarios where a NaN-valued atomic coordinate or
> coordinates ends up propagating to bounding box calculations and the like.
> I've tested the example structure you sent, and it now behaves as shown
> at the bottom of this email.
>
> The code now aborts bond determination with an error under this scenario.
> I've also added a safety check in some of the atom selection operations
> that need bounding box calculations for spatial queries. Hopefully these
> changes will harden VMD somewhat against such bad structures. I haven't
> exhaustively exercised all of the parts of the code that might explode
> if you have NaN-valued atomic coordinates, but this covers two of the most
> heavily used code paths now. If time allows before release, I'll do more
> of this testing, but as you can imagine there could be a lot of unforeseen
> issues with allowing NaNs to propagate too far.
>
> Cheers,
> John Stone
> vmd_at_ks.uiuc.edu
>
> New error handling approach for NaN-valued coordinates:
>
> Info) VMD for LINUXAMD64, version 1.9.3beta3 (September 22, 2016)
> Info) http://www.ks.uiuc.edu/Research/vmd/
> Info) Email questions and bug reports to vmd_at_ks.uiuc.edu
> Info) Please include this reference in published work using VMD:
> Info) Humphrey, W., Dalke, A. and Schulten, K., `VMD - Visual
> Info) Molecular Dynamics', J. Molec. Graphics 1996, 14.1, 33-38.
> Info) -------------------------------------------------------------
> Info) Multithreading available, 32 CPUs detected.
> Info) Free system memory: 58GB (92%)
> Info) Creating CUDA device pool and initializing hardware...
> Info) Detected 3 available CUDA accelerators:
> Info) [0] GeForce GTX 980 16 SM_5.2 @ 1.22 GHz, 4.0GB RAM, KTO, AE2, ZCP
> Info) [1] GeForce GTX 980 16 SM_5.2 @ 1.22 GHz, 4.0GB RAM, KTO, AE2, ZCP
> Info) [2] GeForce GTX 980 16 SM_5.2 @ 1.22 GHz, 4.0GB RAM, AE2, ZCP
> Info) Detected 3 available TachyonL/OptiX ray tracing accelerators
> Info) OpenGL renderer: GeForce GTX 980/PCIe/SSE2
> Info) Features: STENCIL MSAA(4) MDE CVA MTX NPOT PP PS GLSL(OVFGS)
> Info) Full GLSL rendering mode is available.
> Info) Textures: 2-D (16384x16384), 3-D (2048x2048x2048), Multitexture (4)
> Info) Dynamically loaded 2 plugins in directory:
> Info) /Projects/vmd/pub/linux64/lib/vmdtest/plugins/LINUXAMD64/molfile
> Info) File loading in progress, please wait.
> Info) Using plugin pdb for structure file rec_tmp.pdb
> Info) Using plugin pdb for coordinates from file rec_tmp.pdb
> Info) Determining bond structure from distance search ...
> ERROR) vmd_gridsearch_bonds: NaN coordinates in bounds, aborting!
> Info) Finished with coordinate file rec_tmp.pdb.
> Info) Analyzing structure ...
> Info) Atoms: 8212
> Info) Bonds: 0
> Info) Angles: 0 Dihedrals: 0 Impropers: 0 Cross-terms: 0
> Info) Bondtypes: 0 Angletypes: 0 Dihedraltypes: 0 Impropertypes: 0
> Info) Residues: 8212
> Info) Waters: 0
> Info) Segments: 1
> Info) Fragments: 8212 Protein: 0 Nucleic: 0
>
>
>
>
> On Tue, Sep 20, 2016 at 04:17:47PM -0500, John Stone wrote:
> > Hi Brian,
> > Interesting. Can you send me a copy of the broken file to use
> > for testing? I think you've stumbled across a particular failure
> > mode that has never arisen before. It would probably be easy for
> > me to add some sanity checks that would get used for all small
> > structures. A simple for loop with isnan() checks would catch this
> > before going into bond determination code. That being said, if the
> > reason is due to a misformatted file, it should get caught earlier,
> > in the PDB reader itself. If you can share the broken file, or
> > a file that emulates whatever is wrong with the broken one, I am
> > happy to look into that.
> >
> > Cheers,
> > John Stone
> > vmd_at_ks.uiuc.edu
> >
> > On Tue, Sep 20, 2016 at 06:47:26PM +0000, Bennion, Brian wrote:
> > > Hello
> > > Just curious if there is a reason not to include some minor error checking
> > > in the vmd pdb reader for the coordinate columns.
> > >
> > > I ran into a situation where a pdb file is generated in an upstream
> > > application, and for reasons that are being looked into, the xyz columns
> > > are all NaN in a very few files (1 out of 300K or so).
> > >
> > > This "bug" found this while using vmd in batch mode to do some analysis
> > > and vmd was hanging at the distance check after a couple hours of running
> > > the analysis.
> > >
> > > The vmd version is 1.9.2 so maybe this is not an issue in newer releases?
> > >
> > > Thanks
> > > Brian Bennion
> >
> > --
> > NIH Center for Macromolecular Modeling and Bioinformatics
> > Beckman Institute for Advanced Science and Technology
> > University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> > http://www.ks.uiuc.edu/~johns/ Phone: 217-244-3349
> > http://www.ks.uiuc.edu/Research/vmd/
>
> --
> NIH Center for Macromolecular Modeling and Bioinformatics
> Beckman Institute for Advanced Science and Technology
> University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> http://www.ks.uiuc.edu/~johns/ Phone: 217-244-3349
> http://www.ks.uiuc.edu/Research/vmd/

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/