Molecules version 1.4: Now for iPad

Molecules icon

You might have noticed that I updated Molecules to make it version 1.4, which adds some rendering enhancements and bug fixes for PDB searches. However, the highlight of this release is the addition of an iPad-specific interface. Additionally, now that iPhone OS 3.2 is publicly available, I have released the source code to the universal iPhone / iPad version of Molecules.

As I said, the biggest improvement in this version of Molecules is an interface crafted specifically for the iPad, everyone's favorite new toy. Molecules is a universal iPhone / iPad application, capable of running on all iPhone OS devices using the same binary. It auto-detects which system it is running on and presents an appropriate interface for that device.

I may write more about the design of a universal application, but for now feel free to check out the code for the project and see for yourself.

One feature that didn't quite make it into this version is the support for loading your own custom molecules onto the device using the new file sharing capabilities of the iPad. This lets you dock the device and add and remove files for this application via iTunes. I'm working on adding this for the next update.

And, yes, I am working on an iPad interface for Pi Cubed (which will be a universal application like this). It will take a little more work, because it is a much more complex application than Molecules, and I still need to fix some data model issues that I've been trying to overcome for the last few months. Ironically, my advanced iPhone development class has slowed my work on this significantly.

Also in this version is a fix for problems people have been having when trying to do searches in the Protein Data Bank using more than one keyword.


Very nice project, thanks for sharing the source code. I like the user interface better than previous version. Acetylcholinesterase renders a bit slowish on the iPad, but it is a very complex model.

I look forward to this file sharing through iTunes.

Great product...any plans for an Android version??

Unfortunately, no, I will probably never port this to Android. I'm a Cocoa developer, I enjoy working on the platform, and have no desire to write software for anything other than the iPhone, iPad, and Mac.

However, the source code is available, so someone who was sufficiently motivated could port it over to Android in a reasonable amount of time.

There really isn't anything out there for Android yet. One app is atom3d and isn't useful. Maybe some Android developer would port your code over. Thanks for releasing it!

For Android there is now a version of Jmol that you may like to try:

Hi there. Will we be seeing a corresponding update of Pi Cubed for the iPad any time soon? I love that app. The current version works fine, of course, but it's a little horsey at 2x its intended size.

Yes, I'm working on it right now. I wanted to use Molecules as a test project to learn the process for building and submitting universal iPhone / iPad applications. I'm taking what I found from that over to Pi Cubed, which is significantly more complex under the hood. I'm also finishing up the updates that I've been working on for the last few months, development for which was slowed down by the iPhone class I've been teaching. That class is drawing to a close, so I'll be able to direct my full attention to this.

I will be rolling the iPad interface out as an update to the full paid version of Pi Cubed, making it a universal iPhone / iPad application. That way, paid customers will not need to pay anything more for the iPad interface. The free version will lack this functionality, hopefully providing an incentive to step up to the full version.

Any plans to improve the resolution for the iPad? Also, the ability to have mixed renderings within one molecule would be nice. Excellent app!

Yes, the models look a little chunky on the iPad's higher resolution screen. I have a few ideas about how to improve the rendering, including using some of the OpenGL ES 2.0 capabilities present on the iPad, but they might take a little while to implement.

Similarly, I've been working on other visualization modes, but they might take a little while to complete.

In the meantime, I'm finishing up an update that will add some neat new iPad-specific capabilities. I hope to have that ready within the next couple of weeks.

This is obviously a very cool app. However, my chemistry is limited to a general chemistry course in college. It would be nice to look at some simpler non-biological structures, but I don't yet know how to look for some in a format this app would recognize. It would be nice to have some other molecular databases in the drop-down list, and some more layman-oriented names for some of the molecules. I'd second the request for a key to the color-coded atoms in the molecular structure. In any case, thanks for generously making this app and its source code available. The source code will probably prove to be beneficial to me as a good example to study for OpenGL iPhone/iPad apps.


I love this app... but i can not get to compile for either a 3.1.3 simulator or Device... 3.2 is only for ipad. I can see that it is weak linked to UIKit but still getting errors regarding UISPLITVIEWCONTROLLER. Was hoping to find a good way to have a universal app that uses splitcontroller view on ipad and tabbarcontroller on ipod touch/iphone

your help would be greatly appreciated.

If you build the application using the 3.2 SDK, it will run on 3.0 devices. The iPhone OS Deployment Target build setting has iPhone OS 3.0 as the target, so you'll be able to run this on devices using any OS greater than or equal to that one. UIKit is weak-linked because otherwise you would get runtime errors when executing this application on OS 3.0.

OK to simplify the problem:

I downloaded your source, and would like to be able to run in the iphone simulator (not the IPAD simulator), how do I accomplish this as selecting 3.1.3 simulator, build and run fails.

Thanks for your patience,

