//
// ChemDoodle Web Components 4.6.0
//
// http://web.chemdoodle.com
//
// Copyright 2009 iChemLabs, LLC.  All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// As a special exception to the GPL, any HTML file in a public website
// or any free web service which merely makes function calls to this
// code, and for that purpose includes it by reference, shall be deemed
// a separate work for copyright law purposes. If you modify this code,
// you may extend this exception to your version of the code, but you
// are not obligated to do so. If you do not wish to do so, delete this
// exception statement from your version.
//
// As an additional exception to the GPL, you may distribute this
// packed form of the code without the copy of the GPL license normally
// required, provided you include this license notice and a URL through
// which recipients can access the corresponding unpacked source code.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// Please contact iChemLabs <http://www.ichemlabs.com/contact> for
// alternate licensing options.
//
var ChemDoodle=function(){var d={};d.structures={};d.iChemLabs={};d.informatics={};d.io={};d.getVersion=function(){return"4.6.0"};return d}();
(function(d,e,a,f,j){e.SERVER_URL="http://ichemlabs.cloud.chemdoodle.com/ICL_servlets/WebHQ1";e.inRelay=false;e.asynchronous=true;e.INFO={userAgent:navigator.userAgent,v_cwc:d.getVersion(),v_jQuery:j.version,v_jQuery_ui:j.ui?j.ui.version:"N/A"};e.contactServer=function(c,k,b,g){if(this.inRelay)alert("Already connecting to the server, please wait for the first request to finish.");else{e.inRelay=true;j.ajax({dataType:"text",type:"POST",data:JSON.stringify({call:c,content:k,info:e.INFO}),url:this.SERVER_URL,
success:function(h){e.inRelay=false;o=JSON.parse(h);o.message&&alert(o.message);b!=null&&o.content&&!o.stop&&b(o.content);o.stop&&g!=null&&g()},error:function(){e.inRelay=false;alert("Server connectivity failed. Please try again or update this browser to the latest version. (XHR2 not supported)");g!=null&&g()},beforeSend:function(h){h.withCredentials=true},async:e.asynchronous})}};e.optimize=function(c,k,b,g){this.contactServer("optimize",{mol:a.toJSONDummy(c),dimension:k},function(h){h=a.fromJSONDummy(h.mol);
if(k==2){for(var l=0,p=h.atoms.length;l<p;l++){c.atoms[l].x=h.atoms[l].x;c.atoms[l].y=h.atoms[l].y}b()}else if(k==3){l=0;for(p=h.atoms.length;l<p;l++){h.atoms[l].x/=20;h.atoms[l].y/=20;h.atoms[l].z/=20}b(h)}},g)};e.readSMILES=function(c,k,b){this.contactServer("readSMILES",{smiles:c},function(g){k(a.fromJSONDummy(g.mol))},b)};e.writeSMILES=function(c,k,b){this.contactServer("writeSMILES",{mol:a.toJSONDummy(c)},function(g){k(g.smiles)},b)};e.saveFile=function(c,k,b,g){this.contactServer("saveFile",
{mol:a.toJSONDummy(c),ext:k},function(h){b(h.link)},g)};e.getMoleculeFromDatabase=function(c,k,b,g,h){this.contactServer("getMoleculeFromDatabase",{database:c,dimension:g?g:2,query:k},function(l){if(g==3)for(var p=0,n=l.mol.a.length;p<n;p++){l.mol.a[p].x/=20;l.mol.a[p].y/=-20;l.mol.a[p].z/=20}b(a.fromJSONDummy(l.mol))},h)};e.getMoleculeFromContent=function(c,k,b,g){this.contactServer("getMoleculeFromContent",{content:c,format:k},function(h){for(var l=false,p=0,n=h.mol.a.length;p<n;p++)if(h.mol.a[p].z!=
0){l=true;break}if(l){p=0;for(n=h.mol.a.length;p<n;p++){h.mol.a[p].x/=20;h.mol.a[p].y/=20;h.mol.a[p].z/=20}}b(ChemDoodle.io.fromJSONDummy(h.mol))},g)};e.calculate=function(c,k,b,g){this.contactServer("calculate",{mol:a.toJSONDummy(c),descriptors:k},function(h){b(h)},g)};e.simulate1HNMR=function(c,k,b){this.contactServer("simulateNMR",{mol:a.toJSONDummy(c),nucleus:"H",isotope:1},function(g){k(d.readJCAMP(g.jcamp))},b)};e.simulate13CNMR=function(c,k,b){this.contactServer("simulateNMR",{mol:a.toJSONDummy(c),
nucleus:"C",isotope:13},function(g){k(d.readJCAMP(g.jcamp))},b)};e.simulateMassParentPeak=function(c,k,b){this.contactServer("simulateMassParentPeak",{mol:a.toJSONDummy(c)},function(g){k(d.readJCAMP(g.jcamp))},b)};e.getOptimizedPDBStructure=function(c,k,b,g){this.contactServer("getOptimizedPDBStructure",{id:c,withAtoms:k},function(h){var l=null;l=h.mol?a.fromJSONDummy(h.mol):new f.Molecule;l.chains=a.fromJSONChains(h.ribbons);l.fromJSON=true;b(l)},g)};e.getAd=function(c,k){this.contactServer("getAd",
{},function(b){c(b.image_url,b.target_url)},k)};e.kekulize=function(c,k,b){this.contactServer("kekulize",{mol:a.toJSONDummy(c)},function(g){k(a.fromJSONDummy(g.mol))},b)};e.isGraphIsomorphism=function(c,k,b,g){this.contactServer("isGraphIsomorphism",{arrow:a.toJSONDummy(c),target:a.toJSONDummy(k)},function(h){b(h.value)},g)};e.isSubgraphIsomorphism=function(c,k,b,g){this.contactServer("isSubgraphIsomorphism",{arrow:a.toJSONDummy(c),target:a.toJSONDummy(k)},function(h){b(h.value)},g)};e.readIUPACName=
function(c,k,b){this.contactServer("readIUPACName",{iupac:c},function(g){k(a.fromJSONDummy(g.mol))},b)};e.generateImage=function(c,k,b,g){this.contactServer("generateImage",{mol:a.toJSONDummy(c),ext:k},function(h){b(h.link)},g)};e.getZeoliteFromIZA=function(c,k,b,g,h,l){this.contactServer("getZeoliteFromIZA",{query:c},function(p){k(ChemDoodle.readCIF(p.cif,b,g,h))},l)}})(ChemDoodle,ChemDoodle.iChemLabs,ChemDoodle.io,ChemDoodle.structures,jQuery);
ChemDoodle.extensions=function(d,e,a){var f={};f.stringStartsWith=function(j,c){return j.match("^"+c)==c};f.vec3AngleFrom=function(j,c){var k=e.length(j),b=e.length(c);k=e.dot(j,c)/k/b;return a.acos(k)};f.contextHashTo=function(j,c,k,b,g,h,l){var p=0,n=(new d.Point(c,k)).distance(new d.Point(b,g)),q=false,m=c,u=k;c=b-c;for(k=g-k;p<n;){if(q)if(p+l>n){j.moveTo(b,g);break}else{var v=l/n;m+=v*c;u+=v*k;j.moveTo(m,u);p+=l}else if(p+h>n){j.lineTo(b,g);break}else{v=h/n;m+=v*c;u+=v*k;j.lineTo(m,u);p+=h}q=
!q}};f.contextRoundRect=function(j,c,k,b,g,h){j.beginPath();j.moveTo(c+h,k);j.lineTo(c+b-h,k);j.quadraticCurveTo(c+b,k,c+b,k+h);j.lineTo(c+b,k+g-h);j.quadraticCurveTo(c+b,k+g,c+b-h,k+g);j.lineTo(c+h,k+g);j.quadraticCurveTo(c,k+g,c,k+g-h);j.lineTo(c,k+h);j.quadraticCurveTo(c,k,c+h,k);j.closePath()};f.contextEllipse=function(j,c,k,b,g){var h=b/2*0.5522848,l=g/2*0.5522848,p=c+b,n=k+g;b=c+b/2;g=k+g/2;j.beginPath();j.moveTo(c,g);j.bezierCurveTo(c,g-l,b-h,k,b,k);j.bezierCurveTo(b+h,k,p,g-l,p,g);j.bezierCurveTo(p,
g+l,b+h,n,b,n);j.bezierCurveTo(b-h,n,c,g+l,c,g);j.closePath()};return f}(ChemDoodle.structures,vec3,Math);
ChemDoodle.math=function(d,e,a){var f={},j={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",
darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",
gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",
lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",
oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",
skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};f.angleBetweenLargest=function(c){if(c.length==0)return{angle:0,largest:a.PI*2};if(c.length==1)return{angle:c[0]+a.PI,largest:a.PI*2};for(var k=0,b=0,g=0,h=c.length-1;g<h;g++){var l=c[g+1]-c[g];
if(l>k){k=l;b=(c[g+1]+c[g])/2}}g=c[0]+a.PI*2-c[c.length-1];if(g>k){b=c[0]-g/2;k=g;if(b<0)b+=a.PI*2}return{angle:b,largest:k}};f.isBetween=function(c,k,b){return c>=k&&c<=b};f.getRGB=function(c,k){var b=[0,0,0];if(j[c.toLowerCase()]!=null)c=j[c.toLowerCase()];if(c.charAt(0)=="#"){if(c.length==4)c="#"+c.charAt(1)+c.charAt(1)+c.charAt(2)+c.charAt(2)+c.charAt(3)+c.charAt(3);return[parseInt(c.substring(1,3),16)/255*k,parseInt(c.substring(3,5),16)/255*k,parseInt(c.substring(5,7),16)/255*k]}else if(d.stringStartsWith(c,
"rgb")){var g=c.replace(/rgb\(|\)/g,"").split(",");if(g.length!=3)return b;return[parseInt(g[0])/255*k,parseInt(g[1])/255*k,parseInt(g[2])/255*k]}return b};f.distanceFromPointToLineInclusive=function(c,k,b){var g=k.distance(b);b=k.angle(b);b=a.PI/2-b;new e.Point(c.x-k.x,c.y-k.x);new e.Point;b=k.angle(c)+b;c=k.distance(c);pcopRot=new e.Point(c*a.cos(b),-c*a.sin(b));if(f.isBetween(-pcopRot.y,0,g))return a.abs(pcopRot.x);return-1};f.hsl2rgb=function(c,k,b){if(k==0)b=k=c=b;else{var g=function(p,n,q){if(q<
0)q+=1;if(q>1)q-=1;if(q<1/6)return p+(n-p)*6*q;if(q<0.5)return n;if(q<2/3)return p+(n-p)*(2/3-q)*6;return p},h=b<0.5?b*(1+k):b+k-b*k,l=2*b-h;b=g(l,h,c+1/3);k=g(l,h,c);c=g(l,h,c-1/3)}return[b*255,k*255,c*255]};return f}(ChemDoodle.extensions,ChemDoodle.structures,Math);
ChemDoodle.featureDetection=function(d,e,a,f){var j={};j.supports_canvas=function(){return!!a.createElement("canvas").getContext};j.supports_canvas_text=function(){if(!j.supports_canvas())return false;return typeof a.createElement("canvas").getContext("2d").fillText=="function"};j.supports_webgl=function(){var c=a.createElement("canvas");try{if(c.getContext("webgl"))return true;if(c.getContext("experimental-webgl"))return true}catch(k){}return false};j.supports_xhr2=function(){return e.support.cors};
j.supports_touch=function(){return"ontouchstart"in f};j.supports_gesture=function(){return"ongesturestart"in f};return j}(ChemDoodle.iChemLabs,jQuery,document,window);
ChemDoodle.SYMBOLS=["H","He","Li","Be","B","C","N","O","F","Ne","Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca","Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn","Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr","Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn","Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Nd","Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th","Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es",
"Fm","Md","No","Lr","Rf","Db","Sg","Bh","Hs","Mt","Ds","Rg","Cn","Uut","Uuq","Uup","Uuh","Uus","Uuo"];
ChemDoodle.ELEMENT=function(d){function e(c,k,b){this.symbol=c;this.name=k;this.atomicNumber=b;return true}var a=[];a.H=new e("H","Hydrogen",1);a.He=new e("He","Helium",2);a.Li=new e("Li","Lithium",3);a.Be=new e("Be","Beryllium",4);a.B=new e("B","Boron",5);a.C=new e("C","Carbon",6);a.N=new e("N","Nitrogen",7);a.O=new e("O","Oxygen",8);a.F=new e("F","Fluorine",9);a.Ne=new e("Ne","Neon",10);a.Na=new e("Na","Sodium",11);a.Mg=new e("Mg","Magnesium",12);a.Al=new e("Al","Aluminum",13);a.Si=new e("Si","Silicon",
14);a.P=new e("P","Phosphorus",15);a.S=new e("S","Sulfur",16);a.Cl=new e("Cl","Chlorine",17);a.Ar=new e("Ar","Argon",18);a.K=new e("K","Potassium",19);a.Ca=new e("Ca","Calcium",20);a.Sc=new e("Sc","Scandium",21);a.Ti=new e("Ti","Titanium",22);a.V=new e("V","Vanadium",23);a.Cr=new e("Cr","Chromium",24);a.Mn=new e("Mn","Manganese",25);a.Fe=new e("Fe","Iron",26);a.Co=new e("Co","Cobalt",27);a.Ni=new e("Ni","Nickel",28);a.Cu=new e("Cu","Copper",29);a.Zn=new e("Zn","Zinc",30);a.Ga=new e("Ga","Gallium",
31);a.Ge=new e("Ge","Germanium",32);a.As=new e("As","Arsenic",33);a.Se=new e("Se","Selenium",34);a.Br=new e("Br","Bromine",35);a.Kr=new e("Kr","Krypton",36);a.Rb=new e("Rb","Rubidium",37);a.Sr=new e("Sr","Strontium",38);a.Y=new e("Y","Yttrium",39);a.Zr=new e("Zr","Zirconium",40);a.Nb=new e("Nb","Niobium",41);a.Mo=new e("Mo","Molybdenum",42);a.Tc=new e("Tc","Technetium",43);a.Ru=new e("Ru","Ruthenium",44);a.Rh=new e("Rh","Rhodium",45);a.Pd=new e("Pd","Palladium",46);a.Ag=new e("Ag","Silver",47);a.Cd=
new e("Cd","Cadmium",48);a.In=new e("In","Indium",49);a.Sn=new e("Sn","Tin",50);a.Sb=new e("Sb","Antimony",51);a.Te=new e("Te","Tellurium",52);a.I=new e("I","Iodine",53);a.Xe=new e("Xe","Xenon",54);a.Cs=new e("Cs","Cesium",55);a.Ba=new e("Ba","Barium",56);a.La=new e("La","Lanthanum",57);a.Ce=new e("Ce","Cerium",58);a.Pr=new e("Pr","Praseodymium",59);a.Nd=new e("Nd","Neodymium",60);a.Pm=new e("Pm","Promethium",61);a.Sm=new e("Sm","Samarium",62);a.Eu=new e("Eu","Europium",63);a.Gd=new e("Gd","Gadolinium",
64);a.Tb=new e("Tb","Terbium",65);a.Dy=new e("Dy","Dysprosium",66);a.Ho=new e("Ho","Holmium",67);a.Er=new e("Er","Erbium",68);a.Tm=new e("Tm","Thulium",69);a.Yb=new e("Yb","Ytterbium",70);a.Lu=new e("Lu","Lutetium",71);a.Hf=new e("Hf","Hafnium",72);a.Ta=new e("Ta","Tantalum",73);a.W=new e("W","Tungsten",74);a.Re=new e("Re","Rhenium",75);a.Os=new e("Os","Osmium",76);a.Ir=new e("Ir","Iridium",77);a.Pt=new e("Pt","Platinum",78);a.Au=new e("Au","Gold",79);a.Hg=new e("Hg","Mercury",80);a.Tl=new e("Tl",
"Thallium",81);a.Pb=new e("Pb","Lead",82);a.Bi=new e("Bi","Bismuth",83);a.Po=new e("Po","Polonium",84);a.At=new e("At","Astatine",85);a.Rn=new e("Rn","Radon",86);a.Fr=new e("Fr","Francium",87);a.Ra=new e("Ra","Radium",88);a.Ac=new e("Ac","Actinium",89);a.Th=new e("Th","Thorium",90);a.Pa=new e("Pa","Protactinium",91);a.U=new e("U","Uranium",92);a.Np=new e("Np","Neptunium",93);a.Pu=new e("Pu","Plutonium",94);a.Am=new e("Am","Americium",95);a.Cm=new e("Cm","Curium",96);a.Bk=new e("Bk","Berkelium",97);
a.Cf=new e("Cf","Californium",98);a.Es=new e("Es","Einsteinium",99);a.Fm=new e("Fm","Fermium",100);a.Md=new e("Md","Mendelevium",101);a.No=new e("No","Nobelium",102);a.Lr=new e("Lr","Lawrencium",103);a.Rf=new e("Rf","Rutherfordium",104);a.Db=new e("Db","Dubnium",105);a.Sg=new e("Sg","Seaborgium",106);a.Bh=new e("Bh","Bohrium",107);a.Hs=new e("Hs","Hassium",108);a.Mt=new e("Mt","Meitnerium",109);a.Ds=new e("Ds","Darmstadtium",110);a.Rg=new e("Rg","Roentgenium",111);a.Cn=new e("Cn","Copernicium",112);
a.Uut=new e("Uut","Ununtrium",113);a.Uuq=new e("Uuq","Ununquadium",114);a.Uup=new e("Uup","Ununpentium",115);a.Uuh=new e("Uuh","Ununhexium",116);a.Uus=new e("Uus","Ununseptium",117);a.Uuo=new e("Uuo","Ununoctium",118);a.H.jmolColor="#FFFFFF";a.He.jmolColor="#D9FFFF";a.Li.jmolColor="#CC80FF";a.Be.jmolColor="#C2FF00";a.B.jmolColor="#FFB5B5";a.C.jmolColor="#909090";a.N.jmolColor="#3050F8";a.O.jmolColor="#FF0D0D";a.F.jmolColor="#90E050";a.Ne.jmolColor="#B3E3F5";a.Na.jmolColor="#AB5CF2";a.Mg.jmolColor=
"#8AFF00";a.Al.jmolColor="#BFA6A6";a.Si.jmolColor="#F0C8A0";a.P.jmolColor="#FF8000";a.S.jmolColor="#FFFF30";a.Cl.jmolColor="#1FF01F";a.Ar.jmolColor="#80D1E3";a.K.jmolColor="#8F40D4";a.Ca.jmolColor="#3DFF00";a.Sc.jmolColor="#E6E6E6";a.Ti.jmolColor="#BFC2C7";a.V.jmolColor="#A6A6AB";a.Cr.jmolColor="#8A99C7";a.Mn.jmolColor="#9C7AC7";a.Fe.jmolColor="#E06633";a.Co.jmolColor="#F090A0";a.Ni.jmolColor="#50D050";a.Cu.jmolColor="#C88033";a.Zn.jmolColor="#7D80B0";a.Ga.jmolColor="#C28F8F";a.Ge.jmolColor="#668F8F";
a.As.jmolColor="#BD80E3";a.Se.jmolColor="#FFA100";a.Br.jmolColor="#A62929";a.Kr.jmolColor="#5CB8D1";a.Rb.jmolColor="#702EB0";a.Sr.jmolColor="#00FF00";a.Y.jmolColor="#94FFFF";a.Zr.jmolColor="#94E0E0";a.Nb.jmolColor="#73C2C9";a.Mo.jmolColor="#54B5B5";a.Tc.jmolColor="#3B9E9E";a.Ru.jmolColor="#248F8F";a.Rh.jmolColor="#0A7D8C";a.Pd.jmolColor="#006985";a.Ag.jmolColor="#C0C0C0";a.Cd.jmolColor="#FFD98F";a.In.jmolColor="#A67573";a.Sn.jmolColor="#668080";a.Sb.jmolColor="#9E63B5";a.Te.jmolColor="#D47A00";a.I.jmolColor=
"#940094";a.Xe.jmolColor="#429EB0";a.Cs.jmolColor="#57178F";a.Ba.jmolColor="#00C900";a.La.jmolColor="#70D4FF";a.Ce.jmolColor="#FFFFC7";a.Pr.jmolColor="#D9FFC7";a.Nd.jmolColor="#C7FFC7";a.Pm.jmolColor="#A3FFC7";a.Sm.jmolColor="#8FFFC7";a.Eu.jmolColor="#61FFC7";a.Gd.jmolColor="#45FFC7";a.Tb.jmolColor="#30FFC7";a.Dy.jmolColor="#1FFFC7";a.Ho.jmolColor="#00FF9C";a.Er.jmolColor="#00E675";a.Tm.jmolColor="#00D452";a.Yb.jmolColor="#00BF38";a.Lu.jmolColor="#00AB24";a.Hf.jmolColor="#4DC2FF";a.Ta.jmolColor="#4DA6FF";
a.W.jmolColor="#2194D6";a.Re.jmolColor="#267DAB";a.Os.jmolColor="#266696";a.Ir.jmolColor="#175487";a.Pt.jmolColor="#D0D0E0";a.Au.jmolColor="#FFD123";a.Hg.jmolColor="#B8B8D0";a.Tl.jmolColor="#A6544D";a.Pb.jmolColor="#575961";a.Bi.jmolColor="#9E4FB5";a.Po.jmolColor="#AB5C00";a.At.jmolColor="#754F45";a.Rn.jmolColor="#428296";a.Fr.jmolColor="#420066";a.Ra.jmolColor="#007D00";a.Ac.jmolColor="#70ABFA";a.Th.jmolColor="#00BAFF";a.Pa.jmolColor="#00A1FF";a.U.jmolColor="#008FFF";a.Np.jmolColor="#0080FF";a.Pu.jmolColor=
"#006BFF";a.Am.jmolColor="#545CF2";a.Cm.jmolColor="#785CE3";a.Bk.jmolColor="#8A4FE3";a.Cf.jmolColor="#A136D4";a.Es.jmolColor="#B31FD4";a.Fm.jmolColor="#B31FBA";a.Md.jmolColor="#B30DA6";a.No.jmolColor="#BD0D87";a.Lr.jmolColor="#C70066";a.Rf.jmolColor="#CC0059";a.Db.jmolColor="#D1004F";a.Sg.jmolColor="#D90045";a.Bh.jmolColor="#E00038";a.Hs.jmolColor="#E6002E";a.Mt.jmolColor="#EB0026";a.Ds.jmolColor="#000000";a.Rg.jmolColor="#000000";a.Cn.jmolColor="#000000";a.Uut.jmolColor="#000000";a.Uuq.jmolColor=
"#000000";a.Uup.jmolColor="#000000";a.Uuh.jmolColor="#000000";a.Uus.jmolColor="#000000";a.Uuo.jmolColor="#000000";for(var f=0,j=d.length;f<j;f++)a[d[f]].pymolColor=a[d[f]].jmolColor;a.H.pymolColor="#E6E6E6";a.C.pymolColor="#33FF33";a.N.pymolColor="#3333FF";a.O.pymolColor="#FF4D4D";a.F.pymolColor="#B3FFFF";a.S.pymolColor="#E6C640";a.H.covalentRadius=0.31;a.He.covalentRadius=0.28;a.Li.covalentRadius=1.28;a.Be.covalentRadius=0.96;a.B.covalentRadius=0.84;a.C.covalentRadius=0.76;a.N.covalentRadius=0.71;
a.O.covalentRadius=0.66;a.F.covalentRadius=0.57;a.Ne.covalentRadius=0.58;a.Na.covalentRadius=1.66;a.Mg.covalentRadius=1.41;a.Al.covalentRadius=1.21;a.Si.covalentRadius=1.11;a.P.covalentRadius=1.07;a.S.covalentRadius=1.05;a.Cl.covalentRadius=1.02;a.Ar.covalentRadius=1.06;a.K.covalentRadius=2.03;a.Ca.covalentRadius=1.76;a.Sc.covalentRadius=1.7;a.Ti.covalentRadius=1.6;a.V.covalentRadius=1.53;a.Cr.covalentRadius=1.39;a.Mn.covalentRadius=1.39;a.Fe.covalentRadius=1.32;a.Co.covalentRadius=1.26;a.Ni.covalentRadius=
1.24;a.Cu.covalentRadius=1.32;a.Zn.covalentRadius=1.22;a.Ga.covalentRadius=1.22;a.Ge.covalentRadius=1.2;a.As.covalentRadius=1.19;a.Se.covalentRadius=1.2;a.Br.covalentRadius=1.2;a.Kr.covalentRadius=1.16;a.Rb.covalentRadius=2.2;a.Sr.covalentRadius=1.95;a.Y.covalentRadius=1.9;a.Zr.covalentRadius=1.75;a.Nb.covalentRadius=1.64;a.Mo.covalentRadius=1.54;a.Tc.covalentRadius=1.47;a.Ru.covalentRadius=1.46;a.Rh.covalentRadius=1.42;a.Pd.covalentRadius=1.39;a.Ag.covalentRadius=1.45;a.Cd.covalentRadius=1.44;a.In.covalentRadius=
1.42;a.Sn.covalentRadius=1.39;a.Sb.covalentRadius=1.39;a.Te.covalentRadius=1.38;a.I.covalentRadius=1.39;a.Xe.covalentRadius=1.4;a.Cs.covalentRadius=2.44;a.Ba.covalentRadius=2.15;a.La.covalentRadius=2.07;a.Ce.covalentRadius=2.04;a.Pr.covalentRadius=2.03;a.Nd.covalentRadius=2.01;a.Pm.covalentRadius=1.99;a.Sm.covalentRadius=1.98;a.Eu.covalentRadius=1.98;a.Gd.covalentRadius=1.96;a.Tb.covalentRadius=1.94;a.Dy.covalentRadius=1.92;a.Ho.covalentRadius=1.92;a.Er.covalentRadius=1.89;a.Tm.covalentRadius=1.9;
a.Yb.covalentRadius=1.87;a.Lu.covalentRadius=1.87;a.Hf.covalentRadius=1.75;a.Ta.covalentRadius=1.7;a.W.covalentRadius=1.62;a.Re.covalentRadius=1.51;a.Os.covalentRadius=1.44;a.Ir.covalentRadius=1.41;a.Pt.covalentRadius=1.36;a.Au.covalentRadius=1.36;a.Hg.covalentRadius=1.32;a.Tl.covalentRadius=1.45;a.Pb.covalentRadius=1.46;a.Bi.covalentRadius=1.48;a.Po.covalentRadius=1.4;a.At.covalentRadius=1.5;a.Rn.covalentRadius=1.5;a.Fr.covalentRadius=2.6;a.Ra.covalentRadius=2.21;a.Ac.covalentRadius=2.15;a.Th.covalentRadius=
2.06;a.Pa.covalentRadius=2;a.U.covalentRadius=1.96;a.Np.covalentRadius=1.9;a.Pu.covalentRadius=1.87;a.Am.covalentRadius=1.8;a.Cm.covalentRadius=1.69;a.Bk.covalentRadius=0;a.Cf.covalentRadius=0;a.Es.covalentRadius=0;a.Fm.covalentRadius=0;a.Md.covalentRadius=0;a.No.covalentRadius=0;a.Lr.covalentRadius=0;a.Rf.covalentRadius=0;a.Db.covalentRadius=0;a.Sg.covalentRadius=0;a.Bh.covalentRadius=0;a.Hs.covalentRadius=0;a.Mt.covalentRadius=0;a.Ds.covalentRadius=0;a.Rg.covalentRadius=0;a.Cn.covalentRadius=0;
a.Uut.covalentRadius=0;a.Uuq.covalentRadius=0;a.Uup.covalentRadius=0;a.Uuh.covalentRadius=0;a.Uus.covalentRadius=0;a.Uuo.covalentRadius=0;a.H.vdWRadius=1.2;a.He.vdWRadius=1.4;a.Li.vdWRadius=1.82;a.Be.vdWRadius=0;a.B.vdWRadius=0;a.C.vdWRadius=1.7;a.N.vdWRadius=1.55;a.O.vdWRadius=1.52;a.F.vdWRadius=1.47;a.Ne.vdWRadius=1.54;a.Na.vdWRadius=2.27;a.Mg.vdWRadius=1.73;a.Al.vdWRadius=0;a.Si.vdWRadius=2.1;a.P.vdWRadius=1.8;a.S.vdWRadius=1.8;a.Cl.vdWRadius=1.75;a.Ar.vdWRadius=1.88;a.K.vdWRadius=2.75;a.Ca.vdWRadius=
0;a.Sc.vdWRadius=0;a.Ti.vdWRadius=0;a.V.vdWRadius=0;a.Cr.vdWRadius=0;a.Mn.vdWRadius=0;a.Fe.vdWRadius=0;a.Co.vdWRadius=0;a.Ni.vdWRadius=1.63;a.Cu.vdWRadius=1.4;a.Zn.vdWRadius=1.39;a.Ga.vdWRadius=1.87;a.Ge.vdWRadius=0;a.As.vdWRadius=1.85;a.Se.vdWRadius=1.9;a.Br.vdWRadius=1.85;a.Kr.vdWRadius=2.02;a.Rb.vdWRadius=0;a.Sr.vdWRadius=0;a.Y.vdWRadius=0;a.Zr.vdWRadius=0;a.Nb.vdWRadius=0;a.Mo.vdWRadius=0;a.Tc.vdWRadius=0;a.Ru.vdWRadius=0;a.Rh.vdWRadius=0;a.Pd.vdWRadius=1.63;a.Ag.vdWRadius=1.72;a.Cd.vdWRadius=
1.58;a.In.vdWRadius=1.93;a.Sn.vdWRadius=2.17;a.Sb.vdWRadius=0;a.Te.vdWRadius=2.06;a.I.vdWRadius=1.98;a.Xe.vdWRadius=2.16;a.Cs.vdWRadius=0;a.Ba.vdWRadius=0;a.La.vdWRadius=0;a.Ce.vdWRadius=0;a.Pr.vdWRadius=0;a.Nd.vdWRadius=0;a.Pm.vdWRadius=0;a.Sm.vdWRadius=0;a.Eu.vdWRadius=0;a.Gd.vdWRadius=0;a.Tb.vdWRadius=0;a.Dy.vdWRadius=0;a.Ho.vdWRadius=0;a.Er.vdWRadius=0;a.Tm.vdWRadius=0;a.Yb.vdWRadius=0;a.Lu.vdWRadius=0;a.Hf.vdWRadius=0;a.Ta.vdWRadius=0;a.W.vdWRadius=0;a.Re.vdWRadius=0;a.Os.vdWRadius=0;a.Ir.vdWRadius=
0;a.Pt.vdWRadius=1.75;a.Au.vdWRadius=1.66;a.Hg.vdWRadius=1.55;a.Tl.vdWRadius=1.96;a.Pb.vdWRadius=2.02;a.Bi.vdWRadius=0;a.Po.vdWRadius=0;a.At.vdWRadius=0;a.Rn.vdWRadius=0;a.Fr.vdWRadius=0;a.Ra.vdWRadius=0;a.Ac.vdWRadius=0;a.Th.vdWRadius=0;a.Pa.vdWRadius=0;a.U.vdWRadius=1.86;a.Np.vdWRadius=0;a.Pu.vdWRadius=0;a.Am.vdWRadius=0;a.Cm.vdWRadius=0;a.Bk.vdWRadius=0;a.Cf.vdWRadius=0;a.Es.vdWRadius=0;a.Fm.vdWRadius=0;a.Md.vdWRadius=0;a.No.vdWRadius=0;a.Lr.vdWRadius=0;a.Rf.vdWRadius=0;a.Db.vdWRadius=0;a.Sg.vdWRadius=
0;a.Bh.vdWRadius=0;a.Hs.vdWRadius=0;a.Mt.vdWRadius=0;a.Ds.vdWRadius=0;a.Rg.vdWRadius=0;a.Cn.vdWRadius=0;a.Uut.vdWRadius=0;a.Uuq.vdWRadius=0;a.Uup.vdWRadius=0;a.Uuh.vdWRadius=0;a.Uus.vdWRadius=0;a.Uuo.vdWRadius=0;a.H.valency=1;a.He.valency=0;a.Li.valency=1;a.Be.valency=2;a.B.valency=3;a.C.valency=4;a.N.valency=3;a.O.valency=2;a.F.valency=1;a.Ne.valency=0;a.Na.valency=1;a.Mg.valency=0;a.Al.valency=0;a.Si.valency=4;a.P.valency=3;a.S.valency=2;a.Cl.valency=1;a.Ar.valency=0;a.K.valency=0;a.Ca.valency=
0;a.Sc.valency=0;a.Ti.valency=1;a.V.valency=1;a.Cr.valency=2;a.Mn.valency=3;a.Fe.valency=2;a.Co.valency=1;a.Ni.valency=1;a.Cu.valency=0;a.Zn.valency=0;a.Ga.valency=0;a.Ge.valency=4;a.As.valency=3;a.Se.valency=2;a.Br.valency=1;a.Kr.valency=0;a.Rb.valency=0;a.Sr.valency=0;a.Y.valency=0;a.Zr.valency=0;a.Nb.valency=1;a.Mo.valency=2;a.Tc.valency=3;a.Ru.valency=2;a.Rh.valency=1;a.Pd.valency=0;a.Ag.valency=0;a.Cd.valency=0;a.In.valency=0;a.Sn.valency=4;a.Sb.valency=3;a.Te.valency=2;a.I.valency=1;a.Xe.valency=
0;a.Cs.valency=0;a.Ba.valency=0;a.La.valency=0;a.Ce.valency=0;a.Pr.valency=0;a.Nd.valency=0;a.Pm.valency=0;a.Sm.valency=0;a.Eu.valency=0;a.Gd.valency=0;a.Tb.valency=0;a.Dy.valency=0;a.Ho.valency=0;a.Er.valency=0;a.Tm.valency=0;a.Yb.valency=0;a.Lu.valency=0;a.Hf.valency=0;a.Ta.valency=1;a.W.valency=2;a.Re.valency=3;a.Os.valency=2;a.Ir.valency=3;a.Pt.valency=0;a.Au.valency=1;a.Hg.valency=0;a.Tl.valency=0;a.Pb.valency=4;a.Bi.valency=3;a.Po.valency=2;a.At.valency=1;a.Rn.valency=0;a.Fr.valency=0;a.Ra.valency=
0;a.Ac.valency=0;a.Th.valency=0;a.Pa.valency=0;a.U.valency=0;a.Np.valency=0;a.Pu.valency=0;a.Am.valency=0;a.Cm.valency=0;a.Bk.valency=0;a.Cf.valency=0;a.Es.valency=0;a.Fm.valency=0;a.Md.valency=0;a.No.valency=0;a.Lr.valency=0;a.Rf.valency=0;a.Db.valency=0;a.Sg.valency=0;a.Bh.valency=0;a.Hs.valency=0;a.Mt.valency=0;a.Ds.valency=0;a.Rg.valency=0;a.Cn.valency=0;a.Uut.valency=0;a.Uuq.valency=0;a.Uup.valency=0;a.Uuh.valency=0;a.Uus.valency=0;a.Uuo.valency=0;a.H.mass=1;a.He.mass=4;a.Li.mass=7;a.Be.mass=
9;a.B.mass=11;a.C.mass=12;a.N.mass=14;a.O.mass=16;a.F.mass=19;a.Ne.mass=20;a.Na.mass=23;a.Mg.mass=24;a.Al.mass=27;a.Si.mass=28;a.P.mass=31;a.S.mass=32;a.Cl.mass=35;a.Ar.mass=40;a.K.mass=39;a.Ca.mass=40;a.Sc.mass=45;a.Ti.mass=48;a.V.mass=51;a.Cr.mass=52;a.Mn.mass=55;a.Fe.mass=56;a.Co.mass=59;a.Ni.mass=58;a.Cu.mass=63;a.Zn.mass=64;a.Ga.mass=69;a.Ge.mass=74;a.As.mass=75;a.Se.mass=80;a.Br.mass=79;a.Kr.mass=84;a.Rb.mass=85;a.Sr.mass=88;a.Y.mass=89;a.Zr.mass=90;a.Nb.mass=93;a.Mo.mass=98;a.Tc.mass=0;a.Ru.mass=
102;a.Rh.mass=103;a.Pd.mass=106;a.Ag.mass=107;a.Cd.mass=114;a.In.mass=115;a.Sn.mass=120;a.Sb.mass=121;a.Te.mass=130;a.I.mass=127;a.Xe.mass=132;a.Cs.mass=133;a.Ba.mass=138;a.La.mass=139;a.Ce.mass=140;a.Pr.mass=141;a.Nd.mass=142;a.Pm.mass=0;a.Sm.mass=152;a.Eu.mass=153;a.Gd.mass=158;a.Tb.mass=159;a.Dy.mass=164;a.Ho.mass=165;a.Er.mass=166;a.Tm.mass=169;a.Yb.mass=174;a.Lu.mass=175;a.Hf.mass=180;a.Ta.mass=181;a.W.mass=184;a.Re.mass=187;a.Os.mass=192;a.Ir.mass=193;a.Pt.mass=195;a.Au.mass=197;a.Hg.mass=202;
a.Tl.mass=205;a.Pb.mass=208;a.Bi.mass=209;a.Po.mass=0;a.At.mass=0;a.Rn.mass=0;a.Fr.mass=0;a.Ra.mass=0;a.Ac.mass=0;a.Th.mass=232;a.Pa.mass=231;a.U.mass=238;a.Np.mass=0;a.Pu.mass=0;a.Am.mass=0;a.Cm.mass=0;a.Bk.mass=0;a.Cf.mass=0;a.Es.mass=0;a.Fm.mass=0;a.Md.mass=0;a.No.mass=0;a.Lr.mass=0;a.Rf.mass=0;a.Db.mass=0;a.Sg.mass=0;a.Bh.mass=0;a.Hs.mass=0;a.Mt.mass=0;a.Ds.mass=0;a.Rg.mass=0;a.Cn.mass=0;a.Uut.mass=0;a.Uuq.mass=0;a.Uup.mass=0;a.Uuh.mass=0;a.Uus.mass=0;a.Uuo.mass=0;return a}(ChemDoodle.SYMBOLS);
ChemDoodle.RESIDUE=function(){function d(a,f){this.symbol=a;this.name=f;return true}var e=[];e.Ala=new d("Ala","Alanine");e.Arg=new d("Arg","Arginine");e.Asn=new d("Asn","Asparagine");e.Asp=new d("Asp","Aspartic Acid");e.Cys=new d("Cys","Cysteine");e.Gln=new d("Gln","Glutamine");e.Glu=new d("Glu","Glutamic Acid");e.Gly=new d("Gly","Glycine");e.His=new d("His","Histidine");e.Ile=new d("Ile","Isoleucine");e.Leu=new d("Leu","Leucine");e.Lys=new d("Lys","Lysine");e.Met=new d("Met","Methionine");e.Phe=
new d("Phe","Phenylalanine");e.Pro=new d("Pro","Proline");e.Ser=new d("Ser","Serine");e.Thr=new d("Thr","Threonine");e.Trp=new d("Trp","Tryptophan");e.Tyr=new d("Tyr","Tyrosine");e.Val=new d("Val","Valine");e.Asx=new d("Asx","Asparagine/Aspartic Acid");e.Glx=new d("Glx","Glutamine/Glutamic Acid");e["*"]=new d("*","Other");e.A=new d("A","Adenine");e.G=new d("G","Guanine");e.I=new d("I","");e.C=new d("C","Cytosine");e.T=new d("T","Thymine");e.U=new d("U","Uracil");e.Ala.polar=false;e.Arg.polar=true;
e.Asn.polar=true;e.Asp.polar=true;e.Cys.polar=true;e.Gln.polar=true;e.Glu.polar=true;e.Gly.polar=false;e.His.polar=true;e.Ile.polar=false;e.Leu.polar=false;e.Lys.polar=true;e.Met.polar=false;e.Phe.polar=false;e.Pro.polar=false;e.Ser.polar=true;e.Thr.polar=true;e.Trp.polar=true;e.Tyr.polar=true;e.Val.polar=false;e.Asx.polar=true;e.Glx.polar=true;e.Ala.aminoColor="#C8C8C8";e.Arg.aminoColor="#145AFF";e.Asn.aminoColor="#00DCDC";e.Asp.aminoColor="#E60A0A";e.Cys.aminoColor="#E6E600";e.Gln.aminoColor="#00DCDC";
e.Glu.aminoColor="#E60A0A";e.Gly.aminoColor="#EBEBEB";e.His.aminoColor="#8282D2";e.Ile.aminoColor="#0F820F";e.Leu.aminoColor="#0F820F";e.Lys.aminoColor="#145AFF";e.Met.aminoColor="#E6E600";e.Phe.aminoColor="#3232AA";e.Pro.aminoColor="#DC9682";e.Ser.aminoColor="#FA9600";e.Thr.aminoColor="#FA9600";e.Trp.aminoColor="#B45AB4";e.Tyr.aminoColor="#3232AA";e.Val.aminoColor="#0F820F";e.Asx.aminoColor="#FF69B4";e.Glx.aminoColor="#FF69B4";e["*"].aminoColor="#BEA06E";e.A.aminoColor="#BEA06E";e.G.aminoColor="#BEA06E";
e.I.aminoColor="#BEA06E";e.C.aminoColor="#BEA06E";e.T.aminoColor="#BEA06E";e.U.aminoColor="#BEA06E";e.Ala.shapelyColor="#8CFF8C";e.Arg.shapelyColor="#00007C";e.Asn.shapelyColor="#FF7C70";e.Asp.shapelyColor="#A00042";e.Cys.shapelyColor="#FFFF70";e.Gln.shapelyColor="#FF4C4C";e.Glu.shapelyColor="#660000";e.Gly.shapelyColor="#FFFFFF";e.His.shapelyColor="#7070FF";e.Ile.shapelyColor="#004C00";e.Leu.shapelyColor="#455E45";e.Lys.shapelyColor="#4747B8";e.Met.shapelyColor="#B8A042";e.Phe.shapelyColor="#534C52";
e.Pro.shapelyColor="#525252";e.Ser.shapelyColor="#FF7042";e.Thr.shapelyColor="#B84C00";e.Trp.shapelyColor="#4F4600";e.Tyr.shapelyColor="#8C704C";e.Val.shapelyColor="#FF8CFF";e.Asx.shapelyColor="#FF00FF";e.Glx.shapelyColor="#FF00FF";e["*"].shapelyColor="#FF00FF";e.A.shapelyColor="#A0A0FF";e.G.shapelyColor="#FF7070";e.I.shapelyColor="#80FFFF";e.C.shapelyColor="#FF8C4B";e.T.shapelyColor="#A0FFA0";e.U.shapelyColor="#FF8080";return e}();
(function(d){d.Queue=function(){var e=[],a=0;this.getSize=function(){return e.length-a};this.isEmpty=function(){return e.length==0};this.enqueue=function(f){e.push(f)};this.dequeue=function(){var f=undefined;if(e.length){f=e[a];if(++a*2>=e.length){e=e.slice(a);a=0}}return f};this.getOldestElement=function(){var f=undefined;if(e.length)f=e[a];return f}}})(ChemDoodle.structures);
(function(d,e){d.Point=function(a,f){this.x=a?a:0;this.y=f?f:0;this.sub=function(j){this.x-=j.x;this.y-=j.y};this.add=function(j){this.x+=j.x;this.y+=j.y};this.distance=function(j){var c=j.x-this.x;j=j.y-this.y;return e.sqrt(c*c+j*j)};this.angleForStupidCanvasArcs=function(j){var c=j.x-this.x;j=j.y-this.y;var k=0;for(k=c==0?j==0?0:j>0?e.PI/2:3*e.PI/2:j==0?c>0?0:e.PI:c<0?e.atan(j/c)+e.PI:j<0?e.atan(j/c)+2*e.PI:e.atan(j/c);k<0;)k+=e.PI*2;k%=e.PI*2;return k};this.angle=function(j){var c=j.x-this.x;j=
this.y-j.y;var k=0;for(k=c==0?j==0?0:j>0?e.PI/2:3*e.PI/2:j==0?c>0?0:e.PI:c<0?e.atan(j/c)+e.PI:j<0?e.atan(j/c)+2*e.PI:e.atan(j/c);k<0;)k+=e.PI*2;k%=e.PI*2;return k};return true}})(ChemDoodle.structures,Math);
(function(d,e,a,f,j){a.Atom=function(c,k,b,g){this.x=k?k:0;this.y=b?b:0;this.z=g?g:0;this.numLonePair=this.charge=0;this.mass=-1;this.angleOfLeastInterference=this.bondNumber=this.coordinationNumber=0;this.isHidden=false;this.label=c?c.replace(/\s/g,""):"C";this.altLabel=null;if(!d[this.label])this.label="C";this.isSelected=this.isHover=this.isLone=false;this.add3D=function(h){this.x+=h.x;this.y+=h.y;this.z+=h.z};this.sub3D=function(h){this.x-=h.x;this.y-=h.y;this.z-=h.z};this.distance3D=function(h){var l=
h.x-this.x,p=h.y-this.y;h=h.z-this.z;return f.sqrt(l*l+p*p+h*h)};this.draw=function(h,l){if(this.specs)l=this.specs;var p=l.getFontString(l.atoms_font_size_2D,l.atoms_font_families_2D,l.atoms_font_bold_2D,l.atoms_font_italic_2D);h.font=p;h.fillStyle=l.atoms_color;if(l.atoms_useJMOLColors)h.fillStyle=d[this.label].jmolColor;else if(l.atoms_usePYMOLColors)h.fillStyle=d[this.label].pymolColor;if(this.isLone&&!l.atoms_displayAllCarbonLabels_2D||l.atoms_circles_2D){h.beginPath();h.arc(this.x,this.y,l.atoms_circleDiameter_2D/
2,0,f.PI*2,false);h.fill();if(l.atoms_circleBorderWidth_2D>0){h.lineWidth=l.atoms_circleBorderWidth_2D;h.strokeStyle="black";h.stroke(this.x,this.y,0,f.PI*2,l.atoms_circleDiameter_2D/2)}}else if(this.isLabelVisible(l)){h.textAlign="center";h.textBaseline="middle";if(this.altLabel!=undefined)h.fillText(this.altLabel,this.x,this.y);else{h.fillText(this.label,this.x,this.y);if(this.mass!=-1){var n=h.measureText(this.label).width,q=l.getFontString(l.atoms_font_size_2D*0.7,l.atoms_font_families_2D,l.atoms_font_bold_2D,
l.atoms_font_italic_2D),m=h.font;h.font=q;q=h.measureText(this.mass).width;h.fillText(this.mass,this.x-q-0.5,this.y-l.atoms_font_size_2D*0.3);h.font=m}m=this.getImplicitHydrogenCount();if(l.atoms_implicitHydrogens_2D&&m>0){n=h.measureText(this.label).width;var u=h.measureText("H").width;if(m>1){var v=n/2+u/2,r=0;q=l.getFontString(l.atoms_font_size_2D*0.8,l.atoms_font_families_2D,l.atoms_font_bold_2D,l.atoms_font_italic_2D);h.font=q;var w=h.measureText(m).width;if(this.bondNumber==1){if(this.angleOfLeastInterference>
f.PI/2&&this.angleOfLeastInterference<3*f.PI/2)v=-n/2-w-u/2}else if(!(this.angleOfLeastInterference<=f.PI/4))if(this.angleOfLeastInterference<3*f.PI/4){v=0;r=-l.atoms_font_size_2D*0.9}else if(this.angleOfLeastInterference<=5*f.PI/4)v=-n/2-w-u/2;else if(this.angleOfLeastInterference<7*f.PI/4){v=0;r=l.atoms_font_size_2D*0.9}h.font=p;h.fillText("H",this.x+v,this.y+r);h.font=q;h.fillText(m,this.x+v+u/2+w/2,this.y+r+l.atoms_font_size_2D*0.3)}else{v=n/2+u/2;r=0;if(this.bondNumber==1){if(this.angleOfLeastInterference>
f.PI/2&&this.angleOfLeastInterference<3*f.PI/2)v=-n/2-u/2}else if(!(this.angleOfLeastInterference<=f.PI/4))if(this.angleOfLeastInterference<3*f.PI/4){v=0;r=-l.atoms_font_size_2D*0.9}else if(this.angleOfLeastInterference<=5*f.PI/4)v=-n/2-u/2;else if(this.angleOfLeastInterference<7*f.PI/4){v=0;r=l.atoms_font_size_2D*0.9}h.fillText("H",this.x+v,this.y+r)}}}if(this.charge!=0){p=this.charge.toFixed(0);if(p=="1")p="+";else if(p=="-1")p="\u2013";else if(e.stringStartsWith(p,"-"))p=p.substring(1)+"\u2013";
else p+="+";q=this.angleOfLeastInterference;n=l.atoms_font_size_2D;if(this.isLabelVisible(l)&&m>0)q+=f.PI/4;h.textAlign="center";h.textBaseline="middle";h.fillText(p,this.x+n*f.cos(q),this.y-n*f.sin(q))}if(this.numLonePair>0){h.fillStyle="black";if(this.bondNumber==2&&f.abs(this.largestAngle-f.PI)<f.PI/60){this.drawLonePairs(h,l,f.floor(this.numLonePair/2),this.angleOfLeastInterference,this.largestAngle);this.drawLonePairs(h,l,f.floor(this.numLonePair/2)+this.numLonePair%2,this.angleOfLeastInterference+
f.PI,this.largestAngle)}else this.drawLonePairs(h,l,this.numLonePair,this.angleOfLeastInterference,this.largestAngle)}}};this.drawLonePairs=function(h,l,p,n,q){var m=q/(p+(this.bondNumber==0?0:1));q=n-q/2+m;for(var u=0;u<p;u++){n=q+u*m;var v=this.x+Math.cos(n)*l.atoms_lonePairDistance_2D,r=this.y-Math.sin(n)*l.atoms_lonePairDistance_2D,w=n+Math.PI/2;n=Math.cos(w)*l.atoms_lonePairSpread_2D/2;w=-Math.sin(w)*l.atoms_lonePairSpread_2D/2;h.beginPath();h.arc(v+n,r+w,l.atoms_lonePairDiameter_2D,0,f.PI*2,
false);h.fill();h.beginPath();h.arc(v-n,r-w,l.atoms_lonePairDiameter_2D,0,f.PI*2,false);h.fill()}};this.drawDecorations=function(h){if(this.isHover||this.isSelected){h.strokeStyle=this.isHover?"#885110":"#0060B2";h.lineWidth=1.2;h.beginPath();h.arc(this.x,this.y,this.isHover?7:15,0,f.PI*2,false);h.stroke()}};this.render=function(h,l){if(this.specs)l=this.specs;var p=j.translate(h.modelViewMatrix,[this.x,this.y,this.z],[]),n=l.atoms_useVDWDiameters_3D?d[this.label].vdWRadius*l.atoms_vdwMultiplier_3D:
l.atoms_sphereDiameter_3D/2;if(n==0)n=1;j.scale(p,[n,n,n]);n=l.atoms_color;if(l.atoms_useJMOLColors)n=d[this.label].jmolColor;else if(l.atoms_usePYMOLColors)n=d[this.label].pymolColor;h.material.setDiffuseColor(n);h.setMatrixUniforms(p);h.drawElements(h.TRIANGLES,(this.renderAsStar?h.starBuffer:h.sphereBuffer).vertexIndexBuffer.numItems,h.UNSIGNED_SHORT,0)};this.isLabelVisible=function(h){return h.atoms_displayAllCarbonLabels_2D||this.label!="C"||this.altLabel||this.mass!=-1||this.charge!=0||this.numLonePair!=
0||this.isHidden&&h.atoms_showHiddenCarbons_2D||h.atoms_displayTerminalCarbonLabels_2D&&this.bondNumber==1};this.getImplicitHydrogenCount=function(){if(this.label=="H"||d[this.label]==null)return 0;var h=d[this.label].valency,l=h-this.coordinationNumber;if(this.charge>0){h=4-h;if(this.charge<=h)l+=this.charge;else l=4-this.coordinationNumber-this.charge+h}else l+=this.charge;return l<0?0:l};return true};a.Atom.prototype=new a.Point(0,0)})(ChemDoodle.ELEMENT,ChemDoodle.extensions,ChemDoodle.structures,
Math,mat4);
(function(d,e,a,f,j,c){a.Bond=function(k,b,g){this.a1=k;this.a2=b;this.bondOrder=g?g:1;this.stereo=a.Bond.STEREO_NONE;this.isHover=false;this.ring=null;this.getCenter=function(){return new a.Point((this.a1.x+this.a2.x)/2,(this.a1.y+this.a2.y)/2)};this.getLength=function(){return this.a1.distance(this.a2)};this.getLength3D=function(){return this.a1.distance3D(this.a2)};this.contains=function(h){return h==this.a1||h==this.a2};this.getNeighbor=function(h){if(h==this.a1)return this.a2;else if(h==this.a2)return this.a1;
return null};this.draw=function(h,l){if(this.specs)l=this.specs;var p=this.a1.x,n=this.a2.x,q=this.a1.y,m=this.a2.y,u=n-p,v=m-q;if(l.atoms_display&&!l.atoms_circles_2D&&this.a1.isLabelVisible(l)){p+=u*l.bonds_atomLabelBuffer_2D;q+=v*l.bonds_atomLabelBuffer_2D}if(l.atoms_display&&!l.atoms_circles_2D&&this.a2.isLabelVisible(l)){n-=u*l.bonds_atomLabelBuffer_2D;m-=v*l.bonds_atomLabelBuffer_2D}if(l.bonds_clearOverlaps_2D){var r=p+u*0.15,w=q+v*0.15,t=n-u*0.15,x=m-v*0.15;h.strokeStyle=l.backgroundColor;
h.lineWidth=l.bonds_width_2D+l.bonds_overlapClearWidth_2D*2;h.lineCap="round";h.beginPath();h.moveTo(r,w);h.lineTo(t,x);h.closePath();h.stroke()}h.strokeStyle=l.bonds_color;h.fillStyle=l.bonds_color;h.lineWidth=l.bonds_width_2D;h.lineCap=l.bonds_ends_2D;if(l.bonds_useJMOLColors||l.bonds_usePYMOLColors){r=h.createLinearGradient(p,q,n,m);w=d[this.a1.label].jmolColor;t=d[this.a2.label].jmolColor;if(l.atoms_usePYMOLColors){w=d[this.a1.label].pymolColor;t=d[this.a2.label].pymolColor}r.addColorStop(0,w);
if(!l.bonds_colorGradient){r.addColorStop(0.5,w);r.addColorStop(0.51,t)}r.addColorStop(1,t);h.strokeStyle=r;h.fillStyle=r}switch(this.bondOrder){case 0.5:h.beginPath();h.moveTo(p,q);e.contextHashTo(h,p,q,n,m,l.bonds_hashSpacing_2D,l.bonds_hashSpacing_2D);h.stroke();break;case 1:if(this.stereo==a.Bond.STEREO_PROTRUDING||this.stereo==a.Bond.STEREO_RECESSED){var z=l.bonds_width_2D/2;v=this.a1.distance(this.a2)*l.bonds_wedgeThickness_2D/2;r=this.a1.angle(this.a2)+f.PI/2;w=f.cos(r);r=f.sin(r);u=p-w*z;
t=q+r*z;x=p+w*z;z=q-r*z;var A=n+w*v,C=m-r*v;w=n-w*v;r=m+r*v;h.beginPath();h.moveTo(u,t);h.lineTo(x,z);h.lineTo(A,C);h.lineTo(w,r);h.closePath();if(this.stereo==a.Bond.STEREO_PROTRUDING)h.fill();else{h.save();h.clip();h.lineWidth=v*2;h.lineCap="butt";h.beginPath();h.moveTo(p,q);e.contextHashTo(h,p,q,n,m,l.bonds_hashWidth_2D,l.bonds_hashSpacing_2D);h.stroke();h.restore()}}else if(this.stereo==a.Bond.STEREO_AMBIGUOUS){h.beginPath();h.moveTo(p,q);m=f.floor(f.sqrt(u*u+v*v)/l.bonds_wavyLength_2D);p=p;q=
q;r=this.a1.angle(this.a2)+f.PI/2;w=f.cos(r);r=f.sin(r);n=u/m;v=v/m;for(A=0;A<m;A++){p+=n;q+=v;u=l.bonds_wavyLength_2D*w+p-n*0.5;x=l.bonds_wavyLength_2D*-r+q-v*0.5;t=l.bonds_wavyLength_2D*-w+p-n*0.5;z=l.bonds_wavyLength_2D*r+q-v*0.5;A%2==0?h.quadraticCurveTo(u,x,p,q):h.quadraticCurveTo(t,z,p,q)}h.stroke();break}else{h.beginPath();h.moveTo(p,q);h.lineTo(n,m);h.stroke()}break;case 1.5:h.beginPath();h.moveTo(p,q);h.lineTo(n,m);h.stroke();break;case 2:if(this.stereo==a.Bond.STEREO_AMBIGUOUS){v=this.a1.distance(this.a2)*
l.bonds_saturationWidth_2D/2;r=this.a1.angle(this.a2)+f.PI/2;u=p-f.cos(r)*v;t=q+f.sin(r)*v;x=p+f.cos(r)*v;z=q-f.sin(r)*v;A=n+f.cos(r)*v;C=m-f.sin(r)*v;w=n-f.cos(r)*v;r=m+f.sin(r)*v;h.beginPath();h.moveTo(u,t);h.lineTo(A,C);h.moveTo(x,z);h.lineTo(w,r);h.stroke()}else if(!l.bonds_symmetrical_2D&&(this.ring!=null||this.a1.label=="C"&&this.a2.label=="C")){h.beginPath();h.moveTo(p,q);h.lineTo(n,m);w=0;t=this.a1.distance(this.a2);u=this.a1.angle(this.a2);r=u+f.PI/2;v=t*l.bonds_saturationWidth_2D;x=l.bonds_saturationAngle_2D;
if(x<f.PI/2)w=-(v/f.tan(x));if(f.abs(w)<t/2){x=p-f.cos(u)*w;p=n+f.cos(u)*w;n=q+f.sin(u)*w;q=m-f.sin(u)*w;u=x-f.cos(r)*v;t=n+f.sin(r)*v;x=x+f.cos(r)*v;z=n-f.sin(r)*v;A=p-f.cos(r)*v;C=q+f.sin(r)*v;w=p+f.cos(r)*v;r=q-f.sin(r)*v;if(this.ring==null||this.ring.center.angle(this.a1)>this.ring.center.angle(this.a2)&&!(this.ring.center.angle(this.a1)-this.ring.center.angle(this.a2)>f.PI)||this.ring.center.angle(this.a1)-this.ring.center.angle(this.a2)<-f.PI){h.moveTo(u,t);h.lineTo(A,C)}else{h.moveTo(x,z);
h.lineTo(w,r)}h.stroke()}}else{v=this.a1.distance(this.a2)*l.bonds_saturationWidth_2D/2;r=this.a1.angle(this.a2)+f.PI/2;u=p-f.cos(r)*v;t=q+f.sin(r)*v;x=p+f.cos(r)*v;z=q-f.sin(r)*v;A=n+f.cos(r)*v;C=m-f.sin(r)*v;w=n-f.cos(r)*v;r=m+f.sin(r)*v;h.beginPath();h.moveTo(u,t);h.lineTo(w,r);h.moveTo(x,z);h.lineTo(A,C);h.stroke()}break;case 3:v=this.a1.distance(this.a2)*l.bonds_saturationWidth_2D;r=this.a1.angle(this.a2)+f.PI/2;u=p-f.cos(r)*v;t=q+f.sin(r)*v;x=p+f.cos(r)*v;z=q-f.sin(r)*v;A=n+f.cos(r)*v;C=m-f.sin(r)*
v;w=n-f.cos(r)*v;r=m+f.sin(r)*v;h.beginPath();h.moveTo(u,t);h.lineTo(w,r);h.moveTo(x,z);h.lineTo(A,C);h.moveTo(p,q);h.lineTo(n,m);h.stroke();break}};this.drawDecorations=function(h){if(this.isHover||this.isSelected){var l=2*f.PI,p=(this.a1.angleForStupidCanvasArcs(this.a2)+f.PI/2)%l;h.strokeStyle=this.isHover?"#885110":"#0060B2";h.lineWidth=1.2;h.beginPath();var n=(p+f.PI)%l;n%=f.PI*2;h.arc(this.a1.x,this.a1.y,7,p,n,false);h.stroke();h.beginPath();p+=f.PI;n=(p+f.PI)%l;h.arc(this.a2.x,this.a2.y,7,
p,n,false);h.stroke()}};this.render=function(h,l){if(this.specs)l=this.specs;var p=(l.bonds_renderAsLines_3D?1.1:1.001)*this.a1.distance3D(this.a2)/(l.bonds_useJMOLColors||l.bonds_usePYMOLColors?2:1);if(p==0)return false;p=[l.bonds_cylinderDiameter_3D/2,p,l.bonds_cylinderDiameter_3D/2];var n=j.translate(h.modelViewMatrix,[this.a1.x,this.a1.y,this.a1.z],[]),q=null,m=[this.a2.x-this.a1.x,this.a2.y-this.a1.y,this.a2.z-this.a1.z];if(l.bonds_useJMOLColors||l.bonds_usePYMOLColors){c.scale(m,0.5);q=j.translate(h.modelViewMatrix,
[this.a2.x,this.a2.y,this.a2.z],[])}var u=[0],v=null;if(l.bonds_showBondOrders_3D){switch(this.bondOrder){case 2:u=[-l.bonds_cylinderDiameter_3D,l.bonds_cylinderDiameter_3D];break;case 3:u=[-1.2*l.bonds_cylinderDiameter_3D,0,1.2*l.bonds_cylinderDiameter_3D];break}if(u.length>1){v=[0,0,1];var r=j.inverse(h.rotationMatrix,[]);j.multiplyVec3(r,v);v=c.cross(m,v,[]);c.normalize(v)}}var w=[0,1,0];r=0;var t=null;if(this.a1.x==this.a2.x&&this.a1.z==this.a2.z){t=[0,0,1];if(this.a2.y<this.a1.y)r=f.PI}else{r=
e.vec3AngleFrom(w,m);t=c.cross(w,m,[])}m=0;for(w=u.length;m<w;m++){var x=j.set(n,[]);u[m]!=0&&j.translate(x,c.scale(v,u[m],[]));r!=0&&j.rotate(x,r,t);j.scale(x,p);var z=l.bonds_color;if(l.bonds_useJMOLColors)z=d[this.a1.label].jmolColor;else if(l.bonds_usePYMOLColors)z=d[this.a1.label].pymolColor;h.material.setDiffuseColor(z);h.setMatrixUniforms(x);l.bonds_renderAsLines_3D?h.drawArrays(h.LINES,0,h.lineBuffer.vertexPositionBuffer.numItems):h.drawArrays(h.TRIANGLE_STRIP,0,h.cylinderBuffer.vertexPositionBuffer.numItems);
if(l.bonds_useJMOLColors||l.bonds_usePYMOLColors){j.set(q,x);u[m]!=0&&j.translate(x,c.scale(v,u[m],[]));j.rotate(x,r+f.PI,t);j.scale(x,p);h.material.setDiffuseColor(l.bonds_usePYMOLColors?d[this.a2.label].pymolColor:d[this.a2.label].jmolColor);h.setMatrixUniforms(x);l.bonds_renderAsLines_3D?h.drawArrays(h.LINES,0,h.lineBuffer.vertexPositionBuffer.numItems):h.drawArrays(h.TRIANGLE_STRIP,0,h.cylinderBuffer.vertexPositionBuffer.numItems)}}};return true};a.Bond.STEREO_NONE="none";a.Bond.STEREO_PROTRUDING=
"protruding";a.Bond.STEREO_RECESSED="recessed";a.Bond.STEREO_AMBIGUOUS="ambiguous"})(ChemDoodle.ELEMENT,ChemDoodle.extensions,ChemDoodle.structures,Math,mat4,vec3);
(function(d,e){d.Ring=function(){this.atoms=[];this.bonds=[];this.center=null;this.setupBonds=function(){for(var a=0,f=this.bonds.length;a<f;a++)this.bonds[a].ring=this;this.center=this.getCenter()};this.getCenter=function(){for(var a=minY=Infinity,f=maxY=-Infinity,j=0,c=this.atoms.length;j<c;j++){a=e.min(this.atoms[j].x,a);minY=e.min(this.atoms[j].y,minY);f=e.max(this.atoms[j].x,f);maxY=e.max(this.atoms[j].y,maxY)}return new d.Point((f+a)/2,(maxY+minY)/2)};return true}})(ChemDoodle.structures,Math);
(function(d,e,a,f,j){a.Molecule=function(){this.atoms=[];this.bonds=[];this.rings=[];this.findRings=true;this.draw=function(c,k){if(this.specs)k=this.specs;if(k.bonds_display)for(var b=0,g=this.bonds.length;b<g;b++)this.bonds[b].draw(c,k);if(k.atoms_display){b=0;for(g=this.atoms.length;b<g;b++)this.atoms[b].draw(c,k)}};this.render=function(c,k){if(this.specs)k=this.specs;var b=this.atoms.length>0&&this.atoms[0].hetatm!=undefined;if(b){if(k.macro_displayBonds){if(this.bonds.length>0){if(k.bonds_renderAsLines_3D&&
!this.residueSpecs||this.residueSpecs&&this.residueSpecs.bonds_renderAsLines_3D){c.lineWidth(this.residueSpecs?this.residueSpecs.bonds_width_2D:k.bonds_width_2D);c.lineBuffer.bindBuffers(c)}else c.cylinderBuffer.bindBuffers(c);c.material.setTempColors(k.bonds_materialAmbientColor_3D,null,k.bonds_materialSpecularColor_3D,k.bonds_materialShininess_3D)}for(var g=0,h=this.bonds.length;g<h;g++){var l=this.bonds[g];if(!l.a1.hetatm&&(k.macro_atomToLigandDistance==-1||l.a1.closestDistance!=undefined&&k.macro_atomToLigandDistance>=
l.a1.closestDistance&&k.macro_atomToLigandDistance>=l.a2.closestDistance))l.render(c,this.residueSpecs?this.residueSpecs:k)}}if(k.macro_displayAtoms){if(this.atoms.length>0){c.sphereBuffer.bindBuffers(c);c.material.setTempColors(k.atoms_materialAmbientColor_3D,null,k.atoms_materialSpecularColor_3D,k.atoms_materialShininess_3D)}g=0;for(h=this.atoms.length;g<h;g++){var p=this.atoms[g];if(!p.hetatm&&(k.macro_atomToLigandDistance==-1||p.closestDistance!=undefined&&k.macro_atomToLigandDistance>=p.closestDistance))p.render(c,
this.residueSpecs?this.residueSpecs:k)}}}if(k.bonds_display){if(this.bonds.length>0){if(k.bonds_renderAsLines_3D){c.lineWidth(k.bonds_width_2D);c.lineBuffer.bindBuffers(c)}else c.cylinderBuffer.bindBuffers(c);c.material.setTempColors(k.bonds_materialAmbientColor_3D,null,k.bonds_materialSpecularColor_3D,k.bonds_materialShininess_3D)}g=0;for(h=this.bonds.length;g<h;g++){l=this.bonds[g];if(!b||l.a1.hetatm)l.render(c,k)}}if(k.atoms_display){g=0;for(h=this.atoms.length;g<h;g++){p=this.atoms[g];p.bondNumber=
0;p.renderAsStar=false}g=0;for(h=this.bonds.length;g<h;g++){l=this.bonds[g];l.a1.bondNumber++;l.a2.bondNumber++}if(this.atoms.length>0){c.sphereBuffer.bindBuffers(c);c.material.setTempColors(k.atoms_materialAmbientColor_3D,null,k.atoms_materialSpecularColor_3D,k.atoms_materialShininess_3D)}l=[];g=0;for(h=this.atoms.length;g<h;g++){p=this.atoms[g];if(!b||p.hetatm&&(k.macro_showWater||!p.isWater))if(k.atoms_nonBondedAsStars_3D&&p.bondNumber==0){p.renderAsStar=true;l.push(p)}else p.render(c,k)}if(l.length>
0){c.starBuffer.bindBuffers(c);g=0;for(h=l.length;g<h;g++)l[g].render(c,k)}}if(this.chains){c.setMatrixUniforms(c.modelViewMatrix);if(k.proteins_displayRibbon){c.material.setTempColors(k.proteins_materialAmbientColor_3D,null,k.proteins_materialSpecularColor_3D,k.proteins_materialShininess_3D);b=0;for(p=this.ribbons.length;b<p;b++)if(k.proteins_useShapelyColors||k.proteins_useAminoColors||k.proteins_usePolarityColors){l=k.proteins_ribbonCartoonize?this.cartoons[b]:this.ribbons[b];l.front.bindBuffers(c);
g=0;for(h=l.front.segments.length;g<h;g++)l.front.segments[g].render(c,k);l.back.bindBuffers(c);g=0;for(h=l.back.segments.length;g<h;g++)l.back.segments[g].render(c,k)}else if(k.proteins_ribbonCartoonize){l=this.cartoons[b];l.front.bindBuffers(c);g=0;for(h=l.front.cartoonSegments.length;g<h;g++)l.front.cartoonSegments[g].render(c,k);l.back.bindBuffers(c);g=0;for(h=l.back.cartoonSegments.length;g<h;g++)l.back.cartoonSegments[g].render(c,k)}else{l=this.ribbons[b];l.front.render(c,k);l.back.render(c,
k)}}if(k.proteins_displayBackbone){if(!this.alphaCarbonTrace){this.alphaCarbonTrace={nodes:[],edges:[]};b=0;for(p=this.chains.length;b<p;b++){var n=this.chains[b];if(!(n.length>2&&f[n[2].name]&&f[n[2].name].aminoColor=="#BEA06E")&&n.length>0){g=1;for(h=n.length-2;g<h;g++){l=n[g].cp1;l.chainColor=n.chainColor;this.alphaCarbonTrace.nodes.push(l);l=new a.Bond(n[g].cp1,n[g+1].cp1);l.residueName=n[g].name;l.chainColor=n.chainColor;this.alphaCarbonTrace.edges.push(l);if(g==n.length-3){l=n[g+1].cp1;l.chainColor=
n.chainColor;this.alphaCarbonTrace.nodes.push(l)}}}}}if(this.alphaCarbonTrace.nodes.length>0){b=new a.VisualSpecifications;b.atoms_display=true;b.bonds_display=true;b.atoms_sphereDiameter_3D=k.proteins_backboneThickness;b.bonds_cylinderDiameter_3D=k.proteins_backboneThickness;b.bonds_useJMOLColors=false;b.atoms_color=k.proteins_backboneColor;b.bonds_color=k.proteins_backboneColor;b.atoms_useVDWDiameters_3D=false;c.material.setTempColors(k.proteins_materialAmbientColor_3D,null,k.proteins_materialSpecularColor_3D,
k.proteins_materialShininess_3D);c.material.setDiffuseColor(k.proteins_backboneColor);g=0;for(h=this.alphaCarbonTrace.nodes.length;g<h;g++){l=this.alphaCarbonTrace.nodes[g];if(k.macro_colorByChain)b.atoms_color=l.chainColor;c.sphereBuffer.bindBuffers(c);l.render(c,b)}g=0;for(h=this.alphaCarbonTrace.edges.length;g<h;g++){p=this.alphaCarbonTrace.edges[g];l=null;n=f[p.residueName]?f[p.residueName]:f["*"];if(k.macro_colorByChain)l=p.chainColor;else if(k.proteins_useShapelyColors)l=n.shapelyColor;else if(k.proteins_useAminoColors)l=
n.aminoColor;else if(k.proteins_usePolarityColors)l=n.polar?"#C10000":"#FFFFFF";if(l!=null)b.bonds_color=l;c.cylinderBuffer.bindBuffers(c);p.render(c,b)}}}if(k.nucleics_display){c.material.setTempColors(k.nucleics_materialAmbientColor_3D,null,k.nucleics_materialSpecularColor_3D,k.nucleics_materialShininess_3D);b=0;for(p=this.tubes.length;b<p;b++){c.setMatrixUniforms(c.modelViewMatrix);l=this.tubes[b];l.render(c,k)}}}if(k.crystals_displayUnitCell&&this.unitCell){c.setMatrixUniforms(c.modelViewMatrix);
this.unitCell.bindBuffers(c);c.material.setDiffuseColor(k.crystals_unitCellColor);c.lineWidth(k.crystals_unitCellLineWidth);c.drawElements(c.LINES,this.unitCell.vertexIndexBuffer.numItems,c.UNSIGNED_SHORT,0)}if(this.surface&&k.surfaces_display){c.setMatrixUniforms(c.modelViewMatrix);this.surface.bindBuffers(c);c.material.setTempColors(k.surfaces_materialAmbientColor_3D,k.surfaces_color,k.surfaces_materialSpecularColor_3D,k.surfaces_materialShininess_3D);k.surfaces_style=="Dot"?c.drawArrays(c.POINTS,
0,this.surface.vertexPositionBuffer.numItems):c.drawElements(c.TRIANGLES,this.surface.vertexIndexBuffer.numItems,c.UNSIGNED_SHORT,0)}};this.getCenter3D=function(){if(this.atoms.length==1)return new a.Atom("C",this.atoms[0].x,this.atoms[0].y,this.atoms[0].z);var c=minY=minZ=Infinity,k=maxY=maxZ=-Infinity;if(this.chains)for(var b=0,g=this.chains.length;b<g;b++)for(var h=this.chains[b],l=0,p=h.length;l<p;l++){var n=h[l];c=j.min(n.cp1.x,c);minY=j.min(n.cp1.y,minY);minZ=j.min(n.cp1.z,minZ);k=j.max(n.cp1.x,
k);maxY=j.max(n.cp1.y,maxY);maxZ=j.max(n.cp1.z,maxZ);c=j.min(n.cp2.x,c);minY=j.min(n.cp2.y,minY);minZ=j.min(n.cp2.z,minZ);k=j.max(n.cp2.x,k);maxY=j.max(n.cp2.y,maxY);maxZ=j.max(n.cp2.z,maxZ)}b=0;for(g=this.atoms.length;b<g;b++){c=j.min(this.atoms[b].x,c);minY=j.min(this.atoms[b].y,minY);minZ=j.min(this.atoms[b].z,minZ);k=j.max(this.atoms[b].x,k);maxY=j.max(this.atoms[b].y,maxY);maxZ=j.max(this.atoms[b].z,maxZ)}return new a.Atom("C",(k+c)/2,(maxY+minY)/2,(maxZ+minZ)/2)};this.getCenter=function(){if(this.atoms.length==
1)return new a.Point(this.atoms[0].x,this.atoms[0].y);for(var c=minY=Infinity,k=maxY=-Infinity,b=0,g=this.atoms.length;b<g;b++){c=j.min(this.atoms[b].x,c);minY=j.min(this.atoms[b].y,minY);k=j.max(this.atoms[b].x,k);maxY=j.max(this.atoms[b].y,maxY)}return new a.Point((k+c)/2,(maxY+minY)/2)};this.getDimension=function(){if(this.atoms.length==1)return new a.Point(0,0);var c=minY=Infinity,k=maxY=-Infinity;if(this.chains){for(var b=0,g=this.chains.length;b<g;b++)for(var h=this.chains[b],l=0,p=h.length;l<
p;l++){var n=h[l];c=j.min(n.cp1.x,c);minY=j.min(n.cp1.y,minY);k=j.max(n.cp1.x,k);maxY=j.max(n.cp1.y,maxY);c=j.min(n.cp2.x,c);minY=j.min(n.cp2.y,minY);k=j.max(n.cp2.x,k);maxY=j.max(n.cp2.y,maxY)}c-=30;minY-=30;minZ-=30;k+=30;maxY+=30;maxZ+=30}b=0;for(g=this.atoms.length;b<g;b++){c=j.min(this.atoms[b].x,c);minY=j.min(this.atoms[b].y,minY);k=j.max(this.atoms[b].x,k);maxY=j.max(this.atoms[b].y,maxY)}return new a.Point(k-c,maxY-minY)};this.check=function(){if(this.findRings){this.rings=(new d.informatics.SSSRFinder(this)).rings;
for(var c=0,k=this.bonds.length;c<k;c++)this.bonds[c].ring=null;c=0;for(k=this.rings.length;c<k;c++)this.rings[c].setupBonds()}c=0;for(k=this.atoms.length;c<k;c++){this.atoms[c].isLone=false;if(this.atoms[c].label=="C"){for(var b=0,g=0,h=this.bonds.length;g<h;g++)if(this.bonds[g].a1==this.atoms[c]||this.bonds[g].a2==this.atoms[c])b++;if(b==0)this.atoms[c].isLone=true}}b=false;c=0;for(k=this.atoms.length;c<k;c++)if(this.atoms[c].z!=0)b=true;if(b){this.sortAtomsByZ();this.sortBondsByZ()}this.setupMetaData()};
this.getAngles=function(c){for(var k=[],b=0,g=this.bonds.length;b<g;b++)this.bonds[b].contains(c)&&k.push(c.angle(this.bonds[b].getNeighbor(c)));k.sort();return k};this.getCoordinationNumber=function(c){for(var k=0,b=0,g=c.length;b<g;b++)k+=c[b].bondOrder;return k};this.getBonds=function(c){for(var k=[],b=0,g=this.bonds.length;b<g;b++)this.bonds[b].contains(c)&&k.push(this.bonds[b]);return k};this.sortAtomsByZ=function(){for(var c=1,k=this.atoms.length;c<k;c++)for(var b=c;b>0&&this.atoms[b].z<this.atoms[b-
1].z;){var g=this.atoms[b];this.atoms[b]=this.atoms[b-1];this.atoms[b-1]=g;b--}};this.sortBondsByZ=function(){for(var c=1,k=this.bonds.length;c<k;c++)for(var b=c;b>0&&this.bonds[b].a1.z+this.bonds[b].a2.z<this.bonds[b-1].a1.z+this.bonds[b-1].a2.z;){var g=this.bonds[b];this.bonds[b]=this.bonds[b-1];this.bonds[b-1]=g;b--}};this.setupMetaData=function(){for(var c=0,k=this.atoms.length;c<k;c++){var b=this.atoms[c],g=this.getBonds(b),h=this.getAngles(b);b.isHidden=g.length==2&&j.abs(j.abs(h[1]-h[0])-j.PI)<
j.PI/30&&g[0].bondOrder==g[1].bondOrder;h=d.math.angleBetweenLargest(h);b.angleOfLeastInterference=h.angle%(j.PI*2);b.largestAngle=h.largest;b.coordinationNumber=this.getCoordinationNumber(g);b.bondNumber=g.length}};this.scaleToAverageBondLength=function(c){var k=this.getAverageBondLength();if(k!=0){c=c/k;k=0;for(var b=this.atoms.length;k<b;k++){this.atoms[k].x*=c;this.atoms[k].y*=c}}};this.getAverageBondLength=function(){if(this.bonds.length==0)return 0;for(var c=0,k=0,b=this.bonds.length;k<b;k++)c+=
this.bonds[k].getLength();c/=this.bonds.length;return c};return true}})(ChemDoodle,ChemDoodle.math,ChemDoodle.structures,ChemDoodle.RESIDUE,Math);
(function(d,e,a,f){var j=a.multiply([-1/6,0.5,-0.5,1/6,0.5,-1,0.5,0,-0.5,0,0.5,0,1/6,2/3,1/6,0],[0.0060,0,0,0,0.0060,0.02,0,0,0.0010,0.01,0.1,0,0,0,0,1],[]);d.Residue=function(c){this.Ns=9;this.resSeq=c;this.setup=function(k){var b=[k.x-this.cp1.x,k.y-this.cp1.y,k.z-this.cp1.z],g=f.cross(b,[this.cp2.x-this.cp1.x,this.cp2.y-this.cp1.y,this.cp2.z-this.cp1.z],[]);this.D=f.cross(g,b,[]);f.normalize(g);f.normalize(this.D);this.guidePointsSmall=[];this.guidePointsLarge=[];k=[(k.x+this.cp1.x)/2,(k.y+this.cp1.y)/
2,(k.z+this.cp1.z)/2];if(this.helix){f.scale(g,1.5);f.add(k,g)}this.guidePointsSmall[0]=new d.Atom("",k[0]-this.D[0]/2,k[1]-this.D[1]/2,k[2]-this.D[2]/2);for(g=1;g<this.Ns;g++)this.guidePointsSmall[g]=new d.Atom("",this.guidePointsSmall[0].x+this.D[0]*g/this.Ns,this.guidePointsSmall[0].y+this.D[1]*g/this.Ns,this.guidePointsSmall[0].z+this.D[2]*g/this.Ns);f.scale(this.D,4);this.guidePointsLarge[0]=new d.Atom("",k[0]-this.D[0]/2,k[1]-this.D[1]/2,k[2]-this.D[2]/2);for(g=1;g<this.Ns;g++)this.guidePointsLarge[g]=
new d.Atom("",this.guidePointsLarge[0].x+this.D[0]*g/this.Ns,this.guidePointsLarge[0].y+this.D[1]*g/this.Ns,this.guidePointsLarge[0].z+this.D[2]*g/this.Ns)};this.getGuidePointSet=function(k){if(k==0)return this.helix||this.sheet?this.guidePointsLarge:this.guidePointsSmall;else if(k==1)return this.guidePointsSmall;else if(k==2)return this.guidePointsLarge};this.computeLineSegments=function(k,b,g,h){this.split=b.helix!=this.helix||b.sheet!=this.sheet;this.lineSegments=this.innerCompute(0,k,b,g,false);
if(h)this.lineSegmentsCartoon=this.innerCompute(b.helix||b.sheet?2:1,k,b,g,true)};this.innerCompute=function(k,b,g,h,l){var p=[],n=this.getGuidePointSet(k);b=b.getGuidePointSet(k);g=g.getGuidePointSet(k);for(var q=h.getGuidePointSet(k),m=0,u=this.guidePointsLarge.length;m<u;m++){for(var v=a.multiply([b[m].x,b[m].y,b[m].z,1,n[m].x,n[m].y,n[m].z,1,g[m].x,g[m].y,g[m].z,1,q[m].x,q[m].y,q[m].z,1],j,[]),r=[],w=0;w<10;w++){for(k=3;k>0;k--)for(h=0;h<4;h++)v[k*4+h]+=v[(k-1)*4+h];r[w]=new d.Atom("",v[12]/v[15],
v[13]/v[15],v[14]/v[15])}p[m]=r}if(l&&this.arrow)for(k=0;k<10;k++){l=1.5-1.3*k/10;n=e.floor(this.Ns/2);b=p[n];h=0;for(g=p.length;h<g;h++)if(h!=n){q=b[k];m=p[h][k];u=[m.x-q.x,m.y-q.y,m.z-q.z];f.scale(u,l);m.x=q.x+u[0];m.y=q.y+u[1];m.z=q.z+u[2]}}return p}}})(ChemDoodle.structures,Math,mat4,vec3);
(function(d,e,a,f,j){e.Spectrum=function(){this.data=[];this.metadata=[];this.dataDisplay=[];this.yUnit=this.xUnit=this.title=null;this.continuous=true;this.integrationSensitivity=0.01;var c=0,k=false;this.draw=function(b,g,h,l){var p=5,n=0,q=0;b.fillStyle=g.text_color;b.textAlign="center";b.textBaseline="alphabetic";b.font=g.getFontString(g.text_font_size,g.text_font_families);if(this.xUnit){q+=g.text_font_size;b.fillText(this.xUnit,h/2,l-2)}if(this.yUnit&&g.plots_showYAxis){n+=g.text_font_size;
b.save();b.translate(g.text_font_size,l/2);b.rotate(-j.PI/2);b.fillText(this.yUnit,0,0);b.restore()}if(this.title!=null){p+=g.text_font_size;b.fillText(this.title,h/2,g.text_font_size)}q+=5+g.text_font_size;if(g.plots_showYAxis)n+=5+b.measureText("1000").width;if(g.plots_showGrid){b.strokeStyle=g.plots_gridColor;b.lineWidth=g.plots_gridLineWidth;b.strokeRect(n,p,h-n,l-q-p)}b.textAlign="center";b.textBaseline="top";for(var m=this.maxX-this.minX,u=m/100,v=0.0010;v<u||m/v>25;)v*=10;var r=0,w=g.plots_flipXAxis?
h:0;for(m=j.round(this.minX/v)*v;m<=this.maxX;m+=v/2){u=this.getTransformedX(m,g,h,n);if(u>n){b.strokeStyle="black";b.lineWidth=1;if(r%2==0){b.beginPath();b.moveTo(u,l-q);b.lineTo(u,l-q+2);b.stroke();for(var t=m.toFixed(5);t.charAt(t.length-1)=="0";)t=t.substring(0,t.length-1);if(t.charAt(t.length-1)==".")t=t.substring(0,t.length-1);var x=b.measureText(t).width;if(g.plots_flipXAxis)x*=-1;var z=u-x/2;if(g.plots_flipXAxis?z<w:z>w){b.fillText(t,u,l-q+2);w=u+x/2}if(g.plots_showGrid){b.strokeStyle=g.plots_gridColor;
b.lineWidth=g.plots_gridLineWidth;b.beginPath();b.moveTo(u,l-q);b.lineTo(u,p);b.stroke()}}else{b.beginPath();b.moveTo(u,l-q);b.lineTo(u,l-q+2);b.stroke()}}r++}if(g.plots_showYAxis||g.plots_showGrid){u=1/g.scale;b.textAlign="right";b.textBaseline="middle";for(m=0;m<=10;m++){t=u/10*m;v=p+(l-q-p)*(1-t*g.scale);if(g.plots_showGrid){b.strokeStyle=g.plots_gridColor;b.lineWidth=g.plots_gridLineWidth;b.beginPath();b.moveTo(n,v);b.lineTo(h,v);b.stroke()}if(g.plots_showYAxis){b.strokeStyle="black";b.lineWidth=
1;b.beginPath();b.moveTo(n,v);b.lineTo(n-3,v);b.stroke();t=t*100;r=j.max(0,3-j.floor(t).toString().length);t=t.toFixed(r);if(r>0)for(;t.charAt(t.length-1)=="0";)t=t.substring(0,t.length-1);if(t.charAt(t.length-1)==".")t=t.substring(0,t.length-1);b.fillText(t,n-3,v)}}}b.strokeStyle="black";b.lineWidth=1;b.beginPath();b.moveTo(h,l-q);b.lineTo(n,l-q);g.plots_showYAxis&&b.lineTo(n,p);b.stroke();if(this.dataDisplay.length>0){b.textAlign="left";b.textBaseline="top";m=u=0;for(t=this.dataDisplay.length;m<
t;m++)if(this.dataDisplay[m].value){b.fillText([this.dataDisplay[m].display,": ",this.dataDisplay[m].value].join(""),n+10,p+10+u*(g.text_font_size+5));u++}else if(this.dataDisplay[m].tag){v=0;for(r=this.metadata.length;v<r;v++)if(d.stringStartsWith(this.metadata[v],this.dataDisplay[m].tag)){r=this.metadata[v];if(this.dataDisplay[m].display){r=f.inArray("=",this.metadata[v]);r=[this.dataDisplay[m].display,": ",r>-1?this.metadata[v].substring(r+2):this.metadata[v]].join("")}b.fillText(r,n+10,p+10+u*
(g.text_font_size+5));u++;break}}}b.strokeStyle=g.plots_color;b.lineWidth=g.plots_width;r=[];b.beginPath();if(this.continuous){w=false;m=0;for(t=this.data.length;m<t;m++){u=this.getTransformedX(this.data[m].x,g,h,n);if(u>=n&&u<h){v=this.getTransformedY(this.data[m].y,g,l,q,p);g.plots_showIntegration&&j.abs(this.data[m].y)>this.integrationSensitivity&&r.push(new e.Point(this.data[m].x,this.data[m].y));if(!w){b.moveTo(u,v);w=true}b.lineTo(u,v)}else if(w)break}}else{m=0;for(t=this.data.length;m<t;m++){u=
this.getTransformedX(this.data[m].x,g,h,n);if(u>=n&&u<h){b.moveTo(u,l-q);b.lineTo(u,this.getTransformedY(this.data[m].y,g,l,q,p))}}}b.stroke();if(g.plots_showIntegration&&r.length>1){b.strokeStyle=g.plots_integrationColor;b.lineWidth=g.plots_integrationLineWidth;b.beginPath();m=r[1].x>r[0].x;if(this.flipXAxis&&!m||!this.flipXAxis&&m){for(m=r.length-2;m>=0;m--)r[m].y+=r[m+1].y;w=r[0].y}else{m=1;for(t=r.length;m<t;m++)r[m].y+=r[m-1].y;w=r[r.length-1].y}m=0;for(t=r.length;m<t;m++){u=this.getTransformedX(r[m].x,
g,h,n);v=this.getTransformedY(r[m].y/g.scale/w,g,l,q,p);m==0?b.moveTo(u,v):b.lineTo(u,v)}b.stroke()}c=n;k=g.plots_flipXAxis};this.getTransformedY=function(b,g,h,l,p){return p+(h-l-p)*(1-b*g.scale)};this.getTransformedX=function(b,g,h,l){b=l+(b-this.minX)/(this.maxX-this.minX)*(h-l);if(g.plots_flipXAxis)b=h+l-b;return b};this.getInverseTransformedX=function(b,g,h){if(k)b=g+h-b;return(b-h)*(this.maxX-this.minX)/(g-h)+this.minX};this.setup=function(){for(var b=Number.MAX_VALUE,g=Number.MIN_VALUE,h=Number.MIN_VALUE,
l=0,p=this.data.length;l<p;l++){b=j.min(b,this.data[l].x);g=j.max(g,this.data[l].x);h=j.max(h,this.data[l].y)}if(this.continuous){this.minX=b;this.maxX=g}else{this.minX=b-1;this.maxX=g+1}l=0;for(p=this.data.length;l<p;l++)this.data[l].y/=h};this.zoom=function(b,g,h,l){b=this.getInverseTransformedX(b,h,c);g=this.getInverseTransformedX(g,h,c);this.minX=j.min(b,g);this.maxX=j.max(b,g);if(l){l=Number.MIN_VALUE;g=0;for(h=this.data.length;g<h;g++)if(a.isBetween(this.data[g].x,this.minX,this.maxX))l=j.max(l,
this.data[g].y);return 1/l}};this.translate=function(b,g){var h=b/(g-c)*(this.maxX-this.minX)*(k?1:-1);this.minX+=h;this.maxX+=h};this.alertMetadata=function(){alert(this.metadata.join("\n"))};return true}})(ChemDoodle.extensions,ChemDoodle.structures,ChemDoodle.math,jQuery,Math);
(function(d){d._Mesh=function(){return true};d._Mesh.prototype.storeData=function(e,a,f){this.positionData=e;this.normalData=a;this.indexData=f};d._Mesh.prototype.setupBuffers=function(e){this.vertexPositionBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,this.vertexPositionBuffer);e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.positionData),e.STATIC_DRAW);this.vertexPositionBuffer.itemSize=3;this.vertexPositionBuffer.numItems=this.positionData.length/3;this.vertexNormalBuffer=e.createBuffer();
e.bindBuffer(e.ARRAY_BUFFER,this.vertexNormalBuffer);e.bufferData(e.ARRAY_BUFFER,new Float32Array(this.normalData),e.STATIC_DRAW);this.vertexNormalBuffer.itemSize=3;this.vertexNormalBuffer.numItems=this.normalData.length/3;if(this.indexData){this.vertexIndexBuffer=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.indexData),e.STATIC_DRAW);this.vertexIndexBuffer.itemSize=1;this.vertexIndexBuffer.numItems=this.indexData.length}};
d._Mesh.prototype.bindBuffers=function(e){this.vertexPositionBuffer||this.setupBuffers(e);e.bindBuffer(e.ARRAY_BUFFER,this.vertexPositionBuffer);e.vertexAttribPointer(e.shader.vertexPositionAttribute,this.vertexPositionBuffer.itemSize,e.FLOAT,false,0,0);e.bindBuffer(e.ARRAY_BUFFER,this.vertexNormalBuffer);e.vertexAttribPointer(e.shader.vertexNormalAttribute,this.vertexNormalBuffer.itemSize,e.FLOAT,false,0,0);this.vertexIndexBuffer&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer)}})(ChemDoodle.structures,
Math);(function(d,e){d.Cylinder=function(a,f,j){for(var c=[],k=[],b=0;b<j;b++){var g=b*2*e.PI/j,h=e.cos(g);g=e.sin(g);k.push(h,0,g);c.push(a*h,0,a*g);k.push(h,0,g);c.push(a*h,f,a*g)}k.push(1,0,0);c.push(a,0,0);k.push(1,0,0);c.push(a,f,0);this.storeData(c,k);return true};d.Cylinder.prototype=new d._Mesh})(ChemDoodle.structures,Math);
(function(d,e){d.Sphere=function(a,f,j){for(var c=[],k=[],b=0;b<=f;b++){var g=b*e.PI/f,h=e.sin(g),l=e.cos(g);for(g=0;g<=j;g++){var p=g*2*e.PI/j,n=e.sin(p);p=e.cos(p)*h;var q=l;n=n*h;k.push(p,q,n);c.push(a*p,a*q,a*n)}}a=[];j+=1;for(b=0;b<f;b++)for(g=0;g<j;g++){h=b*j+g%j;l=h+j;a.push(h);a.push(l);a.push(h+1);if(g<j-1){a.push(l);a.push(l+1);a.push(h+1)}}this.storeData(c,k,a);return true};d.Sphere.prototype=new d._Mesh})(ChemDoodle.structures,Math);
(function(d,e,a,f){function j(c,k,b){this.name=k;this.entire=c;this.getColor=function(g){return g.macro_colorByChain?this.chainColor:this.name?this.getResidueColor(d[this.name]?this.name:"*",g):this.helix?c.front?g.proteins_ribbonCartoonHelixPrimaryColor:g.proteins_ribbonCartoonHelixSecondaryColor:this.sheet?g.proteins_ribbonCartoonSheetColor:c.front?g.proteins_primaryColor:g.proteins_secondaryColor};this.getResidueColor=function(g,h){var l=d[g];if(h.proteins_useShapelyColors)return l.shapelyColor;
else if(h.proteins_useAminoColors)return l.aminoColor;else if(h.proteins_usePolarityColors)return l.polar?"#C10000":"#FFFFFF";return"#FFFFFF"};this.render=function(g,h){if(!this.vertexIndexBuffer){this.vertexIndexBuffer=g.createBuffer();g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer);g.bufferData(g.ELEMENT_ARRAY_BUFFER,new Uint16Array(b),g.STATIC_DRAW);this.vertexIndexBuffer.itemSize=1;this.vertexIndexBuffer.numItems=b.length}g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer);
g.material.setDiffuseColor(this.getColor(h));g.drawElements(g.TRIANGLES,this.vertexIndexBuffer.numItems,g.UNSIGNED_SHORT,0)}}e.Ribbon=function(c,k,b){var g=c[0].lineSegments.length,h=c[0].lineSegments[0].length,l=[],p=[];this.front=k>0;for(var n=0,q=c.length-1;n<q;n++)for(var m=c[n],u=0;u<g;u++)for(var v=b?m.lineSegmentsCartoon[u]:m.lineSegments[u],r=u==0,w=false,t=0;t<h;t++){var x=v[t],z=n,A=t+1;if(n==c.length-2&&t==h-1)A--;else if(t==h-1){z++;A=0}A=b?c[z].lineSegmentsCartoon[u][A]:c[z].lineSegments[u][A];
z=false;var C=u+1;if(u==g-1){C-=2;z=true}C=b?m.lineSegmentsCartoon[C][t]:m.lineSegments[C][t];A=[A.x-x.x,A.y-x.y,A.z-x.z];C=[C.x-x.x,C.y-x.y,C.z-x.z];var D=f.cross(A,C,[]);if(t==0){f.normalize(A);f.scale(A,-1);p.push(A[0],A[1],A[2]);l.push(x.x,x.y,x.z)}if(r||w){f.normalize(C);f.scale(C,-1);p.push(C[0],C[1],C[2]);l.push(x.x,x.y,x.z);if(r&&t==h-1){r=false;t=-1}}else{f.normalize(D);if(z&&!this.front||!z&&this.front)f.scale(D,-1);p.push(D[0],D[1],D[2]);f.scale(D,a.abs(k));l.push(x.x+D[0],x.y+D[1],x.z+
D[2]);if(u==g-1&&t==h-1){w=true;t=-1}}if(t==-1||t==h-1){f.normalize(A);p.push(A[0],A[1],A[2]);l.push(x.x,x.y,x.z)}}g+=2;h+=2;this.segments=[];var G;if(b){this.cartoonSegments=[];G=[]}k=[];n=0;for(q=c.length-1;n<q;n++){if(n>0&&G)if(c[n].split){u=new j(this,null,G);if(c[n].helix)u.helix=true;if(c[n].sheet)u.sheet=true;this.cartoonSegments.push(u);G=[]}b=n*g*h;m=[];u=0;for(v=g-1;u<v;u++){r=b+u*h;for(t=0;t<h;t++){w=1;if(n==c.length-2)w=0;else if(t==h-1)w=g*h-t;w=[r+t,r+h+t,r+h+t+w,r+t,r+t+w,r+h+t+w];
if(t!=h-1)for(x=0;x<6;x++)m.push(w[x]);if(t==h-2&&n<c.length-3){x=g*h-t;w[2]+=x;w[4]+=x;w[5]+=x}for(x=0;x<6;x++)k.push(w[x]);if(G)for(x=0;x<6;x++)G.push(w[x])}}this.segments.push(new j(this,c[n+1].name,m))}G&&this.cartoonSegments.push(new j(this,null,G));this.storeData(l,p,k);this.render=function(B,I){this.bindBuffers(B);var E=I.macro_colorByChain?this.chainColor:null;E||(E=this.front?I.proteins_primaryColor:I.proteins_secondaryColor);B.material.setDiffuseColor(E);B.drawElements(B.TRIANGLES,this.vertexIndexBuffer.numItems,
B.UNSIGNED_SHORT,0)};return true};e.Ribbon.prototype=new e._Mesh})(ChemDoodle.RESIDUE,ChemDoodle.structures,Math,vec3);
(function(d,e,a){e.Light=function(f,j,c){this.diffuseRGB=d.getRGB(f,1);this.specularRGB=d.getRGB(j,1);this.direction=c;this.lightScene=function(k){k.uniform3f(k.getUniformLocation(k.program,"u_light.diffuse_color"),this.diffuseRGB[0],this.diffuseRGB[1],this.diffuseRGB[2]);k.uniform3f(k.getUniformLocation(k.program,"u_light.specular_color"),this.specularRGB[0],this.specularRGB[1],this.specularRGB[2]);var b=a.create(this.direction);a.normalize(b);a.negate(b);k.uniform3f(k.getUniformLocation(k.program,
"u_light.direction"),b[0],b[1],b[2]);var g=[0,0,0];b=[g[0]+b[0],g[1]+b[1],g[2]+b[2]];g=a.length(b);if(g==0)b=[0,0,1];else a.scale(1/g);k.uniform3f(k.getUniformLocation(k.program,"u_light.half_vector"),b[0],b[1],b[2])};return true}})(ChemDoodle.math,ChemDoodle.structures,vec3);(function(d){d.Line=function(){this.storeData([0,0,0,0,1,0],[0,0,0,0,0,0]);return true};d.Line.prototype=new d._Mesh})(ChemDoodle.structures);
(function(d,e){e.Material=function(a){var f=a.getUniformLocation(a.program,"u_material.ambient_color"),j=a.getUniformLocation(a.program,"u_material.diffuse_color"),c=a.getUniformLocation(a.program,"u_material.specular_color"),k=a.getUniformLocation(a.program,"u_material.shininess"),b=a.getUniformLocation(a.program,"u_material.alpha");this.setTempColors=function(g,h,l,p){if(!this.aCache||this.aCache!=g){this.aCache=g;g=d.getRGB(g,1);a.uniform3f(f,g[0],g[1],g[2])}if(h!=null&&(!this.dCache||this.dCache!=
h)){this.dCache=h;g=d.getRGB(h,1);a.uniform3f(j,g[0],g[1],g[2])}if(!this.sCache||this.sCache!=l){this.sCache=l;g=d.getRGB(l,1);a.uniform3f(c,g[0],g[1],g[2])}if(!this.snCache||this.snCache!=p){this.snCache=p;a.uniform1f(k,p)}this.alCache=1;a.uniform1f(b,1)};this.setDiffuseColor=function(g){if(!this.dCache||this.dCache!=g){this.dCache=g;g=d.getRGB(g,1);a.uniform3f(j,g[0],g[1],g[2])}};this.setAlpha=function(g){if(!this.alCache||this.alCache!=g){this.alCache=g;a.uniform1f(b,g)}};return true}})(ChemDoodle.math,
ChemDoodle.structures);
(function(d,e,a){d.MolecularSurface=function(f,j,c,k,b){function g(B,I,E,K){var L=B.index;if(B.contained){L=-1;for(var M=Infinity,F=0,H=I.length;F<H;F++)for(var N=I[F],J=0,P=N.length;J<P;J++){var Q=N[J];if(!Q.contained&&Q.index!=E&&Q.index!=K){var O=Q.distance3D(B);if(O<M){L=Q.index;M=O}}}}return L}for(var h=[],l=[],p=[],n=[],q=0;q<=j;q++){var m=q*a.PI/j,u=a.sin(m),v=a.cos(m);for(m=0;m<=c;m++){var r=m*2*a.PI/c;n.push(a.cos(r)*u,v,a.sin(r)*u)}}u=[];q=0;for(m=f.atoms.length;q<m;q++){v=[];var w=f.atoms[q],
t=e[w.label][b]+k,x=[];r=0;for(var z=f.atoms.length;r<z;r++)if(r!=q){var A=f.atoms[r];A.index=r;w.distance3D(A)<t+e[A.label][b]+k&&x.push(A)}r=0;for(z=n.length;r<z;r+=3){for(var C=new d.Atom("C",w.x+t*n[r],w.y+t*n[r+1],w.z+t*n[r+2]),D=0,G=x.length;D<G;D++){A=x[D];if(C.distance3D(A)<e[A.label][b]+k){C.contained=true;break}}v.push(C)}u.push(v)}f=[];c++;for(q=0;q<j;q++)for(m=0;m<c;m++){b=q*c+m%c;k=b+c;f.push(b);f.push(k);f.push(b+1);if(m<c-1){f.push(k);f.push(k+1);f.push(b+1)}}q=D=0;for(m=u.length;q<
m;q++){v=u[q];r=0;for(z=v.length;r<z;r++){C=v[r];if(!C.contained){C.index=D;D++;h.push(C.x,C.y,C.z);l.push(n[r*3],n[r*3+1],n[r*3+2])}}r=0;for(z=f.length;r<z;r+=3){b=v[f[r]];k=v[f[r+1]];C=v[f[r+2]];!b.contained&&!k.contained&&!C.contained&&p.push(b.index,k.index,C.index)}}n=[];q=0;for(m=u.length;q<m;q++){v=u[q];r=0;for(z=f.length;r<z;r+=3){b=v[f[r]];k=v[f[r+1]];C=v[f[r+2]];x=[];D=0;for(G=u.length;D<G;D++)D!=q&&x.push(u[D]);if(!(b.contained&&k.contained&&C.contained)&&(b.contained||k.contained||C.contained)){j=
g(b,x,-1,-1);c=g(k,x,j,-1);x=g(C,x,j,c);if(j!=-1&&c!=-1&&x!=-1){k=false;D=0;for(G=n.length;D<G;D+=3){b=n[D];C=n[D+1];w=n[D+2];t=c==b||c==C||c==w;A=x==b||x==C||x==w;if((j==b||j==C||j==w)&&t&&A){k=true;break}}k||n.push(j,c,x)}}}}p=p.concat(n);this.storeData(h,l,p);return true};d.MolecularSurface.prototype=new d._Mesh})(ChemDoodle.structures,ChemDoodle.ELEMENT,Math);
(function(d,e){d.Shader=function(){this.init=function(a){var f=this.getShader(a,"vertex-shader");if(f==null)f=this.loadDefaultVertexShader(a);var j=this.getShader(a,"fragment-shader");if(j==null)j=this.loadDefaultFragmentShader(a);a.attachShader(a.program,f);a.attachShader(a.program,j);a.linkProgram(a.program);a.getProgramParameter(a.program,a.LINK_STATUS)||alert("Could not initialize shaders: "+a.getProgramInfoLog(program));a.useProgram(a.program);this.vertexPositionAttribute=a.getAttribLocation(a.program,
"a_vertex_position");a.enableVertexAttribArray(this.vertexPositionAttribute);this.vertexNormalAttribute=a.getAttribLocation(a.program,"a_vertex_normal");a.enableVertexAttribArray(this.vertexNormalAttribute)};this.getShader=function(a,f){var j=e.getElementById(f);if(!j)return null;for(var c=[],k=j.firstChild;k;){k.nodeType==3&&c.push(k.textContent);k=k.nextSibling}if(j.type=="x-shader/x-fragment")k=a.createShader(a.FRAGMENT_SHADER);else if(j.type=="x-shader/x-vertex")k=a.createShader(a.VERTEX_SHADER);
else return null;a.shaderSource(k,c.join(""));a.compileShader(k);if(!a.getShaderParameter(k,a.COMPILE_STATUS)){alert(j.type+" "+a.getShaderInfoLog(k));return null}return k};this.loadDefaultVertexShader=function(a){var f=[];f.push("struct Light");f.push("{");f.push("vec3 diffuse_color;");f.push("vec3 specular_color;");f.push("vec3 direction;");f.push("vec3 half_vector;");f.push("};");f.push("struct Material");f.push("{");f.push("vec3 ambient_color;");f.push("vec3 diffuse_color;");f.push("vec3 specular_color;");
f.push("float shininess;");f.push("float alpha;");f.push("};");f.push("attribute vec3 a_vertex_position;");f.push("attribute vec3 a_vertex_normal;");f.push("uniform Light u_light;");f.push("uniform Material u_material;");f.push("uniform mat4 u_model_view_matrix;");f.push("uniform mat4 u_projection_matrix;");f.push("uniform mat3 u_normal_matrix;");f.push("varying vec4 v_diffuse;");f.push("varying vec4 v_ambient;");f.push("varying vec3 v_normal;");f.push("varying vec3 v_light_direction;");f.push("void main(void)");
f.push("{");f.push("if(length(a_vertex_normal)==0.0){");f.push("v_normal = a_vertex_normal;");f.push("}else{");f.push("v_normal = normalize(u_normal_matrix * a_vertex_normal);");f.push("}");f.push("vec4 diffuse = vec4(u_light.diffuse_color, 1.0);");f.push("v_light_direction = u_light.direction;");f.push("v_ambient = vec4(u_material.ambient_color, 1.0);");f.push("v_diffuse = vec4(u_material.diffuse_color, 1.0) * diffuse;");f.push("gl_Position = u_projection_matrix * u_model_view_matrix * vec4(a_vertex_position, 1.0);");
f.push("}");var j=a.createShader(a.VERTEX_SHADER);a.shaderSource(j,f.join(""));a.compileShader(j);if(!a.getShaderParameter(j,a.COMPILE_STATUS)){alert("Vertex shader failed to compile: "+a.getShaderInfoLog(j));return null}return j};this.loadDefaultFragmentShader=function(a){var f=[];f.push("precision mediump float;\n");f.push("struct Light");f.push("{");f.push("vec3 diffuse_color;");f.push("vec3 specular_color;");f.push("vec3 direction;");f.push("vec3 half_vector;");f.push("};");f.push("struct Material");
f.push("{");f.push("vec3 ambient_color;");f.push("vec3 diffuse_color;");f.push("vec3 specular_color;");f.push("float shininess;");f.push("float alpha;");f.push("};");f.push("uniform Light u_light;");f.push("uniform Material u_material;");f.push("varying vec4 v_diffuse;");f.push("varying vec4 v_ambient;");f.push("varying vec3 v_normal;");f.push("varying vec3 v_light_direction;");f.push("void main(void)");f.push("{");f.push("if(length(v_normal)==0.0){");f.push("gl_FragColor = vec4(v_diffuse.rgba);");
f.push("}else{");f.push("float nDotL = max(dot(v_normal, v_light_direction), 0.0);");f.push("vec4 color = vec4(v_diffuse.rgb*nDotL, v_diffuse.a);");f.push("float nDotHV = max(dot(v_normal, u_light.half_vector), 0.0);");f.push("vec4 specular = vec4(u_material.specular_color * u_light.specular_color, 1.0);");f.push("color+=vec4(specular.rgb * pow(nDotHV, u_material.shininess), specular.a);");f.push("gl_FragColor = color+v_ambient;");f.push("gl_FragColor.a*=u_material.alpha;");f.push("}");f.push("}");
var j=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(j,f.join(""));a.compileShader(j);if(!a.getShaderParameter(j,a.COMPILE_STATUS)){alert("Fragment shader failed to compile: "+a.getShaderInfoLog(j));return null}return j};return true}})(ChemDoodle.structures,document);
(function(d,e){d.Shape=function(a,f){for(var j=a.length,c=[],k=[],b=new d.Point,g=0,h=j;g<h;g++){var l=g+1;if(g==h-1)l=0;var p=a[g];l=a[l];for(var n=e.cross([0,0,1],[l.x-p.x,l.y-p.y,0]),q=0;q<2;q++){c.push(p.x,p.y,f/2);c.push(p.x,p.y,-f/2);c.push(l.x,l.y,f/2);c.push(l.x,l.y,-f/2)}for(q=0;q<4;q++)k.push(n[0],n[1],n[2]);k.push(0,0,1);k.push(0,0,-1);k.push(0,0,1);k.push(0,0,-1);b.add(p)}b.x/=j;b.y/=j;k.push(0,0,1);c.push(b.x,b.y,f/2);k.push(0,0,-1);c.push(b.x,b.y,-f/2);b=[];p=j*8;g=0;for(h=j;g<h;g++){j=
g*8;b.push(j);b.push(j+1);b.push(j+3);b.push(j);b.push(j+2);b.push(j+3);b.push(j+4);b.push(j+6);b.push(p);b.push(j+5);b.push(j+7);b.push(p+1)}this.storeData(c,k,b);return true};d.Shape.prototype=new d._Mesh})(ChemDoodle.structures,vec3);
(function(d,e,a){d.Star=function(){for(var f=[0.8944,0.4472,0,0.2764,0.4472,0.8506,0.2764,0.4472,-0.8506,-0.7236,0.4472,0.5257,-0.7236,0.4472,-0.5257,-0.3416,0.4472,0,-0.1056,0.4472,0.3249,-0.1056,0.4472,-0.3249,0.2764,0.4472,0.2008,0.2764,0.4472,-0.2008,-0.8944,-0.4472,0,-0.2764,-0.4472,0.8506,-0.2764,-0.4472,-0.8506,0.7236,-0.4472,0.5257,0.7236,-0.4472,-0.5257,0.3416,-0.4472,0,0.1056,-0.4472,0.3249,0.1056,-0.4472,-0.3249,-0.2764,-0.4472,0.2008,-0.2764,-0.4472,-0.2008,-0.5527,0.1058,0,-0.1708,0.1058,
0.5527,-0.1708,0.1058,-0.5527,0.4471,0.1058,0.3249,0.4471,0.1058,-0.3249,0.5527,-0.1058,0,0.1708,-0.1058,0.5527,0.1708,-0.1058,-0.5527,-0.4471,-0.1058,0.3249,-0.4471,-0.1058,-0.3249,0,1,0,0,-1,0],j=[0,9,8,2,7,9,4,5,7,3,6,5,1,8,6,0,8,23,30,6,8,3,21,6,11,26,21,13,23,26,2,9,24,30,8,9,1,23,8,13,25,23,14,24,25,4,7,22,30,9,7,0,24,9,14,27,24,12,22,27,3,5,20,30,7,5,2,22,7,12,29,22,10,20,29,1,6,21,30,5,6,4,20,5,10,28,20,11,21,28,10,19,18,12,17,19,14,15,17,13,16,15,11,18,16,31,19,17,14,17,27,2,27,22,4,22,29,
10,29,19,31,18,19,12,19,29,4,29,20,3,20,28,11,28,18,31,16,18,10,18,28,3,28,21,1,21,26,13,26,16,31,15,16,11,16,26,1,26,23,0,23,25,14,25,15,31,17,15,13,15,25,0,25,24,2,24,27,12,27,17],c=[],k=[],b=[],g=0,h=j.length;g<h;g+=3){var l=j[g]*3,p=j[g+1]*3,n=j[g+2]*3;l=[f[l],f[l+1],f[l+2]];p=[f[p],f[p+1],f[p+2]];n=[f[n],f[n+1],f[n+2]];var q=a.cross([n[0]-p[0],n[1]-p[1],n[2]-p[2]],[l[0]-p[0],l[1]-p[1],l[2]-p[2]],[]);a.normalize(q);c.push(l[0],l[1],l[2],p[0],p[1],p[2],n[0],n[1],n[2]);k.push(q[0],q[1],q[2],q[0],
q[1],q[2],q[0],q[1],q[2]);b.push(g,g+1,g+2)}this.storeData(c,k,b);return true};d.Star.prototype=new d._Mesh})(ChemDoodle.structures,Math,vec3);
(function(d,e,a,f,j,c){var k=function(b,g,h){var l=f.sqrt(g[1]*g[1]+g[2]*g[2]),p=[1,0,0,0,0,g[2]/l,-g[1]/l,0,0,g[1]/l,g[2]/l,0,0,0,0,1],n=[1,0,0,0,0,g[2]/l,g[1]/l,0,0,-g[1]/l,g[2]/l,0,0,0,0,1],q=[l,0,-g[0],0,0,1,0,0,g[0],0,l,0,0,0,0,1];g=[l,0,g[0],0,0,1,0,0,-g[0],0,l,0,0,0,0,1];h=[f.cos(h),-f.sin(h),0,0,f.sin(h),f.cos(h),0,0,0,0,1,0,0,0,0,1];var m=j.multiply(p,j.multiply(q,j.multiply(h,j.multiply(g,n,[]))));this.rotate=function(){return j.multiplyVec3(m,b)}};a.Tube=function(b,g,h){var l=b[0].lineSegments[0].length,
p=[],n=[];this.ends=[];this.ends.push(b[0].lineSegments[0][0]);this.ends.push(b[b.length-2].lineSegments[0][0]);for(var q=[1,0,0],m=0,u=b.length-1;m<u;m++)for(var v=b[m],r=Infinity,w=new a.Atom("",b[m+1].cp1.x,b[m+1].cp1.y,b[m+1].cp1.z),t=0;t<l;t++){var x=v.lineSegments[0][t],z=null;z=t==l-1?m==b.length-2?v.lineSegments[0][t-1]:b[m+1].lineSegments[0][0]:v.lineSegments[0][t+1];z=[z.x-x.x,z.y-x.y,z.z-x.z];c.normalize(z);m==b.length-2&&t==l-1&&c.scale(z,-1);var A=vec3.cross(z,q,[]);c.normalize(A);c.scale(A,
g/2);A=new k(A,z,2*Math.PI/h);z=0;for(var C=h;z<C;z++){var D=A.rotate();if(z==f.floor(h/4))q=[D[0],D[1],D[2]];n.push(D[0],D[1],D[2]);p.push(x.x+D[0],x.y+D[1],x.z+D[2])}if(w!=null){z=x.distance3D(w);if(z<r){r=z;b[m+1].pPoint=x}}}q=[];m=0;for(u=b.length-2;m<u;m++){v=m*l*h;t=0;for(r=l;t<r;t++){w=v+t*h;for(z=0;z<h;z++){if(z==h-1)nextRes=m==b.length-2?0:-z;x=w+z;q.push(x);q.push(x+h);q.push(x+h+1);q.push(x);q.push(x+1);q.push(x+h+1)}}}this.storeData(p,n,q);h=[new a.Point(2,0)];for(m=0;m<60;m++){l=m/60*
f.PI;h.push(new a.Point(2*f.cos(l),-2*f.sin(l)))}h.push(new a.Point(-2,0),new a.Point(-2,4),new a.Point(2,4));var G=new a.Shape(h,1);this.render=function(B,I){this.bindBuffers(B);B.material.setDiffuseColor(I.macro_colorByChain?this.chainColor:I.nucleics_tubeColor);B.drawElements(B.TRIANGLES,this.vertexIndexBuffer.numItems,B.UNSIGNED_SHORT,0);B.sphereBuffer.bindBuffers(B);for(var E=0;E<2;E++){var K=this.ends[E];K=j.translate(B.modelViewMatrix,[K.x,K.y,K.z],[]);var L=g/2;j.scale(K,[L,L,L]);B.setMatrixUniforms(K);
B.drawElements(B.TRIANGLES,B.sphereBuffer.vertexIndexBuffer.numItems,B.UNSIGNED_SHORT,0)}B.cylinderBuffer.bindBuffers(B);E=1;for(L=b.length-1;E<L;E++){var M=b[E],F=M.pPoint,H=new a.Atom("",M.cp2.x,M.cp2.y,M.cp2.z);K=1.001*F.distance3D(H);M=[g/4,K,g/4];K=j.translate(B.modelViewMatrix,[F.x,F.y,F.z],[]);var N=[0,1,0],J=0,P=null,Q=[H.x-F.x,H.y-F.y,H.z-F.z];if(F.x==H.x&&F.z==H.z){P=[0,0,1];if(F.y<F.y)J=f.PI}else{J=d.vec3AngleFrom(N,Q);P=c.cross(N,Q,[])}J!=0&&j.rotate(K,J,P);j.scale(K,M);B.setMatrixUniforms(K);
B.drawArrays(B.TRIANGLE_STRIP,0,B.cylinderBuffer.vertexPositionBuffer.numItems)}G.bindBuffers(B);!I.nucleics_useShapelyColors&&!I.macro_colorByChain&&B.material.setDiffuseColor(I.nucleics_baseColor);E=1;for(L=b.length-1;E<L;E++){M=b[E];H=M.cp2;K=j.translate(B.modelViewMatrix,[H.x,H.y,H.z],[]);N=[0,1,0];J=0;F=M.cp3;Q=[F.x-H.x,F.y-H.y,F.z-H.z];if(H.x==F.x&&H.z==F.z){P=[0,0,1];if(H.y<H.y)J=f.PI}else{J=d.vec3AngleFrom(N,Q);P=c.cross(N,Q,[])}J!=0&&j.rotate(K,J,P);H=[1,0,0];J=j.rotate(j.identity([]),J,
P);j.multiplyVec3(J,H);J=M.cp4;F=M.cp5;if(!(J.y==F.y&&J.z==F.z)){J=[F.x-J.x,F.y-J.y,F.z-J.z];F=d.vec3AngleFrom(H,J);if(c.dot(Q,c.cross(H,J))<0)F*=-1;j.rotateY(K,F)}if(I.nucleics_useShapelyColors&&!I.macro_colorByChain)e[M.name]?B.material.setDiffuseColor(e[M.name].shapelyColor):B.material.setDiffuseColor(e["*"].shapelyColor);B.setMatrixUniforms(K);B.drawElements(B.TRIANGLES,G.vertexIndexBuffer.numItems,B.UNSIGNED_SHORT,0)}};return true};a.Tube.prototype=new a._Mesh})(ChemDoodle.extensions,ChemDoodle.RESIDUE,
ChemDoodle.structures,Math,mat4,vec3);
(function(d){d.UnitCell=function(e){var a=[],f=[],j=function(k,b,g,h){a.push(k[0],k[1],k[2]);a.push(b[0],b[1],b[2]);a.push(g[0],g[1],g[2]);a.push(h[0],h[1],h[2]);for(k=0;k<4;k++)f.push(0,0,0)};j(e.o,e.x,e.xy,e.y);j(e.o,e.y,e.yz,e.z);j(e.o,e.z,e.xz,e.x);j(e.yz,e.y,e.xy,e.xyz);j(e.xyz,e.xz,e.z,e.yz);j(e.xy,e.x,e.xz,e.xyz);e=[];for(j=0;j<6;j++){var c=j*4;e.push(c,c+1,c+1,c+2,c+2,c+3,c+3,c)}this.storeData(a,f,e);return true};d.UnitCell.prototype=new d._Mesh})(ChemDoodle.structures,vec3);
(function(d,e,a){d.Plate=function(f){this.lanes=Array(f);i=0;for(ii=f;i<ii;i++)this.lanes[i]=[];this.sort=function(){i=0;for(ii=this.lanes.length;i<ii;i++)this.lanes[i].sort(function(j,c){return j-c})};this.draw=function(j){var c=j.canvas.width,k=j.canvas.height;this.origin=9*k/10;this.front=k/10;this.laneLength=this.origin-this.front;j.strokeStyle="#000000";j.beginPath();j.moveTo(0,this.front);e.contextHashTo(j,0,this.front,c,this.front,3,3);j.closePath();j.stroke();j.beginPath();j.moveTo(0,this.origin);
j.lineTo(c,this.origin);j.closePath();j.stroke();i=0;for(ii=this.lanes.length;i<ii;i++){k=(i+1)*c/(ii+1);j.beginPath();j.moveTo(k,this.origin);j.lineTo(k,this.origin+3);j.closePath();j.stroke();s=0;for(ss=this.lanes[i].length;s<ss;s++){var b=this.origin-this.laneLength*this.lanes[i][s].rf;switch(this.lanes[i][s].type){case "compact":j.beginPath();j.arc(k,b,3,0,2*a.PI,false);j.closePath();break;case "expanded":j.beginPath();j.arc(k,b,7,0,2*a.PI,false);j.closePath();break;case "trailing":break;case "widened":e.contextOval(j,
k-18,b-10,36,10);break;case "cresent":j.beginPath();j.arc(k,b,9,0,a.PI,true);j.closePath();break}switch(this.lanes[i][s].style){case "solid":j.fillStyle="#000000";j.fill();break;case "transparent":j.stroke();break;case "gradient":break}}}};return true};d.Plate.Spot=function(f,j,c){this.type=f;this.rf=j;this.style=c?c:"solid"}})(ChemDoodle.structures,ChemDoodle.extensions,Math);
(function(d,e,a){d.default_backgroundColor="#FFFFFF";d.default_scale=1;d.default_rotateAngle=0;d.default_bondLength_2D=20;d.default_angstromsPerBondLength=1.25;d.default_lightDirection_3D=[-0.1,-0.1,-1];d.default_lightDiffuseColor_3D="#FFFFFF";d.default_lightSpecularColor_3D="#FFFFFF";d.default_projectionPerspective_3D=true;d.default_projectionPerspectiveVerticalFieldOfView_3D=45;d.default_projectionOrthoWidth_3D=40;d.default_projectionWidthHeightRatio_3D=1;d.default_projectionFrontCulling_3D=0.1;
d.default_projectionBackCulling_3D=1E4;d.default_atoms_display=true;d.default_atoms_color="#000000";d.default_atoms_font_size_2D=12;d.default_atoms_font_families_2D=["Helvetica","Arial","Dialog"];d.default_atoms_font_bold_2D=false;d.default_atoms_font_italic_2D=false;d.default_atoms_circles_2D=false;d.default_atoms_circleDiameter_2D=10;d.default_atoms_circleBorderWidth_2D=1;d.default_atoms_lonePairDistance_2D=8;d.default_atoms_lonePairSpread_2D=4;d.default_atoms_lonePairDiameter_2D=1;d.default_atoms_useJMOLColors=
false;d.default_atoms_usePYMOLColors=false;d.default_atoms_resolution_3D=60;d.default_atoms_sphereDiameter_3D=0.8;d.default_atoms_useVDWDiameters_3D=false;d.default_atoms_vdwMultiplier_3D=1;d.default_atoms_materialAmbientColor_3D="#000000";d.default_atoms_materialSpecularColor_3D="#555555";d.default_atoms_materialShininess_3D=32;d.default_atoms_implicitHydrogens_2D=true;d.default_atoms_displayTerminalCarbonLabels_2D=false;d.default_atoms_showHiddenCarbons_2D=true;d.default_atoms_displayAllCarbonLabels_2D=
false;d.default_atoms_nonBondedAsStars_3D=false;d.default_bonds_display=true;d.default_bonds_color="#000000";d.default_bonds_width_2D=1;d.default_bonds_saturationWidth_2D=0.2;d.default_bonds_ends_2D="round";d.default_bonds_useJMOLColors=false;d.default_bonds_usePYMOLColors=false;d.default_bonds_colorGradient=false;d.default_bonds_saturationAngle_2D=a.PI/3;d.default_bonds_symmetrical_2D=false;d.default_bonds_clearOverlaps_2D=false;d.default_bonds_overlapClearWidth_2D=0.5;d.default_bonds_atomLabelBuffer_2D=
0.25;d.default_bonds_wedgeThickness_2D=0.22;d.default_bonds_hashWidth_2D=1;d.default_bonds_hashSpacing_2D=2.5;d.default_bonds_showBondOrders_3D=false;d.default_bonds_resolution_3D=60;d.default_bonds_renderAsLines_3D=false;d.default_bonds_cylinderDiameter_3D=0.3;d.default_bonds_materialAmbientColor_3D="#222222";d.default_bonds_materialSpecularColor_3D="#555555";d.default_bonds_materialShininess_3D=32;d.default_proteins_displayRibbon=true;d.default_proteins_displayBackbone=false;d.default_proteins_backboneThickness=
1.5;d.default_proteins_backboneColor="#CCCCCC";d.default_proteins_ribbonCartoonize=false;d.default_proteins_useShapelyColors=false;d.default_proteins_useAminoColors=false;d.default_proteins_usePolarityColors=false;d.default_proteins_primaryColor="#FF0D0D";d.default_proteins_secondaryColor="#FFFF30";d.default_proteins_ribbonCartoonHelixPrimaryColor="#00E740";d.default_proteins_ribbonCartoonHelixSecondaryColor="#9905FF";d.default_proteins_ribbonCartoonSheetColor="#E8BB99";d.default_proteins_ribbonThickness=
0.2;d.default_proteins_materialAmbientColor_3D="#222222";d.default_proteins_materialSpecularColor_3D="#555555";d.default_proteins_materialShininess_3D=32;d.default_nucleics_display=true;d.default_nucleics_tubeColor="#CCCCCC";d.default_nucleics_baseColor="#C10000";d.default_nucleics_useShapelyColors=true;d.default_nucleics_tubeThickness=1.5;d.default_nucleics_tubeResolution_3D=60;d.default_nucleics_materialAmbientColor_3D="#222222";d.default_nucleics_materialSpecularColor_3D="#555555";d.default_nucleics_materialShininess_3D=
32;d.default_macro_displayAtoms=false;d.default_macro_displayBonds=false;d.default_macro_atomToLigandDistance=-1;d.default_macro_showWater=false;d.default_macro_colorByChain=false;d.default_surfaces_display=true;d.default_surfaces_style="Dot";d.default_surfaces_color="#E9B862";d.default_surfaces_materialAmbientColor_3D="#000000";d.default_surfaces_materialSpecularColor_3D="#000000";d.default_surfaces_materialShininess_3D=32;d.default_crystals_displayUnitCell=true;d.default_crystals_unitCellColor=
"green";d.default_crystals_unitCellLineWidth=1;d.default_plots_color="#000000";d.default_plots_width=1;d.default_plots_showIntegration=false;d.default_plots_integrationColor="#c10000";d.default_plots_integrationLineWidth=1;d.default_plots_showGrid=false;d.default_plots_gridColor="gray";d.default_plots_gridLineWidth=0.5;d.default_plots_showYAxis=true;d.default_plots_flipXAxis=false;d.default_text_font_size=12;d.default_text_font_families=["Helvetica","Arial","Dialog"];d.default_text_color="#000000";
e.VisualSpecifications=function(){this.backgroundColor=d.default_backgroundColor;this.scale=d.default_scale;this.rotateAngle=d.default_rotateAngle;this.bondLength=d.default_bondLength_2D;this.angstromsPerBondLength=d.default_angstromsPerBondLength;this.lightDirection_3D=d.default_lightDirection_3D;this.lightDiffuseColor_3D=d.default_lightDiffuseColor_3D;this.lightSpecularColor_3D=d.default_lightSpecularColor_3D;this.projectionPerspective_3D=d.default_projectionPerspective_3D;this.projectionPerspectiveVerticalFieldOfView_3D=
d.default_projectionPerspectiveVerticalFieldOfView_3D;this.projectionOrthoWidth_3D=d.default_projectionOrthoWidth_3D;this.projectionWidthHeightRatio_3D=d.default_projectionWidthHeightRatio_3D;this.projectionFrontCulling_3D=d.default_projectionFrontCulling_3D;this.projectionBackCulling_3D=d.default_projectionBackCulling_3D;this.atoms_display=d.default_atoms_display;this.atoms_color=d.default_atoms_color;this.atoms_font_size_2D=d.default_atoms_font_size_2D;this.atoms_font_families_2D=[];for(var f=0,
j=d.default_atoms_font_families_2D.length;f<j;f++)this.atoms_font_families_2D[f]=d.default_atoms_font_families_2D[f];this.atoms_font_bold_2D=d.default_atoms_font_bold_2D;this.atoms_font_italic_2D=d.default_atoms_font_italic_2D;this.atoms_circles_2D=d.default_atoms_circles_2D;this.atoms_circleDiameter_2D=d.default_atoms_circleDiameter_2D;this.atoms_circleBorderWidth_2D=d.default_atoms_circleBorderWidth_2D;this.atoms_lonePairDistance_2D=d.default_atoms_lonePairDistance_2D;this.atoms_lonePairSpread_2D=
d.default_atoms_lonePairSpread_2D;this.atoms_lonePairDiameter_2D=d.default_atoms_lonePairDiameter_2D;this.atoms_useJMOLColors=d.default_atoms_useJMOLColors;this.atoms_usePYMOLColors=d.default_atoms_usePYMOLColors;this.atoms_resolution_3D=d.default_atoms_resolution_3D;this.atoms_sphereDiameter_3D=d.default_atoms_sphereDiameter_3D;this.atoms_useVDWDiameters_3D=d.default_atoms_useVDWDiameters_3D;this.atoms_vdwMultiplier_3D=d.default_atoms_vdwMultiplier_3D;this.atoms_materialAmbientColor_3D=d.default_atoms_materialAmbientColor_3D;
this.atoms_materialSpecularColor_3D=d.default_atoms_materialSpecularColor_3D;this.atoms_materialShininess_3D=d.default_atoms_materialShininess_3D;this.atoms_implicitHydrogens_2D=d.default_atoms_implicitHydrogens_2D;this.atoms_displayTerminalCarbonLabels_2D=d.default_atoms_displayTerminalCarbonLabels_2D;this.atoms_showHiddenCarbons_2D=d.default_atoms_showHiddenCarbons_2D;this.atoms_displayAllCarbonLabels_2D=d.default_atoms_displayAllCarbonLabels_2D;this.atoms_nonBondedAsStars_3D=d.default_atoms_nonBondedAsStars_3D;
this.bonds_display=d.default_bonds_display;this.bonds_color=d.default_bonds_color;this.bonds_width_2D=d.default_bonds_width_2D;this.bonds_saturationWidth_2D=d.default_bonds_saturationWidth_2D;this.bonds_ends_2D=d.default_bonds_ends_2D;this.bonds_useJMOLColors=d.default_bonds_useJMOLColors;this.bonds_usePYMOLColors=d.default_bonds_usePYMOLColors;this.bonds_colorGradient=d.default_bonds_colorGradient;this.bonds_saturationAngle_2D=d.default_bonds_saturationAngle_2D;this.bonds_symmetrical_2D=d.default_bonds_symmetrical_2D;
this.bonds_clearOverlaps_2D=d.default_bonds_clearOverlaps_2D;this.bonds_overlapClearWidth_2D=d.default_bonds_overlapClearWidth_2D;this.bonds_atomLabelBuffer_2D=d.default_bonds_atomLabelBuffer_2D;this.bonds_wedgeThickness_2D=d.default_bonds_wedgeThickness_2D;this.bonds_hashWidth_2D=d.default_bonds_hashWidth_2D;this.bonds_hashSpacing_2D=d.default_bonds_hashSpacing_2D;this.bonds_showBondOrders_3D=d.default_bonds_showBondOrders_3D;this.bonds_resolution_3D=d.default_bonds_resolution_3D;this.bonds_renderAsLines_3D=
d.default_bonds_renderAsLines_3D;this.bonds_cylinderDiameter_3D=d.default_bonds_cylinderDiameter_3D;this.bonds_materialAmbientColor_3D=d.default_bonds_materialAmbientColor_3D;this.bonds_materialSpecularColor_3D=d.default_bonds_materialSpecularColor_3D;this.bonds_materialShininess_3D=d.default_bonds_materialShininess_3D;this.proteins_displayRibbon=d.default_proteins_displayRibbon;this.proteins_displayBackbone=d.default_proteins_displayBackbone;this.proteins_backboneThickness=d.default_proteins_backboneThickness;
this.proteins_backboneColor=d.default_proteins_backboneColor;this.proteins_ribbonCartoonize=d.default_proteins_ribbonCartoonize;this.proteins_useShapelyColors=d.default_proteins_useShapelyColors;this.proteins_useAminoColors=d.default_proteins_useAminoColors;this.proteins_usePolarityColors=d.default_proteins_usePolarityColors;this.proteins_primaryColor=d.default_proteins_primaryColor;this.proteins_secondaryColor=d.default_proteins_secondaryColor;this.proteins_ribbonCartoonHelixPrimaryColor=d.default_proteins_ribbonCartoonHelixPrimaryColor;
this.proteins_ribbonCartoonHelixSecondaryColor=d.default_proteins_ribbonCartoonHelixSecondaryColor;this.proteins_ribbonCartoonSheetColor=d.default_proteins_ribbonCartoonSheetColor;this.proteins_ribbonThickness=d.default_proteins_ribbonThickness;this.proteins_materialAmbientColor_3D=d.default_proteins_materialAmbientColor_3D;this.proteins_materialSpecularColor_3D=d.default_proteins_materialSpecularColor_3D;this.proteins_materialShininess_3D=d.default_proteins_materialShininess_3D;this.macro_displayAtoms=
d.default_macro_displayAtoms;this.macro_displayBonds=d.default_macro_displayBonds;this.macro_atomToLigandDistance=d.default_macro_atomToLigandDistance;this.nucleics_display=d.default_nucleics_display;this.nucleics_tubeColor=d.default_nucleics_tubeColor;this.nucleics_baseColor=d.default_nucleics_baseColor;this.nucleics_useShapelyColors=d.default_nucleics_useShapelyColors;this.nucleics_tubeThickness=d.default_nucleics_tubeThickness;this.nucleics_tubeResolution_3D=d.default_nucleics_tubeResolution_3D;
this.nucleics_materialAmbientColor_3D=d.default_nucleics_materialAmbientColor_3D;this.nucleics_materialSpecularColor_3D=d.default_nucleics_materialSpecularColor_3D;this.nucleics_materialShininess_3D=d.default_nucleics_materialShininess_3D;this.macro_showWater=d.default_macro_showWater;this.macro_colorByChain=d.default_macro_colorByChain;this.surfaces_display=d.default_surfaces_display;this.surfaces_style=d.default_surfaces_style;this.surfaces_color=d.default_surfaces_color;this.surfaces_materialAmbientColor_3D=
d.default_surfaces_materialAmbientColor_3D;this.surfaces_materialSpecularColor_3D=d.default_surfaces_materialSpecularColor_3D;this.surfaces_materialShininess_3D=d.default_surfaces_materialShininess_3D;this.crystals_displayUnitCell=d.default_crystals_displayUnitCell;this.crystals_unitCellColor=d.default_crystals_unitCellColor;this.crystals_unitCellLineWidth=d.default_crystals_unitCellLineWidth;this.plots_color=d.default_plots_color;this.plots_width=d.default_plots_width;this.plots_showIntegration=
d.default_plots_showIntegration;this.plots_integrationColor=d.default_plots_integrationColor;this.plots_integrationLineWidth=d.default_plots_integrationLineWidth;this.plots_showGrid=d.default_plots_showGrid;this.plots_gridColor=d.default_plots_gridColor;this.plots_gridLineWidth=d.default_plots_gridLineWidth;this.plots_showYAxis=d.default_plots_showYAxis;this.plots_flipXAxis=d.default_plots_flipXAxis;this.text_font_size=d.default_text_font_size;this.text_font_families=[];f=0;for(j=d.default_text_font_families.length;f<
j;f++)this.text_font_families[f]=d.default_text_font_families[f];this.text_color=d.default_text_color;this.set3DRepresentation=function(c){this.bonds_display=this.atoms_display=true;this.bonds_color="#777777";this.bonds_showBondOrders_3D=this.bonds_useJMOLColors=this.atoms_useJMOLColors=this.atoms_useVDWDiameters_3D=true;this.bonds_renderAsLines_3D=false;if(c=="Ball and Stick"){this.atoms_vdwMultiplier_3D=0.3;this.bonds_useJMOLColors=false;this.bonds_cylinderDiameter_3D=0.3;this.bonds_materialAmbientColor_3D=
d.default_atoms_materialAmbientColor_3D}else if(c=="van der Waals Spheres"){this.bonds_display=false;this.atoms_vdwMultiplier_3D=1}else if(c=="Stick"){this.bonds_showBondOrders_3D=this.atoms_useVDWDiameters_3D=false;this.bonds_cylinderDiameter_3D=this.atoms_sphereDiameter_3D=0.8;this.bonds_materialAmbientColor_3D=this.atoms_materialAmbientColor_3D}else if(c=="Wireframe"){this.atoms_useVDWDiameters_3D=false;this.bonds_cylinderDiameter_3D=0.05;this.atoms_sphereDiameter_3D=0.15;this.bonds_materialAmbientColor_3D=
d.default_atoms_materialAmbientColor_3D}else if(c=="Line"){this.atoms_display=false;this.bonds_renderAsLines_3D=true;this.bonds_width_2D=1;this.bonds_cylinderDiameter_3D=0.05}else alert('"'+c+'" is not recognized. Use one of the following strings:\n\n1. Ball and Stick\n2. van der Waals Spheres\n3. Stick\n4. Wireframe\n5. Line\n')};this.getFontString=function(c,k,b,g){var h=[];b&&h.push("bold ");g&&h.push("italic ");h.push(c+"px ");c=0;for(b=k.length;c<b;c++){g=k[c];if(g.indexOf(" ")!=-1)g='"'+g+'"';
h.push((c!=0?",":"")+g)}return h.join("")}}})(ChemDoodle,ChemDoodle.structures,Math);
(function(d,e,a,f){a.getPointsPerAngstrom=function(){return d.default_bondLength_2D/d.default_angstromsPerBondLength};a.BondDeducer=function(){this.margin=1.1;this.deduceCovalentBonds=function(j,c){var k=a.getPointsPerAngstrom();if(c)k=c;for(var b=0,g=j.atoms.length;b<g;b++)for(var h=b+1;h<g;h++){var l=j.atoms[b],p=j.atoms[h];l.distance3D(p)<(e[l.label].covalentRadius+e[p.label].covalentRadius)*k*this.margin&&j.bonds.push(new f.Bond(l,p,1))}};return true}})(ChemDoodle,ChemDoodle.ELEMENT,ChemDoodle.informatics,
ChemDoodle.structures);(function(d){d.HydrogenDeducer=function(){this.removeHydrogens=function(e){for(var a=[],f=[],j=0,c=e.bonds.length;j<c;j++)e.bonds[j].a1.label!="H"&&e.bonds[j].a2.label!="H"&&f.push(e.bonds[j]);j=0;for(c=e.atoms.length;j<c;j++)e.atoms[j].label!="H"&&a.push(e.atoms[j]);e.atoms=a;e.bonds=f};return true}})(ChemDoodle.informatics);
(function(d,e,a){e.MolecularSurfaceGenerator=function(){this.generateSurface=function(f,j,c,k,b){return new a.MolecularSurface(f,j,c,k,b)};return true}})(ChemDoodle,ChemDoodle.informatics,ChemDoodle.structures);
(function(d,e){d.Splitter=function(){this.split=function(a){for(var f=[],j=0,c=a.atoms.length;j<c;j++)a.atoms[j].visited=false;j=0;for(c=a.bonds.length;j<c;j++)a.bonds[j].visited=false;j=0;for(c=a.atoms.length;j<c;j++){var k=a.atoms[j];if(!k.visited){var b=new e.Molecule;b.atoms.push(k);k.visited=true;var g=new e.Queue;for(g.enqueue(k);!g.isEmpty();){k=g.dequeue();for(var h=0,l=a.bonds.length;h<l;h++){var p=a.bonds[h];if(p.contains(k)&&!p.visited){p.visited=true;b.bonds.push(p);p=p.getNeighbor(k);
if(!p.visited){p.visited=true;b.atoms.push(p);g.enqueue(p)}}}}f.push(b)}}return f};return true}})(ChemDoodle.informatics,ChemDoodle.structures);
(function(d,e){d.StructureBuilder=function(){this.copy=function(a){for(var f=0,j=a.atoms.length;f<j;f++)a.atoms[f].metaID=f;var c=new e.Molecule;f=0;for(j=a.atoms.length;f<j;f++)c.atoms[f]=new e.Atom(a.atoms[f].label,a.atoms[f].x,a.atoms[f].y,a.atoms[f].z);f=0;for(j=a.bonds.length;f<j;f++)c.bonds[f]=new e.Bond(c.atoms[a.bonds[f].a1.metaID],c.atoms[a.bonds[f].a2.metaID],a.bonds[f].bondOrder);return c};return true}})(ChemDoodle.informatics,ChemDoodle.structures);
(function(d){d._Counter=function(){this.value=0;this.molecule=null;this.setMolecule=function(e){this.value=0;this.molecule=e;this.innerCalculate&&this.innerCalculate()};return true}})(ChemDoodle.informatics);(function(d){d.FrerejacqueNumberCounter=function(e){this.setMolecule(e);return true};d.FrerejacqueNumberCounter.prototype=new d._Counter;d.FrerejacqueNumberCounter.prototype.innerCalculate=function(){this.value=this.molecule.bonds.length-this.molecule.atoms.length+(new d.NumberOfMoleculesCounter(this.molecule)).value}})(ChemDoodle.informatics);
(function(d,e){e.NumberOfMoleculesCounter=function(a){this.setMolecule(a);return true};e.NumberOfMoleculesCounter.prototype=new e._Counter;e.NumberOfMoleculesCounter.prototype.innerCalculate=function(){for(var a=0,f=this.molecule.atoms.length;a<f;a++)this.molecule.atoms[a].visited=false;a=0;for(f=this.molecule.atoms.length;a<f;a++)if(!this.molecule.atoms[a].visited){this.value++;var j=new d.Queue;this.molecule.atoms[a].visited=true;for(j.enqueue(this.molecule.atoms[a]);!j.isEmpty();)for(var c=j.dequeue(),
k=0,b=this.molecule.bonds.length;k<b;k++){var g=this.molecule.bonds[k];if(g.contains(c)){g=g.getNeighbor(c);if(!g.visited){g.visited=true;j.enqueue(g)}}}}}})(ChemDoodle.structures,ChemDoodle.informatics);
(function(d,e){d._RingFinder=function(){this.rings=this.bonds=this.atoms=null;this.reduce=function(a){for(var f=0,j=a.atoms.length;f<j;f++)a.atoms[f].visited=false;f=0;for(j=a.bonds.length;f<j;f++)a.bonds[f].visited=false;for(var c=true;c;){c=false;f=0;for(j=a.atoms.length;f<j;f++){for(var k=0,b=null,g=0,h=a.bonds.length;g<h;g++)if(a.bonds[g].contains(a.atoms[f])&&!a.bonds[g].visited){k++;if(k==2)break;b=a.bonds[g]}if(k==1){c=true;b.visited=true;a.atoms[f].visited=true}}}f=0;for(j=a.atoms.length;f<
j;f++)a.atoms[f].visited||this.atoms.push(a.atoms[f]);f=0;for(j=a.bonds.length;f<j;f++)a.bonds[f].visited||this.bonds.push(a.bonds[f]);if(this.bonds.length==0&&this.atoms.length!=0)this.atoms=[]};this.setMolecule=function(a){this.atoms=[];this.bonds=[];this.rings=[];this.reduce(a);this.atoms.length>2&&this.innerGetRings&&this.innerGetRings()};this.fuse=function(){for(var a=0,f=this.rings.length;a<f;a++)for(var j=0,c=this.bonds.length;j<c;j++)e(this.bonds[j].a1,this.rings[a].atoms)!=-1&&e(this.bonds[j].a2,
this.rings[a].atoms)!=-1&&this.rings[a].bonds.push(this.bonds[j])};return true}})(ChemDoodle.informatics,jQuery.inArray);
(function(d,e,a){function f(j,c){this.atoms=[];if(c)for(var k=0,b=c.atoms.length;k<b;k++)this.atoms[k]=c.atoms[k];this.atoms.push(j);this.grow=function(g,h){for(var l=this.atoms[this.atoms.length-1],p=[],n=0,q=g.length;n<q;n++)if(g[n].contains(l)){var m=g[n].getNeighbor(l);a(m,h)==-1&&p.push(m)}l=[];n=0;for(q=p.length;n<q;n++)l.push(new f(p[n],this));return l};this.check=function(g,h,l){for(var p=0,n=h.atoms.length-1;p<n;p++)if(a(h.atoms[p],this.atoms)!=-1)return null;var q=null;if(h.atoms[h.atoms.length-
1]==this.atoms[this.atoms.length-1]){q=new e.Ring;q.atoms[0]=l;p=0;for(n=this.atoms.length;p<n;p++)q.atoms.push(this.atoms[p]);for(p=h.atoms.length-2;p>=0;p--)q.atoms.push(h.atoms[p])}else{var m=[];p=0;for(n=g.length;p<n;p++)g[p].contains(h.atoms[h.atoms.length-1])&&m.push(g[p]);p=0;for(n=m.length;p<n;p++)if((h.atoms.length==1||!m[p].contains(h.atoms[h.atoms.length-2]))&&m[p].contains(this.atoms[this.atoms.length-1])){q=new e.Ring;q.atoms[0]=l;g=0;for(l=this.atoms.length;g<l;g++)q.atoms.push(this.atoms[g]);
for(g=h.atoms.length-1;g>=0;g--)q.atoms.push(h.atoms[g]);break}}return q};return true}d.EulerFacetRingFinder=function(j){this.fingerBreak=5;this.setMolecule(j);return true};d.EulerFacetRingFinder.prototype=new d._RingFinder;d.EulerFacetRingFinder.prototype.innerGetRings=function(){for(var j=0,c=this.atoms.length;j<c;j++){for(var k=[],b=0,g=this.bonds.length;b<g;b++)this.bonds[b].contains(this.atoms[j])&&k.push(this.bonds[b].getNeighbor(this.atoms[j]));b=0;for(g=k.length;b<g;b++)for(var h=b+1;h<k.length;h++){var l=
[];l[0]=new f(k[b]);l[1]=new f(k[h]);var p=[];p[0]=this.atoms[j];for(var n=0,q=k.length;n<q;n++)n!=b&&n!=h&&p.push(k[n]);var m=[];if(n=l[0].check(this.bonds,l[1],this.atoms[j]))m[0]=n;for(;m.length==0&&l.length>0&&l[0].atoms.length<this.fingerBreak;){var u=[];n=0;for(q=l.length;n<q;n++)for(var v=l[n].grow(this.bonds,p),r=0,w=v.length;r<w;r++)u.push(v[r]);l=u;n=0;for(q=l.length;n<q;n++)for(r=n+1;r<q;r++)(w=l[n].check(this.bonds,l[r],this.atoms[j]))&&m.push(w);if(m.length==0){u=[];n=0;for(q=p.length;n<
q;n++){r=0;for(w=this.bonds.length;r<w;r++)if(this.bonds[r].contains(p[n])){k=this.bonds[r].getNeighbor(p[n]);a(k,p)==-1&&a(k,u)==-1&&u.push(k)}}n=0;for(q=u.length;n<q;n++)p.push(u[n])}}if(m.length>0){l=null;n=0;for(q=m.length;n<q;n++)if(!l||l.atoms.length>m[n].atoms.length)l=m[n];m=false;n=0;for(q=this.rings.length;n<q;n++){p=true;r=0;for(w=l.atoms.length;r<w;r++)if(a(l.atoms[r],this.rings[n].atoms)==-1){p=false;break}if(p){m=true;break}}m||this.rings.push(l)}}}this.fuse()}})(ChemDoodle.informatics,
ChemDoodle.structures,jQuery.inArray);
(function(d){d.SSSRFinder=function(e){this.rings=[];if(e.atoms.length>0){var a=(new d.FrerejacqueNumberCounter(e)).value,f=(new d.EulerFacetRingFinder(e)).rings;f.sort(function(g,h){return g.atoms.length-h.atoms.length});for(var j=0,c=e.bonds.length;j<c;j++)e.bonds[j].visited=false;j=0;for(c=f.length;j<c;j++){e=false;for(var k=0,b=f[j].bonds.length;k<b;k++)if(!f[j].bonds[k].visited){e=true;break}if(e){k=0;for(b=f[j].bonds.length;k<b;k++)f[j].bonds[k].visited=true;this.rings.push(f[j])}if(this.rings.length==
a)break}}return true}})(ChemDoodle.informatics);
(function(d,e,a,f,j,c){var k=/\s+/g,b=/\(|\)|\s+/g,g=/\'|\s+/g,h=/,|\'|\s+/g,l=/[0-9]/,p={P:[],A:[[0,0.5,0.5]],B:[[0.5,0,0.5]],C:[[0.5,0.5,0]],I:[[0.5,0.5,0.5]],R:[[2/3,1/3,1/3],[1/3,2/3,2/3]],S:[[1/3,1/3,2/3],[2/3,2/3,1/3]],T:[[1/3,2/3,1/3],[2/3,1/3,2/3]],F:[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]},n=function(m){var u=0,v=0,r=0,w=0,t=m.indexOf("x"),x=m.indexOf("y"),z=m.indexOf("z");if(t!=-1){v++;if(t>0&&m.charAt(t-1)!="+")v*=-1}if(x!=-1){r++;if(x>0&&m.charAt(x-1)!="+")r*=-1}if(z!=-1){w++;if(z>0&&m.charAt(z-
1)!="+")w*=-1}if(m.length>2){t="+";x=0;for(z=m.length;x<z;x++){var A=m.charAt(x);if((A=="-"||A=="/")&&(x==m.length-1||m.charAt(x+1).match(l)))t=A;if(A.match(l))if(t=="+")u+=parseInt(A);else if(t=="-")u-=parseInt(A);else if(t=="/")u/=parseInt(A)}}return[u,v,r,w]};a.CIFInterpreter=function(){this.read=function(m,u,v,r){u=u?u:1;v=v?v:1;r=r?r:1;var w=new f.Molecule;if(m==null||m.length==0)return w;for(var t=m.split("\n"),x=0,z=0,A=0,C=m=0,D=0,G="P",B=null;!e.stringStartsWith(B=t.shift(),"loop_");)if(B.length>
0)if(e.stringStartsWith(B,"_cell_length_a"))x=parseFloat(B.split(b)[1]);else if(e.stringStartsWith(B,"_cell_length_b"))z=parseFloat(B.split(b)[1]);else if(e.stringStartsWith(B,"_cell_length_c"))A=parseFloat(B.split(b)[1]);else if(e.stringStartsWith(B,"_cell_angle_alpha"))m=j.PI*parseFloat(B.split(b)[1])/180;else if(e.stringStartsWith(B,"_cell_angle_beta"))C=j.PI*parseFloat(B.split(b)[1])/180;else if(e.stringStartsWith(B,"_cell_angle_gamma"))D=j.PI*parseFloat(B.split(b)[1])/180;else if(e.stringStartsWith(B,
"_symmetry_space_group_name_H-M"))G=B.split(g)[1];x=x;B=z;A=A;C=C;D=D;m=(j.cos(m)-j.cos(D)*j.cos(C))/j.sin(D);m=[x,0,0,0,B*j.cos(D),B*j.sin(D),0,0,A*j.cos(C),A*m,A*j.sqrt(1-j.pow(j.cos(C),2)-m*m),0,0,0,0,1];for(C=[];!e.stringStartsWith(B=t.shift(),"loop_");)B.length>0&&e.stringStartsWith(B,"'")&&C.push(B);for(;e.stringStartsWith(t[0],"_");)t.shift();D=0;for(x=t.length;D<x;D++){B=t[D];if(B.length==0)break;B=B.split(k);w.atoms.push(new f.Atom(B[2],parseFloat(B[3]),parseFloat(B[4]),parseFloat(B[5])))}var I=
p[G];B=[];D=0;for(x=C.length;D<x;D++){t=C[D].split(h);var E=n(t[1]),K=n(t[2]),L=n(t[3]);G=0;for(z=w.atoms.length;G<z;G++){t=w.atoms[G];var M=t.x*E[1]+t.y*E[2]+t.z*E[3]+E[0],F=t.x*K[1]+t.y*K[2]+t.z*K[3]+K[0],H=t.x*L[1]+t.y*L[2]+t.z*L[3]+L[0];B.push(new f.Atom(t.label,M,F,H));if(I){A=0;for(var N=I.length;A<N;A++){var J=I[A];B.push(new f.Atom(t.label,M+J[0],F+J[1],H+J[2]))}}}}D=0;for(x=B.length;D<x;D++){for(t=B[D];t.x>=1;)t.x--;for(;t.x<0;)t.x++;for(;t.y>=1;)t.y--;for(;t.y<0;)t.y++;for(;t.z>=1;)t.z--;
for(;t.z<0;)t.z++}C=[];D=0;for(x=B.length;D<x;D++){A=false;t=B[D];G=0;for(z=w.atoms.length;G<z;G++)if(w.atoms[G].distance3D(t)<1.0E-4){A=true;break}if(!A){G=0;for(z=C.length;G<z;G++)if(C[G].distance3D(t)<1.0E-4){A=true;break}A||C.push(t)}}w.atoms=w.atoms.concat(C);x=[];for(D=0;D<u;D++)for(G=0;G<v;G++)for(A=0;A<r;A++)if(!(D==0&&G==0&&A==0)){C=0;for(B=w.atoms.length;C<B;C++){t=w.atoms[C];x.push(new f.Atom(t.label,t.x+D,t.y+G,t.z+A))}}w.atoms=w.atoms.concat(x);D=0;for(x=w.atoms.length;D<x;D++){t=w.atoms[D];
C=c.multiplyVec3(m,[t.x,t.y,t.z]);t.x=C[0];t.y=C[1];t.z=C[2]}(new d.informatics.BondDeducer).deduceCovalentBonds(w,1);u=[-u/2,-v/2,-r/2];w.unitCellVectors={o:c.multiplyVec3(m,u,[]),x:c.multiplyVec3(m,[u[0]+1,u[1],u[2]]),y:c.multiplyVec3(m,[u[0],u[1]+1,u[2]]),z:c.multiplyVec3(m,[u[0],u[1],u[2]+1]),xy:c.multiplyVec3(m,[u[0]+1,u[1]+1,u[2]]),xz:c.multiplyVec3(m,[u[0]+1,u[1],u[2]+1]),yz:c.multiplyVec3(m,[u[0],u[1]+1,u[2]+1]),xyz:c.multiplyVec3(m,[u[0]+1,u[1]+1,u[2]+1])};return w}};var q=new a.CIFInterpreter;
d.readCIF=function(m,u,v,r){return q.read(m,u,v,r)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,Math,mat4,vec3);
(function(d,e,a,f,j){function c(b,g,h){for(var l=b.length,p="",n=0;n<g-l;n++)p+=" ";return h?b+p:p+b}a.MOLInterpreter=function(){this.read=function(b,g){if(!g)g=d.default_bondLength_2D;var h=new f.Molecule;if(b==null||b.length==0)return h;var l=b.split("\n"),p=l[3],n=parseInt(p.substring(0,3));p=parseInt(p.substring(3,6));for(var q=0;q<n;q++){var m=l[4+q];h.atoms[q]=new f.Atom(m.substring(31,34),parseFloat(m.substring(0,10))*g,(g==1?1:-1)*parseFloat(m.substring(10,20))*g,parseFloat(m.substring(20,
30))*g);var u=parseInt(m.substring(34,36));if(u!=0&&e[h.atoms[q].label]!=null)h.atoms[q].mass=e[h.atoms[q].label].mass+u;switch(parseInt(m.substring(36,39))){case 1:h.atoms[q].charge=3;break;case 2:h.atoms[q].charge=2;break;case 3:h.atoms[q].charge=1;break;case 5:h.atoms[q].charge=-1;break;case 6:h.atoms[q].charge=-2;break;case 7:h.atoms[q].charge=-3;break}}for(q=0;q<p;q++){m=l[4+n+q];var v=parseInt(m.substring(6,9));u=parseInt(m.substring(9,12));if(v>3)switch(v){case 4:v=1.5;break;default:v=1;break}m=
new f.Bond(h.atoms[parseInt(m.substring(0,3))-1],h.atoms[parseInt(m.substring(3,6))-1],v);switch(u){case 3:m.stereo=f.Bond.STEREO_AMBIGUOUS;break;case 1:m.stereo=f.Bond.STEREO_PROTRUDING;break;case 6:m.stereo=f.Bond.STEREO_RECESSED;break}h.bonds[q]=m}return h};this.write=function(b){var g="Molecule from ChemDoodle Web Components\n\nhttp://www.ichemlabs.com\n";g=g+c(b.atoms.length.toString(),3)+c(b.bonds.length.toString(),3)+"  0  0  0  0            999 v2000\n";for(var h=b.getCenter(),l=0,p=b.atoms.length;l<
p;l++){var n=b.atoms[l],q=" 0";if(n.mass!=-1&&e[n.label]!=null){var m=n.mass-e[n.label].mass;if(m<5&&m>-4)q=(m>-1?" ":"")+m}m="  0";if(n.charge!=0)switch(n.charge){case 3:m="  1";break;case 2:m="  2";break;case 1:m="  3";break;case -1:m="  5";break;case -2:m="  6";break;case -3:m="  7";break}g=g+c(((n.x-h.x)/d.default_bondLength_2D).toFixed(4),10)+c((-(n.y-h.y)/d.default_bondLength_2D).toFixed(4),10)+c((n.z/d.default_bondLength_2D).toFixed(4),10)+" "+c(n.label,3,true)+q+m+"  0  0  0  0\n"}l=0;for(p=
b.bonds.length;l<p;l++){h=b.bonds[l];n=0;if(h.stereo==f.Bond.STEREO_AMBIGUOUS)n=3;else if(h.stereo==f.Bond.STEREO_PROTRUDING)n=1;else if(h.stereo==f.Bond.STEREO_RECESSED)n=6;g=g+c((j(h.a1,b.atoms)+1).toString(),3)+c((j(h.a2,b.atoms)+1).toString(),3)+c(h.bondOrder.toString(),3)+"  "+n+"     0  0\n"}g+="M  END";return g}};var k=new a.MOLInterpreter;d.readMOL=function(b,g){return k.read(b,g)};d.writeMOL=function(b){return k.write(b)}})(ChemDoodle,ChemDoodle.ELEMENT,ChemDoodle.io,ChemDoodle.structures,
jQuery.inArray);
(function(d,e,a,f,j){a.PDBInterpreter=function(){function k(b,g,h,l,p){for(var n=0,q=g.length;n<q;n++){var m=g[n];if(m.id==h&&l>=m.start&&l<=m.end){if(p)b.helix=true;else b.sheet=true;if(l+1==m.end)b.arrow=true;return}}}this.calculateRibbonDistances=false;this.read=function(b,g){var h=new f.Molecule;h.chains=[];if(b==null||b.length==0)return h;var l=b.split("\n");g||(g=1);for(var p=[],n=[],q=null,m=[],u=0,v=l.length;u<v;u++){var r=l[u];if(e.stringStartsWith(r,"HELIX"))p.push({id:r.substring(19,20),
start:parseInt(r.substring(21,25)),end:parseInt(r.substring(33,37))});else if(e.stringStartsWith(r,"SHEET"))n.push({id:r.substring(21,22),start:parseInt(r.substring(22,26)),end:parseInt(r.substring(33,37))});else if(e.stringStartsWith(r,"ATOM")){var w=r.substring(16,17);if(w==" "||w=="A"){w=j(r.substring(76,78));if(w.length==0){var t=j(r.substring(12,14));if(t=="HD")w="H";else if(t.length>0)w=t.length>1?t.charAt(0)+t.substring(1).toLowerCase():t}w=new f.Atom(w,parseFloat(r.substring(30,38))*g,parseFloat(r.substring(38,
46))*g,parseFloat(r.substring(46,54))*g);w.hetatm=false;h.atoms.push(w);t=parseInt(r.substring(22,26));if(m.length==0)for(var x=0;x<2;x++){var z=new f.Residue(-1);z.cp1=w;z.cp2=w;m.push(z)}if(t!=Number.NaN&&m[m.length-1].resSeq!=t){x=new f.Residue(t);x.name=j(r.substring(17,20));if(x.name.length==3)x.name=x.name.substring(0,1)+x.name.substring(1).toLowerCase();else if(x.name.length==2&&x.name.charAt(0)=="D")x.name=x.name.substring(1);m.push(x);z=r.substring(21,22);k(x,p,z,t,true);k(x,n,z,t,false)}r=
j(r.substring(12,16));t=m[m.length-1];if(r=="CA"||r=="P"||r=="O5'"){if(!t.cp1)t.cp1=w}else if(r=="N3"&&(t.name=="C"||t.name=="U"||t.name=="T")||r=="N1"&&(t.name=="A"||t.name=="G"))t.cp3=w;else if(r=="C2")t.cp4=w;else if(r=="C4"&&(t.name=="C"||t.name=="U"||t.name=="T")||r=="C6"&&(t.name=="A"||t.name=="G"))t.cp5=w;else if(r=="O"||r=="C6"&&(t.name=="C"||t.name=="U"||t.name=="T")||r=="N9"){if(!m[m.length-1].cp2){if(r=="C6"||r=="N9")q=w;t.cp2=w}}else if(r=="C")q=w}}else if(e.stringStartsWith(r,"HETATM")){w=
j(r.substring(76,78));if(w.length>1)w=w.substring(0,1)+w.substring(1).toLowerCase();w=new f.Atom(w,parseFloat(r.substring(30,38))*g,parseFloat(r.substring(38,46))*g,parseFloat(r.substring(46,54))*g);w.hetatm=true;if(j(r.substring(17,20))=="HOH")w.isWater=true;h.atoms.push(w)}else if(e.stringStartsWith(r,"TER")){this.endChain(h,m,q);m=[]}else if(e.stringStartsWith(r,"ENDMDL"))break}this.endChain(h,m,q);(new d.informatics.BondDeducer).deduceCovalentBonds(h,g);this.calculateRibbonDistances&&this.calculateDistances(h);
return h};this.endChain=function(b,g,h){if(g.length>0){var l=g[g.length-1];if(!l.cp1)l.cp1=b.atoms[b.atoms.length-2];if(!l.cp2)l.cp2=b.atoms[b.atoms.length-1];for(l=0;l<4;l++){var p=new f.Residue(-1);p.cp1=h;p.cp2=g[g.length-1].cp2;g.push(p)}b.chains.push(g)}};this.calculateDistances=function(b){for(var g=[],h=[],l=0,p=b.atoms.length;l<p;l++){var n=b.atoms[l];if(n.hetatm)n.isWater||g.push(n);else h.push(n)}l=0;for(p=h.length;l<p;l++){n=h[l];n.closestDistance=Number.POSITIVE_INFINITY;if(g.length==
0)n.closestDistance=0;else{b=0;for(var q=g.length;b<q;b++)n.closestDistance=Math.min(n.closestDistance,n.distance3D(g[b]))}}}};var c=new a.PDBInterpreter;d.readPDB=function(k,b){return c.read(k,b)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,jQuery.trim);
(function(d,e,a,f,j,c){var k={"@":0,A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,I:9,a:-1,b:-2,c:-3,d:-4,e:-5,f:-6,g:-7,h:-8,i:-9},b={"%":0,J:1,K:2,L:3,M:4,N:5,O:6,P:7,Q:8,R:9,j:-1,k:-2,l:-3,m:-4,n:-5,o:-6,p:-7,q:-8,r:-9},g={S:1,T:2,U:3,V:4,W:5,X:6,Y:7,Z:8,s:9};a.JCAMPInterpreter=function(){this.convertHZ2PPM=false;this.read=function(l){this.isBreak=function(R){return k[R]!=null||b[R]!=null||g[R]!=null||R==" "||R=="-"||R=="+"};this.getValue=function(R,X){var T=R.charAt(0),U=R.substring(1);if(k[T]!=null)return parseFloat(k[T]+
U);else if(b[T]!=null)return parseFloat(b[T]+U)+X;return parseFloat(U)};var p=new f.Spectrum;if(l==null||l.length==0)return p;l=l.split("\n");for(var n=[],q,m,u,v,r=1,w=1,t=1,x=-1,z=-1,A=-1,C=true,D=false,G=0,B=l.length;G<B;G++){var I=c(l[G]),E=j.inArray("$$",I);if(E!=-1)I=I.substring(0,E);if(n.length==0||!e.stringStartsWith(l[G],"##")){n.length!=0&&n.push("\n");n.push(c(I))}else{E=n.join("");C&&E.length<100&&p.metadata.push(E);n=[I];if(e.stringStartsWith(E,"##TITLE="))p.title=c(E.substring(8));else if(e.stringStartsWith(E,
"##XUNITS=")){p.xUnit=c(E.substring(9));if(this.convertHZ2PPM&&p.xUnit.toUpperCase()=="HZ"){p.xUnit="PPM";D=true}}else if(e.stringStartsWith(E,"##YUNITS="))p.yUnit=c(E.substring(9));else if(!e.stringStartsWith(E,"##XYPAIRS="))if(e.stringStartsWith(E,"##FIRSTX="))m=parseFloat(c(E.substring(9)));else if(e.stringStartsWith(E,"##LASTX="))q=parseFloat(c(E.substring(8)));else if(e.stringStartsWith(E,"##FIRSTY="))u=parseFloat(c(E.substring(9)));else if(e.stringStartsWith(E,"##NPOINTS="))v=parseFloat(c(E.substring(10)));
else if(e.stringStartsWith(E,"##XFACTOR="))r=parseFloat(c(E.substring(10)));else if(e.stringStartsWith(E,"##YFACTOR="))w=parseFloat(c(E.substring(10)));else if(e.stringStartsWith(E,"##DELTAX="))x=parseFloat(c(E.substring(9)));else if(e.stringStartsWith(E,"##.OBSERVE FREQUENCY=")){if(this.convertHZ2PPM)t=parseFloat(c(E.substring(21)))}else if(e.stringStartsWith(E,"##.SHIFT REFERENCE=")){if(this.convertHZ2PPM){A=E.substring(19).split(",");z=parseInt(c(A[2]));A=parseFloat(c(A[3]))}}else if(e.stringStartsWith(E,
"##XYDATA=")){D||(t=1);I=C=false;E=E.split("\n");var K=(q-m)/(v-1);if(x!=-1)for(var L=1,M=E.length;L<M;L++)if(E[L].charAt(0)=="|"){K=x;break}var F=m-K,H=u,N=0,J;L=1;for(M=E.length;L<M;L++){var P=[];F=c(E[L]);n=[];for(var Q=false,O=0,S=F.length;O<S;O++)if(this.isBreak(F.charAt(O))){n.length>0&&!(n.length==1&&n[0]==" ")&&P.push(n.join(""));n=[F.charAt(O)]}else if(F.charAt(O)=="|")Q=true;else n.push(F.charAt(O));P.push(n.join(""));F=parseFloat(P[0])*r-K;O=1;for(S=P.length;O<S;O++){H=P[O];if(g[H.charAt(0)]!=
null)for(var Y=parseInt(g[H.charAt(0)]+H.substring(1))-1,W=0;W<Y;W++){F+=K;N=this.getValue(J,N);H=N*w;V++;p.data[p.data.length-1]=new f.Point(F/t,H)}else if(k[H.charAt(0)]!=null&&I){H=this.getValue(H,N)*w;if(Q){F+=K;p.data.push(new f.Point(F/t,H))}}else{I=b[H.charAt(0)]!=null;J=H;F+=K;N=this.getValue(H,N);H=N*w;V++;p.data.push(new f.Point(F/t,H))}}}if(z!=-1){I=A-p.data[z-1].x;G=0;for(B=p.data.length;G<B;G++)p.data[G].x+=I}}else if(e.stringStartsWith(E,"##PEAK TABLE=")){C=false;p.continuous=false;
E=E.split("\n");var V=0;L=1;for(M=E.length;L<M;L++){I=E[L].split(/[\s,]+/);V+=I.length/2;O=0;for(S=I.length;O+1<S;O+=2)p.data.push(new f.Point(parseFloat(c(I[O])),parseFloat(c(I[O+1]))))}}}}p.setup();return p}};var h=new a.JCAMPInterpreter;h.convertHZ2PPM=true;d.readJCAMP=function(l){return h.read(l)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,jQuery,jQuery.trim);
(function(d,e,a){d.fromJSONChains=function(f){for(var j=[],c=0,k=f.cs.length;c<k;c++){for(var b=f.cs[c],g=[],h=0,l=b.length;h<l;h++){var p=b[h],n=new e.Residue;n.name=p.n;n.cp1=new e.Atom("",p.x1,p.y1,p.z1);n.cp2=new e.Atom("",p.x2,p.y2,p.z2);if(p.x3){n.cp3=new e.Atom("",p.x3,p.y3,p.z3);n.cp4=new e.Atom("",p.x4,p.y4,p.z4);n.cp5=new e.Atom("",p.x5,p.y5,p.z5)}n.helix=p.h;n.sheet=p.s;n.arrow=p.a;g.push(n)}j.push(g)}return j};d.fromJSONPDB=function(f){var j=d.fromJSONDummy(f.mol);j.findRings=false;j.fromJSON=
true;j.chains=d.fromJSONChains(f.ribbons);return j};d.fromJSONDummy=function(f){for(var j=new e.Molecule,c=0,k=f.a.length;c<k;c++){var b=f.a[c],g=new e.Atom(b.l?b.l:"C",b.x,b.y);if(b.z)g.z=b.z;if(b.c)g.charge=b.c;if(b.m)g.mass=b.m;if(b.p_h!=undefined)g.hetatm=b.p_h;if(b.p_w!=undefined)g.isWater=b.p_w;if(b.p_d!=undefined)g.closestDistance=b.p_d;j.atoms.push(g)}c=0;for(k=f.b.length;c<k;c++){b=f.b[c];g=new e.Bond(j.atoms[b.b],j.atoms[b.e],b.o?b.o:1);if(b.s)g.stereo=b.s;j.bonds.push(g)}return j};d.toJSONDummy=
function(f){for(var j={a:[],b:[]},c=0,k=f.atoms.length;c<k;c++){var b=f.atoms[c];j.a[c]={x:b.x,y:b.y};if(b.label!="C")j.a[c].l=b.label;if(b.z!=0)j.a[c].z=b.z;if(b.charge!=0)j.a[c].c=b.charge;if(b.mass!=-1)j.a[c].m=b.mass}c=0;for(k=f.bonds.length;c<k;c++){b=f.bonds[c];j.b[c]={b:a(b.a1,f.atoms),e:a(b.a2,f.atoms)};if(b.bondOrder!=1)j.b[c].o=b.bondOrder;if(b.stereo!=e.Bond.STEREO_NONE)j.b[c].s=b.stereo}return j}})(ChemDoodle.io,ChemDoodle.structures,jQuery.inArray);
(function(d,e,a,f,j,c){f.XYZInterpreter=function(){this.deduceCovalentBonds=true;this.read=function(b){var g=new j.Molecule;if(b==null||b.length==0)return g;b=b.split("\n");for(var h=parseInt(c(b[0])),l=0;l<h;l++){var p=b[l+2].split(/\s+/g);g.atoms[l]=new j.Atom(isNaN(p[0])?p[0]:a[parseInt(p[0])-1],parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3]))}this.deduceCovalentBonds&&(new d.informatics.BondDeducer).deduceCovalentBonds(g,1);return g}};var k=new f.XYZInterpreter;d.readXYZ=function(b){return k.read(b)}})(ChemDoodle,
ChemDoodle.ELEMENT,ChemDoodle.SYMBOLS,ChemDoodle.io,ChemDoodle.structures,jQuery.trim);
ChemDoodle.monitor=function(d,e,a){var f={};f.CANVAS_DRAGGING=null;f.CANVAS_OVER=null;f.ALT=false;f.SHIFT=false;f.META=false;d.supports_touch()||e(a).ready(function(){e(a).mousemove(function(j){if(f.CANVAS_DRAGGING!=null)if(f.CANVAS_DRAGGING.drag){f.CANVAS_DRAGGING.prehandleEvent(j);f.CANVAS_DRAGGING.drag(j)}});e(a).mouseup(function(j){if(f.CANVAS_DRAGGING!=null&&f.CANVAS_DRAGGING!=f.CANVAS_OVER)if(f.CANVAS_DRAGGING.mouseup){f.CANVAS_DRAGGING.prehandleEvent(j);f.CANVAS_DRAGGING.mouseup(j)}f.CANVAS_DRAGGING=
null});e(a).keydown(function(j){f.SHIFT=j.shiftKey;f.ALT=j.altKey;f.META=j.metaKey;var c=f.CANVAS_OVER;if(f.CANVAS_DRAGGING!=null)c=f.CANVAS_DRAGGING;if(c!=null)if(c.keydown){c.prehandleEvent(j);c.keydown(j)}});e(a).keypress(function(j){var c=f.CANVAS_OVER;if(f.CANVAS_DRAGGING!=null)c=f.CANVAS_DRAGGING;if(c!=null)if(c.keypress){c.prehandleEvent(j);c.keypress(j)}});e(a).keyup(function(j){f.SHIFT=j.shiftKey;f.ALT=j.altKey;f.META=j.metaKey;var c=f.CANVAS_OVER;if(f.CANVAS_DRAGGING!=null)c=f.CANVAS_DRAGGING;
if(c!=null)if(c.keyup){c.prehandleEvent(j);c.keyup(j)}})});return f}(ChemDoodle.featureDetection,jQuery,document);
(function(d,e,a,f,j,c,k,b,g){d._Canvas=function(){this.image=this.emptyMessage=this.molecule=null;return true};d._Canvas.prototype.repaint=function(){var h=b.getElementById(this.id);if(h.getContext){var l=h.getContext("2d"),p=g.devicePixelRatio?g.devicePixelRatio:1;if(p!=1){h.width=this.width*p;h.height=this.height*p;l.scale(p,p)}if(this.image==null){if(this.specs.backgroundColor!=null){l.fillStyle=this.specs.backgroundColor;l.fillRect(0,0,this.width,this.height)}}else l.drawImage(this.image,0,0);
if(this.innerRepaint)this.innerRepaint(l);else if(this.molecule!=null&&this.molecule.atoms.length>0){l.save();l.translate(this.width/2,this.height/2);l.rotate(this.specs.rotateAngle);l.scale(this.specs.scale,this.specs.scale);l.translate(-this.width/2,-this.height/2);this.molecule.draw(l,this.specs);l.restore()}else if(this.emptyMessage!=null){l.fillStyle="#737683";l.textAlign="center";l.textBaseline="middle";l.font="18px Helvetica, Verdana, Arial, Sans-serif";l.fillText(this.emptyMessage,this.width/
2,this.height/2)}this.drawChildExtras&&this.drawChildExtras(l)}};d._Canvas.prototype.setBackgroundImage=function(h){this.image=new Image;var l=this;this.image.onload=function(){l.repaint()};this.image.src=h};d._Canvas.prototype.loadMolecule=function(h){this.molecule=h;this.center();this instanceof ChemDoodle._Canvas3D||this.molecule.check();this.afterLoadMolecule&&this.afterLoadMolecule();this.repaint()};d._Canvas.prototype.center=function(){var h=this.molecule.getCenter3D(),l=new f.Atom("C",this.width/
2,this.height/2,0);l.sub3D(h);h=0;for(var p=this.molecule.atoms.length;h<p;h++)this.molecule.atoms[h].add3D(l);l=this.molecule.getDimension();this.specs.scale=1;if(l.x>this.width||l.y>this.height)this.specs.scale=k.min(this.width/l.x,this.height/l.y)*0.85};d._Canvas.prototype.create=function(h,l,p){this.id=h;this.width=l;this.height=p;if(b.getElementById(h)){var n=j("#"+h);if(l)n.attr("width",l);else this.width=n.attr("width");if(p)n.attr("height",p);else this.height=n.attr("height")}else!d.featureDetection.supports_canvas_text()&&
c.msie&&c.version>="6"?b.writeln('<div style="border: 1px solid black;" width="'+l+'" height="'+p+'">Please install <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a>, then restart Internet Explorer.</div>'):b.writeln('<canvas class="ChemDoodleWebComponent" id="'+h+'" width="'+l+'" height="'+p+'">This browser does not support HTML5/Canvas.</canvas>');h=j("#"+h);h.css("width",this.width);h.css("height",this.height);this.specs=new f.VisualSpecifications;var q=this;if(e.supports_touch()){h.bind("touchstart",
function(m){var u=(new Date).getTime();if(q.lastTouch&&m.originalEvent.touches.length==1&&u-q.lastTouch<500)if(q.dbltap){q.prehandleEvent(m);q.dbltap(m)}else if(q.dblclick){q.prehandleEvent(m);q.dblclick(m)}else if(q.touchstart){q.prehandleEvent(m);q.touchstart(m)}else{if(q.mousedown){q.prehandleEvent(m);q.mousedown(m)}}else if(q.touchstart){q.prehandleEvent(m);q.touchstart(m)}else if(q.mousedown){q.prehandleEvent(m);q.mousedown(m)}q.lastTouch=u});h.bind("touchmove",function(m){if(m.originalEvent.touches.length>
1&&q.multitouchmove){var u=m.originalEvent.touches.length;q.prehandleEvent(m);for(var v=new f.Point(-m.offset.left*u,-m.offset.top*u),r=0;r<u;r++){v.x+=m.originalEvent.changedTouches[r].pageX;v.y+=m.originalEvent.changedTouches[r].pageY}v.x/=u;v.y/=u;m.p=v;q.multitouchmove(m,u)}else if(q.touchmove){q.prehandleEvent(m);q.touchmove(m)}else if(q.drag){q.prehandleEvent(m);q.drag(m)}});h.bind("touchend",function(m){gestureSpread=-1;if(q.touchend){q.prehandleEvent(m);q.touchend(m)}else if(q.mouseup){q.prehandleEvent(m);
q.mouseup(m)}});h.bind("gesturestart",function(m){if(q.gesturestart){q.prehandleEvent(m);q.gesturestart(m)}});h.bind("gesturechange",function(m){if(q.gesturechange){q.prehandleEvent(m);q.gesturechange(m)}});h.bind("gestureend",function(m){if(q.gestureend){q.prehandleEvent(m);q.gestureend(m)}})}else{h.click(function(m){switch(m.which){case 1:if(q.click){q.prehandleEvent(m);q.click(m)}break;case 2:if(q.middleclick){q.prehandleEvent(m);q.middleclick(m)}break;case 3:if(q.rightclick){q.prehandleEvent(m);
q.rightclick(m)}break}});h.dblclick(function(m){if(q.dblclick){q.prehandleEvent(m);q.dblclick(m)}});h.mousedown(function(m){switch(m.which){case 1:a.CANVAS_DRAGGING=q;if(q.mousedown){q.prehandleEvent(m);q.mousedown(m)}break;case 2:if(q.middlemousedown){q.prehandleEvent(m);q.middlemousedown(m)}break;case 3:if(q.rightmousedown){q.prehandleEvent(m);q.rightmousedown(m)}break}});h.mousemove(function(m){if(a.CANVAS_DRAGGING==null&&q.mousemove){q.prehandleEvent(m);q.mousemove(m)}});h.mouseout(function(m){a.CANVAS_OVER=
null;if(q.mouseout){q.prehandleEvent(m);q.mouseout(m)}});h.mouseover(function(m){a.CANVAS_OVER=q;if(q.mouseover){q.prehandleEvent(m);q.mouseover(m)}});h.mouseup(function(m){switch(m.which){case 1:if(q.mouseup){q.prehandleEvent(m);q.mouseup(m)}break;case 2:if(q.middlemouseup){q.prehandleEvent(m);q.middlemouseup(m)}break;case 3:if(q.rightmouseup){q.prehandleEvent(m);q.rightmouseup(m)}break}});h.mousewheel(function(m,u){if(q.mousewheel){q.prehandleEvent(m);q.mousewheel(m,u)}})}this.subCreate&&this.subCreate()};
d._Canvas.prototype.getMolecule=function(){return this.molecule};d._Canvas.prototype.prehandleEvent=function(h){if(h.originalEvent.changedTouches){h.pageX=h.originalEvent.changedTouches[0].pageX;h.pageY=h.originalEvent.changedTouches[0].pageY}h.preventDefault();h.offset=j("#"+this.id).offset();h.p=new f.Point(h.pageX-h.offset.left,h.pageY-h.offset.top)}})(ChemDoodle,ChemDoodle.featureDetection,ChemDoodle.monitor,ChemDoodle.structures,jQuery,jQuery.browser,Math,document,window);
(function(d){d._AnimatorCanvas=function(e,a,f){e&&this.create(e,a,f);this.timeout=33;return true};d._AnimatorCanvas.prototype=new d._Canvas;d._AnimatorCanvas.prototype.startAnimation=function(){this.stopAnimation();this.lastTime=(new Date).getTime();var e=this;if(this.nextFrame)this.handle=setInterval(function(){var a=(new Date).getTime();e.nextFrame(a-e.lastTime);e.repaint();e.lastTime=a},this.timeout)};d._AnimatorCanvas.prototype.stopAnimation=function(){if(this.handle!=null){clearInterval(this.handle);
this.handle=null}};d._AnimatorCanvas.prototype.isRunning=function(){return this.handle!=null}})(ChemDoodle);
(function(d,e){d.FileCanvas=function(a,f,j,c){a&&this.create(a,f,j);form='<br><form name="FileForm" enctype="multipart/form-data" method="POST" action="'+c+'" target="HiddenFileFrame"><input type="file" name="f" /><input type="submit" name="submitbutton" value="Show File" /></form><iframe id="HFF-'+a+'" name="HiddenFileFrame" height="0" width="0" style="display:none;" onLoad="GetMolFromFrame(\'HFF-'+a+"', "+a+')"></iframe>';e.writeln(form);this.emptyMessage="Click below to load file";this.repaint();
return true};d.FileCanvas.prototype=new d._Canvas})(ChemDoodle,document);
(function(d){d.HyperlinkCanvas=function(e,a,f,j,c,k){e&&this.create(e,a,f);this.urlOrFunction=j;this.color=c?c:"blue";this.size=k?k:2;this.openInNewWindow=true;this.e=this.hoverImage=null;return true};d.HyperlinkCanvas.prototype=new d._Canvas;d.HyperlinkCanvas.prototype.drawChildExtras=function(e){if(this.e!=null)if(this.hoverImage==null){e.strokeStyle=this.color;e.lineWidth=this.size*2;e.strokeRect(0,0,this.width,this.height)}else e.drawImage(this.hoverImage,0,0)};d.HyperlinkCanvas.prototype.setHoverImage=
function(e){this.hoverImage=new Image;this.hoverImage.src=e};d.HyperlinkCanvas.prototype.click=function(){this.e=null;this.repaint();if(this.urlOrFunction instanceof Function)this.urlOrFunction();else if(this.openInNewWindow)window.open(this.urlOrFunction);else location.href=this.urlOrFunction};d.HyperlinkCanvas.prototype.mouseout=function(){this.e=null;this.repaint()};d.HyperlinkCanvas.prototype.mouseover=function(e){this.e=e;this.repaint()}})(ChemDoodle);
(function(d,e,a,f){d.MolGrabberCanvas=function(j,c,k){j&&this.create(j,c,k);c=[];c.push('<br><input type="text" id="');c.push(j);c.push('_query" size="32" value="" />');c.push("<br><nobr>");c.push('<select id="');c.push(j);c.push('_select">');c.push('<option value="chemexper">ChemExper');c.push('<option value="chemspider">ChemSpider');c.push('<option value="pubchem" selected>PubChem');c.push("</select>");c.push('<button id="');c.push(j);c.push('_submit">Show Molecule</button>');c.push("</nobr>");
f.writeln(c.join(""));var b=this;a("#"+j+"_submit").click(function(){b.search()});a("#"+j+"_query").keypress(function(g){g.which==13&&b.search()});this.emptyMessage="Enter search term below";this.repaint();return true};d.MolGrabberCanvas.prototype=new d._Canvas;d.MolGrabberCanvas.prototype.setSearchTerm=function(j){a("#"+this.id+"_query").val(j);this.search()};d.MolGrabberCanvas.prototype.search=function(){this.emptyMessage="Searching...";this.molecule=null;this.repaint();var j=this;e.getMoleculeFromDatabase(a("#"+
this.id+"_select").val(),a("#"+this.id+"_query").val(),function(c){j.loadMolecule(c)})}})(ChemDoodle,ChemDoodle.iChemLabs,jQuery,document);
(function(d,e,a){d.RotatorCanvas=function(f,j,c,k){f&&this.create(f,j,c);this.rotate3D=k;this.zIncrement=this.yIncrement=this.xIncrement=f=e.PI/15;return true};d.RotatorCanvas.prototype=new d._AnimatorCanvas;d.RotatorCanvas.prototype.nextFrame=function(f){if(this.molecule==null)this.stopAnimation();else{var j=f/1E3;if(this.rotate3D){f=[];a.identity(f);a.rotate(f,this.xIncrement*j,[1,0,0]);a.rotate(f,this.yIncrement*j,[0,1,0]);a.rotate(f,this.zIncrement*j,[0,0,1]);j=0;for(var c=this.molecule.atoms.length;j<
c;j++){var k=this.molecule.atoms[j],b=[k.x-this.width/2,k.y-this.height/2,k.z];a.multiplyVec3(f,b);k.x=b[0]+this.width/2;k.y=b[1]+this.height/2;k.z=b[2]}j=0;for(c=this.molecule.rings.length;j<c;j++)this.molecule.rings[j].center=this.molecule.rings[j].getCenter();this.specs.atoms_display&&this.specs.atoms_circles_2D&&this.molecule.sortAtomsByZ();this.specs.bonds_display&&this.specs.bonds_clearOverlaps_2D&&this.molecule.sortBondsByZ()}else this.specs.rotateAngle+=this.zIncrement*j}};d.RotatorCanvas.prototype.dblclick=
function(){this.isRunning()?this.stopAnimation():this.startAnimation()}})(ChemDoodle,Math,mat4);
(function(d){d.SlideshowCanvas=function(e,a,f){e&&this.create(e,a,f);this.molecules=[];this.curIndex=0;this.timeout=5E3;this.alpha=0;this.innerHandle=null;this.phase=0;return true};d.SlideshowCanvas.prototype=new d._AnimatorCanvas;d.SlideshowCanvas.prototype.drawChildExtras=function(e){e.fillStyle="rgba("+parseInt(this.specs.backgroundColor.substring(1,3),16)+", "+parseInt(this.specs.backgroundColor.substring(3,5),16)+", "+parseInt(this.specs.backgroundColor.substring(5,7),16)+", "+this.alpha+")";
e.fillRect(0,0,this.width,this.height)};d.SlideshowCanvas.prototype.nextFrame=function(){if(this.molecules.length==0)this.stopAnimation();else{this.phase=0;var e=this,a=1;this.innerHandle=setInterval(function(){e.alpha=a/15;e.repaint();a==15&&e.breakInnerHandle();a++},33)}};d.SlideshowCanvas.prototype.breakInnerHandle=function(){if(this.innerHandle!=null){clearInterval(this.innerHandle);this.innerHandle=null}if(this.phase==0){this.curIndex++;if(this.curIndex>this.molecules.length-1)this.curIndex=
0;this.alpha=1;this.loadMolecule(this.molecules[this.curIndex]);this.phase=1;var e=this,a=1;this.innerHandle=setInterval(function(){e.alpha=(15-a)/15;e.repaint();a==15&&e.breakInnerHandle();a++},33)}else if(this.phase==1){this.alpha=0;this.repaint()}};d.SlideshowCanvas.prototype.addMolecule=function(e){this.molecules.length==0&&this.loadMolecule(e);this.molecules.push(e)}})(ChemDoodle);
(function(d,e,a,f,j){d.TransformCanvas=function(c,k,b,g){c&&this.create(c,k,b);this.lastPoint=null;this.rotate3D=g;this.rotationMultMod=1.3;this.lastPinchScale=1;this.lastGestureRotate=0;return true};d.TransformCanvas.prototype=new d._Canvas;d.TransformCanvas.prototype.mousedown=function(c){this.lastPoint=c.p};d.TransformCanvas.prototype.dblclick=function(){var c=new a.Point(this.width/2,this.height/2);c.sub(this.molecule.getCenter());for(var k=0,b=this.molecule.atoms.length;k<b;k++)this.molecule.atoms[k].add(c);
this.molecule.check();this.repaint()};d.TransformCanvas.prototype.drag=function(c){if(!this.lastPoint.multi){if(e.ALT){var k=new a.Point(c.p.x,c.p.y);k.sub(this.lastPoint);for(var b=0,g=this.molecule.atoms.length;b<g;b++)this.molecule.atoms[b].add(k);this.lastPoint=c.p;this.molecule.check()}else if(this.rotate3D==true){k=f.max(this.width/4,this.height/4);b=(c.p.x-this.lastPoint.x)/k*this.rotationMultMod;g=-(c.p.y-this.lastPoint.y)/k*this.rotationMultMod;k=[];j.identity(k);j.rotate(k,g,[1,0,0]);j.rotate(k,
b,[0,1,0]);b=0;for(g=this.molecule.atoms.length;b<g;b++){var h=this.molecule.atoms[b],l=[h.x-this.width/2,h.y-this.height/2,h.z];j.multiplyVec3(k,l);h.x=l[0]+this.width/2;h.y=l[1]+this.height/2;h.z=l[2]}b=0;for(g=this.molecule.rings.length;b<g;b++)this.molecule.rings[b].center=this.molecule.rings[b].getCenter();this.lastPoint=c.p;this.specs.atoms_display&&this.specs.atoms_circles_2D&&this.molecule.sortAtomsByZ();this.specs.bonds_display&&this.specs.bonds_clearOverlaps_2D&&this.molecule.sortBondsByZ()}else{k=
new a.Point(this.width/2,this.height/2);b=k.angle(this.lastPoint);this.specs.rotateAngle-=k.angle(c.p)-b;this.lastPoint=c.p}this.repaint()}};d.TransformCanvas.prototype.mousewheel=function(c,k){this.specs.scale+=k/10;if(this.specs.scale<0.01)this.specs.scale=0.01;this.repaint()};d.TransformCanvas.prototype.multitouchmove=function(c,k){if(k==2)if(this.lastPoint.multi){var b=new a.Point(c.p.x,c.p.y);b.sub(this.lastPoint);for(var g=0,h=this.molecule.atoms.length;g<h;g++)this.molecule.atoms[g].add(b);
this.lastPoint=c.p;this.lastPoint.multi=true;this.molecule.check();this.repaint()}else{this.lastPoint=c.p;this.lastPoint.multi=true}};d.TransformCanvas.prototype.gesturechange=function(c){if(c.originalEvent.scale-this.lastPinchScale!=0){this.specs.scale*=c.originalEvent.scale/this.lastPinchScale;if(this.specs.scale<0.01)this.specs.scale=0.01;this.lastPinchScale=c.originalEvent.scale}if(this.lastGestureRotate-c.originalEvent.rotation!=0){for(var k=(this.lastGestureRotate-c.originalEvent.rotation)/
180*f.PI,b=new a.Point(this.width/2,this.height/2),g=0,h=this.molecule.atoms.length;g<h;g++){var l=b.distance(this.molecule.atoms[g]),p=b.angle(this.molecule.atoms[g])+k;this.molecule.atoms[g].x=b.x+l*f.cos(p);this.molecule.atoms[g].y=b.y-l*f.sin(p)}this.lastGestureRotate=c.originalEvent.rotation;this.molecule.check()}this.repaint()};d.TransformCanvas.prototype.gestureend=function(){this.lastPinchScale=1;this.lastGestureRotate=0}})(ChemDoodle,ChemDoodle.monitor,ChemDoodle.structures,Math,mat4);
(function(d){d.ViewerCanvas=function(e,a,f){e&&this.create(e,a,f);return true};d.ViewerCanvas.prototype=new d._Canvas})(ChemDoodle);
(function(d){d._SpectrumCanvas=function(e,a,f){e&&this.create(e,a,f);this.spectrum=null;this.emptyMessage="No Spectrum Loaded or Recognized";this.getMolecule=this.loadMolecule=null;return true};d._SpectrumCanvas.prototype=new d._Canvas;d._SpectrumCanvas.prototype.innerRepaint=function(e){if(this.spectrum!=null&&this.spectrum.data.length>0)this.spectrum.draw(e,this.specs,this.width,this.height);else if(this.emptyMessage!=null){e.fillStyle="#737683";e.textAlign="center";e.textBaseline="middle";e.font=
"18px Helvetica, Verdana, Arial, Sans-serif";e.fillText(this.emptyMessage,this.width/2,this.height/2)}};d._SpectrumCanvas.prototype.loadSpectrum=function(e){this.spectrum=e;this.repaint()};d._SpectrumCanvas.prototype.getSpectrum=function(){return this.spectrum}})(ChemDoodle,document);(function(d){d.ObserverCanvas=function(e,a,f){e&&this.create(e,a,f);return true};d.ObserverCanvas.prototype=new d._SpectrumCanvas})(ChemDoodle);
(function(d,e,a){d.PerspectiveCanvas=function(f,j,c){f&&this.create(f,j,c);this.dragRange=null;this.rescaleYAxisOnZoom=true;this.lastPinchScale=1;return true};d.PerspectiveCanvas.prototype=new d._SpectrumCanvas;d.PerspectiveCanvas.prototype.mousedown=function(f){this.dragRange=new d.structures.Point(f.p.x,f.p.x)};d.PerspectiveCanvas.prototype.mouseup=function(f){if(this.dragRange!=null&&this.dragRange.x!=this.dragRange.y){if(!this.dragRange.multi){f=this.spectrum.zoom(this.dragRange.x,f.p.x,this.width,
this.rescaleYAxisOnZoom);if(this.rescaleYAxisOnZoom)this.specs.scale=f}this.dragRange=null;this.repaint()}};d.PerspectiveCanvas.prototype.drag=function(f){if(this.dragRange!=null){if(this.dragRange.multi)this.dragRange=null;else{if(e.SHIFT){this.spectrum.translate(f.p.x-this.dragRange.x,this.width);this.dragRange.x=f.p.x}this.dragRange.y=f.p.x}this.repaint()}};d.PerspectiveCanvas.prototype.drawChildExtras=function(f){if(this.dragRange!=null){var j=a.min(this.dragRange.x,this.dragRange.y),c=a.max(this.dragRange.x,
this.dragRange.y);f.strokeStyle="gray";f.lineStyle=1;f.beginPath();f.moveTo(j,this.height/2);for(j=j;j<=c;j++)j%10<5?f.lineTo(j,a.round(this.height/2)):f.moveTo(j,a.round(this.height/2));f.stroke()}};d.PerspectiveCanvas.prototype.mousewheel=function(f,j){this.specs.scale+=j/10;if(this.specs.scale<0.01)this.specs.scale=0.01;this.repaint()};d.PerspectiveCanvas.prototype.dblclick=function(){this.spectrum.setup();this.specs.scale=1;this.repaint()};d.PerspectiveCanvas.prototype.multitouchmove=function(f,
j){if(j==2)if(this.dragRange==null||!this.dragRange.multi){this.dragRange=new d.structures.Point(f.p.x,f.p.x);this.dragRange.multi=true}else{this.spectrum.translate(f.p.x-this.dragRange.x,this.width);this.dragRange.x=f.p.x;this.dragRange.y=f.p.x;this.repaint()}};d.PerspectiveCanvas.prototype.gesturechange=function(f){this.specs.scale*=f.originalEvent.scale/this.lastPinchScale;if(this.specs.scale<0.01)this.specs.scale=0.01;this.lastPinchScale=f.originalEvent.scale;this.repaint()};d.PerspectiveCanvas.prototype.gestureend=
function(){this.lastPinchScale=1}})(ChemDoodle,ChemDoodle.monitor,Math);
(function(d,e,a,f,j,c,k,b,g,h){d._Canvas3D=function(l,p,n){l&&this.create(l,p,n);this.rotationMatrix=b.identity([]);this.translationMatrix=b.identity([]);this.lastPoint=null;this.emptyMessage="WebGL is Unavailable!";return true};d._Canvas3D.prototype=new d._Canvas;d._Canvas3D.prototype.afterLoadMolecule=function(){var l=this.molecule.getDimension();this.maxDimension=c.max(l.x,l.y);this.translationMatrix=b.translate(b.identity([]),[0,0,-this.maxDimension-10]);this.setupScene()};d._Canvas3D.prototype.setViewDistance=
function(l){this.translationMatrix=b.translate(b.identity([]),[0,0,-l])};d._Canvas3D.prototype.repaint=function(){if(this.gl){this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT);this.gl.modelViewMatrix=b.multiply(this.translationMatrix,this.rotationMatrix,[]);this.gl.rotationMatrix=this.rotationMatrix;this.molecule!=null&&this.molecule.render(this.gl,this.specs);this.gl.flush()}};d._Canvas3D.prototype.center=function(){k.getElementById(this.id);for(var l=this.molecule.getCenter3D(),p=
0,n=this.molecule.atoms.length;p<n;p++)this.molecule.atoms[p].sub3D(l);if(this.molecule.chains&&this.molecule.fromJSON){p=0;for(n=this.molecule.chains.length;p<n;p++)for(var q=this.molecule.chains[p],m=0,u=q.length;m<u;m++){var v=q[m];v.cp1.sub3D(l);v.cp2.sub3D(l);if(v.cp3){v.cp3.sub3D(l);v.cp4.sub3D(l);v.cp5.sub3D(l)}}}};d._Canvas3D.prototype.subCreate=function(){try{var l=k.getElementById(this.id);this.gl=l.getContext("webgl");if(!this.gl)this.gl=l.getContext("experimental-webgl")}catch(p){}if(this.gl){this.gl.viewport(0,
0,this.width,this.height);this.gl.program=this.gl.createProgram();this.gl.shader=new f.Shader;this.gl.shader.init(this.gl);this.setupScene()}else{this.molecule=null;this.displayMessage()}};d._Canvas.prototype.displayMessage=function(){var l=k.getElementById(this.id);if(l.getContext){l=l.getContext("2d");if(this.specs.backgroundColor!=null){l.fillStyle=this.specs.backgroundColor;l.fillRect(0,0,this.width,this.height)}if(this.emptyMessage!=null){l.fillStyle="#737683";l.textAlign="center";l.textBaseline=
"middle";l.font="18px Helvetica, Verdana, Arial, Sans-serif";l.fillText(this.emptyMessage,this.width/2,this.height/2)}}};d._Canvas3D.prototype.setupScene=function(){if(this.gl){var l=a.getRGB(this.specs.backgroundColor,1);this.gl.clearColor(l[0],l[1],l[2],1);this.gl.clearDepth(1);this.gl.enable(this.gl.DEPTH_TEST);this.gl.depthFunc(this.gl.LEQUAL);this.gl.sphereBuffer=new f.Sphere(1,this.specs.atoms_resolution_3D,this.specs.atoms_resolution_3D);this.gl.starBuffer=new f.Star;this.gl.cylinderBuffer=
new f.Cylinder(1,1,this.specs.bonds_resolution_3D);this.gl.lineBuffer=new f.Line;if(this.molecule){if(this.molecule.unitCellVectors)this.molecule.unitCell=new f.UnitCell(this.molecule.unitCellVectors);if(this.molecule.chains){this.molecule.ribbons=[];this.molecule.cartoons=[];this.molecule.tubes=[];l=0;for(var p=this.molecule.chains.length;l<p;l++){var n=this.molecule.chains[l],q=n.length>2&&j[n[2].name]&&j[n[2].name].aminoColor=="#BEA06E";if(n.length>0&&!n[0].lineSegments){for(var m=0,u=n.length-
1;m<u;m++){if(q)n[m].Ns=1;n[m].setup(n[m+1].cp1)}if(!q){m=1;for(u=n.length-1;m<u;m++)if(e.vec3AngleFrom(n[m-1].D,n[m].D)>c.PI/2){n[m].guidePointsSmall.reverse();n[m].guidePointsLarge.reverse();h.scale(n[m].D,-1)}}m=1;for(u=n.length-3;m<u;m++)n[m].computeLineSegments(n[m-1],n[m+1],n[m+2],!q);n.pop();n.pop();n.pop();n.shift()}var v=a.hsl2rgb(p==1?0.5:l/p,1,0.5);v="rgb("+v[0]+","+v[1]+","+v[2]+")";n.chainColor=v;if(q){n=new f.Tube(n,this.specs.nucleics_tubeThickness,this.specs.nucleics_tubeResolution_3D);
n.chainColor=v;this.molecule.tubes.push(n)}else{q={front:new f.Ribbon(n,this.specs.proteins_ribbonThickness,false),back:new f.Ribbon(n,-this.specs.proteins_ribbonThickness,false)};q.front.chainColor=v;q.back.chainColor=v;m=0;for(u=q.front.segments.length;m<u;m++)q.front.segments[m].chainColor=v;m=0;for(u=q.back.segments.length;m<u;m++)q.back.segments[m].chainColor=v;this.molecule.ribbons.push(q);n={front:new f.Ribbon(n,this.specs.proteins_ribbonThickness,true),back:new f.Ribbon(n,-this.specs.proteins_ribbonThickness,
true)};n.front.chainColor=v;n.back.chainColor=v;m=0;for(u=n.front.segments.length;m<u;m++)n.front.segments[m].chainColor=v;m=0;for(u=n.back.segments.length;m<u;m++)n.back.segments[m].chainColor=v;m=0;for(u=n.front.cartoonSegments.length;m<u;m++)n.front.cartoonSegments[m].chainColor=v;m=0;for(u=n.back.cartoonSegments.length;m<u;m++)n.back.cartoonSegments[m].chainColor=v;this.molecule.cartoons.push(n)}}}}this.gl.lighting=new f.Light(this.specs.lightDiffuseColor_3D,this.specs.lightSpecularColor_3D,this.specs.lightDirection_3D);
this.gl.lighting.lightScene(this.gl);this.gl.material=new f.Material(this.gl);this.gl.projectionMatrix=this.specs.projectionPerspective_3D?b.perspective(this.specs.projectionPerspectiveVerticalFieldOfView_3D,this.specs.projectionWidthHeightRatio_3D,this.specs.projectionFrontCulling_3D,this.specs.projectionBackCulling_3D):b.ortho(-this.specs.projectionOrthoWidth_3D/2,this.specs.projectionOrthoWidth_3D/2,-this.specs.projectionOrthoWidth_3D/2/this.specs.projectionWidthHeightRatio_3D,this.specs.projectionOrthoWidth_3D/
2/this.specs.projectionWidthHeightRatio_3D,this.specs.projectionFrontCulling_3D,this.specs.projectionBackCulling_3D);this.gl.uniformMatrix4fv(this.gl.getUniformLocation(this.gl.program,"u_projection_matrix"),false,this.gl.projectionMatrix);var r=this.gl.getUniformLocation(this.gl.program,"u_model_view_matrix"),w=this.gl.getUniformLocation(this.gl.program,"u_normal_matrix");this.gl.setMatrixUniforms=function(t){this.uniformMatrix4fv(r,false,t);t=g.transpose(b.toInverseMat3(t,[]));this.uniformMatrix3fv(w,
false,t)}}};d._Canvas3D.prototype.mousedown=function(l){this.lastPoint=l.p};d._Canvas3D.prototype.rightmousedown=function(l){this.lastPoint=l.p};d._Canvas3D.prototype.drag=function(l){if(d.monitor.ALT){var p=new f.Point(l.p.x,l.p.y);p.sub(this.lastPoint);b.translate(this.translationMatrix,[p.x/20,-p.y/20,0])}else{c.max(this.width/4,this.height/4);var n=l.p.x-this.lastPoint.x;p=l.p.y-this.lastPoint.y;n=b.rotate(b.identity([]),n*c.PI/180,[0,1,0]);b.rotate(n,p*c.PI/180,[1,0,0]);this.rotationMatrix=b.multiply(n,
this.rotationMatrix)}this.lastPoint=l.p;this.repaint()};d._Canvas3D.prototype.mousewheel=function(l,p){b.translate(this.translationMatrix,[0,0,p*this.maxDimension/8]);this.repaint()}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.math,ChemDoodle.structures,ChemDoodle.RESIDUE,Math,document,mat4,mat3,vec3,window);
(function(d,e,a,f){d.MolGrabberCanvas3D=function(j,c,k){j&&this.create(j,c,k);c=[];c.push('<br><input type="text" id="');c.push(j);c.push('_query" size="32" value="" />');c.push("<br><nobr>");c.push('<select id="');c.push(j);c.push('_select">');c.push('<option value="pubchem" selected>PubChem');c.push("</select>");c.push('<button id="');c.push(j);c.push('_submit">Show Molecule</button>');c.push("</nobr>");f.writeln(c.join(""));var b=this;a("#"+j+"_submit").click(function(){b.search()});a("#"+j+"_query").keypress(function(g){g.which==
13&&b.search()});return true};d.MolGrabberCanvas3D.prototype=new d._Canvas3D;d.MolGrabberCanvas3D.prototype.setSearchTerm=function(j){a("#"+this.id+"_query").val(j);this.search()};d.MolGrabberCanvas3D.prototype.search=function(){var j=this;e.getMoleculeFromDatabase(a("#"+this.id+"_select").val(),a("#"+this.id+"_query").val(),function(c){j.loadMolecule(c)},3)}})(ChemDoodle,ChemDoodle.iChemLabs,jQuery,document);
(function(d,e){d.MovieCanvas3D=function(a,f,j){a&&this.create(a,f,j);this.timeout=50;this.molecules=[];this.frameNumber=0;this.playMode=2;this.reverse=false;return true};d.MovieCanvas3D.PLAY_ONCE=0;d.MovieCanvas3D.PLAY_LOOP=1;d.MovieCanvas3D.PLAY_SPRING=2;d.MovieCanvas3D.prototype=new d._Canvas3D;d.MovieCanvas3D.prototype.startAnimation=d._AnimatorCanvas.prototype.startAnimation;d.MovieCanvas3D.prototype.stopAnimation=d._AnimatorCanvas.prototype.stopAnimation;d.MovieCanvas3D.prototype.isRunning=d._AnimatorCanvas.prototype.isRunning;
d.MovieCanvas3D.prototype.dblclick=d.RotatorCanvas.prototype.dblclick;d.MovieCanvas3D.prototype.nextFrame=function(){this.molecule=this.molecules[this.frameNumber];if(this.playMode==2&&this.reverse){this.frameNumber--;if(this.frameNumber<0){this.frameNumber=1;this.reverse=false}}else{this.frameNumber++;if(this.frameNumber>=this.molecules.length)if(this.playMode==2){this.frameNumber-=2;this.reverse=true}else{this.frameNumber=0;this.playMode==0&&this.stopAnimation()}}};d.MovieCanvas3D.prototype.center=
function(){var a=this.molecule.getCenter3D(),f=new e.Atom;f.sub3D(a);a=0;for(var j=this.molecules.length;a<j;a++)for(var c=this.molecules[a],k=0,b=c.atoms.length;k<b;k++)c.atoms[k].add3D(f)}})(ChemDoodle,ChemDoodle.structures);
(function(d,e,a){d.RotatorCanvas3D=function(f,j,c){f&&this.create(f,j,c);this.timeout=33;this.zIncrement=this.yIncrement=this.xIncrement=f=e.PI/15;return true};d.RotatorCanvas3D.prototype=new d._Canvas3D;d.RotatorCanvas3D.prototype.startAnimation=d._AnimatorCanvas.prototype.startAnimation;d.RotatorCanvas3D.prototype.stopAnimation=d._AnimatorCanvas.prototype.stopAnimation;d.RotatorCanvas3D.prototype.isRunning=d._AnimatorCanvas.prototype.isRunning;d.RotatorCanvas3D.prototype.dblclick=d.RotatorCanvas.prototype.dblclick;
d.RotatorCanvas3D.prototype.mousedown=null;d.RotatorCanvas3D.prototype.rightmousedown=null;d.RotatorCanvas3D.prototype.drag=null;d.RotatorCanvas3D.prototype.mousewheel=null;d.RotatorCanvas3D.prototype.nextFrame=function(f){if(this.molecule==null)this.stopAnimation();else{var j=[];a.identity(j);f=f/1E3;a.rotate(j,this.xIncrement*f,[1,0,0]);a.rotate(j,this.yIncrement*f,[0,1,0]);a.rotate(j,this.zIncrement*f,[0,0,1]);a.multiply(this.rotationMatrix,j)}}})(ChemDoodle,Math,mat4);
(function(d){d.TransformCanvas3D=function(e,a,f){e&&this.create(e,a,f);return true};d.TransformCanvas3D.prototype=new d._Canvas3D})(ChemDoodle);(function(d){d.ViewerCanvas3D=function(e,a,f){e&&this.create(e,a,f);return true};d.ViewerCanvas3D.prototype=new d._Canvas3D;d.ViewerCanvas3D.prototype.mousedown=null;d.ViewerCanvas3D.prototype.rightmousedown=null;d.ViewerCanvas3D.prototype.drag=null;d.ViewerCanvas3D.prototype.mousewheel=null})(ChemDoodle);
(function(d,e,a){function f(j,c,k,b){this.element=j;this.x=c;this.y=k;this.dimension=b}d.PeriodicTableCanvas=function(j,c){this.padding=5;j&&this.create(j,c*18+this.padding*2,c*10+this.padding*2);this.getMolecule=this.loadMolecule=null;this.cellDimension=c?c:20;this.setupTable();this.repaint();return true};d.PeriodicTableCanvas.prototype=new d._Canvas;d.PeriodicTableCanvas.prototype.getHoveredElement=function(){if(this.hovered!=null)return this.hovered.element;return null};d.PeriodicTableCanvas.prototype.innerRepaint=
function(j){for(var c=0,k=this.cells.length;c<k;c++)this.drawCell(j,this.specs,this.cells[c]);this.hovered!=null&&this.drawCell(j,this.specs,this.hovered);this.selected!=null&&this.drawCell(j,this.specs,this.selected)};d.PeriodicTableCanvas.prototype.setupTable=function(){this.cells=[];for(var j=y=this.padding,c=0,k=0,b=d.SYMBOLS.length;k<b;k++){if(c==18){c=0;y+=this.cellDimension;j=this.padding}var g=d.ELEMENT[d.SYMBOLS[k]];if(g.atomicNumber==2){j+=16*this.cellDimension;c+=16}else if(g.atomicNumber==
5||g.atomicNumber==13){j+=10*this.cellDimension;c+=10}if((g.atomicNumber<58||g.atomicNumber>71&&g.atomicNumber<90||g.atomicNumber>103)&&g.atomicNumber<113){this.cells.push(new f(g,j,y,this.cellDimension));j+=this.cellDimension;c++}}y+=2*this.cellDimension;j=3*this.cellDimension+this.padding;for(k=57;k<104;k++){g=d.ELEMENT[d.SYMBOLS[k]];if(g.atomicNumber==90){y+=this.cellDimension;j=3*this.cellDimension+this.padding}if(g.atomicNumber>=58&&g.atomicNumber<=71||g.atomicNumber>=90&&g.atomicNumber<=103){this.cells.push(new f(g,
j,y,this.cellDimension));j+=this.cellDimension}}};d.PeriodicTableCanvas.prototype.drawCell=function(j,c,k){var b=j.createRadialGradient(k.x+k.dimension/3,k.y+k.dimension/3,k.dimension*1.5,k.x+k.dimension/3,k.y+k.dimension/3,k.dimension/10);b.addColorStop(0,"#000000");b.addColorStop(0.7,k.element.jmolColor);b.addColorStop(1,"#FFFFFF");j.fillStyle=b;e.contextRoundRect(j,k.x,k.y,k.dimension,k.dimension,k.dimension/8);if(k==this.hovered||k==this.selected){j.lineWidth=2;j.strokeStyle="#c10000";j.stroke();
j.fillStyle="white"}j.fill();j.font=c.getFontString(c.text_font_size,c.text_font_families);j.fillStyle=c.text_color;j.textAlign="center";j.textBaseline="middle";j.fillText(k.element.symbol,k.x+k.dimension/2,k.y+k.dimension/2)};d.PeriodicTableCanvas.prototype.click=function(){if(this.hovered!=null){this.selected=this.hovered;this.repaint()}};d.PeriodicTableCanvas.prototype.mousemove=function(j){var c=j.p.x;j=j.p.y;this.hovered=null;for(var k=0,b=this.cells.length;k<b;k++){var g=this.cells[k];if(a.isBetween(c,
g.x,g.x+g.dimension)&&a.isBetween(j,g.y,g.y+g.dimension)){this.hovered=g;break}}this.repaint()};d.PeriodicTableCanvas.prototype.mouseout=function(){this.hovered=null;this.repaint()}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.math,document);(function(d,e){d._Layout=function(){return true};d._Layout.prototype.layout=function(){this.innerLayout&&this.innerLayout()};d._Layout.prototype.create=function(a){this.name=a;this.specs=new e.VisualSpecifications}})(ChemDoodle,ChemDoodle.structures);
(function(d,e,a){d.SimpleReactionLayout=function(f){this.reactants=[];this.products=[];this.textBelow=this.textAbove=null;this.arrow="&rarr;";this.plus="+";this.create(f);return true};d.SimpleReactionLayout.prototype=new d._Layout;d.SimpleReactionLayout.prototype.addReactant=function(f){this.reactants.push(f)};d.SimpleReactionLayout.prototype.addProduct=function(f){this.products.push(f)};d.SimpleReactionLayout.prototype.innerLayout=function(){a.writeln("<table><tr>");for(var f=0,j=this.reactants.length;f<
j;f++){f>0&&a.writeln('<td><span style="font-size:25px;">'+this.plus+"</span></td>");a.writeln("<td>");var c=this.reactants[f].getDimension();c=new d.ViewerCanvas(this.name+"_reactant"+f,c.x+60,c.y+60);this.specs.backgroundColor==null&&e("#"+this.name+"_reactant"+f).css("border","0px");c.specs=this.specs;c.loadMolecule(this.reactants[f]);a.writeln("</td>")}a.writeln("<td>");a.writeln("<table>");a.writeln("<tr><td>");this.textAbove!=null?a.writeln("<center>"+this.textAbove+"</center>"):a.writeln("&nbsp;");
a.writeln("</td></tr>");a.writeln('<tr><td><center><span style="font-size:25px;">'+this.arrow+"</span></center></td></tr>");a.writeln("<tr><td>");this.textBelow!=null?a.writeln("<center>"+this.textBelow+"</center>"):a.writeln("&nbsp;");a.writeln("</td></tr>");a.writeln("</table>");a.writeln("</td>");f=0;for(j=this.products.length;f<j;f++){f>0&&a.writeln('<td><span style="font-size:25px;">'+this.plus+"</td>");a.writeln("<td>");c=this.products[f].getDimension();c=new d.ViewerCanvas(this.name+"_product"+
f,c.x+60,c.y+60);this.specs.backgroundColor==null&&e("#"+this.name+"_product"+f).css("border","0px");c.specs=this.specs;c.loadMolecule(this.products[f]);a.writeln("</td>")}a.writeln("</tr></table>")}})(ChemDoodle,jQuery,document);(function(d,e,a){d.png={};d.png.create=function(f){a.open(e.getElementById(f.id).toDataURL("image/png"))}})(ChemDoodle.io,document,window);

