document.getElementById('debug').value+=\"$txt\"; "; flush(); } } if($DEBUG) { echo ''; echo ""; } ?> &1`-0; debug("Running generate processes: $CNT_generate\\n"); $CNT_jmolviewd=`ps -ef | grep jmolviewd2 | grep -v grep | wc -l 2>&1`-0; debug("Running jmolviewd servers: $CNT_jmolviewd\\n"); // Overwrite variable values with the data given via POST debug("POST-Variablen: "); foreach($_POST as $key => $value) { debug("$key=$value,\t"); if($key=="nextpage") $nextpage=$value; if($key=="backpage") $backpage=$value; if($key=="formula") $formula=$value; if($key=="formula") $formula=$value; if($key=="reset") $reset=1; } if($formula=="") $reset=1; debug("\\n"); // Reset data, if this was requested if($reset) { $formula="C6H6"; } ?> 0) { return trim(fgets($istream, 1024)); } return FALSE; } // Überschreibe Anzahl gefundener Moleküle function set_nocalc($nr,$stat) { echo << document.getElementById("nocalc").firstChild.nodeValue="$nr" document.getElementById("status").firstChild.nodeValue="$stat" document.getElementById("jmolview").notifyChange() END; } // For each molgen-run we need a unique processid // Last used processid is stored in file $TMP_PATH/processid.dat. // The id is running cyclic through the values 100-999. // Thus, after 900 calls the output files are automatically overwritten. // (Hoping, that the file is not used any more!) function get_processid() { global $pidfile; // Lese zuletzt genutzte process_id $file=fopen($pidfile,"r"); $process_id=fread($file,10); fclose($file); // Neue process_id: if($process_id<100 || $process_id>=999) $process_id=100; else $process_id=1+$process_id; // Schreibe neue processid: $file=fopen($pidfile,"w"); fwrite($file,"$process_id\n"); fclose($file); return $process_id; } function start_molgen() { global $sdffile; global $logfile; global $pid; global $process; global $pipes; global $command; $REMOTE_ADDR=getenv('REMOTE_ADDR'); $HTTP_USER_AGENT=getenv('HTTP_USER_AGENT'); $fp=fopen("$logfile","a"); fputs($fp,date("[Y/m/d-H:i:s]")." $REMOTE_ADDR: START PROCESS $pid:\n $command \t($HTTP_USER_AGENT)\n"); fclose($fp); $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a file to write to: Number of chars=number of generated molecules 2 => array("pipe", "w") // stderr is a pipe that the child will write to // 1 => array("pipe", "w"), // stdout is a pipe that the child will write to // 2 => array("file", "$logfile", "w") // stderr is a file to write to ); $process = proc_open("$command", $descriptorspec, $pipes); } function close_molgen() { global $logfile; global $pid; global $process; global $pipes; fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); $REMOTE_ADDR=getenv('REMOTE_ADDR'); $HTTP_USER_AGENT=getenv('HTTP_USER_AGENT'); $fp=fopen("$logfile","a"); fputs($fp,date("[Y/m/d-H:i:s]")." $REMOTE_ADDR: PROCESS $pid DONE. (".connection_status()."): $command \t($HTTP_USER_AGENT)\n"); fclose($fp); } function start_jmolviewd() { global $sdffile; global $logfile; global $pid; global $process_jmolviewd; global $pipes_jmolviewd; global $command_jmolviewd; echo "Starting demon...\n"; $REMOTE_ADDR=getenv('REMOTE_ADDR'); $HTTP_USER_AGENT=getenv('HTTP_USER_AGENT'); $fp=fopen("$logfile","a"); fputs($fp,date("[Y/m/d-H:i:s]")." $REMOTE_ADDR: START PROCESS $pid:\n $command_jmolviewd \t($HTTP_USER_AGENT)\n"); fclose($fp); $command_jmolviewd="$BIN_PATH/jmolviewd2.wwwlauncher $sdffile"; $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a file to write to: Number of chars=number of generated molecules 2 => array("pipe", "w") // stderr is a pipe that the child will write to ); $process = proc_open("$command_jmolviewd", $descriptorspec, $pipes_jmolviewd); } // ************************************************** // Initialisierungen... if($reset==0) { // build up command line: $logfile="$TMP_PATH/molgen.log"; $pidfile="$TMP_PATH/molgen.pid"; debug("\$logfile: $logfile\\n"); debug("\$pidfile: $pidfile\\n"); $pid=get_processid(); $sdffile="$TMP_PATH/gen${pid}.sdf"; $DUMMY=`touch $sdffile`; debug("\$sdffile: $sdffile\\n"); // Launch jmolviewd server: debug("Calling jmolviewd: \\n `$BIN_PATH/jmolviewd2.wwwlauncher $sdffile 2>&1` \\n"); $handle= popen("$BIN_PATH/jmolviewd2.wwwlauncher $sdffile 2>&1","r"); $IOR = fgets($handle); pclose($handle); debug("DONE.\\n"); debug("IOR: $IOR\\n"); // Aus irgendeinem Grund erscheint das nicht, vmtl. zu lang? } ?>
 

MOLiS: Eingabe in MOLGEN

MOLGEN
 

Geben Sie eine Molekülformel ein (Indizes werden automatisch gesetzt):

         


 
0 Moleküle mit dieser Summenformel (rechnet).

END; } ?>
 
 
 
 

(c) Walter.Wagner ät uni-bayreuth.de, Universität Bayreuth; Impressum

 
=$TIMEOUT) { $stop=1; debug("timeout\\n\\n"); set_nocalc($i,"(Zeitlimit überschritten)"); fwrite($pipes[0], "C"); // causes molgen to interrupt itself. } } if(($line = fgets_u($pipes[2]))) { debug("$line\\n"); } if(($line=fgets_u($pipes[1]))) { $i+=strlen($line); set_nocalc(" $i","(rechnet)"); } flush(); } if(!$stop) { // molgen finished regularly set_nocalc($i,"(fertig)"); debug("DONE.\\n\\n"); } close_molgen(); } } // if($reset!=1) ?>