1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768
|
#!@WHICHPYTHON@
"""
APBS input form [fill in later]
"""
__date__ = "22 June 2007"
__author__ = "Samir Unni"
__version__ = "0.0.1"
import string, sys, os, time, errno, shutil, tempfile, urllib, copy, pickle, glob
#sys.path.append("/home/samir/public_html/pdb2pqr")
import src
import cgi, cgitb
import locale
from sys import stdout, stderr, stdin
from src.aconf import *
from src.server import setID
#from initVars import *
#from generateForm import generateForm
#from apbsInputMake import *
#from apbsExec import apbsExec
#from apbsExec import apbsOpalExec
from sgmllib import SGMLParser
from src.utilities import (getTrackingScriptString,
getEventTrackingString,
startLogFile,
resetLogFile)
def apbsOpalExec(logTime, form, apbsOptions):
sys.path.append(os.path.dirname(APBS_LOCATION))
from ApbsClient import execApbs, initRemoteVars, enoughMemory
#style = "%spdb2pqr.css" # HARDCODED
#apbsLog = "apbs_runtime_output.log"
#apbsErrs = "apbs_errors.log"
# Copies PQR file to temporary directory
pqrFileName = form["pdb2pqrid"].value + '.pqr'
#shutil.copyfile('../pdb2pqr/tmp/%s' % pqrFileName, './tmp/%s/%s' % (logTime, pqrFileName))
# Removes water from molecule if requested by the user
if form.has_key("removewater"):
if form["removewater"].value == "on":
os.chdir('./tmp/%s' % logTime)
inpath = pqrFileName
infile = open(inpath, "r")
outpath = inpath[:-4] + '-nowater' + inpath[-4:]
outfile = open(outpath, "w")
newinpath = inpath[:-4] + '-water' + inpath[-4:]
newoutpath = inpath
while 1:
line = infile.readline()
if line == '':
break
if "WAT" in line:
pass
elif "HOH" in line:
pass
else:
outfile.write(line)
infile.close()
outfile.close()
shutil.move(inpath, newinpath)
shutil.move(outpath, newoutpath)
os.chdir('../../')
#argv=[os.path.abspath("tmp/%s/%s.in") % (logTime, "apbsinput")] # HARDCODED??
argv=[os.path.abspath("%s%s%s/apbsinput.in" % (INSTALLDIR, TMPDIR, logTime))]
vars={'service_url' : APBS_OPAL_URL}
# Check for enough memory
if(not enoughMemory(argv[-1])):
return 'notenoughmem'
appServicePortArray = execApbs(vars=vars, argv=argv)
# if the version number doesn't match, execApbs returns False
if(appServicePortArray == False):
return False
appServicePort = appServicePortArray[0]
#aspFile = open('./tmp/%s/%s-asp' % (logTime, logTime),'w')
#pickle.dump(appServicePort, aspFile)
#aspFile.close()
resp = appServicePortArray[1]
return resp._jobID
def apbsExec(logTime, form, apbsOptions):
tempPage = "results.html"
# Temporary index.py html page - refreshes in 30 seconds
#apbsLog = "apbs_runtime_output.log"
#apbsErrs = "apbs_errors.log"
# Copies PQR file to temporary directory
pqrFileName = form["pdb2pqrid"].value + '.pqr'
#shutil.copyfile('../pdb2pqr/tmp/%s' % pqrFileName, './tmp/%s/%s' % (logTime, pqrFileName))
# Removes water from molecule if requested by the user
try:
if form["removewater"].value == "on":
os.chdir('./tmp/%s' % logTime)
inpath = pqrFileName
infile = open(inpath, "r")
outpath = inpath[:-4] + '-nowater' + inpath[-4:]
outfile = open(outpath, "w")
newinpath = inpath[:-4] + '-water' + inpath[-4:]
newoutpath = inpath
while 1:
line = infile.readline()
if line == '':
break
if "WAT" in line:
pass
elif "HOH" in line:
pass
else:
outfile.write(line)
infile.close()
outfile.close()
shutil.move(inpath, newinpath)
shutil.move(outpath, newoutpath)
os.chdir('../../')
except KeyError:
pass
pid = os.fork()
if pid:
print redirector(logTime)
sys.exit()
else:
currentdir = os.getcwd()
os.chdir("/")
os.setsid()
os.umask(0)
os.chdir(currentdir)
os.close(1)
os.close(2)
#os.chdir('./tmp/%s' % logTime)
os.chdir('%s%s%s' % (INSTALLDIR, TMPDIR, logTime))
# LAUNCHING APBS HERE
startLogFile(logTime, 'apbs_status', "running\n")
# statusfile = open('%s%s%s/apbs_status' % (INSTALLDIR, TMPDIR, logTime),'w')
# statusfile.write("running\n")
# statusfile.close()
apbs_stdin, apbs_stdout, apbs_stderr = os.popen3('%s apbsinput.in' % APBS_LOCATION)
startLogFile(logTime, 'apbs_stdout.txt', apbs_stdout.read())
# stdoutFile=open('%s%s%s/apbs_stdout.txt' % (INSTALLDIR, TMPDIR, logTime), 'w')
# stdoutFile.write(apbs_stdout.read())
# stdoutFile.close()
startLogFile(logTime, 'apbs_stderr.txt', apbs_stderr.read())
# stderrFile=open('%s%s%s/apbs_stderr.txt' % (INSTALLDIR, TMPDIR, logTime), 'w')
# stderrFile.write(apbs_stderr.read())
# stderrFile.close()
startLogFile(logTime, 'apbs_end_time', str(time.time()))
# endtimefile=open('%s%s%s/apbs_end_time' % (INSTALLDIR, TMPDIR, logTime), 'w')
# endtimefile.write(str(time.time()))
# endtimefile.close()
jobDir = '%s%s%s/' % (INSTALLDIR, TMPDIR, logTime)
statusStr = "complete\n"
statusStr += jobDir + 'apbsinput.in\n'
statusStr += jobDir + '%s.pqr\n' % logTime
statusStr += jobDir + 'io.mc\n'
for filename in glob.glob(jobDir+"%s-*.dx" % logTime):
statusStr += (filename+"\n")
statusStr += jobDir + 'apbs_stdout.txt\n'
statusStr += jobDir + 'apbs_stderr.txt\n'
startLogFile(logTime, 'apbs_status', statusStr)
# statusfile=open('%s%s%s/apbs_status' % (INSTALLDIR, TMPDIR, logTime),'w')
# statusfile.write("complete\n")
# statusfile.write("%s%s%s/apbsinput.in\n" % (INSTALLDIR, TMPDIR, logTime))
# statusfile.write("%s%s%s/%s.pqr\n" % (INSTALLDIR, TMPDIR, logTime, logTime))
# statusfile.write("%s%s%s/io.mc\n" % (INSTALLDIR, TMPDIR, logTime))
# for filename in glob.glob("%s%s%s/%s-*.dx" % (INSTALLDIR, TMPDIR, logTime, logTime)):
# statusfile.write(filename+"\n")
# statusfile.write("%s%s%s/apbs_stdout.txt\n" % (INSTALLDIR, TMPDIR, logTime))
# statusfile.write("%s%s%s/apbs_stderr.txt\n" % (INSTALLDIR, TMPDIR, logTime))
# statusfile.close()
sys.exit()
def generateForm(file, initVars, pdb2pqrID, type):
"""CGI form generation code"""
cgifile = "apbs_cgi.cgi"
cginame = "thisform"
file.write("""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>APBS input</title>
<link href="pdb2pqr.css" type="text/css" rel="stylesheet" />
<script type=\"text/javascript\">
function showHide(elemShow, elemHide) {
document.getElementById(elemHide).style.display = 'none';
//document.getElementById(elemShow).style.display = 'block';
//document.getElementById(elemShow).style.visibility= 'visible';
document.getElementById(elemShow).style.display = '';
}
function toggle(element) {
if(document.getElementById(element).style.display == 'none') {
document.getElementById(element).style.display = '';
}
else {
document.getElementById(element).style.display = 'none';
}
}
function getElementsByClass(searchClass,node,tag) {
var classElements = new Array();
if ( node == null )
node = document;
if ( tag == null )
tag = '*';
var els = node.getElementsByTagName(tag);
var elsLen = els.length;
//var pattern = new RegExp("(^|\\\\\\\\s)"+searchClass+"(\\\\\\\\s|$)");
for (i = 0, j = 0; i < elsLen; i++) {
//if ( pattern.test(els[i].className) ) {
if( els[i].className.indexOf(searchClass) != -1) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}
function disableCalcType(calcTypeToDisable) {
//var elements = getElementsByClass(calcTypeToDisable, null, 'div');
var elements = getElementsByClass(calcTypeToDisable);
for(var i=0; i<elements.length; i++) {
elements[i].style.display = 'none';
}
}
function showCalcType(calcType) {
//var calcTypesToDisable = ['mg-auto','mg-para','mg-manual','fe-manual','mg-dummy'];
var calcTypesToDisable = ['mg-auto','mg-para','mg-manual','fe-manual','mg-dummy'];
for(var i=0; i<calcTypesToDisable.length; i++) {
if(calcTypesToDisable[i]!=calcType) {
disableCalcType(calcTypesToDisable[i]);
}
}
//var elements = getElementsByClass(calcType, null, 'div');
var elements = getElementsByClass(calcType);
for(var i=0; i<elements.length; i++) {
//elements[i].style.display = 'block';
elements[i].style.display = '';
//elements[i].style.visibility = 'visible';
}
}
function findCheckedCalc() {
for(var i=0; i<document.%s.type.length; i++) {
if(document.%s.type[i].checked) {
type = document.%s.type[i];
return type;
}
}
}
function configInitCheckedCalc() {
showCalcType('%s');
}
function executeOnPageLoad(myfunc) {
if(window.addEventListener) {
window.addEventListener('load', myfunc, false);
}
else if(window.attachEvent) {
window.attachEvent('onload', myfunc);
}
}
executeOnPageLoad(configInitCheckedCalc);
window.onload = function() {
// Check if hash exists
if(window.location.hash) {
// Remove the "#" from the hash
hash = window.location.hash.substr(1);
// Display element with id == hash
document.getElementById(hash).style.display = "block";
}
}
</script>
</head>
<body>
<!-- ... body of document ... -->
<h2>APBS web solver</h2>
""" % (cginame, cginame, cginame, initVars['calculationType'])) # hardcoded css link
file.write("<h3>Calculation on <a href=\"tmp/%s/%s\" target=\"_blank\">%s</a> with default values provided by PDB2PQR:</h3><br />\n" % (pdb2pqrID, initVars['pqrname'],initVars['pdbID']))
# Write out the form element
print "<form action=\"%s\" method=\"post\" enctype=\"multipart/form-data\" name=\"%s\" id=\"%s\">" % (cgifile, cginame, cginame)
print "<input type=\"submit\" value=\"Launch\"/><br /><br />"
print """
If you prefer to run APBS with custom values, click here:
<input type=\"checkbox\" name=\"customvalues\" onClick=\"toggle(\'params\');"/>
<br /><br />
<div id=\"params\" style=\"display:none\">
Please specify the type of calculation (all parameters for the specified calculation must be fullfilled, unless indicated otherwise):
<br />
"""
print "<input type=\"radio\" name=\"type\" value=\"mg-auto\" onClick=\"showCalcType(\'mg-auto\');\"",
if initVars['calculationType'] == "mg-auto":
print " checked=\"checked\"",
print "/> Automatically-configured sequential focusing multigrid calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#mg-auto\" target=\"_blank\"><font title=\"mg-auto\" >(<span class=\"tooltip\">?</span>)</font></a>"
print "<br />"
print "<input type=\"radio\" name=\"type\" value=\"mg-para\" onClick=\"showCalcType(\'mg-para\');\"",
if initVars['calculationType'] == "mg-para":
print " checked=\"checked\"",
#print "disabled=\"disabled\""
print """/> Automatically-configured parallel focusing multigrid calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#mg-para\" target=\"_blank\"><font title=\"mg-para\">(<span class=\"tooltip\">?</span>)</font></a>"""
print "<br />"
print "<input type=\"radio\" name=\"type\" value=\"mg-manual\" onClick=\"showCalcType(\'mg-manual\');\"",
if initVars['calculationType'] == "mg-manual":
print " checked=\"checked\"",
#print "disabled=\"disabled\""
print """/> Manually-configured multigrid calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#mg-manual\" target=\"_blank\"><font title=\"mg-manual\">(<span class=\"tooltip\">?</span>)</font></a>"""
print "<br />"
print "<input type=\"radio\" name=\"type\" value=\"fe-manual\" onClick=\"showCalcType(\'fe-manual\');\"",
if initVars['calculationType'] == "fe-manual":
print " checked=\"checked\"",
#print "disabled=\"disabled\""
print """/> Manually-configured adaptive finite element calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#fe-manual\" target=\"_blank\"><font title=\"fe-manual\">(<span class=\"tooltip\">?</span>)</font></a>"""
print "<br />"
print "<input type=\"radio\" name=\"type\" value=\"mg-dummy\" onClick=\"showCalcType(\'mg-dummy\');\"",
if initVars['calculationType'] == "mg-dummy":
print " checked=\"checked\"",
#print "disabled=\"disabled\""
print """/> Surface and charge distribution property calculations (does not require solution of the PBE) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#mg-dummy\" target=\"_blank\"><font title=\"mg-dummy\">(<span class=\"tooltip\">?</span>)</font></a>"""
print "<ul><li><input type=\"checkbox\" name=\"removewater\" value=\"on\" checked=\"checked\"/> Remove water from calculations and visualizations</li></ul>"
print """
<div class=\"mg-auto mg-para mg-manual mg-dummy\">
<ul>"""
print """
<table class=\"apbs\" border=\"1\">
<tr>
<th></th>
<th>x-direction</th>
<th>y-direction</th>
<th>z-direction</th>
</tr>
<tbody class=\"mg-auto mg-para mg-manual mg-dummy\">
<tr>
<td>Number of grid points<br />per processor for grid-<br />based discretization <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-dime\" target=\"_blank\"><font title=\"dime\">(<span class=\"tooltip\">?</span>)</font></a></td>
<td><input type=\"text\" name=\"dimenx\" size=\"10\" maxlength=\"20\""""
if initVars.has_key('dime'):
print "value=\"%d\"" % initVars['dime'][0]
print "/></td>"
print "<td><input type=\"text\" name=\"dimeny\" size=\"10\" maxlength=\"20\""
if initVars.has_key('dime'):
print "value=\"%d\"" % initVars['dime'][1]
print "/></td>"
print "<td><input type=\"text\" name=\"dimenz\" size=\"10\" maxlength=\"20\""
if initVars.has_key('dime'):
print "value=\"%d\"" % initVars['dime'][2]
print "/></td></tr></tbody>"
# next row
print "<tbody class=\"mg-auto mg-para mg-dummy\">"
print "<tr>"
print "<td>Coarse mesh domain<br />lengths in a focusing<br />calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-cglen\" target=\"_blank\"><font title=\"cglen\">(<span class=\"tooltip\">?</span>)</font></a></td>"
print "<td><input type=\"text\" name=\"cglenx\" size=\"10\" maxlength=\"20\""
if initVars.has_key('coarseGridLength'):
print "value=\"%g\"" % initVars['coarseGridLength'][0]
print "/>"
print "<td><input type=\"text\" name=\"cgleny\" size=\"10\" maxlength=\"20\""
if initVars.has_key('coarseGridLength'):
print "value=\"%g\"" % initVars['coarseGridLength'][1]
print "/>"
print "<td><input type=\"text\" name=\"cglenz\" size=\"10\" maxlength=\"20\""
if initVars.has_key('coarseGridLength'):
print "value=\"%g\"" % initVars['coarseGridLength'][2]
print "/></td></tr></tbody>"
# next row
print "<tbody class=\"mg-auto mg-para\">"
print "<tr>"
print "<td>Fine mesh domain<br />lengths in a focusing<br />calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-fglen\" target=\"_blank\"><font title=\"fglen\">(<span class=\"tooltip\">?</span>)</font></a></td>"
print "<td><input type=\"text\" name=\"fglenx\" size=\"10\" maxlength=\"20\""
if initVars.has_key('fineGridLength'):
print "value=\"%g\"" % initVars['fineGridLength'][0]
print "/>"
print "<td><input type=\"text\" name=\"fgleny\" size=\"10\" maxlength=\"20\""
if initVars.has_key('fineGridLength'):
print "value=\"%g\"" % initVars['fineGridLength'][1]
print "/>"
print "<td><input type=\"text\" name=\"fglenz\" size=\"10\" maxlength=\"20\""
if initVars.has_key('fineGridLength'):
print "value=\"%g\"" % initVars['fineGridLength'][2]
print "/></td></tr></tbody>"
# next row
print "<tbody class=\"mg-para\">"
print "<tr>"
print "<td>Number of proces-<br />sors in a parallel<br />focusing calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-pdime\" target=\"_blank\"><font title=\"pdime\">(<span class=\"tooltip\">?</span>)</font></a></td>"
print "<td><input type=\"text\" name=\"pdimex\" size=\"10\" maxlength=\"20\""
if initVars.has_key('pdime'):
print "value=\"%g\"" % initVars['pdime'][0]
print "/>"
print "<td><input type=\"text\" name=\"pdimey\" size=\"10\" maxlength=\"20\""
if initVars.has_key('pdime'):
print "value=\"%g\"" % initVars['pdime'][1]
print "/>"
print "<td><input type=\"text\" name=\"pdimez\" size=\"10\" maxlength=\"20\""
if initVars.has_key('pdime'):
print "value=\"%g\"" % initVars['pdime'][2]
print "/></td></tr></tbody>"
# next row
print "<tbody class=\"mg-manual\">"
print "<tr>"
print "<td>Mesh domain<br />lengths <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-glen\" target=\"_blank\"><font title=\"glen\">(<span class=\"tooltip\">?</span>)</font></a></td>"
print "<td><input type=\"text\" name=\"glenx\" size=\"10\" maxlength=\"20\""
if initVars.has_key('glen'):
print "value=\"%g\"" % initVars['glen'][0]
print "/>"
print "<td><input type=\"text\" name=\"gleny\" size=\"10\" maxlength=\"20\""
if initVars.has_key('glen'):
print "value=\"%g\"" % initVars['glen'][1]
print "/>"
print "<td><input type=\"text\" name=\"glenz\" size=\"10\" maxlength=\"20\""
if initVars.has_key('glen'):
print "value=\"%g\"" % initVars['glen'][2]
print "/></td></tr></tbody>"
print "</table></div></ul>"
print """ <div class=\"mg-para\"><ul>
<li>Amount of overlap to include between the individual processors' meshes <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-ofrac\" target=\"_blank\"><font title=\"ofrac\">(<span class=\"tooltip\">?</span>)</font></a>:"""
print "<input type=\"text\" name=\"ofrac\" size=\"10\" maxlength=\"20\""
if initVars.has_key('processorMeshOverlap'):
print "value=\"%f\"" % initVars['processorMeshOverlap']
print "/></li><br />"
print "<li><input type=\"checkbox\" name=\"asyncflag\" onClick=toggle(\"async\") "
if initVars['asyncflag']:
print " checked=\"checked\""
print """/> Perform the tasks in a parallel run asynchronously <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-async\" target=\"_blank\"><font title=\"asyncflag\">(<span class=\"tooltip\">?</span>)</font></a></li>"""
print "<blockquote>"
print "<div id=\"async\" style=\"display:none\">"
print "<li>Rank for a processor to masquerade as <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-async\" target=\"_blank\"><font title=\"async\">(<span class=\"tooltip\">?</span>)</font></a>:"
print "<input type=\"text\" name=\"async\" size=\"10\" maxlength=\"20\""
if initVars.has_key('async'):
print " value=\"%i\"" % initVars['async']
print "/></li>"
print "</blockquote>"
print "</li></ul></div>"
print "<div class=\"mg-manual mg-dummy\">"
print "<ul><li>Depth of the multilevel hierarchy used in the multigrid solver <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-nlev\" target=\"_blank\"><font title=\"nlev\">(<span class=\"tooltip\">?</span>)</font></a>:"
print "<input type=\"text\" name=\"nlev\" size=\"10\" maxlength=\"20\""
if initVars.has_key('nlev'):
print " value=\"%i\"" % initVars['nlev']
print "/></li></ul></div>"
print """ <div class=\"mg-manual mg-dummy\"><ul>
<li>Center of the grid <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-cgcent\" target=\"_blank\"><font title=\"gcent\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>
<blockquote><ul><li>"""
print "<input type=\"radio\" name=\"gcent\" value=\"mol\" onClick=\"showHide(\'gcentmol\',\'gcentcoord\');\""
if initVars['gridCenterMethod'] == "molecule":
print "checked=\"checked\""
print "/> Center the grid on a molecule.</li></ul>"
print "<div id=\"gcentmol\""
if initVars['gridCenterMethod'] != "molecule":
print " style=\"display: none;\""
print"""><blockquote>
<ul>
<li>Enter molecule ID:"""
print "<input type=\"text\" name=\"gcentid\" size=\"10\" maxlength=\"20\""
if initVars['gridCenterMethod'] == "molecule" and initVars.has_key('gridCenterMoleculeID'):
print "value=\"%d\"" % initVars['gridCenterMoleculeID']
print "/>"
print """
</li>
</ul>
</blockquote></div>
"""
print "<ul><li><input type=\"radio\" name=\"gcent\" value=\"coord\" onClick=\"showHide(\'gcentcoord\',\'gcentmol\');\""
if initVars['gridCenterMethod'] == "coordinate":
print "checked"
print "/> Manually enter coordinates for center of grid:</li></ul>"
print "<div id=\"gcentcoord\""
if initVars['gridCenterMethod'] != "coordinate":
print "style=\"display: none;\""
print """><blockquote>
<ul>
<li>"""
print "x-coordinate: <input type=\"text\" name=\"gxcent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('gridCenter'):
print "value=\"%d\"" % initVars['gridCenter'][0]
print "/>"
print """
</li>
<li>"""
print "y-coordinate: <input type=\"text\" name=\"gycent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('gridCenter'):
print "value=\"%d\"" % initVars['gridCenter'][1]
print "/>"
print """
</li>
<li>"""
print "z-coordinate: <input type=\"text\" name=\"gzcent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('gridCenter'):
print "value=\"%d\"" % initVars['gridCenter'][2]
print "/>"
print "</li></ul></blockquote></div>"
print "</blockquote>"
print "</div>"
print """
<div class=\"mg-auto mg-para\"><ul>
<li>Center of the coarse grid <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-cgcent\" target=\"_blank\"><font title=\"cgcent\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>
<blockquote><ul><li>"""
print "<input type=\"radio\" name=\"cgcent\" value=\"mol\" onClick=\"showHide(\'cgcentmol\',\'cgcentcoord\');\""
if initVars['coarseGridCenterMethod'] == "molecule":
print "checked=\"checked\""
print "/> Center the grid on a molecule.</li></ul>"
print "<div id=\"cgcentmol\""
if initVars['coarseGridCenterMethod'] != "molecule":
print " style=\"display: none;\""
print"""><blockquote>
<ul>
<li>Enter molecule ID:"""
print "<input type=\"text\" name=\"cgcentid\" size=\"10\" maxlength=\"20\""
if initVars['coarseGridCenterMethod'] == "molecule" and initVars.has_key('coarseGridCenterMoleculeID'):
print "value=\"%d\"" % initVars['coarseGridCenterMoleculeID']
print "/>"
print """
</li>
</ul>
</blockquote>
</div>
"""
print "<ul><li><input type=\"radio\" name=\"cgcent\" value=\"coord\" onClick=\"showHide(\'cgcentcoord\',\'cgcentmol\');\""
if initVars['coarseGridCenterMethod'] == "coordinate":
print "checked"
print "/> Manually enter coordinates for center of grid:</li></ul>"
print "<div id=\"cgcentcoord\""
if initVars['coarseGridCenterMethod'] != "coordinate":
print "style=\"display: none;\""
print """><blockquote>
<ul>
<li>"""
print "x-coordinate: <input type=\"text\" name=\"cgxcent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('coarseGridCenter'):
print "value=\"%d\"" % initVars['coarseGridCenter'][0]
print "/>"
print """
</li>
<li>"""
print "y-coordinate: <input type=\"text\" name=\"cgycent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('coarseGridCenter'):
print "value=\"%d\"" % initVars['coarseGridCenter'][1]
print "/>"
print """
</li>
<li>"""
print "z-coordinate: <input type=\"text\" name=\"cgzcent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('coarseGridCenter'):
print "value=\"%d\"" % initVars['coarseGridCenter'][2]
print "/>"
print """</li></ul></blockquote>
</blockquote>"""
#"""</div>"""
print """
<ul>
<li>Center of the fine grid <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-fgcent\" target=\"_blank\"><font title=\"fgcent\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>
<blockquote>
<ul><li>"""
print "<input type=\"radio\" name=\"fgcent\" value=\"mol\" onClick=\"showHide(\'fgcentmol\',\'fgcentcoord\');\""
if initVars['fineGridCenterMethod'] == "molecule":
print "checked=\"checked\""
print "/> Center the grid on a molecule.</li></ul>"
print "<div id=\"fgcentmol\""
if initVars['fineGridCenterMethod'] != "molecule":
print "style=\"display: none\""
print """
><blockquote>
<ul>
<li>Enter molecule ID:"""
print "<input type=\"text\" name=\"fgcentid\" size=\"10\" maxlength=\"20\""
if initVars['fineGridCenterMethod'] == "molecule" and initVars.has_key('fineGridCenterMoleculeID'):
print "value=\"%d\"" % initVars['fineGridCenterMoleculeID']
print "/>"
print """
</li>
</ul>
</blockquote></div>"""
print "<ul><li><input type=\"radio\" name=\"fgcent\" value=\"coord\" onClick=\"showHide(\'fgcentcoord\',\'fgcentmol\');\""
if initVars['fineGridCenterMethod'] == "coordinate":
print "checked"
print "/> Manually enter coordinates for the center of the grid.</li></ul>"
print "<div id=\"fgcentcoord\""
if initVars['fineGridCenterMethod'] != "coordinate":
print "style=\"display: none;\""
print """
><blockquote>
<ul>
<li>"""
print "x-coordinate: <input type=\"text\" name=\"fgxcent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('fineGridCenter'):
print "value=\"%d\"" % initVars['fineGridCenter'][0]
print "/>"
print """
</li>
<li>"""
print "y-coordinate: <input type=\"text\" name=\"fgycent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('fineGridCenter'):
print "value=\"%d\"" % initVars['fineGridCenter'][1]
print "/>"
print """
</li>
<li>"""
print "z-coordinate: <input type=\"text\" name=\"fgzcent\" size=\"10\" maxlength=\"20\""
if initVars.has_key('fineGridCenter'):
print "value=\"%d\"" % initVars['fineGridCenter'][2]
print "/>"
print """
</li>
</ul>
</blockquote>
</blockquote>
</div>"""#</div>"""
#print """<ul>
# <div class=\"mg-para mg-manual fe-manual mg-dummy\""""
#print """>
# <li>Molecule for which the PBE is to be solved <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-mol\" target=\"_blank\"><font title=\"mol\">(<span class=\"tooltip\">?</span>)</font></a>:"""
#print "<input type=\"text\" name=\"mol\" size=\"10\" maxlength=\"20\""
#if initVars.molecule != None:
# print "value=\"%d\"" % initVars.molecule
#print "/></li></div>"
#print """</ul>
print """ <ul>
<li>Type of PBE to be solved:</li></ul>"""
print """<blockquote>
<ul>"""
print "<li><input type=\"radio\" name=\"solvetype\" value=\"lpbe\""
if initVars['solveType'] == "linearized":
print "checked=\"checked\""
print "/> Linearized <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-lpbe\" target=\"_blank\"><font title=\"lpbe\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "<li><input type=\"radio\" name=\"solvetype\" value=\"npbe\""
if initVars['solveType'] == "nonlinearized":
print "checked=\"checked\""
print "/> Nonlinearized <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-npbe\" target=\"_blank\"><font title=\"npbe\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "<div class=\"fe-manual\""
#if initVars.defaultCalcType != "fe-manual":
# print " style=\"display: none;\""
print "><li><input type=\"radio\" name=\"solvetype\" value=\"lrpbe\""
if initVars['solveType'] == "linearized regularized":
print "checked=\"checked\""
print "/> Linearized (regularized) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-lrpbe\" target=\"_blank\"><font title=\"lrpbe\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "<li><input type=\"radio\" name=\"solvetype\" value=\"nrpbe\""
if initVars['solveType'] == "nonlinearized regularized":
print "checked=\"checked\""
print "/> Nonlinearized (regularized) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-nrpbe\" target=\"_blank\"><font title=\"nrpbe\">(<span class=\"tooltip\">?</span>)</font></a></li></div>"
print """</ul>
</blockquote>"""
print " <ul><li>Boundary condition definition <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-bcfl\" target=\"_blank\"><font title=\"bcfl\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"
print "<blockquote> <ul>"
print "<li><input type=\"radio\" name=\"bcfl\" value=\"zero\""
if initVars['boundaryConditions'] == "zero":
print "checked=\"checked\""
print "/> Zero <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-bcfl\" target=\"_blank\"><font title=\"zero\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "<li><input type=\"radio\" name=\"bcfl\" value=\"sdh\""
if initVars['boundaryConditions'] == "sdh":
print "checked=\"checked\""
print "/> Single Debye-Huckel <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-bcfl\" target=\"_blank\"><font title=\"sdh\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "<li><input type=\"radio\" name=\"bcfl\" value=\"mdh\""
if initVars['boundaryConditions'] == "mdh":
print "checked=\"checked\""
print "/> Multiple Debye-Huckel <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-bcfl\" target=\"_blank\"><font title=\"mdh\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "<li><input type=\"radio\" name=\"bcfl\" value=\"focus\""
if initVars['boundaryConditions'] == "focus":
print "checked=\"checked\""
print "/> Focusing <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-bcfl\" target=\"_blank\"><font title=\"focus\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "</ul></blockquote>"
print "<ul>"
print """ <li>Mobile ion species present in system (optional) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-ion\" target=\"_blank\"><font title=\"ion\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"""
print """<ul>
<table class=\"apbs\" border=\"1\">
<tr>
<th></th>
<th>Mobile ion species<br />charge (in e<sub>c</sub>) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-ion\" target=\"_blank\"><font title=\"charge\">(<span class=\"tooltip\">?</span>)</font></a></th>
<th>Mobile ion species<br />concentration (in M) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-ion\" target=\"_blank\"><font title=\"conc\">(<span class=\"tooltip\">?</span>)</font></a></th>
<th>Mobile ion species<br />radius (in A) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-ion\" target=\"_blank\"><font title=\"radius\">(<span class=\"tooltip\">?</span>)</font></a></th>
</tr>"""
# new row
for i in range(0,3):
print """<tr>
<td>Ion %d</td>
<td><input type=\"text\" name=\"charge%d\" size=\"10\" maxlength=\"20\"""" % ((i+1),i)
if initVars.has_key('mobileIonSpeciesCharge'):
print "value=\"%d\"" % initVars['mobileIonSpeciesCharge']
print "/></td>"
print """
<td><input type=\"text\" name=\"conc%d\" size=\"10\" maxlength=\"20\"""" % i
if initVars.has_key('mobileIonSpeciesConcentration'):
print "value=\"%d\"" % initVars['mobileIonSpeciesConcentration']
print "/></td>"
print """
<td><input type=\"text\" name=\"radius%d\" size=\"10\" maxlength=\"20\"""" % i
if initVars.has_key('mobileIonSpeciesRadius'):
print "value=\"%d\"" % initVars['mobileIonSpeciesRadius']
print "/></td>"
print "</tr></table></ul>"
#print """<blockquote><ul>
# <li>Mobile ion species charge (in e<sub>c</sub>) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-ion\" target=\"_blank\"><font title=\"charge\">(<span class=\"tooltip\">?</span>)</font></a>: """
#print "<input type=\"text\" name=\"charge\" size=\"10\" maxlength=\"20\""
#if initVars.defaultMobileIonSpeciesCharge != None:
# print "value=\"%d\"" % initVars.defaultMobileIonSpeciesCharge
#print "/></li>"
#
#print " <li>Mobile ion species concentration (in M) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-ion\" target=\"_blank\"><font title=\"conc\">(<span class=\"tooltip\">?</span>)</font></a>:"
#
#print "<input type=\"text\" name=\"conc\" size=\"10\" maxlength=\"20\""
#if initVars.defaultMobileIonSpeciesConcentration != None:
# print "value=\"%d\"" % initVars.defaultMobileIonSpeciesConcentration
#print "/></li>"
#print " <li>Mobile ion species radius (in A) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-ion\" target=\"_blank\"><font title=\"radius\">(<span class=\"tooltip\">?</span>)</font></a>:"
#
#print "<input type=\"text\" name=\"radius\" size=\"10\" maxlength=\"20\""
#if initVars.defaultMobileIonSpeciesRadius != None:
# print "value=\"%d\"" % initVars.defaultMobileIonSpeciesRadius
#print "/></li>"
#print "</ul></blockquote>"
print " <ul><li>Biomolecular dielectric constant <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-pdie\" target=\"_blank\"><font title=\"pdie\">(<span class=\"tooltip\">?</span>)</font></a>:"
print "<input type=\"text\" name=\"pdie\" size=\"10\" maxlength=\"20\""
if initVars.has_key('biomolecularDielectricConstant'):
print "value=\"%g\"" % initVars['biomolecularDielectricConstant']
print "/>"
print """ </li>
</ul>"""
print " <ul><li>Dielectric constant of solvent <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-sdie\" target=\"_blank\"><font title=\"sdie\">(<span class=\"tooltip\">?</span>)</font></a>:"
print " <input type=\"text\" name=\"sdie\" size=\"10\" maxlength=\"20\""
if initVars.has_key('dielectricSolventConstant'):
print "value=\"%g\"" % initVars['dielectricSolventConstant']
print """/></li>
</ul>
<ul>
<li>Method by which the biomolecular point charges are mapped onto the grid <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-chgm\" target=\"_blank\"><font title=\"chgm\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"""
print "<blockquote><ul>"
print "<li><input type=\"radio\" name=\"chgm\" value=\"spl0\""
if initVars.has_key('biomolecularPointChargeMapMethod') and initVars['biomolecularPointChargeMapMethod'] == "spl0":
print "checked"
print "/> Traditional trilinear interpolation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-chgm\" target=\"_blank\"><font title=\"spl0\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "<li><input type=\"radio\" name=\"chgm\" value=\"spl2\""
if initVars.has_key('biomolecularPointChargeMapMethod') and initVars['biomolecularPointChargeMapMethod'] == "spl2":
print "checked=\"checked\""
print "/> Cubic B-spline discretization <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-chgm\" target=\"_blank\"><font title=\"spl2\">(<span class=\"tooltip\">?</span>)</font></a></li>"
print "<li><input type=\"radio\" name=\"chgm\" value=\"spl4\""
if initVars.has_key('biomolecularPointChargeMapMethod') and initVars['biomolecularPointChargeMapMethod'] == "spl4":
print "checked"
print "/> Quintic B-spline discretization <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-chgm\" target=\"_blank\"><font title=\"spl4\">(<span class=\"tooltip\">?</span>)</a></font></li>"
print "</ul></blockquote>"
print " <ul><li>Number of grid points per square-angstrom to use in surface constructions <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-sdens\" target=\"_blank\"><font title=\"sdens\">(<span class=\"tooltip\">?</span>)</font></a>:"
print "<input type=\"text\" name=\"sdens\" size=\"10\" maxlength=\"20\""
if initVars.has_key('surfaceConstructionResolution'):
print "value=\"%g\"" % initVars['surfaceConstructionResolution']
print """ /></li></ul>
<ul><li>Model to use to construct the dielectric ion-accessibility coefficients <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-srfm\" target=\"_blank\"><font title=\"srfm\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"""
print "<blockquote> <ul>"
print "<li><input type=\"radio\" name=\"srfm\" value=\"mol\""
if initVars.has_key('dielectricIonAccessibilityModel') and initVars['dielectricIonAccessibilityModel'] == "mol":
print "checked=\"checked\""
print "/> Dielectric coefficient is defined based on a molecular surface definition; ion-accessibility coefficient is defined by an \"inflated\" van der Waals model <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-srfm\" target=\"_blank\"><font title=\"mol\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"
print "<li><input type=\"radio\" name=\"srfm\" value=\"smol\""
if initVars.has_key('dielectricIonAccessibilityModel') and initVars['dielectricIonAccessibilityModel'] == "smol":
print "checked=\"checked\""
print "/> Dielectric and ion-accessiblity coefficients are defined as above, but then are then \"smoothed\" by a 9-point harmonic averaging to somewhat reduce sensitivity to the grid setup <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-srfm\" target=\"_blank\"><font title=\"smol\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"
print "<li><input type=\"radio\" name=\"srfm\" value=\"spl2\""
if initVars.has_key('dielectricIonAccessibilityModel') and initVars['dielectricIonAccessibilityModel'] == "spl2":
print "checked=\"checked\""
print "/> Dielectric and ion-accessibility coefficients are defined by a cubic-spline surface <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-srfm\" target=\"_blank\"><font title=\"spl2\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"
print "<li><input type=\"radio\" name=\"srfm\" value=\"spl4\""
if initVars.has_key('dielectricIonAccessibilityModel') and initVars['dielectricIonAccessibilityModel'] == "spl4":
print "checked=\"checked\""
print "/> Dielectric and ion-accessibility coefficients are defined by a 7th order polynomial <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-srfm\" target=\"_blank\"><font title=\"spl4\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"
print "</ul></blockquote>"
print " <ul><li>Radius of the solvent molecules <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-srad\" target=\"_blank\"><font title=\"srad\">(<span class=\"tooltip\">?</span>)</font></a>:"
print "<input type=\"text\" name=\"srad\" size=\"10\" maxlength=\"20\""
if initVars['solventRadius'] != None:
print "value=\"%g\"" % initVars['solventRadius']
print """/></li></ul>
<ul><li>Size of the support for spline-based surface definitions <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-swin\" target=\"_blank\"><font title=\"swin\">(<span class=\"tooltip\">?</span>)</font></a>:"""
print "<input type=\"text\" name=\"swin\" size=\"10\" maxlength=\"20\""
if initVars.has_key('surfaceDefSupportSize'):
print "value=\"%g\"" % initVars['surfaceDefSupportSize']
print """/></li></ul>
<ul><li>Temperature for PBE calculation (in K) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-temp\" target=\"_blank\"><font title=\"temp\">(<span class=\"tooltip\">?</span>)</font></a>:"""
print "<input type=\"text\" name=\"temp\" size=\"10\" maxlength=\"20\""
if initVars.has_key('temperature'):
print "value=\"%g\"" % initVars['temperature']
print """/></li></ul>
<ul><li>Calculation of electrostatic energy from a PBE calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-calcenergy\" target=\"_blank\"><font title=\"calcenergy\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"""
print "<blockquote><ul>"
print "<li><input type=\"radio\" name=\"calcenergy\" value=\"no\""
if initVars['calculationEnergy'] == "no":
print "checked"
print """/> Don\'t calculate any energies <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-calcenergy\" target=\"_blank\"><font title=\"no\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"radio\" name=\"calcenergy\" value=\"total\""
if initVars['calculationEnergy'] == "total":
print "checked=\"checked\""
print """/> Calculate and return total electrostatic energy for the entire molecule <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-calcenergy\" target=\"_blank\"><font title=\"total\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"radio\" name=\"calcenergy\" value=\"comps\""
if initVars['calculationEnergy'] == "comps":
print "checked=\"checked\""
print """/> Calculate and return total electrostatic energy for the entire molecule as well as electrostatic energy components for each atom <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-calcenergy\" target=\"_blank\"><font title=\"comps\">(<span class=\"tooltip\">?</span>)</font></a>.</li>
</ul></blockquote>
<ul><li>Calculation of electrostatic and apolar force outputs from a PBE calculation <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-calcforce\" target=\"_blank\"><font title=\"calcforce\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"""
print "<blockquote><ul>"
print "<li><input type=\"radio\" name=\"calcforce\" value=\"no\""
if initVars['calculationForce'] == "no":
print "checked=\"checked\""
print """/> Don\'t calculate any forces <a href=\"href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-calcforce\" target=\"_blank\"><font title=\"no\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"radio\" name=\"calcforce\" value=\"total\""
if initVars['calculationForce'] == "total":
print "checked=\"checked\""
print """/> Calculate and return total electrostatic and apolar forces for the entire molecule <a href=\"href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-calcforce\" target=\"_blank\"><font title=\"total\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"radio\" name=\"calcforce\" value=\"comps\""
if initVars['calculationForce'] == "comps":
print "checked=\"checked\""
print """/> Calculate and return total electrostatic and apolar forces for the entire molecule as well as force components for each atom <a href=\"href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-calcforce\" target=\"_blank\"><font title=\"comps\">(<span class=\"tooltip\">?</span>)</font></a>.</li>
</ul> </blockquote>"""
print """
<ul><li>Output of scalar data calculated during the PB run <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"write\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"""
print "<blockquote><ul>"
print "<li><input type=\"checkbox\" name=\"writecharge\""
if initVars['writeBiomolecularChargeDistribution']:
print "checked=\"checked\""
print """/> Write out the biomolecular charge distribution in units of e<sub>c</sub> (multigrid only) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"charge\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writepot\""
if initVars['writeElectrostaticPotential']:
print "checked=\"checked\""
print """/> Write out the electrostatic potential in units of k<sub>b</sub>T/e<sub>c</sub> (multigrid and finite element) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"pot\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writesmol\""
if initVars['writeMolecularSurfaceSolventAccessibility']:
print "checked=\"checked\""
print """/> Write out the solvent accessibility defined by the molecular surface definition <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"smol\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writesspl\""
if initVars['writeSplineBasedSolventAccessibility']:
print "checked=\"checked\""
print """/> Write out the spline-based solvent accessibility <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"sspl\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writevdw\""
if initVars['writeVanDerWaalsSolventAccessibility']:
print "checked=\"checked\""
print """/> Write out the van der Waals-based solvent accessibility <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"blank\"><font title=\"vdw\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writeivdw\""
if initVars['writeInflatedVanDerWaalsIonAccessibility']:
print "checked=\"checked\""
print """/> Write out the inflated van der Waals-based ion accessibility <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"ivdw\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writelap\""
if initVars['writePotentialLaplacian']:
print "checked=\"checked\""
print """/> Write out the Laplacian of the potential in units of k<sub>B</sub>T/e<sub>c</sub>/A<sup>2</sup> (multigrid only) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"lap\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writeedens\""
if initVars['writeEnergyDensity']:
print "checked=\"checked\""
print """/> Write out the \"energy density\" in units of k<sub>B</sub>T/e<sub>c</sub>/A<sup>2</sup> (multigrid only) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"edens\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writendens\""
if initVars['writeMobileIonNumberDensity']:
print "checked=\"checked\""
print """/> Write out the mobile ion number density for <i>m</i> ion species in units of M (multigrid only) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"ndens\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writeqdens\""
if initVars['writeMobileChargeDensity']:
print "checked=\"checked\""
print """/> Write out the mobile charge density for <i>m</i> ion species in units of e<sub>c</sub> M (multigrid only) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"qdens\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writedielx\""
if initVars['writeDielectricMapShift'][0]:
print "checked=\"checked\""
print """/> Write out the dielectric map shifted by <sup>1</sup>/<sub>2</sub> grid spacing in the x-direction <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"dielx\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writediely\""
if initVars['writeDielectricMapShift'][1]:
print "checked=\"checked\""
print """/> Write out the dielectric map shifted by <sup>1</sup>/<sub>2</sub> grid spacing in the y-direction <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"diely\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writedielz\""
if initVars['writeDielectricMapShift'][2]:
print "checked=\"checked\""
print """/> Write out the dielectric map shifted by <sup>1</sup>/<sub>2</sub> grid spacing in the z-direction <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"dielz\">(<span class=\"tooltip\">?</span>)</font></a>.</li>"""
print "<li><input type=\"checkbox\" name=\"writekappa\""
if initVars['writeIonAccessibilityKappaMap']:
print "checked=\"checked\""
print """/> Write out the ion-accessibility kappa map <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"kappa\">(<span class=\"tooltip\">?</span>)</font></a>.</li>
</ul></blockquote>
<ul><li>Format for writing out the data <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"format\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"""
print "<blockquote><ul>"
print "<li><input type=\"radio\" name=\"writeformat\" value=\"dx\""
if initVars['format'] == "dx":
print "checked=\"checked\""
print """/> OpenDX (multigrid and finite element) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"dx\">(<span class=\"tooltip\">?</span>)</font></a></li>"""
print """
<li><input type=\"radio\" name=\"writeformat\" value=\"avs\" disabled=\"disabled\"/> AVS UCD (finite element only) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"avs\">(<span class=\"tooltip\">?</span>)</font></a></li>
<li><input type=\"radio\" name=\"writeformat\" value=\"uhbd\" disabled=\"disabled\"/> UBHD (multigrid only) <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-write\" target=\"_blank\"><font title=\"uhbd\">(<span class=\"tooltip\">?</span>)</font></a></li>
</ul></blockquote>
</div>"""
#print """<ul><li>Choose type of operator to output <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-writemat\" target=\"_blank\"><font title=\"type\">(<span class=\"tooltip\">?</span>)</font></a>:</li></ul>"""
#ADD PYTHON CODE ABOVE WHEN OTHER OPTIONS ARE AVAILABLE
#print "<blockquote><ul>"
#print """ <li><input type=\"radio\" name=\"writemat\" value=\"poisson\" disabled=\"disabled\"/> Poisson <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-writemat\" target=\"_blank\"><font title=\"poisson\">(<span class=\"tooltip\">?</span>)</font></a></li>
#<li><input type=\"radio\" name=\"writemat\" value=\"pot\" disabled=\"disabled\"/> Gateaux derivative of the full PBE operator evaluated at the current solution <a href=\"http://www.poissonboltzmann.org/docs/apbs-overview/#elec-keyword-writemat\" target=\"_blank\"><font title=\"pot\">(<span class=\"tooltip\">?</span>)</font></a></li>
#</ul>
#</blockquote>
#""" #ADD PYTHON CODE ABOVE WHEN OPTIONS ARE AVAILABLE
print "<br />"
if type=="local":
print "<input type=\"hidden\" name=\"hiddencheck\" value=\"local\"/>"
else:
print "<input type=\"hidden\" name=\"hiddencheck\" value=\"opal\"/>"
print "<input type=\"hidden\" name=\"pdb2pqrid\"",
print "value=\"%s\"" % pdb2pqrID,
print "/>"
print "<input type=\"hidden\" name=\"mol\" value=\"1\"/>"
print """
</form>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
</p>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-11026338-3");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
"""
def unpickleVars(pdb2pqrID):
""" Converts instance pickle from PDB2PQR into a dictionary for APBS """
apbsOptions = {}
#pfile = open("/home/samir/public_html/pdb2pqr/tmp/%s-input.p" % pdb2pqrID, 'r')
pfile = open("%s%s%s/%s-input.p" % (INSTALLDIR, TMPDIR, pdb2pqrID, pdb2pqrID), 'r')
inputObj = pickle.load(pfile)
pfile.close()
myElec = inputObj.elecs[0]
apbsOptions['pqrname'] = pdb2pqrID+'.pqr'
apbsOptions['pdbID'] = inputObj.pqrname[:-4]
if myElec.cgcent[0:3] == "mol":
apbsOptions['coarseGridCenterMethod'] = "molecule"
apbsOptions['coarseGridCenterMoleculeID'] = locale.atoi(myElec.cgcent[4:])
else:
apbsOptions['coarseGridCenterMethod'] = "coordinate"
apbsOptions['coarseGridCenter'] = myElec.cgcent
if myElec.fgcent[0:3] == "mol":
apbsOptions['fineGridCenterMethod'] = "molecule"
apbsOptions['fineGridCenterMoleculeID'] = locale.atoi(myElec.fgcent[4:])
else:
apbsOptions['fineGridCenterMethod'] = "coordinate"
apbsOptions['fineGridCenter'] = myElec.fgcent
if myElec.gcent[0:3] == "mol":
apbsOptions['gridCenterMethod'] = "molecule"
apbsOptions['gridCenterMoleculeID'] = locale.atoi(myElec.gcent[4:])
else:
apbsOptions['gridCenterMethod'] = "coordinate"
apbsOptions['gridCenter'] = myElec.gcent
if myElec.lpbe == 1:
apbsOptions['solveType'] = 'linearized'
elif myElec.npbe == 1:
apbsOptions['solveType'] = 'nonlinearized'
#TODO: Currently this is not used.
if len(myElec.ion) == 0:
apbsOptions['mobileIonSpecies[0]'] = None
else:
apbsOptions['mobileIonSpecies[1]'] = myElec.ion
if len(myElec.write) <= 1:
apbsOptions['format'] = 'dx'
else:
apbsOptions['format'] = myElec.write[1]
apbsOptions['calculationType'] = myElec.method
apbsOptions['dime'] = myElec.dime
apbsOptions['pdime'] = myElec.pdime
apbsOptions['async'] = myElec.async_
apbsOptions['asyncflag'] = myElec.asyncflag
apbsOptions['nlev'] = myElec.nlev
apbsOptions['glen'] = myElec.glen
apbsOptions['coarseGridLength'] = myElec.cglen
apbsOptions['fineGridLength'] = myElec.fglen
apbsOptions['molecule'] = myElec.mol
apbsOptions['boundaryConditions'] = myElec.bcfl
apbsOptions['biomolecularDielectricConstant'] = myElec.pdie
apbsOptions['dielectricSolventConstant'] = myElec.sdie
apbsOptions['biomolecularPointChargeMapMethod'] = myElec.chgm
apbsOptions['surfaceConstructionResolution'] = myElec.sdens
apbsOptions['dielectricIonAccessibilityModel'] = myElec.srfm
apbsOptions['solventRadius'] = myElec.srad
apbsOptions['surfaceDefSupportSize'] = myElec.swin
apbsOptions['temperature'] = myElec.temp
apbsOptions['calculationEnergy'] = myElec.calcenergy
apbsOptions['calculationForce'] = myElec.calcforce
apbsOptions['processorMeshOverlap'] = myElec.ofrac
apbsOptions['writeBiomolecularChargeDistribution'] = False
apbsOptions['writeElectrostaticPotential'] = True
apbsOptions['writeMolecularSurfaceSolventAccessibility'] = False
apbsOptions['writeSplineBasedSolventAccessibility'] = False
apbsOptions['writeVanDerWaalsSolventAccessibility'] = False
apbsOptions['writeInflatedVanDerWaalsIonAccessibility'] = False
apbsOptions['writePotentialLaplacian'] = False
apbsOptions['writeEnergyDensity'] = False
apbsOptions['writeMobileIonNumberDensity'] = False
apbsOptions['writeMobileChargeDensity'] = False
apbsOptions['writeDielectricMapShift'] = [False,False,False]
apbsOptions['writeIonAccessibilityKappaMap'] = False
return apbsOptions
def fieldStorageToDict(form):
""" Converts the CGI input from the web interface to a dictionary """
apbsOptions = {'writeCheck':0}
if form.has_key("writecharge") and form["writecharge"].value != "":
apbsOptions['writeCheck'] += 1
apbsOptions['writeCharge'] = True
else:
apbsOptions['writeCharge'] = False
if form.has_key("writepot") and form["writepot"].value != "":
apbsOptions['writeCheck'] += 1
apbsOptions['writePot'] = True
else:
apbsOptions['writePot'] = False
if form.has_key("writesmol") and form["writesmol"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeSmol'] = True
else:
apbsOptions['writeSmol'] = False
if form.has_key("asyncflag") and form["asyncflag"].value == "on":
apbsOptions['async'] = locale.atoi(form["async"].value)
apbsOptions['asyncflag'] = True
else:
apbsOptions['asyncflag'] = False
if form.has_key("writesspl") and form["writesspl"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeSspl'] = True
else:
apbsOptions['writeSspl'] = False
if form.has_key("writevdw") and form["writevdw"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeVdw'] = True
else:
apbsOptions['writeVdw'] = False
if form.has_key("writeivdw") and form["writeivdw"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeIvdw'] = True
else:
apbsOptions['writeIvdw'] = False
if form.has_key("writelap") and form["writelap"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeLap'] = True
else:
apbsOptions['writeLap'] = False
if form.has_key("writeedens") and form["writeedens"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeEdens'] = True
else:
apbsOptions['writeEdens'] = False
if form.has_key("writendens") and form["writendens"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeNdens'] = True
else:
apbsOptions['writeNdens'] = False
if form.has_key("writeqdens") and form["writeqdens"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeQdens'] = True
else:
apbsOptions['writeQdens'] = False
if form.has_key("writedielx") and form["writedielx"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeDielx'] = True
else:
apbsOptions['writeDielx'] = False
if form.has_key("writediely") and form["writediely"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeDiely'] = True
else:
apbsOptions['writeDiely'] = False
if form.has_key("writedielz") and form["writedielz"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeDielz'] = True
else:
apbsOptions['writeDielz'] = False
if form.has_key("writekappa") and form["writekappa"].value == "on":
apbsOptions['writeCheck'] += 1
apbsOptions['writeKappa'] = True
else:
apbsOptions['writeKappa'] = False
if apbsOptions['writeCheck'] > 4:
print "Please select a maximum of four write statements."
os._exit(99)
# READ section variables
apbsOptions['readType'] = "mol"
apbsOptions['readFormat'] = "pqr"
apbsOptions['pqrPath'] = ""
apbsOptions['pqrFileName'] = form['pdb2pqrid'].value+'.pqr'
#ELEC section variables
apbsOptions['calcType'] = form["type"].value
apbsOptions['ofrac'] = locale.atof(form["ofrac"].value)
apbsOptions['dimeNX'] = locale.atoi(form["dimenx"].value)
apbsOptions['dimeNY'] = locale.atoi(form["dimeny"].value)
apbsOptions['dimeNZ'] = locale.atoi(form["dimenz"].value)
apbsOptions['cglenX'] = locale.atof(form["cglenx"].value)
apbsOptions['cglenY'] = locale.atof(form["cgleny"].value)
apbsOptions['cglenZ'] = locale.atof(form["cglenz"].value)
apbsOptions['fglenX'] = locale.atof(form["fglenx"].value)
apbsOptions['fglenY'] = locale.atof(form["fgleny"].value)
apbsOptions['fglenZ'] = locale.atof(form["fglenz"].value)
apbsOptions['glenX'] = locale.atof(form["glenx"].value)
apbsOptions['glenY'] = locale.atof(form["gleny"].value)
apbsOptions['glenZ'] = locale.atof(form["glenz"].value)
apbsOptions['pdimeNX'] = locale.atof(form["pdimex"].value)
apbsOptions['pdimeNY'] = locale.atof(form["pdimey"].value)
apbsOptions['pdimeNZ'] = locale.atof(form["pdimez"].value)
if form["cgcent"].value == "mol":
apbsOptions['coarseGridCenterMethod'] = "molecule"
apbsOptions['coarseGridCenterMoleculeID'] = locale.atoi(form["cgcentid"].value)
elif form["cgcent"].value == "coord":
apbsOptions['coarseGridCenterMethod'] = "coordinate"
apbsOptions['cgxCent'] = locale.atoi(form["cgxcent"].value)
apbsOptions['cgyCent'] = locale.atoi(form["cgycent"].value)
apbsOptions['cgzCent'] = locale.atoi(form["cgzcent"].value)
if form["fgcent"].value == "mol":
apbsOptions['fineGridCenterMethod'] = "molecule"
apbsOptions['fineGridCenterMoleculeID'] = locale.atoi(form["fgcentid"].value)
elif form["fgcent"].value == "coord":
apbsOptions['fineGridCenterMethod'] = "coordinate"
apbsOptions['fgxCent'] = locale.atoi(form["fgxcent"].value)
apbsOptions['fgyCent'] = locale.atoi(form["fgycent"].value)
apbsOptions['fgzCent'] = locale.atoi(form["fgzcent"].value)
if form["gcent"].value == "mol":
apbsOptions['gridCenterMethod'] = "molecule"
apbsOptions['gridCenterMoleculeID'] = locale.atoi(form["gcentid"].value)
elif form["gcent"].value == "coord":
apbsOptions['gridCenterMethod'] = "coordinate"
apbsOptions['gxCent'] = locale.atoi(form["gxcent"].value)
apbsOptions['gyCent'] = locale.atoi(form["gycent"].value)
apbsOptions['gzCent'] = locale.atoi(form["gzcent"].value)
apbsOptions['mol'] = locale.atoi(form["mol"].value)
apbsOptions['solveType'] = form["solvetype"].value
apbsOptions['boundaryConditions'] = form["bcfl"].value
apbsOptions['biomolecularDielectricConstant'] = locale.atof(form["pdie"].value)
apbsOptions['dielectricSolventConstant'] = locale.atof(form["sdie"].value)
apbsOptions['dielectricIonAccessibilityModel'] = form["srfm"].value
apbsOptions['biomolecularPointChargeMapMethod'] = form["chgm"].value
apbsOptions['surfaceConstructionResolution'] = locale.atof(form["sdens"].value)
apbsOptions['solventRadius'] = locale.atof(form["srad"].value)
apbsOptions['surfaceDefSupportSize'] = locale.atof(form["swin"].value)
apbsOptions['temperature'] = locale.atof(form["temp"].value)
apbsOptions['calcEnergy'] = form["calcenergy"].value
apbsOptions['calcForce'] = form["calcforce"].value
for i in range(0,3):
chStr = 'charge%i' % i
concStr = 'conc%i' % i
radStr = 'radius%i' % i
if form[chStr].value != "":
apbsOptions[chStr] = locale.atoi(form[chStr].value)
if form[concStr].value != "":
apbsOptions[concStr] = locale.atof(form[concStr].value)
if form[radStr].value != "":
apbsOptions[radStr] = locale.atof(form[radStr].value)
apbsOptions['writeFormat'] = form["writeformat"].value
#apbsOptions['writeStem'] = apbsOptions['pqrFileName'][:-4]
apbsOptions['writeStem'] = form["pdb2pqrid"].value
return apbsOptions
def pqrFileCreator(apbsOptions):
"""
Creates a pqr file, using the data from the form
"""
apbsOptions['tmpDirName'] = "%s%s%s/" % (INSTALLDIR, TMPDIR, apbsOptions['writeStem'])
try:
os.makedirs(apbsOptions['tmpDirName'])
except OSError, err:
if err.errno == errno.EEXIST:
if os.path.isdir(apbsOptions['tmpDirName']):
# print "Error (tmp directory already exists) - please try again"
pass
else:
print "Error (file exists where tmp dir should be) - please try again"
raise
else:
raise
apbsOptions['tempFile'] = "apbsinput.in"
apbsOptions['tab'] = " " # 4 spaces - used for writing to file
input = open('%s/tmp/%s/%s' % (INSTALLDIR, apbsOptions['writeStem'], apbsOptions['tempFile']), 'w')
# writing READ section to file
input.write('read\n')
input.write('%s%s %s %s%s' % (apbsOptions['tab'], apbsOptions['readType'], apbsOptions['readFormat'], apbsOptions['pqrPath'], apbsOptions['pqrFileName']))
input.write('\nend\n')
# writing ELEC section to file
input.write('elec\n')
input.write('%s%s\n' % (apbsOptions['tab'], apbsOptions['calcType']))
if apbsOptions['calcType']!="fe-manual":
input.write('%sdime %d %d %d\n' % (apbsOptions['tab'], apbsOptions['dimeNX'], apbsOptions['dimeNY'], apbsOptions['dimeNZ']))
if apbsOptions['calcType'] == "mg-para":
input.write('%spdime %d %d %d\n' % (apbsOptions['tab'], apbsOptions['pdimeNX'], apbsOptions['pdimeNY'], apbsOptions['pdimeNZ']))
input.write('%sofrac %g\n' % (apbsOptions['tab'], apbsOptions['ofrac']))
if apbsOptions['asyncflag']:
input.write('%sasync %d\n' % (apbsOptions['tab'], apbsOptions['async']))
if apbsOptions['calcType'] == "mg-manual":
input.write('%sglen %g %g %g\n' % (apbsOptions['tab'], apbsOptions['glenX'], apbsOptions['glenY'], apbsOptions['glenZ']))
if apbsOptions['calcType'] in ['mg-auto','mg-para','mg-dummy']:
input.write('%scglen %g %g %g\n' % (apbsOptions['tab'], apbsOptions['cglenX'], apbsOptions['cglenY'], apbsOptions['cglenZ']))
if apbsOptions['calcType'] in ['mg-auto','mg-para']:
input.write('%sfglen %g %g %g\n' % (apbsOptions['tab'], apbsOptions['fglenX'], apbsOptions['fglenY'], apbsOptions['fglenZ']))
if apbsOptions['coarseGridCenterMethod']=='molecule':
input.write('%scgcent mol %d\n' % (apbsOptions['tab'], apbsOptions['coarseGridCenterMoleculeID'] ))
elif apbsOptions['coarseGridCenterMethod']=='coordinate':
input.write('%scgcent %d %d %d\n' % (apbsOptions['tab'], apbsOptions['cgxCent'], apbsOptions['cgyCent'], apbsOptions['cgzCent']))
if apbsOptions['fineGridCenterMethod']=='molecule':
input.write('%sfgcent mol %d\n' % (apbsOptions['tab'], apbsOptions['fineGridCenterMoleculeID']))
elif apbsOptions['fineGridCenterMethod']=='coordinate':
input.write('%sfgcent %d %d %d\n' % (apbsOptions['tab'], apbsOptions['fgxCent'], apbsOptions['fgyCent'], apbsOptions['fgzCent']))
if apbsOptions['calcType'] in ['mg-manual','mg-dummy']:
if apbsOptions['gridCenterMethod']=='molecule':
input.write('%sgcent mol %d\n' % (apbsOptions['tab'], apbsOptions['gridCenterMoleculeID'] ))
elif apbsOptions['gridCenterMethod']=='coordinate':
input.write('%sgcent %d %d %d\n' % (apbsOptions['tab'], apbsOptions['gxCent'], apbsOptions['gyCent'], apbsOptions['gzCent']))
input.write('%smol %d\n' % (apbsOptions['tab'], apbsOptions['mol']))
input.write('%s%s\n' % (apbsOptions['tab'], apbsOptions['solveType']))
input.write('%sbcfl %s\n' % (apbsOptions['tab'], apbsOptions['boundaryConditions']))
input.write('%spdie %g\n' % (apbsOptions['tab'], apbsOptions['biomolecularDielectricConstant']))
input.write('%ssdie %g\n' % (apbsOptions['tab'], apbsOptions['dielectricSolventConstant']))
input.write('%ssrfm %s\n' % (apbsOptions['tab'], apbsOptions['dielectricIonAccessibilityModel']))
input.write('%schgm %s\n' % (apbsOptions['tab'], apbsOptions['biomolecularPointChargeMapMethod']))
input.write('%ssdens %g\n' % (apbsOptions['tab'], apbsOptions['surfaceConstructionResolution']))
input.write('%ssrad %g\n' % (apbsOptions['tab'], apbsOptions['solventRadius']))
input.write('%sswin %g\n' % (apbsOptions['tab'], apbsOptions['surfaceDefSupportSize']))
input.write('%stemp %g\n' % (apbsOptions['tab'], apbsOptions['temperature']))
input.write('%scalcenergy %s\n' % (apbsOptions['tab'], apbsOptions['calcEnergy']))
input.write('%scalcforce %s\n' % (apbsOptions['tab'], apbsOptions['calcForce']))
for i in range(0,3):
chStr = 'charge%i' % i
concStr = 'conc%i' % i
radStr = 'radius%i' % i
if apbsOptions.has_key(chStr) and apbsOptions.has_key(concStr) and apbsOptions.has_key(radStr):
#ion charge {charge} conc {conc} radius {radius}
input.write('%sion charge %d conc %g radius %g\n' % (apbsOptions['tab'],
apbsOptions[chStr],
apbsOptions[concStr],
apbsOptions[radStr]))
if apbsOptions['writeCharge']:
input.write('%swrite charge %s %s-charge\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writePot']:
input.write('%swrite pot %s %s-pot\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeSmol']:
input.write('%swrite smol %s %s-smol\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeSspl']:
input.write('%swrite sspl %s %s-sspl\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeVdw']:
input.write('%swrite vdw %s %s-vdw\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeIvdw']:
input.write('%swrite ivdw %s %s-ivdw\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeLap']:
input.write('%swrite lap %s %s-lap\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeEdens']:
input.write('%swrite edens %s %s-edens\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeNdens']:
input.write('%swrite ndens %s %s-ndens\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeQdens']:
input.write('%swrite qdens %s %s-qdens\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeDielx']:
input.write('%swrite dielx %s %s-dielx\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeDiely']:
input.write('%swrite diely %s %s-diely\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeDielz']:
input.write('%swrite dielz %s %s-dielz\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
if apbsOptions['writeKappa']:
input.write('%swrite kappa %s %s-kappa\n' % (apbsOptions['tab'], apbsOptions['writeFormat'], apbsOptions['writeStem']))
input.write('end\n')
input.write('quit')
input.close()
def convertOpalToLocal(jobid,pdb2pqrOpalJobID):
"""
takes a remote Opal page and saves the files to a local directory
"""
appLocator = AppServiceLocator()
resp = appLocator.getAppServicePort(PDB2PQR_OPAL_URL).getOutputs(getOutputsRequest(pdb2pqrOpalJobID))
# returns the variable to prepend the files
#sys.path.append('/home/samir/public_html/pdb2pqr/src') # HARDCODED
#from src import server
#logTime = setID(time.time())
#os.makedirs('%s%s%s' % (INSTALLDIR, TMPDIR, logTime))
for file in resp._outputFile:
fileName = file._name
if fileName!="Standard Output" and fileName!="Standard Error":
if fileName.rfind('-') != -1:
fileName = jobid+fileName[fileName.rfind('-'):]
elif fileName.rfind('.') != -1:
fileName = jobid+fileName[fileName.rfind('.'):]
urllib.urlretrieve(file._url, '%s%s%s/%s' % (INSTALLDIR, TMPDIR, jobid, fileName)) # HARDCODED
def redirector(logTime):
if (str(logTime) != "False") and (str(logTime) != "notenoughmem"):
startLogFile(logTime, 'apbs_start_time', str(time.time()))
resetLogFile(logTime, 'apbs_end_time')
# starttimefile = open('%s%s%s/apbs_start_time' % (INSTALLDIR, TMPDIR, logTime), 'w')
# starttimefile.write(str(time.time()))
# starttimefile.close()
redirectWait = 3
redirectURL = "{website}querystatus.cgi?jobid={jobid}&calctype=apbs".format(website=WEBSITE,
jobid=logTime)
string = """
<html>
<head>
{trackingscript}
<link rel="stylesheet" href="css/foundation.css">
<script type="text/javascript">
{trackingevents}
</script>
<link rel="stylesheet" href="@website@pdb2pqr.css" type="text/css">
<meta http-equiv="refresh" content="{wait};url={redirectURL}"/>
</head>
<body>
<center> You are being automatically redirected to a new location.<br/>
If your browser does not redirect you in {wait} seconds, or you do
not wish to wait, <a href="{redirectURL}">click here</a> </center>.
</body>
</html>""".format(trackingscript=getTrackingScriptString(jobid=logTime),
trackingevents = getEventTrackingString(category='apbs',
action='submission',
label=str(os.environ["REMOTE_ADDR"])),
redirectURL=redirectURL, wait=redirectWait)
return string
def mainInput() :
"""
Main function
"""
global have_opal
file = stdout
file.write("Content-type: text/html; charset=utf-8\n\n")
cgitb.enable()
# Check cgi.FieldStorage() for checkbox indicating whether we were invoked frmo the form or from the URL
form = cgi.FieldStorage()
firstRun = True
pdb2pqrOpalChecked = False
pdb2pqrChecked = False
if form.has_key("jobid"): # means it's not the first run
firstRun = False
if HAVE_PDB2PQR_OPAL:
pdb2pqrOpalJobIDFile = open('%s%s%s/pdb2pqr_opal_job_id' % (INSTALLDIR, TMPDIR, form["jobid"].value))
pdb2pqrOpalJobID = pdb2pqrOpalJobIDFile.read()
pdb2pqrOpalJobIDFile.close()
pdb2pqrID = form["jobid"].value
logTime = form["jobid"].value
convertOpalToLocal(form["jobid"].value, pdb2pqrOpalJobID)
pdb2pqrOpalChecked = True
pdb2pqrChecked = False
else:
pdb2pqrID = form["jobid"].value
logTime = pdb2pqrID
pdb2pqrChecked = True
pdb2pqrOpalChecked = False
if form.has_key("hiddencheck"): # means this time apbs must be run
firstRun = False
if form["hiddencheck"].value == "local":
typeOfRun="local"
elif form["hiddencheck"].value == "opal":
typeOfRun="opal"
#redirects to pdb2pqr input page
if firstRun:
pdb2pqrLocation = '../pdb2pqr/html/server.html'
print '<html>'
print '<head>'
print '<link rel="stylesheet" href="@website@pdb2pqr.css" type="text/css">'
print '<meta http-equiv=\"refresh\" content=\"0;url=%s\"/>' % pdb2pqrLocation
print '</head>'
print '<body>'
print '</body>'
print '</html>'
#generates web interface and displays it
elif pdb2pqrChecked:
initVars = unpickleVars(pdb2pqrID)
generateForm(file, initVars, pdb2pqrID, "local")
elif pdb2pqrOpalChecked:
initVars = unpickleVars(pdb2pqrID)
generateForm(file, initVars, pdb2pqrID, "opal")
#runs apbs
else:
# logTime stores the prefix of the names for all the data files for a run
logTime = form["pdb2pqrid"].value
tempPage = "results.html"
apbsOptions = fieldStorageToDict(form)
pqrFileCreator(apbsOptions)
if APBS_OPAL_URL == "":
have_opal = False
else:
have_opal = True
aoFile = open('%s%s%s/%s-ao' % (INSTALLDIR, TMPDIR, logTime, logTime),'w')
pickle.dump(apbsOptions, aoFile)
aoFile.close()
if have_opal:
apbsOpalJobID = apbsOpalExec(logTime, form, apbsOptions)
# if the version number doesn't match, apbsOpalExec returns False
if(str(apbsOpalJobID) == 'False'):
print redirector(False)
# Check if not enough memory
elif(str(apbsOpalJobID) == 'notenoughmem'):
print redirector('notenoughmem')
else:
print redirector(logTime)
startLogFile(logTime, 'apbs_opal_job_id', apbsOpalJobID)
# apbsOpalJobIDFile = open('%s%s%s/apbs_opal_job_id' % (INSTALLDIR, TMPDIR, logTime),'w')
# apbsOpalJobIDFile.write(apbsOpalJobID)
# apbsOpalJobIDFile.close()
else:
apbsExec(logTime, form, apbsOptions)
if __name__ == "__main__" and os.environ.has_key("REQUEST_METHOD"):
""" Determine if called from command line or CGI """
if APBS_OPAL_URL!="" or HAVE_PDB2PQR_OPAL:
have_opal = True
from AppService_client import queryStatusRequest
from AppService_client import AppServiceLocator, queryStatusRequest, getOutputsRequest
else:
have_opal = False
mainInput()
|