home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / testChem.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  2.4 KB  |  61 lines

  1. <pre>
  2. <?php
  3. //
  4. // +----------------------------------------------------------------------+
  5. // | PHP Version 4                                                        |
  6. // +----------------------------------------------------------------------+
  7. // | Copyright (c) 1997-2003 The PHP Group                                |
  8. // +----------------------------------------------------------------------+
  9. // | This source file is subject to version 2.0 of the PHP license,       |
  10. // | that is bundled with this package in the file LICENSE, and is        |
  11. // | available at through the world-wide-web at                           |
  12. // | http://www.php.net/license/2_02.txt.                                 |
  13. // | If you did not receive a copy of the PHP license and are unable to   |
  14. // | obtain it through the world-wide-web, please send a note to          |
  15. // | license@php.net so we can mail you a copy immediately.               |
  16. // +----------------------------------------------------------------------+
  17. // | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net>                |
  18. // +----------------------------------------------------------------------+
  19. //
  20. // $Id: testChem.php,v 1.3 2003/01/04 11:56:25 mj Exp $
  21. //
  22.  
  23. require_once "Science/Chemistry.php";
  24. require_once "Science/Chemistry/Molecule_XYZ.php";
  25. require_once "Science/Chemistry/Macromolecule.php";
  26.  
  27. echo "Creating and printing an atom\n";
  28. $a = new Science_Chemistry_Atom("N", array(2.3,4.5,-2.1));
  29. echo $a->toString()."\n";
  30. echo "Creating a second atom and calculating distance to first one\n";
  31. $b = new Science_Chemistry_Atom("C", array(1.2,3.4,-1.6));
  32. echo $b->toString()."\n";
  33. echo "\nDistance N to C: ".sprintf("%.4f", $a->distance($b))." Angstroms\n";
  34. //print_r($a);
  35. //print_r($b);
  36.  
  37. echo "\n=====\nReading a molecule:\n";
  38. $m = new Science_Chemistry_Molecule_XYZ("his.xyz");
  39. echo "\$m is a molecule: ".(int)Science_Chemistry_Molecule::isMolecule($m)."\n";
  40. echo $m->toString();
  41. //echo "Calculating Distance Matrix\n";
  42. //$m->printDistanceMatrix();
  43. //echo "Calculating Connection Table\n";
  44. //$m->printConnectionTable();
  45. //echo $m->toCML("Histidine","His", true);
  46. //print_r($m);
  47. //print_r($m->getConnectionTable());
  48. //$start=time();
  49.  
  50. $n = new Science_Chemistry_Molecule_XYZ("lys.xyz");
  51.  
  52. $mols = array($m, $n);
  53.  
  54. $big = new Science_Chemistry_Macromolecule("big one", $mols);
  55.  
  56. echo $big->toString();
  57. echo $big->toCML("biggie", "big", true);
  58.  
  59. ?>
  60. </pre>
  61.