Leonardo Electronic Journal of Practices and echnologies ISSN 1583-1078 Issue 1, July-December 2002. 69-76 Free Software Develoment. 2. Chemical Database Management Monica ŞEFU 1, Mihaela Ligia UNGUREŞAN 2, Lorentz JÄNSCHI 2,* 1 Babeş-Bolyai University Cluj-Naoca 2 echnical University Cluj-Naoca * corresonding author, htt://lori.academicdirect.ro Abstract he resent aer is focused on modeling of thermodynamic rocesses by using of thermodynamic functions with alications in field of material science and engineering. A new method of data rocessing is resented and alied on a set of substances with known thermodynamic arameters (temerature coefficients of molar caloric caacity, standard enthaly and entroy). he method allows identifying the ossible reactions and evaluating of state transformation arameters ( G, H, S). An algorithm for comuting data was imlemented in rerocessed hyertext language (PHP), a hyertext marku language interface for them was also realized and ut onto vl.academicdirect.ro educational web server, and it is accessible via htt rotocol at the address: htt://vl.academicdirect.ro/molecular_dynamics/free_enthaly/. Keywords Modeling, Analytical methods, Automat rocessing of data, Server side technologies. htt://lejt.utcluj.ro 69
Free Software Develoment. 2. Chemical Database Management Monica ŞEFU, Mihaela Ligia UNGUREŞAN, Lorentz JÄNSCHI 1. Introduction In field of statistical data rocessing it exist a large set of software to comute and fit the regressions, but few are free. Even for free software, another roblem it aear, oerating system license and ortability of the software. As examle, to use well known Microsoft Excel software, you must have Microsoft Windows and Microsoft Excel license and ortability of Excel rogram is restricted to Windows latform. o imort Excel files in another rograms or latforms, conversion modules are needed, and conversion is not totally in most of the cases. Platform indeendent and free software is a real alternative to this. First ste to build totally free software is to install a free oerating system. Unix-like oerating systems are known to be free, but even here exist licensed software. In order to select a totally free Unixlike oerating system, best offer come from BSD family. he most secure and license check for installed software is NetBSD [1]. he NetBSD detect so called license agreement and do not ermit to install a software if the software contain unaccetable license agreement (different form free) and software can be installed only if the accetance is exlicitly stiulated by the user in configuration files of the system. Another advantage of NetBSD oerating system is his huge ortability under various hardware latforms from i386 family to Sun and Macintosh machines. By another hand, most full featured oerating system of BSD family is FreeBSD [2]. One of the advantages of the FreeBSD oerating system is his software ortability. With adequate ackages, under FreeBSD, can be executed DOS, Windows, Linux and Sun-OS rograms. Another advantage of FreeBSD system comes from easiest to install and use it. Once you have an oerating system installed, the next ste is to choose a roer rogramming language for software develoing. Here, some major questions must be answered. In terms of rogramming, ortability of resulted rogram can be a roblem. As examle, if we are chose to imlement the algorithm in Visual Basic, the execution of the rogram is restricted to Windows machines. If Perl is our choice, a Unix-based machine is necessary to run rogram. Even if we chouse to imlement the rogram in C language, we will have serious difficulties to comile the rograms on machines running with different oerating systems. 70
Leonardo Electronic Journal of Practices and echnologies ISSN 1583-1078 Issue 1, July-December 2002. 69-76 he comlexity of rogram building is also a serious reason in language chousing. Is known that C based languages is oor in simlicity and necessity more time to exend for alication building than other languages. Other questions require an answer: We want a server based alication or client based alication? We want a server side alication or a client side alication? As examle, a client side alication can have disadvantage of execution on client, and deendence of rocessing seed by ower of client machine. If we refer this variant, a java scrit or visual basic scrit is our rogramming language. A server side alication requires a web server installed. he area of web servers is also a large set, but few have multilatform caability. If we want a full featured web server, Aache is our solution [3]. Under Aache, we have the ossibility to execute rograms already comiled in C, Fortran and Java, under Unix machines we can directly execute Perl rograms, and, most imortant, under all oerating system latforms we can execute PHP rograms if we reviously install h language and module binaries. [4] he advantage of PHP rograms consist in his ortability under most of oerating system latforms and internal comilation feature that do not necessity the comilation by hand from the user. he disadvantage can be same internal comilation that consumes sulementary time in execution. But, this disadvantage can be artially eliminated through installing a PHP roxy, that store comiled rograms and next execution of the unmodified rogram use this comiled binary [5]. In terms of rogram develoing PHP is easy to use, the language borrow syntax from C, Pascal, Basic and Perl, but do not borrow the comlex declaration syntax from them. he ointer mechanism is absolute. hus, a variable used as a string, can be exloited as an integer or real if the value reresent a number such that. Class constructing is also available and PHP osses a strong library of database connectivity. Modular rogramming, recursivity and grahics are at home! Module loading of comiled rograms in other languages and execution of binary rograms is also available. System services such as mail service are easy to exloit in PHP scrits [6]. A very easy mechanism to link PHP scrits to HML scrits make PHP language to be one of the best. Shell executing commands make PHP a useful latform for system administration (PhSysInfo, WebAdmin, PhMyAdmin, PhPgAdmin) [7]. As a conclusion, PHP is our choice [8]! 71
Free Software Develoment. 2. Chemical Database Management Monica ŞEFU, Mihaela Ligia UNGUREŞAN, Lorentz JÄNSCHI PHP rograms are utted on a web server data folder and executed by them using PHP module. he outut of the PHP rogram is in HML style and can be viewed by any web client (Microsoft Internet Exlorer, Mozzilla, Oera, Netscae, Konkueror). 2. heoretical Considerations he enthaly (H) is a function of two indeendent state variables; if we chouse and indeendent variables, then H = H(,) and: H dh = H d + d = H d + C d (1) where C is caloric caacity at constant ressure. he modeling of C P = C P () are described in literature through one of the equations: C + c' C = a + b + (2) 0 2 0 = a + b c, 2 deending on tye of substance [9]. he coefficients a, b, c and c' are exerimentally obtained. Reactants Products C va to t f Fig. 1. Caloric isobar caacity deendency of temerature For a chemical reaction (see fig. 1) if we consider two different temeratures, the transformation functions can be exressed at one temerature deending on the other temerature through equation: 72
Leonardo Electronic Journal of Practices and echnologies ISSN 1583-1078 Issue 1, July-December 2002. 69-76 1 r H( 1 ) = r H( 0 ) + r C ()d (3) 0 where r H is variation of enthaly function and r C is variation of caloric isobar caacity in reaction. For a given substance, the exression for H function (see fig. 1) is: t (s) H() = H(0) + C () d + toh + f 0 t (g) C () d + H + C ()d (4) (l) va f where C (s), C (l), C (g) are caloric isobar caacities in solid, liquid and gaseous hase. Based on similar considerations, the equation for S deendence of temerature is: S() = S(0) + t 0 (s) C () d + to t H + f C t () d (l) + va f H f (g) C () d (5) he free enthaly, enthaly and entroy are related through equation: G = H S (6) For a rocess at constant ressure and temerature: G = H S (7) he mentioned above formulas are used to comute the transformation functions. 10 3. Imlementation and Results A grahical interface was built in PHP with a SELEC and OPION for inut data and an INPU SUBMI button for submitting data to the server. he server is a Free BSD Unix based server (5.0 DP1 software version) with an Aache web server (1.3.26 software version) running on. he server is hosted in educational network of echnical University of Cluj-Naoca with address 193.226.7.200 and name vl.academicdirect.ro. he PHP language was comiled with GDI (grahical device interface) and MySQL (database server) suort 73
Free Software Develoment. 2. Chemical Database Management Monica ŞEFU, Mihaela Ligia UNGUREŞAN, Lorentz JÄNSCHI and the PHP software version is 4.2.3. he MySQL database server is also installed and running on and his software version is 3.23.52. A database called reactii was utted onto a MySQL database server. he database contains two tables, one called substante and the other called ecuatii. he table substante contain formula of substance, the standard enthaly and entroy, temerature coefficients of caloric isobar caacity and the maximum and minimum values of temeratures for validity of deendency of C P by temerature. he table ecuatii contain the coefficients of all ossible reactions between substances from table substante and the equations of reactions [11]. he database was filled using PhMyAdmin rogram. he inut interface is resented in fig. 2: Fig. 2. he outut of index.h he index.h rogram submits data to the vl.academicdirect.ro server and these select reaction roducts and ut the coefficients of reaction and submit them to the client. Next ste is to select a wanted temerature and submit to the server (see fig. 3). 2Na + 2HCl -> 2NaCl + H 2 Reaction temerature: Fig.3. he outut of ecuatie.h he ecuatie.h rogram submits data to the vl.academicdirect.ro server and these comute transformation state functions, as in fig. 4. Based on these calculations, can be obtained some imortant results: the deendence of enthaly from temerature for an given substance; the deendence of entroy from temerature for an given substance; 74
Leonardo Electronic Journal of Practices and echnologies ISSN 1583-1078 Issue 1, July-December 2002. 69-76 the interval of temerature for which a given reaction is sontaneously; the temerature oint when a sontaneous reaction become a forced reaction; H(Na, 316.25 K, 1 atm.) = 507.47349797813 kj/mol S(Na, 316.25 K, 1 atm.) = 53.073192700215 J/mol*K H(HCl, 316.25 K, 1 atm.) = 438.76832126635 kj/mol S(HCl, 316.25 K, 1 atm.) = 188.43019937988 J/mol*K H(NaCl, 316.25 K, 1 atm.) = 518.9519321 kj/mol S(NaCl, 316.25 K, 1 atm.) = 75.38930503336 J/mol*K H(H2, 316.25 K, 1 atm.) = 525.85395428912 kj/mol S(H2, 316.25 K, 1 atm.) = 132.31319666725 J/mol*K H(2Na + 2HCl -> 2NaCl + H2) = 2*H(NaCl) + 1*H(H2) - 2*H(Na) - 2*H(HCl) S(2Na + 2HCl -> 2NaCl + H2) = 2*S(NaCl) + 1*S(H2) - 2*S(Na) - 2*S(HCl) G = H - * S H(2Na + 2HCl -> 2NaCl + H2) = -328.72581999982 kj/mol S(2Na + 2HCl -> 2NaCl + H2) = -199.91497742623 J/mol*K G(2Na + 2HCl -> 2NaCl + H2) = -265.50270838878 kj/mol Fig. 4. he outut of calcule.h 4. Conclusions Considering the advantages of imlemented software technology (machine and oerating system ortability, grahical interface and database connectivity features, easiest of rograms develoing, free tye license agreement, htt caability) the rogramming language and the rogram itself is the one of the best choice now available. he rogram is successfully used for student ractice in field of hysical chemistry. he rogram ermits to observe more efficient the rocess of reaction on different temeratures in real time. Imrovements of the rogram can be make considering that the equation can be obtain directly from substances formula and coefficients, and also the coefficients can be obtained directly from stoechiometry. 5. Acknowledgments Authors are grateful to the rector of echnical University of Cluj-Naoca, Prof. Ph. D. Eng. Gheorghe LAZEA for his olicy on romoting information technology and to the 75
Free Software Develoment. 2. Chemical Database Management Monica ŞEFU, Mihaela Ligia UNGUREŞAN, Lorentz JÄNSCHI university staff for suort related to the internet connection of com web server. Useful suort was also benefit from Romanian Ministry of Education for finance funding of MEC/CNCSIS contract 468/"A"/2002 and 281/"A"/2002. References [1] htt://www.netbsd.org [2] htt://www.freebsd.org [3] htt://www.aache.org [4] Lorentz Jäntschi, Real ime Proerty Investigation in Sets of Alloys, International Conference on Advanced Materials and Structures AMS 2002, Setember 19-21 2002, imisoara, Romania, volume "SIC on AMS",. 189-194. [5] htt://www.zend.com [6] Lorentz Jäntschi, Automat Server Side Processing of Statistical Data, UNIECH'02 International Scientific Conference, November 21-22 2002, Gabrovo, Bulgaria, volume "ISC UNIECH'02 GABROVO Proceedings",. 185-189. [7] htt://www.hmyadmin.net [8] Lorentz Jäntschi, Proerty Investigations with an Automat Correlation Routine and Alications for a Set of Alloys, Acta echnica Naocensis, Section Machine Constructions, Materials, Vol. 45(2002), art 1,. 296-301. [9] Holm Jan Lutzow, Enthaly Cycles in Inorganic Chemistry, J. Chem. Educ., 51, 460, 1974. [10] Lorentz Jäntschi, Mihaela Unguresan, Physical Chemistry. Molecular Kinetic and Dynamic (in Romanian), Mediamira, Cluj-Naoca, 2001, 159. [11] Rock P. A., Chemical hermodynamics, University Science Books, Mill Valley, 1983. 76