I571/ChE531 2007 Class WikiMain Page | About | Help | FAQ | Special pages | Log in

Printable version | Disclaimers | Privacy policy

Programming Notes

From I571/ChE531 2007 Class Wiki

[edit] Create a page that uses a JMOL molecule

Log onto cheminfo.informatics.indiana.edu, and enter your public_html directory

cd public_html

Download the JMOL package and extract the JMOL applet files to your "server"

wget http://superb-west.dl.sourceforge.net/sourceforge/jmol/jmol-11.2.14-binary.tar.gz
tar xvzf jmol-11.2.14-binary.tar.gz

Rename the directory

mv jmol-11.2.14 jmol

Create a caffeine molecule XYZ file

cat > caffeine.xyz
 24
 Caffeine
 C          0.8423320060       -0.3654865620        0.0000000000
 C         -0.2841017540       -1.1961236000        0.0000000000
 N          2.0294818880       -1.1042264700        0.0000000000
 N          0.0774743850       -2.5357317920        0.0000000000
 N         -1.6472646000       -0.6177952290        0.0000000000
 C          1.4531962870       -2.3678913120        0.0000000000
 C          0.6373131870        1.1735112670        0.0000000000
 C         -1.7812691930        0.7688916330        0.0000000000
 N         -0.6771444680        1.6306355000        0.0000000000
 O          1.6106752160        1.9349693060        0.0000000000
 O         -2.9202890400        1.2510058880        0.0000000000
 C         -0.9202462430        3.1094501020        0.0000000000
 C         -2.8623938560       -1.4824503660        0.0000000000
 C          3.4552156930       -0.6811094280        0.0000000000
 H          2.0878150460       -3.2451913360        0.0000000000
 H         -1.4989252090        3.4222116470       -0.8897886280
 H         -1.4989252090        3.4222116470        0.8897886280
 H          0.0071905670        3.7148499490        0.0000000000
 H         -3.4903070930       -1.2888938190       -0.8907763360
 H         -3.4903070930       -1.2888938190        0.8907763360
 H         -2.6289534570       -2.5638654230        0.0000000000
 H          4.1360211370       -1.5529079440        0.0000000000
 H          3.6817059520       -0.0685850980        0.8931597470
 H          3.6817059520       -0.0685850980       -0.8931597470

(press CTRL-D)

Create a simple page that uses JMOL

cat > test.html
<head> 
  <title>Simple JMOL example</title> 
  <script src="jmol/Jmol.js" type="text/javascript"></script> 
</head>
<body>
  <form>
    <script type="text/javascript"> 
      jmolInitialize("jmol"); //    Use your own path here {#2} 
      jmolApplet(400, "load caffeine.xyz"); 
    </script>
  </form>
</body>

(press CTRL-D)

View your page at (substitute djwild for your username):

http://cheminfo.informatics.indiana.edu/~djwild/test.html

[edit] Write a simple PHP script to extract molecules from a database

We will use the database djwildtest we created in a previous class.

Create PHP file (substitute password)

cat > getsmiles.php
<BODY>

Results...<br><br>

<?php

if (!pg_connect("host=localhost dbname=chord user=cicc1 password=*****"))
{
  echo 'ERROR:'.pg_last_error();
  echo "<br>";
}

$result = pg_query("select smiles,name,logp from djwildtest where matches(smiles, '*C(=O)O');");

if(!$result)
{
  echo 'ERROR:'.pg_last_error();
  echo "<br>";
}

while($row = pg_fetch_row($result))
{
  echo $row[0].' '.$row[1];
  echo "<br>";
}

?>

(press CTRL-D)

View it, e.g. at http://cheminfo.informatics.indiana.edu/~djwild/getsmiles.php

Retrieved from "http://cheminfo.informatics.indiana.edu/djwild/i571wiki2007/index.php/Programming_Notes"

This page has been accessed 519 times. This page was last modified 16:06, 17 October 2007.


Find

Browse
Main Page
Community portal
Current events
Recent changes
Random page
Help
Donations
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list
Statistics
Bug reports
More...