home *** CD-ROM | disk | FTP | other *** search
- #include "elements.h"
-
- extern struct IntuiText CAMMText, TextText, ElementText;
-
- display_subpart()
- {
- struct Window *window;
- struct RastPort *rp;
- static int vertlines[] = {136,248,360,480,560};
- static int boxwidth[] = {0,112,112,120,80,56};
- register USHORT i;
- long x, y;
- static char *text0[] = {"","Symbol","Rest mass (kg)","Rel. atomic mass",
- "Charge (C)","Radius (m)","Spin quantum #","Magnetic Moment!"};
- static char *text1[] = {"Neutron","Proton","Electron*","Neutrino*","Photon"};
- static char *text2[] = {"n","p","e (e-)","v","y"};
- static char *data0[] = {"1.67495x10-+2+7","1.67265x10-+2+7","9.1095x10-+3+1","~0","0"};
- static char *data1[] = {"1.008665","1.007276","5.48580x10-+4","~0","0"};
- static char *data2[] = {"0","1.60219x10-+1+9","-1.60219x10-+1+9","0","0"};
- static char *data3[] = {"8x10-+1+6","8x10-+1+6","<1x10-+1+6","~0","0"};
- static char *data4[] = {"1/2","1/2","1/2","1/2","1/2","1"};
- static char *data5[] = {"-1.913uN","2.793uN","1.001uB","0","0"};
- static char *infotext[] = {
- " * The positron (e+) has properties similar to those of the (negative)",
- "electron or beta particle except that its charge has opposite sign (+).",
- "The antineutrino (v) has properties similar to those of the neutrino",
- "except that its spin (or rotation) is opposite in relation to its direc-",
- "tion of propogation.",
- " An antineutrino accompanies release of an electron in radioactive B",
- "(particle) decay, whereas a neutrino accompanies the release of a posi-",
- "tron in B+ decay.","",
- " !uB = Bohr magneton and uN = Nuclear magneton."};
- char text[20];
-
- *(text0[7]+15) = 0x8A;
- *(text2[2]+4) = 0x8E;
- *(text2[3]) = 0x93;
- *(text2[4]) = 0x94;
- *(data5[0]+6) = 0x90;
- *(data5[0]+7) = 0x92;
- *(data5[1]+5) = 0x90;
- *(data5[1]+6) = 0x92;
- *(data5[2]+5) = 0x90;
- *(data5[2]+6) = 0x91;
- *(infotext[0]+19) = 0x8F;
- *(infotext[2]+18) = 0x93;
- *(infotext[5]+70) = 0x8D;
- *(infotext[7]+8) = 0x8D;
- *(infotext[7]+9) = 0x8F;
- *(infotext[9]+1) = 0x8A;
- *(infotext[9]+2) = 0x90;
- *(infotext[9]+3) = 0x91;
- *(infotext[9]+25) = 0x90;
- *(infotext[9]+26) = 0x92;
-
- if (!(window = get_window(12,100,616,197,"Info")))
- return(NULL);
- rp = window->RPort;
-
- ElementText.FrontPen = GREENTEXT;
- ElementText.IText = (UBYTE *)"Data Concerning The More Stable Elementary (Subatomic) Particles";
- i = .5 * (616-IntuiTextLength(&ElementText));
- PrintIText(rp, &ElementText, (long)i, 13L);
-
- SetAPen(rp, (long)BOX_COLOR);
- for (y = 30; y < 110; y += 10)
- {
- Move(rp, 0L, y);
- Draw(rp, 616L, y);
- }
- Move(rp, 0L, 111L);
- Draw(rp, 616L, 111L);
-
- for (i = 0; i < 5; i++)
- {
- Move(rp, (long)vertlines[i], 31L);
- Draw(rp, (long)vertlines[i], 111L);
- }
- TextText.FrontPen = GREENTEXT;
- for (y = 1; y < 8; y++)
- {
- TextText.IText = (UBYTE *)text0[y];
- PrintIText(rp, &TextText, 3L, (long)(y*10+32));
- }
- for (x = 0; x < 5; x++)
- {
- TextText.IText = (UBYTE *)text1[x];
- i = .5 * (boxwidth[x+1]-IntuiTextLength(&TextText)) + 1;
- PrintIText(rp, &TextText, (long)(vertlines[x]+i), 32L);
- }
- TextText.FrontPen = BLUETEXT;
- for (x = 0; x < 5; x++)
- {
- TextText.IText = (UBYTE *)text2[x];
- i = .5 * (boxwidth[x+1]-IntuiTextLength(&TextText)) + 1;
- PrintIText(rp, &TextText, (long)vertlines[x]+i, 41L);
- }
- TextText.FrontPen = REDTEXT;
-
- for (y = 0; y < 6; y++)
- for (x = 0; x < 5; x++)
- {
- if (y == 0) convert_super(data0[x], text);
- if (y == 1) convert_super(data1[x], text);
- if (y == 2) convert_super(data2[x], text);
- if (y == 3) convert_super(data3[x], text);
- if (y == 4) convert_super(data4[x], text);
- if (y == 5) convert_super(data5[x], text);
- for (i = 1; text[i] != '\0'; i++)
- if (text[i] == '-')
- text[i] = 0x8E;
- TextText.IText = (UBYTE *)text;
- i = .5 * (boxwidth[x+1]-IntuiTextLength(&TextText)) + 2;
- PrintIText(rp, &TextText, (long)(vertlines[x]+i), (long)(y*10+52));
- }
- TextText.FrontPen = GREENTEXT;
- for (y = 0; y < 10; y++)
- {
- TextText.IText = (UBYTE *)infotext[y];
- PrintIText(rp, &TextText, 21L, (long)(y*8+114));
- }
- return(TRUE);
- }
-
- display_radioiso()
- {
- struct Window *window1, *window2;
- struct RastPort *rp;
- FILE *file;
- char isotope[40], text[40];
- register USHORT i;
- long x, y;
- BOOL par, nat;
- static char *infotext[] = {
- "Naturally occurring radioactive isotopes",
- "are designated by a mass number in blue",
- "(although some are also manufactured).",
- "Letter m indicates an isomer of another",
- "isotope of the same mass number. Half-",
- "lives follow in parenthesis,where s,min,",
- "h,d,and y stand respectively for seconds,",
- "minutes,hours,days,and years. The table",
- "includes mainly the longer-lived radio-",
- "active isotopes; many others have been",
- "prepared. Isotopes known to be radioact-",
- "ive but with half-lives exceeding 1012y",
- "have not been included. Symbols describ-",
- "ing the principle mode(or modes)of decay",
- "are as follows (these processes are gen-",
- "erally accompanied by gamma radiation.","",
- "a alpha particle emission",
- "B- beta particle (electron) emission",
- "B+ positron emission",
- "EC orbital electron capture",
- "IT isomeric transition from upper/lower",
- "SF spontaneous fission"
- };
- *(infotext[11]+36) += 0x50;
- *(infotext[11]+37) += 0x50;
- *(infotext[17]) = 0x8C;
- *(infotext[18]) = 0x8D;
- *(infotext[18]+1) = 0x8E;
- *(infotext[19]) = 0x8D;
- *(infotext[19]+1) = 0x8F;
-
- if (!(file = fopen(ISOTOPES_FILE, "r")))
- return(NULL);
-
- if (!(window1 = get_window(0,0,640,400,"Table of Selected Radioactive Isotopes")))
- return(NULL);
-
- if (!(window2 = get_window(100,100,337,216,"Info")))
- {
- close_window(window1);
- return(NULL);
- }
- rp = window2->RPort;
-
- ElementText.FrontPen = BLUETEXT;
- ElementText.IText = (UBYTE *)"Selected Radioactive Isotopes";
- y = .5 * (337-IntuiTextLength(&ElementText));
- PrintIText(rp, &ElementText, y, 12L);
-
- TextText.FrontPen = GREENTEXT;
- for (y = 0; y < 23; y++)
- {
- strcpy(text, infotext[y]);
- TextText.IText = (UBYTE *)text;
- PrintIText(rp, &TextText, 5L, (long)(y*8+26));
- if (y > 16)
- {
- *(text+2) = '\0';
- TextText.FrontPen = REDTEXT;
- PrintIText(rp, &TextText, 5L, (long)(y*8+26));
- TextText.FrontPen = GREENTEXT;
- }
- }
- rp = window1->RPort;
-
- x = 4; y = 12;
- TextText.FrontPen = GREENTEXT;
-
- while (fscanf(file, "%s", &text) != EOF)
- {
- par = NULL;
- nat = NULL;
- if (text[0] == '_')
- text[0] = ' ';
- if (text[1] == '_')
- text[1] = ' ';
- for (i = 2; text[i] != '\0'; i++)
- {
- if (text[i] == ')')
- par = TRUE;
- if (text[i] == '_')
- text[i] = ' ';
- if (text[i] == 'a')
- text[i] = 0x8C;
- if (text[i] == 'B')
- text[i] = 0x8D;
- if (text[i] == '-')
- text[i] = 0x8E;
- if ((text[i] == '+') && par)
- text[i] = 0x8F;
- if (text[i] == '*')
- {
- text[i] = '\0';
- nat = TRUE;
- }
- }
- convert_super(text, isotope);
- TextText.FrontPen = GREENTEXT;
- TextText.IText = (UBYTE *)isotope;
- PrintIText(rp, &TextText, x, y);
- if (isotope[0] == '1')
- isotope[3] = '\0';
- else isotope[2] = '\0';
- TextText.FrontPen = REDTEXT;
- PrintIText(rp, &TextText, x, y);
- if (nat)
- {
- sprintf(isotope, "%c%c%c", text[2], text[3], text[4]);
- TextText.IText = (UBYTE *)isotope;
- TextText.FrontPen = BLUETEXT;
- PrintIText(rp, &TextText, x+16L, y);
- }
- y += 9;
- if (y > 390)
- {
- y = 12;
- x += 160;
- }
- }
- fclose(file);
-
- return(TRUE);
- }
-
- display_ionichar()
- {
- register USHORT i;
- long x = 0;
- struct Window *window;
- struct RastPort *rp;
- static float diff[] = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,
- 1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,
- 2.5,2.6,2.7,2.8,2.9,3.0,3.1,3.2};
- static USHORT percent[] = {0,1,2,4,6,9,12,15,19,22,26,30,34,39,43,47,51,
- 55,59,63,67,70,74,76,79,82,84,86,88,89,91,92};
- char difftext[25], perctext[4];
-
- if (!(window = get_window(30,150,578,71,"Info")))
- return(NULL);
- rp = window->RPort;
-
- ElementText.FrontPen = GREENTEXT;
- ElementText.IText = (UBYTE *)"Percent Ionic Character of a Single Chemical Bond";
- x = .5 * (578-IntuiTextLength(&ElementText));
- PrintIText(rp, &ElementText, x, 13L);
-
- TextText.FrontPen = BLUETEXT;
- TextText.IText = (UBYTE *)"Difference in electronegativity:";
- PrintIText(rp, &TextText, 5L, 30L);
-
- TextText.FrontPen = REDTEXT;
- TextText.IText = (UBYTE *)"Percent ionic character %";
- PrintIText(rp, &TextText, 5L, 60L);
-
- SetAPen(rp, (long)BOX_COLOR);
- for (x = 0; x < 32; x++)
- {
- Move(rp, x*18L, 41L);
- Draw(rp, x*18L, 55L);
- }
- Move(rp,0L,40L); Draw(rp,x*18L,40L);
- Move(rp,0L,48L); Draw(rp,x*18L,48L);
- Move(rp,0L,56L); Draw(rp,x*18L,56L);
-
- for (i = 0; i < 32; i++)
- {
- sprintf(difftext, "%1f", diff[i]);
- difftext[3] = '\0';
- CAMMText.FrontPen = BLUETEXT;
- CAMMText.IText = (UBYTE *)difftext;
- x = .5 * (18-IntuiTextLength(&CAMMText)) + 1;
- PrintIText(rp, &CAMMText, (long)(i*18+x), 42L);
-
- sprintf(perctext, "%d", percent[i]);
- CAMMText.FrontPen = REDTEXT;
- CAMMText.IText = (UBYTE *)perctext;
- if (i == 0)
- CAMMText.IText = (UBYTE *)"0.5";
- x = .5 * (18-IntuiTextLength(&CAMMText)) + 1;
- PrintIText(rp, &CAMMText, (long)(i*18+x), 50L);
- }
- return(TRUE);
- }
-
- display_notes()
- {
- struct Window *window;
- struct RastPort *rp;
- register USHORT i;
- static char *text[] = {
- "The A & B subgroup designations, applicable to elements in rows 4,5,6,and 7,",
- "are those recommended by the International Union of Pure and Applied Chem-",
- "istry. It should be noted that some authors and organizations use the oppo-",
- "site convention in distinguishing these subgroups.",
- "",
- " The names and symbols of elements 104-106 are those recommended by IUPAC",
- "as systematic alternatives to those suggested by the purported discoverers.",
- "Berkeley (USA) researchers have proposed Rutherfordium, Rf, for element 104",
- "and Hahnium, Ha, for element 105. Dubna (USSR) researchers, who also claim",
- "the discovery of these elements have proposed different names (and symbols).",
- "",
- "The Elements:",
- "",
- " Atomic Symbol:",
- " Atomic Weight is based upon carbon-12. () indicates most stable or best-",
- "known isotope.",
- " Densities of the gaseous elements refer to the gaseous state at 273K and",
- "1 atm and are given in units of g/l.",
- " Thermal Conductivity and Specific Heat Capacity are at 300K (27°C).",
- " Heat of Vaporization is at boiling point.",
- " Heat of Fusion is at melting point.",
- " Electrical Conductivity is generally at 293K (20°C).",
- " Atomic Radius is the quantum mechanical value for free atom.",
- " Atomic Volume is from density at 300K (27°C) for liquid and solid elem-",
- "ents; values for gaseous elements refer to liquid state at boiling point.",
- "",
- " This information was obtained from Sargent-Welch Scientific Company,",
- "7300 Linder Avenue, Skokie, Illinois 60077 with express prior written",
- "permission."
- };
- static char *hightext[] = {
- "Atomic Symbol","Atomic Weight","","Densities","","Thermal Conductivity",
- "Heat of Vaporization","Heat of Fusion","Electrical Conductivity",
- "Atomic Radius","Atomic Volume"
- };
-
- if (!(window = get_window(10,50,620,291,"Info")))
- return(NULL);
- rp = window->RPort;
-
- ElementText.FrontPen = REDTEXT;
- ElementText.IText = (UBYTE *)"Notes concerning the Table";
- i = .5 * (620-IntuiTextLength(&ElementText));
- PrintIText(rp, &ElementText, (long)i, 12L);
-
- TextText.FrontPen = GREENTEXT;
- for (i = 0; i < 29; i++)
- {
- if (i > 25) TextText.FrontPen = BLUETEXT;
-
- TextText.IText = (UBYTE *)text[i];
- PrintIText(rp, &TextText, 5L, (long)(i*9+27));
- }
- TextText.FrontPen = REDTEXT;
- for (i = 0; i < 11; i++)
- {
- TextText.IText = (UBYTE *)hightext[i];
- PrintIText(rp, &TextText, 21L, (long)(i*9+144));
- }
- ElementText.FrontPen = GREENTEXT;
- ElementText.IText = (UBYTE *)"SOLID";
- PrintIText(rp, &ElementText, 150L, 138L);
- ElementText.FrontPen = BLUETEXT;
- ElementText.IText = (UBYTE *)"LIQUID";
- PrintIText(rp, &ElementText, 220L, 138L);
- ElementText.FrontPen = REDTEXT;
- ElementText.IText = (UBYTE *)"GAS";
- PrintIText(rp, &ElementText, 300L, 138L);
- ElementText.IText = (UBYTE *)"SYNTHETICALLY PREPARED";
- outline(rp, &ElementText, 370L, 138L, (long)GREENTEXT);
-
- return(TRUE);
- }
-
- display_info()
- {
- struct Window *window;
- struct RastPort *rp;
- register USHORT i;
- long x;
- static char *text[] = {
- "This program is ShareWare. It was written",
- "as part of a larger molecular modeling",
- "application. You may copy this program",
- "and share it with your friends as much",
- "as you like. If you find this program",
- "exceptionally useful, please feel free",
- "to send me a small donation to help me",
- "offset my development time (And perhaps",
- "help pay my way through college. A good",
- "education is expensive!). If you send a",
- "disk and a donation of $10 or more, I'll",
- "gladly send you the source, and a demo",
- "of my CAMM v1.0 & v2.0 modeling software.",
- "",
- "Send donations/disks to:",
- "Paul Thomas Miller",
- "129 Orchard Avenue",
- "Rocky Mount, VA 24151",
- "(703) 483-8219"
- };
-
- if (!(window = get_window(150,50,350,222,"Some more info...")))
- return(NULL);
- rp = window->RPort;
-
- for (i = 0; i < 19; i++)
- {
- TextText.IText = (UBYTE *)text[i];
- x = .5 * (350-IntuiTextLength(&TextText));
- if (i < 14)
- TextText.FrontPen = GREENTEXT;
- if (i == 14)
- TextText.FrontPen = BLUETEXT;
- if (i > 14)
- TextText.FrontPen = REDTEXT;
- PrintIText(rp, &TextText, x, (long)(i*10)+12L);
- }
- ElementText.IText = (UBYTE *)"S h a r e a n d E n j o y !";
- x = .5 * (350-IntuiTextLength(&ElementText));
- outline(rp, &ElementText, (long)x, 205L, (long)GREENTEXT);
-
- return(NULL);
- }
-