#!/bin/csh -f
#
# Script version 1.0 - December 2010
# Script Version 2.0 - March 2019
# Script Version 2.0.1 - July 2019 (this version)
#
# This csh script is useful for generating a Jmol-based graphical interface, and
#                           for parsing R.E.D. Server Development outputs
#
# Distributed under the GNU General Public License 3.0 within R.E.D. Server Development
#
#
# To be able to visualize Jmol applets on a workstation one needs to install:
#   - the Apache HTTP server
#   - the Jmol viewer for chemical structures (http://jmol.sourceforge.net/) see ../../jmol below
#
#
# -1- For instance under Ubuntu 18.04 LTS, install the Apache HTTP server as it follows:
# sudo apt-get install apache2            -> Install the apache server
# sudo a2enmod userdir                    -> Enable module userdir (use ~/public_html) 
# mkdir ~/public_html                     -> Create a public_html directory in the user login
# sudo systemctl restart apache2.service  -> Restart apache
#
# -2- Download and install Jmol in ~/public_html
#   Two cases: 
#    -2.1- Old Jmol versions:
# Jmol versions anterior or equal to jmol-13.0.18: Jmol.js and the Java Runtime Environment (JRE) are used.
# Ex: https://sourceforge.net/projects/jmol/files/Jmol/Version%2013.0/Version%2013.0.18/Jmol-13.0.18-binary.zip/download
# cp Jmol-13.0.18-binary.zip ~/public_html
# cd ~/public_html
# unzip Jmol-13.0.18-binary.zip
# ln -s jmol-13.0.18 jmol
#
# Install the Java Runtime Environment (JRE); see:
# https://q4md-forcefieldtools.org/REDServer-Development/faq.php#19 and 
# https://q4md-forcefieldtools.org/REDServer-Development/popup/javaconfig.php
#
#     or
#
#    -2.2- Recent Jmol versions:
# Jmol versions posterior to jmol-13.0.18: JSmol and javascript are used.
# Ex: https://sourceforge.net/projects/jmol/files/Jmol/Version%2014.29/Jmol%2014.29.42/Jmol-14.29.42-binary.zip/download
# cp Jmol-14.29.42-binary.zip ~/public_html
# cd ~/public_html
# unzip Jmol-14.29.42-binary.zip
# ln -s jmol-14.29.42 jmol
# cd jmol
# unzip jsmol.zip
#
#
# Execute "csh Web-InterfacePyRED.csh Job_Directory_Name"
#     exemple: csh Web-InterfacePyRED.csh P124
#
# Then, load the P124.html web page in a browser using the following web link:
#   http://localhost/~user/P124.html
# This corresponds to the following subdirectories in the user login:
#   /home/user/public_html/P124.html
#   /home/user/public_html/P124
#   /home/user/public_html/P124.tar.bz2
#   /home/user/jmol
#
# Opening the P124.html web page as a regular file in a browser may not work:
#  i.e. using file:///home/fyd/public_html/P124.html