Unfortunately, you can't run the iPhone Simulator with this code using the 3.2 SDK. I recommend looking at the 4.0 beta SDK, as they may or may not have changed this.

If you do need to test on the iPhone Simulator using the 3.2 SDK, you will need to remove all references to UISplitViewController and UIPopoverController and use NSClassFromString() to access them. Personally, I prefer to keep compile-time type checking in trade for not being able to test in the Simulator (I do most of my testing on the devices anyway, given the vast differences in graphics and processing hardware).

Dear Dr. Larson:

I really enjoyed your molecules program. It is very good in displaying molecular structure of many proteins. However, I ran into troubles when trying to display structures of some small molecules such as chlorophylls or caffein. I have pdb file for these small molecules and also compressed zg files for these, which were loaded into a specific server. Then, using your molecules app, I can download these files, but they cannot display. What's wrong. Please help.

Professor of Environmental Chemistry

There appears to be a bug with the parsing of files served by certain web servers that I'm still tracking down. I don't know what's causing it, so I can't suggest anything to try differently.

However, I just updated the application to support direct file sharing via iTunes, so if you have an iPad (or an iPhone running OS 4.0) you can now directly drag files into the application when your device is connected to iTunes. Molecules will then parse and display these structures on its next startup.

Your generosity in making this source available is inspiring. Thanks

I have tried to load some small molecules via itunes and they can not be seen. The pdb files were generated by a molecular modeling program. Also, I tried pdb files which were converted from mol2 by open babel.

Could you send me these files at contact(at) It would help me find out what is going wrong in this case.

I saw that someone already commented on this, but are there any simpler molecules available for this app? It is a wonderful visual tool and I would love to use it in my middle school science courses.

I saw that someone already commented on this, but are there any simpler molecules available for this app? It is a wonderful visual tool and I would love to use it in my middle school science courses.

Am trying to compile this and getting this error:
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

I'm a real noob, so it's probably me, but...

Xcode 3.2.4, 64-bit

I am targetting the ipad simulator

Thanks -- looking forward to seeing this...

That isn't really the compile error. What does it say in the build log before or after that?

I bet that it's complaining about the lack of the base SDK. To set that, inspect the project and change the Base SDK for All Configurations to iOS Device 4.1 (or whatever the latest SDK version is that you have installed).


/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -x objective-c-header -arch i386 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -mdynamic-no-pic -Werror -Wmissing-prototypes -Wreturn-type -Wunused-variable -D__IPHONE_OS_VERSION_MIN_REQUIRED=30200 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk -fexceptions -fvisibility=hidden -mmacosx-version-min=10.5 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000 -iquote /Users/danielsullivan/Downloads/Molecules/build/ -I/Users/danielsullivan/Downloads/Molecules/build/ -I/Users/danielsullivan/Downloads/Molecules/build/ -iquote /Users/danielsullivan/Downloads/Molecules/build/

That's due to a workaround I put in place to allow the application to compile with LLVM against the Simulator in the 4.1 iOS SDK. To fix this, build using the iOS 4.1 SDK using the LLVM compiler or go to the target's build settings in Xcode and remove what's in the Other C Flags setting.

I'm also getting the error and can't get past it. It says it's happening when it tries to precompile Molecules_Prefix.pch. I set the base SDK for all configurations to iOS Simulator 4.1, and checked the Other C flags entry but it was already empty. I'm running XCode 3.2.4 64-bit.

Any other ideas? I'm eager to see this!

I also tried using LLVM as the C/C++ compiler version.

Disregard my earlier comments. It turns out that the project I have for the previous version has some issues with the iOS 4.1 SDK. I'd resolved those at some point in the version I'm working on now.

Try downloading a prerelease build of that version from here, which should compile properly on 4.1. I'm still working on a few bugs, though, so this isn't the version I'll be submitting as an update.


Just loaded the 10/21 source and compiled it against iOS 4.2; it still has the "_IPHONE_OS_VERSION_MIN_REQUIRED is defined twice" error, but removing the Other C Flags setting resolves that.

Thanks for making the source available.

Yes, iOS 4.2 fixed the 4.1 issue with LLVM, so you can remove those flags. I just haven't updated the code yet for that.

Great app - love the surface rendering - looks fantastic! Next time I give a poster presentation at a conference I'll have an iPad right there to show some structures.

Any chance of implementing opening of e-mail attachments or files from Dropbox? Also, what about being able to open other file types like vanilla XYZ and Mol2?

I'm working on adding additional file type support (someone was going to implement XYZ input, but they never wrote back). You should be able to open email attachments in .pdb or .pdd.gz format by tapping and holding on the item, then selecting Open In Molecules. That works just fine on my devices.

As for DropBox, I'll probably add iCloud sync support first. I don't have a lot of time to work on this, and DropBox integration looks like it might take a little more effort.

Syndicate content