Italy 1989, it was the age of Commodore Amiga with its BOING demo, the bouncing ball that conquest the heart of the millions of young people living the microcomputer revolution.
It was the time when a software failure was a moment of Guru Meditation and when possessing a hard disk of 60 MB, it was considered a luxury of abundance and privilege.
It was for me also the age of the Amiga BASIC programming. I moved my first steps in learning how to program a computer using the CBM BASIC of the Commodore VIC 20 (another mythical microcomputer of the ’80 that deserve another blog) and by refining my skills with the MSX BASIC of the PHILIPS VG 8010 before end up using the Amiga BASIC. I fell always nostalgic when I come back with my memory to those years since I wrote many interesting programs with this language for the simulation or the study of different serious and recreational topics in Physics and Chemistry. Few year ago, in the verge of one of these nostalgic moments, I have dedicated some time in an effort of forensic archaeology to recover, from my 27 years old collection of Amiga floppy disks, the forgotten products of my pristine programming experiences. I sold my powerful Amiga 500 (it was equipped with a Motorola 68020 CPU with the arithmetic coprocessor and an external 40 MB hard disk) to buy a PC running the wonderful OS Linux that I got to know in 1993 when I started my Ph.D. Not having anymore an Amiga computer, I could not read the 800 kB formatted Amiga disk with a normal PC. In fact, these floppy disks require an Amiga floppy driver that format the disk in a different manner than those on common PC. I was almost resolved to buy a second hand Amiga 500 on eBay (an idea that still is tickling in my mind time to time) when I discover the smart adfread software by Toni Wilen and Simon Owen, that use two PC floppy drivers to read 800kB Amiga formatted. I was lucky to still possess an old PC with a motherboard supporting 2 floppy drivers, and that the 2-drive trick worked nicely for all of my 27 years old floppies! So I could recover all my programs. The next step in this story is the great Amiga emulator FS-UEA (https://fs-uae.net) that can run very nicely the emulation of the Amiga 4000 (Motorola 68040 CPU, the top level of the Amiga family that was for me a dream computer since I could not afford to buy it!) with Workbench 3.1 on my MacBook laptop. This allowed me to run software that I have developed more than 27 years ago! The largest projects that I accomplished with this computer was the realization of a program for the visualization of molecules. I have described it in another blog in Italian. Here, I will give a short summary.
The program is one of the most complex programs in the BASIC programming language that I have ever written using a microcomputer. It combines both capabilities of editing and visualization of molecular structures.
The program assists in editing the coordinates of the molecules creating a sort of database. The coordinates can be retrieved using a file loader shown in the screenshot below from the FS-UAE emulator.
The file loader window contains a list of molecules whose crystallographic fractional coordinates. I have copied these coordinates by hand from books and journals of crystallography from the library of the Department of chemistry. Unfortunately, at that time, I was a chemistry undergraduate student without the access to the crystallographic database (CSD)… I had also to spend quite some time to find the general formula to transform the coordinated from fractional crystallographic to cartesian (normal) one. I remember that I was jubilant and proud of myself when finally I figured out the correct matrix!
The atomic coordinates are usually reported in the literature as fractional coordinates (i.e. divided by the length of the sides (a,b,c) of the unit cell) in the reference frame of the unit cell. To represent them in the Cartesian reference system used in my program, it is needed to apply a reference system transformation that takes in account the crystallographic angles (, and ) of the unit cell. For a given atom of fractional coordinates the corresponding cartesian coordinates are obtaind by the transformation:
' In Amiga Basic ' Convert Fractional to Cartesian Coordinates X=XF*AA Y=YF*BB Z=ZF*CC XC=X*SIN(ga)+Z*((COS(be)-COS(ga)*COS(al))/SIN(ga)) YC=X*COS(ga)+Y+Z*COS(al) ZC=(Z/SIN(ga))*SQR(1-(COS(ga)^2)-(COS(al)^2)-(COS(be)^2)+2*COS(al)*COS(be)*COS(ga))
The unitary cell can be also visualized with the atomic coordinates. In the above screenshot, the crystal structure of the beta-carotene molecule and the crystallographic unit cell are shown.
In addition, the program can manipulate the molecules in space by performing translation, scaling and rotations along the axis of the reference system. The resulting coordinates are projected on the viewport of the screen using the parallel-perspective transformation. The program can also generate the visualization of the crystallographic packing.
Finally, in this last screenshot, it is shown one of the windows for the measure of geometric properties of the molecule, in this case bond angles.