if ($#argv == 0) then
	echo
	echo "Provide a R.E.D. Server Job name/a directory name..."
	echo "   i.e. execute: csh Web-InterfacePyRED.csh Pxxxx" 
	echo

else if (($#argv > 0) && ($#argv < 2)) then

	set Var_Renam_Ser = $argv

	if (-d $Var_Renam_Ser) then

		cd $Var_Renam_Ser

		set REDSVersion   = REDServer-Development
		set MIRROR        = "http://upjv.q4md-forcefieldtools.org"
		set DIRRED        = Data-R.E.D.Server
		set PATHJMOL      = "../../jmol"  # i. e. /home/user/public_html/jmol
		set FILE          = "$Var_Renam_Ser.html"
		set TMP           = `find . -iname "R.E.D.-Server-*.q4md-forcefieldtools.org.log" -print0 | sed "s/^\.\///" | sed "s/\.\// /g" | awk '{print $NF}'`
		if ($TMP == "") then
			echo "Empty journal log: something wrong" > R.E.D.-Server-00.master1.q4md-forcefieldtools.org.log
			echo "Empty steps file: something wrong"  > 00.master1.q4md-forcefieldtools.org-Info.out
		endif
		set TMP           = `find . -iname "R.E.D.-Server-*.q4md-forcefieldtools.org.log" -print0 | sed "s/^\.\///" | sed "s/\.\// /g" | awk '{print $NF}'`
		set PBS_JOBID     = `echo $TMP | sed "s/\.\///g" | sed 's/R.E.D.-Server-//g' | sed 's/.q4md-forcefieldtools.org.log//g'`

		if (! -d "./$DIRRED") set DIRRED = "."

		echo
		echo "Generation of the graphical interface for $Var_Renam_Ser : Started..."
		echo

# head of the index file...
echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'						>  $FILE
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																					>> $FILE
echo '<head>'																																		>> $FILE
echo "<title> R.E.D. Server Development: Project $Var_Renam_Ser </title>"																					>> $FILE
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																		>> $FILE
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"												>> $FILE
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																>> $FILE
echo '<script type="text/javascript">'																												>> $FILE
echo 'function popup (page,nom,largeur,hauteur,options) { var top = (screen.height-hauteur)/2; var left = (screen.width-largeur)/2; window.open (page,nom,"top="+top+",left = "+left+",width="+largeur+",height="+hauteur+","+options); }'		>> $FILE
echo 'function windowClose() { window.open("","_parent",""); window.close(); }'																		>> $FILE
echo '</script>'																																	>> $FILE
echo '</head>'																																		>> $FILE
echo '<body>'																																		>> $FILE
echo "<img src='$MIRROR/images-new/REDSDev-logo.png' align='left' width='80' alt='' /><img src='$MIRROR/images-new/REDSDev-logo.png' align='right' width='80' alt='' />"		>> $FILE
echo "<br /><br /><br /><br /><center><font size='4' color='red'><b>PROJECT $Var_Renam_Ser</b></font><br /><br /><font size='3' color='red'><b> HTML INTERFACE GENERATED BY R.E.D. SERVER DEVELOPMENT</b></font><br /><br />"		>> $FILE

echo "<font size='2' color='red'><b>"																												>> $FILE
date "+Date: %m/%d/%Y (month/day/year) - Time: %H:%M:%S %Z"																							>> $FILE
echo "</b></font><br /><br />"																														>> $FILE

echo "<font size='2' color='red'>Time data are conserved on the R.E.D. Server Development hard drives: see <a href='$MIRROR/$REDSVersion/faq.php#11' target='_blank'>faq.php#11</a></font><br /><br />"	>> $FILE

echo "<font size='2' color='red'>Job failure? &rarr; Read the <a href='$MIRROR/$REDSVersion/Documentation/readme.txt' target='_blank'>readme.txt</a>, <a href='$MIRROR/$REDSVersion/Documentation/System.config' target='_blank'>System.config</a> and <a href='$MIRROR/$REDSVersion/Documentation/Project.config' target='_blank'>Project.config</a> files, as well as how to create an <a href='$MIRROR/$REDSVersion/popup/poparchive.php' target='_blank'>archive</a> file.</font></center><br />"		>> $FILE

echo '<center><input type="button" value="Close this window" onclick="windowClose();"/></center><br />'												>> $FILE

echo "<font size='2' color='black'><b> &nbsp; &nbsp; Data are available in the </b></font><font size='2' color='black'><b>'<a href='$Var_Renam_Ser/$DIRRED' target='_blank'>$DIRRED</a></b></font><font size='2' color='black'><b>' directory...</b></font><br /><br /><font size='2' color='black'><b> &nbsp; &nbsp; Display the </b></font><font size='2' color='black'><b>'<a href='$Var_Renam_Ser/$PBS_JOBID.q4md-forcefieldtools.org-Info.out' target='_blank'>different steps</a></b></font><font size='2' color='black'><b>' of the whole processus...</b></font><br /><br /><font size='2' color='black'><b> &nbsp; &nbsp; Display the </b></font><font size='2' color='black'><b>'<a href='$Var_Renam_Ser/R.E.D.-Server-$PBS_JOBID.q4md-forcefieldtools.org.log' target='_blank'>PyRED log</a></b></font><font size='2' color='black'><b>' file...</b></font><br /><br />"		>> $FILE

if (-e ./Project.config) then
echo "<font size='2' color='black'><b> &nbsp; &nbsp; Display the uploaded </b></font><font size='2' color='black'><b>'<a href='$Var_Renam_Ser/Project.config' target='_blank'>Project.config</a></b></font><font size='2' color='black'><b>' file...</b></font><br /><br />"		>> $FILE
endif

if (-e ./System.config) then
echo "<font size='2' color='black'><b> &nbsp; &nbsp; Display the uploaded </b></font><font size='2' color='black'><b>'<a href='$Var_Renam_Ser/System.config' target='_blank'>System.config</a></b></font><font size='2' color='black'><b>' file...</b></font><br /><br />"		>> $FILE
endif

if (-e ./frcmod.user) then
echo "<font size='2' color='black'><b> &nbsp; &nbsp; Display the uploaded </b></font><font size='2' color='black'><b>'<a href='$Var_Renam_Ser/frcmod.user' target='_blank'>frcmod.user</a></b></font><font size='2' color='black'><b>' file...</b></font><br /><br />"			>> $FILE
endif

if (-e ./ArchiveFile) then
echo "<font size='2' color='black'><b> &nbsp; &nbsp; Display the uploaded </b></font><font size='2' color='black'><b>'<a href='$Var_Renam_Ser/ArchiveFile' target='_blank'>ArchiveFile</a></b></font><font size='2' color='black'><b>' file...</b></font><br /><br />"			>> $FILE
endif

set pdbnb = 0
if (-e Mol_red1.pdb) then
	set i = 1
	foreach PDBINP (`/bin/ls -v Mol_red[1-9].pdb Mol_red[1-9][0-9].pdb Mol_red[1-9][0-9][0-9].pdb | grep pdb`)
		@ i++
	end
	set pdbnb = `expr $i - 1`
endif

echo "<font size='2' color='red'><b> &nbsp; &nbsp; Number of PDB input file(s) involved in the PyRED job: &nbsp; $pdbnb</b></font><br /><br />" 		>> $FILE

if (-e Mol_red1.pdb) then
	if (! -d Applet-dir_$Var_Renam_Ser) then
		mkdir Applet-dir_$Var_Renam_Ser
	endif
echo '<font size="2" color="red"><b> &nbsp; &nbsp; PyRED input file(s)</b></font>'																		>> $FILE
echo '<table width="700">'																																>> $FILE
echo '<tr><td align="center"><font size="2"><b> &nbsp; &nbsp; No</b></font></td><td align="center"><font size="2"><b>PDB input file(s)</b></font></td><td align="center"><font size="2"><b>Download</b></font></td><td align="center"><font size="2"><b>3D display-1</b></font></td><td align="center"><font size="2"><b>3D display-2</b></font></td><td align="center"><font size="2"><b>QM File(s)</b></font ></td><td align="center"><font size="2"><b>Download</b></font></td></tr>'		>> $FILE
	set i = 1
	foreach PDBINP (`/bin/ls -v Mol_red[1-9].pdb Mol_red[1-9][0-9].pdb Mol_red[1-9][0-9][0-9].pdb | grep pdb`)
echo "<tr><td align='center'><font size='2'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2'>$PDBINP</font></td><td align='center'><a href='$Var_Renam_Ser/$PDBINP' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td><td align='center'><a href='javascript:popup("\"./$Var_Renam_Ser/Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html\"","\"java_applet-pdbinp-$i\"",800,650,"\"menubar=no,scrollbars=yes,statusbar=no,resizable=yes\"")'><img src='$MIRROR/images-new/jmol-q4mdfft.png' style='height:25px' alt='' /></a></td><td align='center'><a href='javascript:popup("\"./$Var_Renam_Ser/Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html\"","\"javascript_applet-pdbinp-$i\"",1000,750,"\"menubar=no,scrollbars=yes,statusbar=no,resizable=yes\"")'><img src='$MIRROR/images-new/jsmol-q4mdfft.png' style='height:25px' alt='' /></a></td>"		>> $FILE

echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'									>  Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																									>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo '<head>'																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<title> Project $Var_Renam_Ser - No $i - $PDBINP</title>"																											>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"																>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<script type='text/javascript' src='$PATHJMOL/Jmol.js'></script>"																								>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<script type='text/javascript'>function windowClose() { window.open('','_parent',''); window.close(); }</script>"												>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<style type='text/css'>.stlJSmol { font-size:10pt }</style>"																									>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo '</head>'																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo '<body>'																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<a href='$MIRROR/$REDSVersion' target='_blank'><img src='$MIRROR/images-new/REDSDev-logo.png' style='float:left;height:40px' alt='' /></a>"									>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<a href='https://www.java.com/en/download/manual.jsp' target='_blank'><img src='$MIRROR/images-new/java-logo.png' style='float:right;margin-left:10px;height:40px' alt='' /></a>"		>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<a href='https://sourceforge.net/projects/jmol/' target='_blank'><img src='$MIRROR/images-new/jmol-q4mdfft.png' style='float:right;height:25px' alt='' /></a>"						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<script type='text/javascript'>jmolInitialize('$PATHJMOL',true);</script>"																											>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "<br /><br /><table style='margin-left:auto;margin-right:auto;width:95%;margin-top:5px;margin-bottom:10px'><tr><td align='center'><span style='font-size:8pt;'><b>$PDBINP</b></span></td></tr><tr><td align='center'><p class='stlJSmol'><script type='text/javascript'>"																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "jmolApplet(350, 'load ../$PDBINP; background skyblue; spacefill 0; wireframe 0.10; set echo top center; color echo red; font echo 18 serif bold; echo PDB input file; select all; label %a; font label 14 serif; zoom 130; spin off');"		>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo '</script></p></td><td> &nbsp; &nbsp; </td><td align="center"><p class="stlJSmol"><script type="text/javascript">'												>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "jmolRadioGroup([['spacefill 0;wireframe 0.01','Wireframe'],['spacefill 0;wireframe 0.10','Stick','checked'],['spacefill 25%;wireframe 0.15','Ball &amp; Stick']]);jmolBr();jmolBr();"				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo 'jmolButton("reset","Reset to original orientation");jmolBr();'																				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo 'jmolCheckbox("spin on","spin off","spin"); jmolHtml(" &nbsp; &nbsp; &nbsp; ");'																				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo 'jmolCheckbox("axes 0.03","axes off","Axes");jmolHtml(" &nbsp; &nbsp; &nbsp; ");'																				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo 'jmolCheckbox("boundbox","boundbox off","Boundbox");jmolBr();jmolBr();'																				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo 'jmolMenu([" background black",[" background skyblue",null,"selected"]," background pink"," background palegreen"]);jmolBr();jmolBr();'			>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "jmolRadioGroup([['select all;font label 14 serif bold;color label cpk;label %a','Atom names','checked'],['select all;font label 14 serif bold;color label cpk;label %i','Atom indexes'],['calculate chirality;font label 14 serif bold;color label yellow;label %[chirality]','R/S Z/E'],['select all;label off','All off']]);jmolBr();jmolBr();"	>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "jmolCheckbox('select all; set showHydrogens false','select all; set showHydrogens true','Hide Hydrogen atoms',false)"					>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo "</script></p></td></tr></table><center><span style='font-size:8pt;color:red'>Problems with Java? Use <a href='http://www.palemoon.org/' target='_blank'>Pale Moon</a> instead of <a href='https://www.java.com/en/download/help/firefox_java.xml' target='_blank'>Firefox</a> or <a href='https://www.java.com/en/download/faq/chrome.xml' target='_blank'>Chrome</a>!</span><br /><br /><span style='font-size:8pt;font-style:italic'>To translate, shift-double click &amp; drag on the structure; to zoom, shift-click &amp; vertically drag.<br />Right click on the applet to get more functionalities.</span><br /><span style='font-size:8pt'>Done using <a href='http://jmol.sourceforge.net/' target='_blank'>Jmol</a> &amp; <a href='https://www.java.com/en/download/manual.jsp' target='_blank'>Java (JRE)</a>...</span></center><br />"			>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html

echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:25px" /></a> &nbsp; <input type="button" value="Close this window" onclick="windowClose();"/> &nbsp; <a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:25px" /></a></center><br />'						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo '</body>'															>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html
echo '</html>'															>> Applet-dir_$Var_Renam_Ser/java_applet-pdbinp-$i.html

echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'									>  Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo '<head>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<title> Project $Var_Renam_Ser - No $i - $PDBINP</title>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"																>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																				>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<script type='text/javascript' src='$PATHJMOL/jsmol/JSmol.min.js'></script>"																					>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<script type='text/javascript'>var JSMol_Info = { width:400,height:400,use:'HTML5',j2sPath:'$PATHJMOL/jsmol/j2s' }</script>"									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<script type='text/javascript'>function windowClose() { window.open('','_parent',''); window.close(); }</script>"												>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<\!-- Jonathan Gutow's code --><script type='text/javascript'>function jsmolpulldown(theform) { with(theform) { eval(options[selectedIndex].value); } }</script>"		>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<style type='text/css'>.stlJSmol { font-size:10pt }</style>"																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo '</head>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo '<body>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<a href='$MIRROR/$REDSVersion' target='_blank'><img src='$MIRROR/images-new/REDSDev-logo.png' style='float:left;height:40px' alt='' /></a>"									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<a href='https://en.wikipedia.org/wiki/JavaScript' target='_blank'><img src='$MIRROR/images-new/javascript-logo.png' style='float:right;margin-left:10px;height:40px' alt='' /></a>"				>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<a href='https://sourceforge.net/projects/jsmol/' target='_blank'><img src='$MIRROR/images-new/jsmol-q4mdfft.png' style='float:right;height:25px' alt='' /></a>"									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<br /><br /><table style='margin-left:auto;margin-right:auto;width:95%;margin-top:5px;margin-bottom:10px'><tr><td align='center'><span style='font-size:8pt;'><b>$PDBINP</b></span></td></tr><tr><td align='center'><p class='stlJSmol'><script type='text/javascript'>"																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "JSmolInfo = Jmol.getApplet('JSmolInfo', JSMol_Info)"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.script(JSmolInfo,'load ../$PDBINP; background skyblue; spacefill 0; wireframe 0.10; set echo top center; color echo red; font echo 18 serif bold; echo PDB input file; select all; label %a; font label 14 serif; zoom 130; spin off')"		>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "</script><select id='JSmolApplet' onchange ='jsmolpulldown(this)' title='Select_size'>"																		>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "<option value='Jmol.resizeApplet(JSmolInfo,400,0);' selected='selected'>Small (400 px)</option><option value='Jmol.resizeApplet(JSmolInfo,600,0);'>Medium (600 px)</option><option value='Jmol.resizeApplet(JSmolInfo,800,0);'>Large (800 px)</option>"			>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "</select></p></td><td> &nbsp; &nbsp; </td><td align='center'><p class='stlJSmol'><script type='text/javascript'>"												>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['spacefill 0;wireframe 0.01','Wireframe'],['spacefill 0;wireframe 0.10','Stick','checked'],['spacefill 25%;wireframe 0.15','Ball &amp; Stick'],['spacefill on','Space-filling']])"	>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "document.write(' &nbsp; ')"																																	>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolButton(JSmolInfo,'reset','Reset to original orientation')"																							>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																															>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'zoom 300','zoom 130','Zoom',false)"																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'spin on','spin off','Spin',false)"																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																															>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'axes 0.03','axes off','Axes')"																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																															>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'boundbox','boundbox off','Boundbox')"																							>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "document.write(' &nbsp; ')"																																	>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolMenu(JSmolInfo,[['background skyblue',null,'selected'],'background black','background palegreen','background white'])"								>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['select all;font label 14 serif bold;color label cpk;label %a','Atom names','checked'],['select all;font label 14 serif bold;color label cpk;label %i','Atom indexes'],['calculate chirality;font label 14 serif bold;color label yellow;label %[chirality]','R/S Z/E'],['select all;label off','All off']])"			>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'select all; set showHydrogens false','select all; set showHydrogens true','Hide Hydrogen atoms',false)"							>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo "</script></p></td></tr></table><center><span style='font-size:8pt;font-style:italic'>To translate, shift-double click &amp; drag on the structure; to zoom, shift-click &amp; vertically drag.<br />Right click on the applet to get more functionalities.</span><br /><span style='font-size:8pt'>Done using <a href='http://wiki.jmol.org/index.php/JSmol' target='_blank'>JSmol</a> &amp; <a href='https://en.wikipedia.org/wiki/JavaScript' target='_blank'>JavaScript</a>...</span></center><br />"																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:25px" /></a> &nbsp; <input type="button" value="Close this window" onclick="windowClose();"/> &nbsp; <a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:25px" /></a></center><br />'		>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo '</body>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html
echo '</html>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbinp-$i.html

		set LOG = `expr $PDBINP:r`
		if (-e "$LOG.log") then
echo "<td align='center'><font size='2'>$LOG.log</font></td><td align='center'><a href='$Var_Renam_Ser/$LOG.log' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>" >>    	$FILE
		else if (-e "$LOG.out") then
echo "<td align='center'><font size='2'>$LOG.out</font></td><td align='center'><a href='$Var_Renam_Ser/$LOG.out' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>" >>    	$FILE
		else
			if (-e Mol_red$i-1.log) then
				set line = 1
				foreach QMLOGFILE (`/bin/ls -v Mol_red$i-[1-9].log Mol_red$i-[1-9][0-9].log Mol_red$i-[1-9][0-9][0-9].log | grep log`)
					if ($line == 1) then
echo "<td align='center'><font size='2'>$QMLOGFILE</font></td><td align='center'><a href='$Var_Renam_Ser/$QMLOGFILE' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>" >>    $FILE
					else
echo "<td align='center'><font size='2'>&nbsp;</font></td><td align='center'><font size='2'>&nbsp;</font></td><td align='center'><font size='2'>&nbsp;</font></td><td align='center'><font size='2'>&nbsp;</font></td><td align='center'><font size='2'>$QMLOGFILE</font></td><td align='center'><a href='$Var_Renam_Ser/$QMLOGFILE' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>" >>		$FILE
					endif
					@ line++
				end
			else if (-e Mol_red$i-1.out) then
				set line = 1
				foreach QMLOGFILE (`/bin/ls -v Mol_red$i-[1-9].out Mol_red$i-[1-9][0-9].out Mol_red$i-[1-9][0-9][0-9].out | grep out`)
					if ($line == 1) then
echo "<td align='center'><font size='2'>$QMLOGFILE</font></td><td align='center'><a href='$Var_Renam_Ser/$QMLOGFILE' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>" >>    $FILE
					else
echo "<td align='center'><font size='2'>&nbsp;</font></td><td align='center'><font size='2'>&nbsp;</font></td><td align='center'><font size='2'>&nbsp;</font></td><td align='center'><font size='2'>&nbsp;</font></td><td align='center'><font size='2'>$QMLOGFILE</font></td><td align='center'><a href='$Var_Renam_Ser/$QMLOGFILE' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>" >>		$FILE
					endif
					@ line++
				end
			else
echo '<td align="center"><font size="2">Not available</font></td><td align="center"><font size="2">Not available</font></td></tr>'																	>> $FILE
			endif
		endif
		@ i++
	end
echo '</table><br /><br />'																																											>> $FILE
endif

echo "$pdbnb PDB files found..."


if (-e $DIRRED/Mol_m1/Mol_m1-c1-qmra.pdb) then
	if (! -d Applet-dir_$Var_Renam_Ser) then
		mkdir Applet-dir_$Var_Renam_Ser
	endif
echo '<font size="2" color="red"><b> &nbsp; &nbsp; Optimized geometry(ies)</b></font>'																												>> $FILE
echo '<table width="700">'																																											>> $FILE
echo '<tr><td align="center"><font size="2"><b> &nbsp; &nbsp; No</b></font></td><td align="center"><font size="2"><b>PDB file(s)</b></font></td><td align="center"><font size="2"><b>Download</b></font></td><td align="center"><font size="2"><b>3D display-1</b></font></td><td align="center"><font size="2"><b>3D display-2</b></font></td></tr>'				>> $FILE
	set i = 1
	foreach PDB (`/bin/ls -v $DIRRED/Mol_m*/Mol_m*.pdb | grep pdb`)
		set TMPPDB = `echo "$PDB" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2'>$TMPPDB</font></td><td align='center'><a href='$Var_Renam_Ser/$PDB' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td><td align='center'><a href='javascript:popup("\"./$Var_Renam_Ser/Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html\"","\"java_applet-pdbout-$i\"",800,650,"\"menubar=no,scrollbars=yes,statusbar=no,resizable=yes\"")'><img src='$MIRROR/images-new/jmol-q4mdfft.png' style='height:25px' alt='' /></a></td><td align='center'><a href='javascript:popup("\"./$Var_Renam_Ser/Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html\"","\"javascript_applet-pdbout-$i\"",1000,750,"\"menubar=no,scrollbars=yes,statusbar=no,resizable=yes\"")'><img src='$MIRROR/images-new/jsmol-q4mdfft.png' style='height:25px' alt='' /></a></td></tr>"			>> $FILE

echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'									>  Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																									>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '<head>'																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<title> Project $Var_Renam_Ser - No $i - $TMPPDB</title>"																											>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"																>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<script type='text/javascript' src='$PATHJMOL/Jmol.js'></script>"																								>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<script type='text/javascript'>function windowClose() { window.open('','_parent',''); window.close(); }</script>"												>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<style type='text/css'>.stlJSmol { font-size:10pt }</style>"																									>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '</head>'																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '<body>'																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<a href='$MIRROR/$REDSVersion' target='_blank'><img src='$MIRROR/images-new/REDSDev-logo.png' style='float:left;height:40px' alt='' /></a>"									>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<a href='https://www.java.com/en/download/manual.jsp' target='_blank'><img src='$MIRROR/images-new/java-logo.png' style='float:right;margin-left:10px;height:40px' alt='' /></a>"		>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<a href='https://sourceforge.net/projects/jmol/' target='_blank'><img src='$MIRROR/images-new/jmol-q4mdfft.png' style='float:right;height:25px' alt='' /></a>"							>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<script type='text/javascript'>jmolInitialize('$PATHJMOL',true);</script>"																											>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "<br /><br /><table style='margin-left:auto;margin-right:auto;width:95%;margin-top:5px;margin-bottom:10px'><tr><td align='center'><span style='font-size:8pt;'><b>$TMPPDB</b></span></td></tr><tr><td align='center'><p class='stlJSmol'><script type='text/javascript'>"																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "jmolApplet(350, 'load ../$PDB; background skyblue; spacefill 0; wireframe 0.10; axes 0.03; set echo top center; color echo red; font echo 18 serif bold; echo PDB file - Opt. geometry; select all; label %a; font label 14 serif; zoom 130; spin off');"				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '</script></p></td><td> &nbsp; &nbsp; </td><td align="center"><p class="stlJSmol"><script type="text/javascript">'												>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "jmolRadioGroup([['spacefill 0;wireframe 0.01','Wireframe'],['spacefill 0;wireframe 0.10','Stick','checked'],['spacefill 25%;wireframe 0.15','Ball &amp; Stick']]);jmolBr();jmolBr();"				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo 'jmolButton("reset","Reset to original orientation");jmolBr();'																								>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo 'jmolCheckbox("spin on","spin off","spin"); jmolHtml(" &nbsp; &nbsp; &nbsp; ");'																				>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo 'jmolCheckbox("axes 0.03","axes off","Axes","on");jmolHtml(" &nbsp; &nbsp; &nbsp; ");'																			>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo 'jmolCheckbox("boundbox","boundbox off","Boundbox");jmolBr();jmolBr();'																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo 'jmolMenu([" background black",[" background skyblue",null,"selected"]," background pink"," background palegreen"]);jmolBr();jmolBr();'						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "jmolRadioGroup([['select all;font label 14 serif bold;color label cpk;label %a','Atom names','checked'],['select all;font label 14 serif bold;color label cpk;label %i','Atom indexes'],['calculate chirality;font label 14 serif bold;color label yellow;label %[chirality]','R/S Z/E'],['select all;label off','All off']]);jmolBr();jmolBr();"			>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "jmolCheckbox('select all; set showHydrogens false','select all; set showHydrogens true','Hide Hydrogen atoms',false)"											>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo "</script></p></td></tr></table><center><span style='font-size:8pt;color:red'>Problems with Java? Use <a href='http://www.palemoon.org/' target='_blank'>Pale Moon</a> instead of <a href='https://www.java.com/en/download/help/firefox_java.xml' target='_blank'>Firefox</a> or <a href='https://www.java.com/en/download/faq/chrome.xml' target='_blank'>Chrome</a>!</span><br /><br /><span style='font-size:8pt;font-style:italic'>To translate, shift-double click &amp; drag on the structure; to zoom, shift-click &amp; vertically drag.<br />Right click on the applet to get more functionalities.</span><br /><span style='font-size:8pt'>Done using <a href='http://jmol.sourceforge.net/' target='_blank'>Jmol</a> &amp; <a href='https://www.java.com/en/download/manual.jsp' target='_blank'>Java (JRE)</a>...</span></center><br />"																																									>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:25px" /></a> &nbsp; <input type="button" value="Close this window" onclick="windowClose();"/> &nbsp; <a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:25px" /></a></center><br />'		>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '</body>'																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html
echo '</html>'																																						>> Applet-dir_$Var_Renam_Ser/java_applet-pdbout-$i.html

echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'									>  Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo '<head>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<title> Project $Var_Renam_Ser - No $i - $TMPPDB</title>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"																>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																				>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<script type='text/javascript' src='$PATHJMOL/jsmol/JSmol.min.js'></script>"																					>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<script type='text/javascript'>var JSMol_Info = { width:400,height:400,use:'HTML5',j2sPath:'$PATHJMOL/jsmol/j2s' }</script>"									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<script type='text/javascript'>function windowClose() { window.open('','_parent',''); window.close(); }</script>"												>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<\!-- Jonathan Gutow's code --><script type='text/javascript'>function jsmolpulldown(theform) { with(theform) { eval(options[selectedIndex].value); } }</script>"		>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<style type='text/css'>.stlJSmol { font-size:10pt }</style>"																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo '</head>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo '<body>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<a href='$MIRROR/$REDSVersion' target='_blank'><img src='$MIRROR/images-new/REDSDev-logo.png' style='float:left;height:40px' alt='' /></a>"									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<a href='https://en.wikipedia.org/wiki/JavaScript' target='_blank'><img src='$MIRROR/images-new/javascript-logo.png' style='float:right;margin-left:10px;height:40px' alt='' /></a>"		>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<a href='https://sourceforge.net/projects/jsmol/' target='_blank'><img src='$MIRROR/images-new/jsmol-q4mdfft.png' style='float:right;height:25px' alt='' /></a>"							>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<br /><br /><table style='margin-left:auto;margin-right:auto;width:95%;margin-top:5px;margin-bottom:10px'><tr><td align='center'><span style='font-size:8pt;'><b>$TMPPDB</b></span></td></tr><tr><td align='center'><p class='stlJSmol'><script type='text/javascript'>"																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "JSmolInfo = Jmol.getApplet('JSmolInfo', JSMol_Info)"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.script(JSmolInfo, 'load ../$PDB; background skyblue; spacefill 0; wireframe 0.10; axes 0.03; set echo top center; color echo red; font echo 18 serif bold; echo PDB file - Opt. geometry; select all; label %a; font label 14 serif; zoom 130; spin off')"				>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "</script><select id='JSmolApplet' onchange ='jsmolpulldown(this)' title='Select_size'>"																		>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "<option value='Jmol.resizeApplet(JSmolInfo,400,0);' selected='selected'>Small (400 px)</option><option value='Jmol.resizeApplet(JSmolInfo,600,0);'>Medium (600 px)</option><option value='Jmol.resizeApplet(JSmolInfo,800,0);'>Large (800 px)</option>"			>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "</select></p></td><td> &nbsp; &nbsp; </td><td align='center'><p class='stlJSmol'><script type='text/javascript'>"												>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['spacefill 0;wireframe 0.01','Wireframe'],['spacefill 0;wireframe 0.10','Stick','checked'],['spacefill 25%;wireframe 0.15','Ball &amp; Stick'],['spacefill on','Space-filling']])"			>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "document.write(' &nbsp; ')"																																	>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolButton(JSmolInfo,'reset','Reset to original orientation')"																							>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																															>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'zoom 300','zoom 130','Zoom',false)"																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'spin on','spin off','Spin',false)"																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																															>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'axes 0.03','axes off','Axes','on')"																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																															>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'boundbox','boundbox off','Boundbox')"																							>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "document.write(' &nbsp; ')"																																	>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolMenu(JSmolInfo,[['background skyblue',null,'selected'],'background black','background palegreen','background white'])"								>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['select all;font label 14 serif bold;color label cpk;label %a','Atom names','checked'],['select all;font label 14 serif bold;color label cpk;label %i','Atom indexes'],['calculate chirality;font label 14 serif bold;color label yellow;label %[chirality]','R/S Z/E'],['select all;label off','All off']])"					>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'select all; set showHydrogens false','select all; set showHydrogens true','Hide Hydrogen atoms',false)"							>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo "</script></p></td></tr></table><center><span style='font-size:8pt;font-style:italic'>To translate, shift-double click &amp; drag on the structure; to zoom, shift-click &amp; vertically drag.<br />Right click on the applet to get more functionalities.</span><br /><span style='font-size:8pt'>Done using <a href='http://wiki.jmol.org/index.php/JSmol' target='_blank'>JSmol</a> &amp; <a href='https://en.wikipedia.org/wiki/JavaScript' target='_blank'>JavaScript</a>...</span></center><br />"																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:25px" /></a> &nbsp; <input type="button" value="Close this window" onclick="windowClose();"/> &nbsp; <a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:25px" /></a></center><br />'																		>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo '</body>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
echo '</html>'																																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-pdbout-$i.html
		@ i++
	end
echo '</table><br /><br />'																		>> $FILE
endif

if (-e $DIRRED/Mol_m1/Mol-sm_m1-c1.mol2) then
	if (! -d Applet-dir_$Var_Renam_Ser) then
		mkdir Applet-dir_$Var_Renam_Ser
	endif
echo '<font size="2" color="red"><b> &nbsp; &nbsp; Force field library(ies)</b></font>'			>> $FILE
echo '<table width="700">'																		>> $FILE
echo '<tr><td align="center"><font size="2"><b> &nbsp; &nbsp; No</b></font></td><td align="center"><font size="2"><b>mol2 file(s)</b></font></td><td align="center"><font size="2"><b>Download</b></font></td><td align="center"><font size="2"><b>3D Display-1</b></font></td><td align="center"><font size="2"><b>3D Display-2</b></font></td></tr>'				>> $FILE
	set i = 1
	foreach MOL (`/bin/ls -v $DIRRED/Mol_m*/Mol*.mol2 | grep mol2`)
		set TMPMOL = `echo "$MOL" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2' color='grey'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2' color='grey'>$TMPMOL</font></td><td align='center'><a href='$Var_Renam_Ser/$MOL' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td><td align='center'><a href='javascript:popup("\"./$Var_Renam_Ser/Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html\"","\"java_applet-mol2$i\"",800,650,"\"menubar=no,scrollbars=yes,statusbar=no,resizable=yes\"")'><img src='$MIRROR/images-new/jmol-q4mdfft.png' style='height:25px' alt='' /></a></td><td align='center'><a href='javascript:popup("\"./$Var_Renam_Ser/Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html\"","\"javascript_applet-mol2$i\"",1000,750,"\"menubar=no,scrollbars=yes,statusbar=no,resizable=yes\"")'><img src='$MIRROR/images-new/jsmol-q4mdfft.png' style='height:25px' alt='' /></a></td></tr>"			>> $FILE

echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'												>  Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																												>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<head>'																																									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<title> Project $Var_Renam_Ser - No $i - $TMPMOL</title>"																														>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"																			>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<script type='text/javascript' src='$PATHJMOL/Jmol.js'></script>"																											>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<script type='text/javascript'>function windowClose() { window.open('','_parent',''); window.close(); }</script>"															>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<style type='text/css'>.stlJSmol { font-size:10pt }</style>"																												>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '</head>'																																									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<body>'																																									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<a href='$MIRROR/$REDSVersion' target='_blank'><img src='$MIRROR/images-new/REDSDev-logo.png' style='float:left;height:40px' alt='' /></a>"												>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<a href='https://www.java.com/en/download/manual.jsp' target='_blank'><img src='$MIRROR/images-new/java-logo.png' style='float:right;margin-left:10px;height:40px' alt='' /></a>"			>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<a href='https://sourceforge.net/projects/jmol/' target='_blank'><img src='$MIRROR/images-new/jmol-q4mdfft.png' style='float:right;height:25px' alt='' /></a>"							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<script type='text/javascript'>jmolInitialize('$PATHJMOL',true);</script>"																								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<br /><br /><table style='margin-left:auto;margin-right:auto;width:95%;margin-top:5px;margin-bottom:10px'><tr><td align='center'><span style='font-size:8pt;'><b>$TMPMOL</b></span></td></tr><tr><td align='center'><p class='stlJSmol'><script type='text/javascript'>"																																									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolApplet(350, 'load ../$MOL; background skyblue; spacefill 0; wireframe 0.10; isosurface molecular map MEP; color isosurface translucent; set echo top center; color echo red; font echo 18 serif bold; echo Force field library; select all; label %-8.3P; font label 14 serif; zoom 130; spin off');"		>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '</script></p></td><td> &nbsp; &nbsp; </td><td align="center"><p class="stlJSmol"><script type="text/javascript">'															>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolRadioGroup([['spacefill 0;wireframe 0.01','Wireframe'],['spacefill 0;wireframe 0.10','Stick','checked'],['spacefill 25%;wireframe 0.15','Ball &amp; Stick']]);jmolBr();jmolBr();"		>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolButton("reset","Reset to original orientation");jmolBr();'																											>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolCheckbox("spin on","spin off","spin"); jmolHtml(" &nbsp; &nbsp; &nbsp; ");'																							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolCheckbox("axes 0.03","axes off","Axes");jmolHtml(" &nbsp; &nbsp; &nbsp; ");'																							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolCheckbox("boundbox","boundbox off","Boundbox");jmolBr();jmolBr();'																									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolMenu([" background black",[" background skyblue",null,"selected"]," background pink"," background palegreen"]);jmolBr();jmolBr();'									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolRadioGroup([['select all;font label 14 serif bold;color label cpk;label %-8.3P','Atomic charges','checked'],['select all;font label 14 serif bold;color label cpk;label %B','Atom types'],['select all;font label 14 serif bold;color label cpk;label %a','Atom names'],['select all;font label 14 serif bold;color label cpk;label %i','Atom indexes'],['calculate chirality;font label 14 serif bold;color label yellow;label %[chirality]','R/S Z/E'],['select all;label off','All off']]);jmolBr();jmolBr();"																							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolCheckbox('select all; set showHydrogens false','select all; set showHydrogens true','Hide Hydrogen atoms',false);jmolBr();jmolBr();"									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolRadioGroup([['dipole delete; isosurface molecular map MEP; color isosurface translucent','Molecular electrostatic potential','checked'],['isosurface delete; select all; dipole calculate molecular','Molecular Dipole'],['isosurface delete; dipole delete','All off']])"																																							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "</script></p></td></tr></table><center><span style='font-size:8pt;color:red'>Problems with Java? Use <a href='http://www.palemoon.org/' target='_blank'>Pale Moon</a> instead of <a href='https://www.java.com/en/download/help/firefox_java.xml' target='_blank'>Firefox</a> or <a href='https://www.java.com/en/download/faq/chrome.xml' target='_blank'>Chrome</a>!</span><br /><br /><span style='font-size:8pt;font-style:italic'>To translate, shift-double click &amp; drag on the structure; to zoom, shift-click &amp; vertically drag.<br />Right click on the applet to get more functionalities.</span><br /><span style='font-size:8pt'>Done using <a href='http://jmol.sourceforge.net/' target='_blank'>Jmol</a> &amp; <a href='https://www.java.com/en/download/manual.jsp' target='_blank'>Java (JRE)</a>...</span></center><br />"																																												>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:25px" /></a> &nbsp; <input type="button" value="Close this window" onclick="windowClose();"/> &nbsp; <a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:25px" /></a></center><br />'																					>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '</body>'																																									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '</html>'																																									>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html

echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'												>  Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																												>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<head>'																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<title> Project $Var_Renam_Ser - No $i - $TMPMOL</title>"																														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"																			>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																							>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<script type='text/javascript' src='$PATHJMOL/jsmol/JSmol.min.js'></script>"																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<script type='text/javascript'>var JSMol_Info = { width:400,height:400,use:'HTML5',j2sPath:'$PATHJMOL/jsmol/j2s' }</script>"												>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<script type='text/javascript'>function windowClose() { window.open('','_parent',''); window.close(); }</script>"															>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<\!-- Jonathan Gutow's code --><script type='text/javascript'>function jsmolpulldown(theform) { with(theform) { eval(options[selectedIndex].value); } }</script>"			>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<style type='text/css'>.stlJSmol { font-size:10pt }</style>"																												>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '</head>'																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<body>'																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<a href='$MIRROR/$REDSVersion' target='_blank'><img src='$MIRROR/images-new/REDSDev-logo.png' style='float:left;height:40px' alt='' /></a>"												>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<a href='https://en.wikipedia.org/wiki/JavaScript' target='_blank'><img src='$MIRROR/images-new/javascript-logo.png' style='float:right;margin-left:10px;height:40px' alt='' /></a>"			>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<a href='https://sourceforge.net/projects/jsmol/' target='_blank'><img src='$MIRROR/images-new/jsmol-q4mdfft.png' style='float:right;height:25px' alt='' /></a>"								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<br /><br /><table style='margin-left:auto;margin-right:auto;width:95%;margin-top:5px;margin-bottom:10px'><tr><td align='center'><span style='font-size:8pt;'><b>$TMPMOL</b></span></td></tr><tr><td align='center'><p class='stlJSmol'><script type='text/javascript'>"																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "JSmolInfo = Jmol.getApplet('JSmolInfo', JSMol_Info)"																														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.script(JSmolInfo, 'load ../$MOL; background skyblue; spacefill 0; wireframe 0.10; isosurface molecular map MEP; color isosurface translucent; set echo top center; color echo red; font echo 18 serif bold; echo Force field library; select all; label %-8.3P; font label 14 serif; zoom 130; spin off')"																																>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><select id='JSmolApplet' onchange ='jsmolpulldown(this)' title='Select_size'>"																					>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<option value='Jmol.resizeApplet(JSmolInfo,400,0);' selected='selected'>Small (400 px)</option><option value='Jmol.resizeApplet(JSmolInfo,600,0);'>Medium (600 px)</option><option value='Jmol.resizeApplet(JSmolInfo,800,0);'>Large (800 px)</option>"																																										>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</select></p></td><td> &nbsp; &nbsp; </td><td align='center'><p class='stlJSmol'><script type='text/javascript'>"															>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['spacefill 0;wireframe 0.01','Wireframe'],['spacefill 0;wireframe 0.10','Stick','checked'],['spacefill 25%;wireframe 0.15','Ball &amp; Stick'],['spacefill on','Space-filling']])"																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; ')"																																				>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolButton(JSmolInfo,'reset','Reset to original orientation')"																										>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																																		>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'zoom 300','zoom 130','Zoom',false)"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'spin on','spin off','Spin',false)"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																																		>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'axes 0.03','axes off','Axes')"																												>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																																		>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'boundbox','boundbox off','Boundbox')"																										>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; ')"																																				>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolMenu(JSmolInfo,[['background skyblue',null,'selected'],'background black','background palegreen','background white'])"											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['select all;font label 14 serif bold;color label cpk;label %-8.3P','Atomic charges','checked'],['select all;font label 14 serif bold;color label cpk;label %B','Atom types'],['select all;font label 14 serif bold;color label cpk;label %a','Atom names'],['select all;font label 14 serif bold;color label cpk;label %i','Atom indexes'],['calculate chirality;font label 14 serif bold;color label yellow;label %[chirality]','R/S Z/E'],['select all;label off','All off']])"																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'select all; set showHydrogens false','select all; set showHydrogens true','Hide Hydrogen atoms',false)"										>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['dipole delete; isosurface molecular map MEP; color isosurface translucent','Molecular electrostatic potential','checked'],['isosurface delete; select all; dipole calculate molecular','Molecular Dipole'],['isosurface delete; dipole delete','All off']])"																																			>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script></p></td></tr></table><center><span style='font-size:8pt;font-style:italic'>To translate, shift-double click &amp; drag on the structure; to zoom, shift-click &amp; vertically drag.<br />Right click on the applet to get more functionalities.</span><br /><span style='font-size:8pt'>Done using <a href='http://wiki.jmol.org/index.php/JSmol' target='_blank'>JSmol</a> &amp; <a href='https://en.wikipedia.org/wiki/JavaScript' target='_blank'>JavaScript</a>...</span></center><br />"																																												>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:25px" /></a> &nbsp; <input type="button" value="Close this window" onclick="windowClose();"/> &nbsp; <a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:25px" /></a></center><br />'																					>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '</body>'																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '</html>'																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
		@ i++
	end

	if (-d $DIRRED/Mol_MM) then
		foreach MOLM (`/bin/ls -v $DIRRED/Mol_MM/Mol_mm*.mol2  $DIRRED/Mol_MM/INT*/*.mol2  $DIRRED/Mol_MM/INT*/mm*/*.mol2 | grep mol2`)
			set TMPMOLM = `echo "$MOLM" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2'>$TMPMOLM</font></td><td align='center'><a href='$Var_Renam_Ser/$MOLM' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td><td align='center'><a href='javascript:popup("\"./$Var_Renam_Ser/Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html\"","\"java_applet-mol2$i\"",800,650,"\"menubar=no,scrollbars=yes,statusbar=no,resizable=yes\"")'><img src='$MIRROR/images-new/jmol-q4mdfft.png' style='height:25px' alt='' /></a></td><td align='center'><a href='javascript:popup("\"./$Var_Renam_Ser/Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html\"","\"javascript_applet-mol2$i\"",1000,750,"\"menubar=no,scrollbars=yes,statusbar=no,resizable=yes\"")'><img src='$MIRROR/images-new/jsmol-q4mdfft.png' style='height:25px' alt='' /></a></td></tr>"		>> $FILE

echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'											>  Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																											>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<head>'																																								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<title> Project $Var_Renam_Ser - No $i - $TMPMOLM</title>"																													>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"																		>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																						>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<script type='text/javascript' src='$PATHJMOL/Jmol.js'></script>"																										>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<script type='text/javascript'>function windowClose() { window.open('','_parent',''); window.close(); }</script>"														>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<style type='text/css'>.stlJSmol { font-size:10pt }</style>"																											>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '</head>'																																								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<body>'																																								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<a href='$MIRROR/$REDSVersion' target='_blank'><img src='$MIRROR/images-new/REDSDev-logo.png' style='float:left;height:40px' alt='' /></a>"											>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<a href='https://www.java.com/en/download/manual.jsp' target='_blank'><img src='$MIRROR/images-new/java-logo.png' style='float:right;margin-left:10px;height:40px' alt='' /></a>"			>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<a href='https://sourceforge.net/projects/jmol/' target='_blank'><img src='$MIRROR/images-new/jmol-q4mdfft.png' style='float:right;height:25px' alt='' /></a>"							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<script type='text/javascript'>jmolInitialize('$PATHJMOL',true);</script>"																							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "<br /><br /><table style='margin-left:auto;margin-right:auto;width:95%;margin-top:5px;margin-bottom:10px'><tr><td align='center'><span style='font-size:8pt;'><b>$TMPMOLM</b></span></td></tr><tr><td align='center'><p class='stlJSmol'><script type='text/javascript'>"																																							>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolApplet(350, 'load ../$MOLM; background skyblue; spacefill 0; wireframe 0.10; isosurface molecular map MEP; color isosurface translucent; set echo top center; color echo red; font echo 18 serif bold; echo Force field library; select all; label %-8.3P; font label 14 serif; zoom 130; spin off');"																													>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '</script></p></td><td> &nbsp; &nbsp; </td><td align="center"><p class="stlJSmol"><script type="text/javascript">'														>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolRadioGroup([['spacefill 0;wireframe 0.01','Wireframe'],['spacefill 0;wireframe 0.10','Stick','checked'],['spacefill 25%;wireframe 0.15','Ball &amp; Stick']]);jmolBr();jmolBr();"					>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolButton("reset","Reset to original orientation");jmolBr();'																										>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolCheckbox("spin on","spin off","spin"); jmolHtml(" &nbsp; &nbsp; &nbsp; ");'																						>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolCheckbox("axes 0.03","axes off","Axes");jmolHtml(" &nbsp; &nbsp; &nbsp; ");'																						>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolCheckbox("boundbox","boundbox off","Boundbox");jmolBr();jmolBr();'																								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo 'jmolMenu([" background black",[" background skyblue",null,"selected"]," background pink"," background palegreen"]);jmolBr();jmolBr();'								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolRadioGroup([['select all;font label 14 serif bold;color label cpk;label %-8.3P','Atomic charges','checked'],['select all;font label 14 serif bold;color label cpk;label %B','Atom types'],['select all;font label 14 serif bold;color label cpk;label %a','Atom names'],['select all;font label 14 serif bold;color label cpk;label %i','Atom indexes'],['calculate chirality;font label 14 serif bold;color label yellow;label %[chirality]','R/S Z/E'],['select all;label off','All off']]);jmolBr();jmolBr();"																						>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolCheckbox('select all; set showHydrogens false','select all; set showHydrogens true','Hide Hydrogen atoms',false);jmolBr();jmolBr();"								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "jmolRadioGroup([['dipole delete; isosurface molecular map MEP; color isosurface translucent','Molecular electrostatic potential','checked'],['isosurface delete; select all; dipole calculate molecular','Molecular Dipole'],['isosurface delete; dipole delete','All off']])"																																						>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo "</script></p></td></tr></table><center><span style='font-size:8pt;color:red'>Problems with Java? Use <a href='http://www.palemoon.org/' target='_blank'>Pale Moon</a> instead of <a href='https://www.java.com/en/download/help/firefox_java.xml' target='_blank'>Firefox</a> or <a href='https://www.java.com/en/download/faq/chrome.xml' target='_blank'>Chrome</a>!</span><br /><br /><span style='font-size:8pt;font-style:italic'>To translate, shift-double click &amp; drag on the structure; to zoom, shift-click &amp; vertically drag.<br />Right click on the applet to get more functionalities.</span><br /><span style='font-size:8pt'>Done using <a href='http://jmol.sourceforge.net/' target='_blank'>Jmol</a> &amp; <a href='https://www.java.com/en/download/manual.jsp' target='_blank'>Java (JRE)</a>...</span></center><br />"																																											>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:25px" /></a> &nbsp; <input type="button" value="Close this window" onclick="windowClose();"/> &nbsp; <a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:25px" /></a></center><br />'																				>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '</body>'																																								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html
echo '</html>'																																								>> Applet-dir_$Var_Renam_Ser/java_applet-mol2-$i.html

echo '<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'											>  Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<head>'																																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<title> Project $Var_Renam_Ser - No $i - $TMPMOLM</title>"																													>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />'																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<link rel='stylesheet' media='screen' type='text/css' title='Essai' href='$MIRROR/REDServer-Development.css' />"																		>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<link rel='shortcut icon' href='$MIRROR/images-new/favicon.ico' type='image/x-icon' />"																						>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<script type='text/javascript' src='$PATHJMOL/jsmol/JSmol.min.js'></script>"																							>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<script type='text/javascript'>var JSMol_Info = { width:400,height:400,use:'HTML5',j2sPath:'$PATHJMOL/jsmol/j2s' }</script>"											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<script type='text/javascript'>function windowClose() { window.open('','_parent',''); window.close(); }</script>"														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<\!-- Jonathan Gutow's code --><script type='text/javascript'>function jsmolpulldown(theform) { with(theform) { eval(options[selectedIndex].value); } }</script>"		>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<style type='text/css'>.stlJSmol { font-size:10pt }</style>"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '</head>'																																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<body>'																																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<a href='$MIRROR/$REDSVersion' target='_blank'><img src='$MIRROR/images-new/REDSDev-logo.png' style='float:left;height:40px' alt='' /></a>"											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<a href='https://en.wikipedia.org/wiki/JavaScript' target='_blank'><img src='$MIRROR/images-new/javascript-logo.png' style='float:right;margin-left:10px;height:40px' alt='' /></a>"			>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<a href='https://sourceforge.net/projects/jsmol/' target='_blank'><img src='$MIRROR/images-new/jsmol-q4mdfft.png' style='float:right;height:25px' alt='' /></a>"								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<br /><br /><table style='margin-left:auto;margin-right:auto;width:95%;margin-top:5px;margin-bottom:10px'><tr><td align='center'><span style='font-size:8pt;'><b>$TMPMOLM</b></span></td></tr><tr><td align='center'><p class='stlJSmol'><script type='text/javascript'>"																																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "JSmolInfo = Jmol.getApplet('JSmolInfo', JSMol_Info)"																													>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.script(JSmolInfo, 'load ../$MOLM; background skyblue; spacefill 0; wireframe 0.10; isosurface molecular map MEP; color isosurface translucent; set echo top center; color echo red; font echo 18 serif bold; echo Force field library; select all; label %-8.3P; font label 14 serif; zoom 130; spin off')"																															>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><select id='JSmolApplet' onchange ='jsmolpulldown(this)' title='Select_size'>"																				>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "<option value='Jmol.resizeApplet(JSmolInfo,400,0);' selected='selected'>Small (400 px)</option><option value='Jmol.resizeApplet(JSmolInfo,600,0);'>Medium (600 px)</option><option value='Jmol.resizeApplet(JSmolInfo,800,0);'>Large (800 px)</option>"																																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</select></p></td><td> &nbsp; &nbsp; </td><td align='center'><p class='stlJSmol'><script type='text/javascript'>"														>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['spacefill 0;wireframe 0.01','Wireframe'],['spacefill 0;wireframe 0.10','Stick','checked'],['spacefill 25%;wireframe 0.15','Ball &amp; Stick'],['spacefill on','Space-filling']])"																																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																													>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; ')"																																			>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolButton(JSmolInfo,'reset','Reset to original orientation')"																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																																	>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'zoom 300','zoom 130','Zoom',false)"																										>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																													>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'spin on','spin off','Spin',false)"																										>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																																	>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'axes 0.03','axes off','Axes')"																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; &nbsp; ')"																																	>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'boundbox','boundbox off','Boundbox')"																									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																													>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "document.write(' &nbsp; ')"																																			>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolMenu(JSmolInfo,[['background skyblue',null,'selected'],'background black','background palegreen','background white'])"										>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																													>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['select all;font label 14 serif bold;color label cpk;label %-8.3P','Atomic charges','checked'],['select all;font label 14 serif bold;color label cpk;label %B','Atom types'],['select all;font label 14 serif bold;color label cpk;label %a','Atom names'],['select all;font label 14 serif bold;color label cpk;label %i','Atom indexes'],['calculate chirality;font label 14 serif bold;color label yellow;label %[chirality]','R/S Z/E'],['select all;label off','All off']])"																							>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																													>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolCheckbox(JSmolInfo,'select all; set showHydrogens false','select all; set showHydrogens true','Hide Hydrogen atoms',false)"									>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script><br /><br /><script type='text/javascript'>"																													>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "Jmol.jmolRadioGroup(JSmolInfo,[['dipole delete; isosurface molecular map MEP; color isosurface translucent','Molecular electrostatic potential','checked'],['isosurface delete; select all; dipole calculate molecular','Molecular Dipole'],['isosurface delete; dipole delete','All off']])"																																		>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo "</script></p></td></tr></table><center><span style='font-size:8pt;font-style:italic'>To translate, shift-double click &amp; drag on the structure; to zoom, shift-click &amp; vertically drag.<br />Right click on the applet to get more functionalities.</span><br /><span style='font-size:8pt'>Done using <a href='http://wiki.jmol.org/index.php/JSmol' target='_blank'>JSmol</a> &amp; <a href='https://en.wikipedia.org/wiki/JavaScript' target='_blank'>JavaScript</a>...</span></center><br />"																																											>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:25px" /></a> &nbsp; <input type="button" value="Close this window" onclick="windowClose();"/> &nbsp; <a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:25px" /></a></center><br />'																				>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '</body>'																																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
echo '</html>'																																								>> Applet-dir_$Var_Renam_Ser/javascript_applet-mol2-$i.html
			@ i++
		end
	endif
echo '</table><br /><br />'																									>> $FILE
endif

if (-e $DIRRED/Mol_m1/input1-sm_m1.in) then
echo '<font size="2" color="red"><b> &nbsp; &nbsp; RESP fitting file(s)</b></font>'											>> $FILE
if (-s ./polarizabilities.dat) then
echo '<br /><font size="2"><b> &nbsp; &nbsp; Display the <a href='$Var_Renam_Ser/polarizabilities.dat' target='_blank'>polarizabilities.dat</a> file</b></font><br />'				>> $FILE
endif

echo '<table width="400">'																									>> $FILE
echo '<tr><td align="center"><font size="2"><b> &nbsp; &nbsp; No</b></font></td><td align="center"><font size="2"><b>input file(s)</b></font></td><td align="center"><font size="2"><b>Download</b></font></td></tr>'													>> $FILE
	set i = 1
	foreach INP (`/bin/ls -v $DIRRED/Mol_m*/input* | grep input`)
		set TMPINP = `echo "$INP" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2' color='grey'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2' color='grey'>$TMPINP</font></td><td align='center'><a href='$Var_Renam_Ser/$INP' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"						>> $FILE
		@ i++
	end

	if (-d $DIRRED/Mol_MM) then
		foreach INPM (`/bin/ls -v $DIRRED/Mol_MM/input* | grep input`)
			set TMPINPM = `echo "$INPM" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2'>$TMPINPM</font></td><td align='center'><a href='$Var_Renam_Ser/$INPM' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"									>> $FILE
			@ i++
		end
	endif
echo '<tr><td align="center"><font size="2"><b> &nbsp; &nbsp; No</b></font></td><td align="center"><font size="2"><b>punch file(s)</b></font></td><td align="center"><font size="2"><b>Download</b></font></td></tr>'													>> $FILE

	foreach OUT (`/bin/ls -v $DIRRED/Mol_m*/punch* | grep punch`)
		set TMPOUT = `echo "$OUT" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2' color='grey'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2' color='grey'>$TMPOUT</font></td><td align='center'><a href='$Var_Renam_Ser/$OUT' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"						>> $FILE
		@ i++
	end
	if (-d $DIRRED/Mol_MM) then
		foreach OUTM (`/bin/ls -v $DIRRED/Mol_MM/punch* | grep punch`)
			set TMPOUTM = `echo "$OUTM" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2'>$TMPOUTM</font></td><td align='center'><a href='$Var_Renam_Ser/$OUTM' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"									>> $FILE
			@ i++
		end
	endif
echo '</table><br /><br />'																												>> $FILE
endif

if (-e $DIRRED/Mol_m1/Mol-sm_m1-charge.txt) then
echo '<font size="2" color="red"><b> &nbsp; &nbsp; Charge value correction and comparison</b></font>'									>> $FILE
echo '<table width="400">'																		>> $FILE
echo '<tr><td align="center"><font size="2"><b> &nbsp; &nbsp; No</b></font></td><td align="center"><font size="2"><b>File(s)</b></font></td><td align="center"><font size="2"><b>Download</b></font></td></tr>'													>> $FILE
	set i = 1
	foreach STAT (`/bin/ls -v $DIRRED/Mol_m*/Statistics* $DIRRED/Mol_m*/Mol*charge.txt | grep txt`)
		set TMPSTAT = `echo "$STAT" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2' color='grey'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2' color='grey'>$TMPSTAT</font></td><td align='center'><a href='$Var_Renam_Ser/$STAT' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"						>> $FILE
		@ i++
	end

	if (-d $DIRRED/Mol_MM) then
		foreach STATM (`/bin/ls -v $DIRRED/Mol_MM/Statistics* $DIRRED/Mol_MM/Mol*charge.txt | grep txt`)
			set TMPSTATM = `echo "$STATM" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2'>$TMPSTATM</font></td><td align='center'><a href='$Var_Renam_Ser/$STATM' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"								>> $FILE
			@ i++
		end
	endif
echo '</table><br /><br />'																		>> $FILE
endif

if (-e $DIRRED/Data-Default-Proj/frcmod.known) then
echo '<font size="2" color="red"><b> &nbsp; &nbsp; Force field parameters and LEaP script</b></font>'									>> $FILE
echo '<table width="400">'																		>> $FILE
echo '<tr><td align="center"><font size="2"><b> &nbsp; &nbsp; No</b></font></td><td align="center"><font size="2"><b>File(s)</b></font></td><td align="center"><font size="2"><b>Download</b></font></td></tr>'													>> $FILE
	set i = 1
	foreach MISC (`/bin/ls -v $DIRRED/Data-Default-Proj/frcmod.* $DIRRED/Data-Default-Proj/leaprc.*fft | grep f`)
		set TMPMISC = `echo "$MISC" | sed -e "s/$DIRRED\/Data-Default-Proj\///"`
echo "<tr><td align='center'><font size='2'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2'>$TMPMISC</font></td><td align='center'><a href='$Var_Renam_Ser/$MISC' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"						>> $FILE
		@ i++
	end
echo '</table><br /><br />'																		>> $FILE
endif

if (-e $DIRRED/Mol_m1/Energy_m1-c1.txt) then
echo '<font size="2" color="red"><b> &nbsp; &nbsp; Energy decomposition</b></font>'											>> $FILE
echo '<table width="400">'																		>> $FILE
echo '<tr><td align="center"><font size="2"><b> &nbsp; &nbsp; No</b></font></td><td align="center"><font size="2"><b>File(s)</b></font></td><td align="center"><font size="2"><b>Download</b></font></td></tr>'													>> $FILE
	set i = 1
	foreach ENERGY (`/bin/ls -v $DIRRED/Mol_m*/Energy_m*.txt | grep txt`)
		set TMPENERGY = `echo "$ENERGY" | sed -e "s/$DIRRED\///"`
echo "<tr><td align='center'><font size='2'> &nbsp; &nbsp; $i</font></td><td align='center'><font size='2'>$TMPENERGY</font></td><td align='center'><a href='$Var_Renam_Ser/$ENERGY' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"				>> $FILE
		@ i++
	end
echo '</table><br /><br />'																		>> $FILE
endif

# end of html file...
echo '<table width="300">'																		>> $FILE
echo "<tr><td><font size='2' color='red'><b> &nbsp; &nbsp; Download the whole project...</b></font></td><td><a href='./$Var_Renam_Ser.tar.bz2' target='_blank'><img src='$MIRROR/images-new/disquette.gif' alt='' /></a></td></tr>"														>> $FILE
echo '</table><br /><br />'																		>> $FILE
echo '<table width="600">'																		>> $FILE
echo "<tr><td><font size='2' color='red'><b> &nbsp; &nbsp; Do you need help?</b></font></td><td><font size='2' color='black'>See the R.E.D. Server Development FAQ, <i>i. e.</i> click <a href='$MIRROR/$REDSVersion/faq.php#5' target='_blank'>HERE</a>...</font><br /><font size='1' color='black'> (we always try to help)</font></td></tr>"                                  >> $FILE
echo '</table><br /><br />'                                                                                                                                             >> $FILE
echo '<center><input type="button" value="Close this window" onclick="windowClose();"/></center><br />'								>> $FILE
echo '<center><a href="http://validator.w3.org/check?uri=referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Transitional" style="border:0;width:88px;height:31px" /></a><a href="http://jigsaw.w3.org/css-validator/check/referer" onclick="window.open(this.href,'\'_blank\'');return false;"><img src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="CSS Valide !" style="border:0;width:88px;height:31px" /></a></center><br />'		>> $FILE
echo '<center><font size="1" color="grey">Internet page &#169; 2009-2019. All rights reserved.<br />Universit&eacute; de Picardie Jules Verne - Sanford Burnham Prebys Medical Discovery Institute.</font></center><br />'		>> $FILE
echo '</body>'																				>> $FILE
echo '</html>'																				>> $FILE

mv $FILE ..
cd ..

echo "Graphical interface generated for $Var_Renam_Ser : Done."
echo "See the $Var_Renam_Ser.html file"
echo

	else
		echo
		echo "Directory ./$Var_Renam_Ser does not exist..."
		echo "Please provide a correct directory name for Pxxx"
		echo
	endif

else

	echo
	echo "Provide a single R.E.D. Server Job name/a directory name..."
	echo "   i.e. execute: csh Web-InterfacePyRED.csh Pxxxx" 
	echo

endif

