Molecules 1.2 submitted for review
I just submitted Molecules 1.2 for review in the App Store. Sorry it's taken me so long to get a new version out to you, but this version required a complete rewrite of a portion of the core code. I also have been distracted by a few things at my day job and some shiny new technology that I've been playing with.
While this version does not bring any new visualization options or other visible features, it has significantly improved performance. The entire backend data model of Molecules has been rewritten to use SQLite. Previously, I had simply stored downloaded PDB files on the device and parsed them every time I needed to render a molecule or even load its metadata. This was very much a quick-and-dirty solution.
I'll post on this in more detail, but the use of SQLite lets you realize much faster load times for the molecules and their metadata. On the initial startup of the new version, all of the Gzipped PDB files stored on the phone are scanned and indexed. A table for the molecules stores their file names key metadata. Supplemental metadata are stored in a different table, so that they can be loaded on demand when a user selects the detail disclosure triangle in the list of molecules. Atoms and chemical bonds are generated from the PDB file description and stored in their own tables, with links back to the molecule that they are part of.
After this initial indexing, the only time files on disk are touched is when new molecules are downloaded and stored in the database and when existing ones are deleted. The remainder of the time, SQL queries will provide information on demand. Molecule names and information will load nearly instantly, no matter how many you have downloaded. Metadata loads on demand in between switching views from the molecule list to the detail view. Rendering is faster than before, and is now limited by the speed at which I can calculate geometry.
Like I said, I will do a longer post on SQLite and how I ended up using it in this version.
People were reporting problems with NMR models with large numbers of structures, so for now I only display the first structure in the model. I'm working on an interface for specifying which structure you'd like to view, as well as having the option to overlay all structures.
I tried to accelerate the OpenGL rendering using some simple optimizations, but wasn't able to accomplish much. It seemed like the fact that I used glGetFixedv calls in the middle of the rendering of a frame might be halting the OpenGL rendering and slowing things down. Removing those calls had no noticeable effect on performance. Likewise, switching all of my remaining OpenGL lighting setup calls to fixed-point math to match the rest of my OpenGL rendering did not improve much. Finally, I tried altering some of the compilation parameters to accelerate floating point operations, but that didn't do much. The one thing that did lead to a slight performance boost (~ 10 %) was the firmware upgrade from 2.0 to 2.1.
Again, I appreciate your patience with the delay in this update.
For 1.3, I'm working on a couple of ways for you to load your own custom molecules onto the device without having to go through the PDB.