Writing programs that communicate with MMP and ChemSite
Other programs can communicate with Molecular Modeling Pro and ChemSite in a variety of ways.
The simplest is to support the copying and pasting of MDL Molfiles over the text portion of the WINDOWS clipboard. The format of the MDL Molfile was published in J. Chem. Inf. Comput. Sci, 1992, 32, 244-255 by Arthur Dalby et.al. MDL occasionally upgrades this format, but the 1992 paper is the industry-wide standard format. You will need an upgraded format if you use molecules with more than 999 atoms.
Molecular Modeling Pro (all versions) can be opened with the Windows API call WinExec() [or the Visual Basic Shell command]. Make sure that it is opened with focus. If you pass it a file name on the command line (e.g. call it through WinExec with "mmp32.exe filename.ext") you can automatically open various types of files. Here are the file extensions recognized by Molecular Modeling Pro:
.dat = MACROMODEL connection table (of the mid-1990s era)(all versions of MMP)
.mol = MDL Molfile connection table (all versions of MMP)
.pdf, .ent = Brookhaven protein database file (version 2 or greater)
.mop = MOPAC input file (version 2 or greater)
.csv = Molecular Analysis Pro version 3 database file (version 5)
.mdb = Microsoft ACCESS database (version 5)
.txt = tab-delimited text database with the first line being field names (version 5)
.sdf = MDL SD File (version 5)
.xml = extensible mark-up language database file (version 5)
Molecular Modeling Pro (versions 3 or greater) periodically checks the clipboard for Molfiles with special commands on the third line of the file. MMP must be open and be given the focus for this to work. The WINDOWS API command FindWindow, WinExec and SetFocus can be used from within your program to make this happen. The commands on the third line of the Molfile recognized by MMP are:
physprop - causes MMP to calculate most of the Molfile's physical properties and display them in a text editor.
mopac - causes MMP to open the Molfile and feed it into MOPAC which starts running too.
addtodatabase - causes MMP to start the procedure of saving the Molfile to a database.
mmpload - causes the Molfile to be displayed in MMP, but nothing further is done.
Use lower case letters.
ChemSite (versions 3 or greater) also periodically looks on the clipboard for Molfile's with special instructions on the third line of the Molfile. For this to work ChemSite must be open and you must give it focus. You can check to see if ChemSite is open with the FindWindow API function and open the program with the WinExec() API function. The text on the third line that cause ChemSite to load Molfiles are:
raytrace - the Molfile is rendered in a ray-traced CPK type images
ballandstick - the Molfile is rendered in a ray-traced ball and stick image
ball - the Molfile is rendered in a ray-traced image as spheres
molorb - the Molfile is rendered in a ray-traced image of the molecular orbitals
convert3d - the Molfile is minimized with AMBER
lcao-mo - the electrostatic surface is calculated and displayed.
display - the Molfile is displayed in ChemSite, but nothing further is done.
Use lower case letters.
You will also have to modify the ChemSite file called extprog.dat. You must know the Window's class name for your program. The entries look like this (using Notepad as the example):
Command: viewmolfile edit "&View molfile in Notepad..."
In the above example, you can put about anything in the Message area, just don't leave it blank. Title where you place the Windows class name for the program. The Command line places a menu item into ChemSite which, in the example, will place "View molfile in Notepad..." as an item on the Edit menu. The keyword viewmolfile will be found on the third line of the molfile.