Benutzer:Matthias M./ChemDoodleWeb.js

aus Wikipedia, der freien Enzyklopädie

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
//
// ChemDoodle Web Components 4.7.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(){return{structures:{},iChemLabs:{},informatics:{},io:{},getVersion:function(){return"4.7.0"}}}();
(function(b,c,a,g,e){c.SERVER_URL="http://ichemlabs.cloud.chemdoodle.com/ICL_servlets/WebHQ1";c.inRelay=!1;c.asynchronous=!0;c.INFO={userAgent:navigator.userAgent,v_cwc:b.getVersion(),v_jQuery:e.version,v_jQuery_ui:e.ui?e.ui.version:"N/A"};c.contactServer=function(a,k,f,b){this.inRelay?alert("Already connecting to the server, please wait for the first request to finish."):(c.inRelay=!0,e.ajax({dataType:"text",type:"POST",data:JSON.stringify({call:a,content:k,info:c.INFO}),url:this.SERVER_URL,success:function(a){c.inRelay=
!1;o=JSON.parse(a);o.message&&alert(o.message);null!=f&&o.content&&!o.stop&&f(o.content);o.stop&&null!=b&&b()},error:function(){c.inRelay=!1;alert("Server connectivity failed. Please try again or update this browser to the latest version. (XHR2 not supported)");null!=b&&b()},beforeSend:function(a){a.withCredentials=!0},async:c.asynchronous}))};c.optimize=function(d,b,f,c){this.contactServer("optimize",{mol:a.toJSONDummy(d),dimension:b},function(c){c=a.fromJSONDummy(c.mol);if(2==b){for(var j=0,e=c.atoms.length;j<
e;j++)d.atoms[j].x=c.atoms[j].x,d.atoms[j].y=c.atoms[j].y;f()}else if(3==b){j=0;for(e=c.atoms.length;j<e;j++)c.atoms[j].x/=20,c.atoms[j].y/=20,c.atoms[j].z/=20;f(c)}},c)};c.readSMILES=function(d,b,f){this.contactServer("readSMILES",{smiles:d},function(d){b(a.fromJSONDummy(d.mol))},f)};c.writeSMILES=function(d,b,f){this.contactServer("writeSMILES",{mol:a.toJSONDummy(d)},function(a){b(a.smiles)},f)};c.saveFile=function(d,b,f,c){this.contactServer("saveFile",{mol:a.toJSONDummy(d),ext:b},function(a){f(a.link)},
c)};c.getMoleculeFromDatabase=function(d,b,f,c,e){this.contactServer("getMoleculeFromDatabase",{database:d,dimension:c?c:2,query:b},function(d){if(3==c)for(var b=0,k=d.mol.a.length;b<k;b++)d.mol.a[b].x/=20,d.mol.a[b].y/=-20,d.mol.a[b].z/=20;f(a.fromJSONDummy(d.mol))},e)};c.getMoleculeFromContent=function(a,b,f,c){this.contactServer("getMoleculeFromContent",{content:a,format:b},function(a){for(var d=!1,b=0,c=a.mol.a.length;b<c;b++)if(0!=a.mol.a[b].z){d=!0;break}if(d){b=0;for(c=a.mol.a.length;b<c;b++)a.mol.a[b].x/=
20,a.mol.a[b].y/=20,a.mol.a[b].z/=20}f(ChemDoodle.io.fromJSONDummy(a.mol))},c)};c.calculate=function(d,b,f,c){this.contactServer("calculate",{mol:a.toJSONDummy(d),descriptors:b},function(a){f(a)},c)};c.simulate1HNMR=function(d,c,f){this.contactServer("simulateNMR",{mol:a.toJSONDummy(d),nucleus:"H",isotope:1},function(a){c(b.readJCAMP(a.jcamp))},f)};c.simulate13CNMR=function(d,c,f){this.contactServer("simulateNMR",{mol:a.toJSONDummy(d),nucleus:"C",isotope:13},function(a){c(b.readJCAMP(a.jcamp))},f)};
c.simulateMassParentPeak=function(d,c,f){this.contactServer("simulateMassParentPeak",{mol:a.toJSONDummy(d)},function(a){c(b.readJCAMP(a.jcamp))},f)};c.getOptimizedPDBStructure=function(d,b,f,c){this.contactServer("getOptimizedPDBStructure",{id:d,withAtoms:b},function(d){var b=null,b=d.mol?a.fromJSONDummy(d.mol):new g.Molecule;b.chains=a.fromJSONChains(d.ribbons);b.fromJSON=!0;f(b)},c)};c.getAd=function(a,b){this.contactServer("getAd",{},function(b){a(b.image_url,b.target_url)},b)};c.kekulize=function(d,
b,f){this.contactServer("kekulize",{mol:a.toJSONDummy(d)},function(d){b(a.fromJSONDummy(d.mol))},f)};c.isGraphIsomorphism=function(d,b,f,c){this.contactServer("isGraphIsomorphism",{arrow:a.toJSONDummy(d),target:a.toJSONDummy(b)},function(a){f(a.value)},c)};c.isSubgraphIsomorphism=function(d,b,f,c){this.contactServer("isSubgraphIsomorphism",{arrow:a.toJSONDummy(d),target:a.toJSONDummy(b)},function(a){f(a.value)},c)};c.readIUPACName=function(d,b,f){this.contactServer("readIUPACName",{iupac:d},function(d){b(a.fromJSONDummy(d.mol))},
f)};c.generateImage=function(d,b,f,c){this.contactServer("generateImage",{mol:a.toJSONDummy(d),ext:b},function(a){f(a.link)},c)};c.getZeoliteFromIZA=function(a,b,f,c,e,j){this.contactServer("getZeoliteFromIZA",{query:a},function(a){b(ChemDoodle.readCIF(a.cif,f,c,e))},j)}})(ChemDoodle,ChemDoodle.iChemLabs,ChemDoodle.io,ChemDoodle.structures,jQuery);
ChemDoodle.extensions=function(b,c,a){return{stringStartsWith:function(a,b){return a.match("^"+b)==b},vec3AngleFrom:function(b,e){var d=c.length(b),k=c.length(e),d=c.dot(b,e)/d/k;return a.acos(d)},contextHashTo:function(a,c,d,k,f,m,n){for(var j=0,p=(new b.Point(c,d)).distance(new b.Point(k,f)),l=!1,h=c,v=d,c=k-c,d=f-d;j<p;){if(l)if(j+n>p){a.moveTo(k,f);break}else{var q=n/p,h=h+q*c,v=v+q*d;a.moveTo(h,v);j+=n}else if(j+m>p){a.lineTo(k,f);break}else q=m/p,h+=q*c,v+=q*d,a.lineTo(h,v),j+=m;l=!l}},contextRoundRect:function(a,
b,d,c,f,m){a.beginPath();a.moveTo(b+m,d);a.lineTo(b+c-m,d);a.quadraticCurveTo(b+c,d,b+c,d+m);a.lineTo(b+c,d+f-m);a.quadraticCurveTo(b+c,d+f,b+c-m,d+f);a.lineTo(b+m,d+f);a.quadraticCurveTo(b,d+f,b,d+f-m);a.lineTo(b,d+m);a.quadraticCurveTo(b,d,b+m,d);a.closePath()},contextEllipse:function(a,b,d,c,f){var m=0.5522848*(c/2),n=0.5522848*(f/2),j=b+c,p=d+f,c=b+c/2,f=d+f/2;a.beginPath();a.moveTo(b,f);a.bezierCurveTo(b,f-n,c-m,d,c,d);a.bezierCurveTo(c+m,d,j,f-n,j,f);a.bezierCurveTo(j,f+n,c+m,p,c,p);a.bezierCurveTo(c-
m,p,b,f+n,b,f);a.closePath()}}}(ChemDoodle.structures,vec3,Math);
ChemDoodle.math=function(b,c,a){var g={},e={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"};g.angleBetweenLargest=function(d){if(0==d.length)return{angle:0,largest:2*a.PI};if(1==d.length)return{angle:d[0]+a.PI,largest:2*a.PI};for(var b=0,c=0,e=0,g=d.length-1;e<g;e++){var j=d[e+1]-d[e];
j>b&&(b=j,c=(d[e+1]+d[e])/2)}e=d[0]+2*a.PI-d[d.length-1];e>b&&(c=d[0]-e/2,b=e,0>c&&(c+=2*a.PI));return{angle:c,largest:b}};g.isBetween=function(a,b,c){return a>=b&&a<=c};g.getRGB=function(a,c){var f=[0,0,0];null!=e[a.toLowerCase()]&&(a=e[a.toLowerCase()]);if("#"==a.charAt(0))return 4==a.length&&(a="#"+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)+a.charAt(3)+a.charAt(3)),[parseInt(a.substring(1,3),16)/255*c,parseInt(a.substring(3,5),16)/255*c,parseInt(a.substring(5,7),16)/255*c];if(b.stringStartsWith(a,
"rgb")){var g=a.replace(/rgb\(|\)/g,"").split(",");return 3!=g.length?f:[parseInt(g[0])/255*c,parseInt(g[1])/255*c,parseInt(g[2])/255*c]}return f};g.distanceFromPointToLineInclusive=function(d,b,f){var e=b.distance(f),f=b.angle(f),f=a.PI/2-f;new c.Point(d.x-b.x,d.y-b.x);new c.Point;f=b.angle(d)+f;d=b.distance(d);pcopRot=new c.Point(d*a.cos(f),-d*a.sin(f));return g.isBetween(-pcopRot.y,0,e)?a.abs(pcopRot.x):-1};g.calculateDistanceInterior=function(d,b,c){if(this.isBetween(b.x,c.x,c.x+c.w)&&this.isBetween(b.y,
c.y,c.y+c.w))return d.distance(b);var e=[];e.push({x1:c.x,y1:c.y,x2:c.x+c.w,y2:c.y});e.push({x1:c.x,y1:c.y+c.h,x2:c.x+c.w,y2:c.y+c.h});e.push({x1:c.x,y1:c.y,x2:c.x,y2:c.y+c.h});e.push({x1:c.x+c.w,y1:c.y,x2:c.x+c.w,y2:c.y+c.h});for(var c=[],g=0;4>g;g++){var j=e[g];(j=this.intersectLines(b.x,b.y,d.x,d.y,j.x1,j.y1,j.x2,j.y2))&&c.push(j)}if(0==c.length)return 0;g=b=0;for(e=c.length;g<e;g++)var j=c[g],p=d.x-j.x,j=d.y-j.y,b=a.max(b,a.sqrt(p*p+j*j));return b};g.intersectLines=function(a,b,c,e,g,j,p,l){var c=
c-a,e=e-b,p=p-g,l=l-j,h=e*p-c*l;if(0==h)return!1;p=(l*(a-g)-p*(b-j))/h;g=(e*(a-g)-c*(b-j))/h;return 0<=g&&1>=g&&0<=p&&1>=p?{x:a+p*c,y:b+p*e}:!1};g.hsl2rgb=function(a,b,c){if(0==b)c=b=a=c;else var e=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*c:0.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a},g=0.5>c?c*(1+b):c+b-c*b,j=2*c-g,c=e(j,g,a+1/3),b=e(j,g,a),a=e(j,g,a-1/3);return[255*c,255*b,255*a]};return g}(ChemDoodle.extensions,ChemDoodle.structures,Math);
ChemDoodle.featureDetection=function(b,c,a,g){var e={supports_canvas:function(){return!!a.createElement("canvas").getContext},supports_canvas_text:function(){return!e.supports_canvas()?!1:"function"==typeof a.createElement("canvas").getContext("2d").fillText},supports_webgl:function(){var c=a.createElement("canvas");try{if(c.getContext("webgl")||c.getContext("experimental-webgl"))return!0}catch(b){}return!1},supports_xhr2:function(){return c.support.cors},supports_touch:function(){return"ontouchstart"in
g},supports_gesture:function(){return"ongesturestart"in g}};return e}(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".split(",");
ChemDoodle.ELEMENT=function(b){function c(a,c,b){this.symbol=a;this.name=c;this.atomicNumber=b;return!0}var a=[];a.H=new c("H","Hydrogen",1);a.He=new c("He","Helium",2);a.Li=new c("Li","Lithium",3);a.Be=new c("Be","Beryllium",4);a.B=new c("B","Boron",5);a.C=new c("C","Carbon",6);a.N=new c("N","Nitrogen",7);a.O=new c("O","Oxygen",8);a.F=new c("F","Fluorine",9);a.Ne=new c("Ne","Neon",10);a.Na=new c("Na","Sodium",11);a.Mg=new c("Mg","Magnesium",12);a.Al=new c("Al","Aluminum",13);a.Si=new c("Si","Silicon",
14);a.P=new c("P","Phosphorus",15);a.S=new c("S","Sulfur",16);a.Cl=new c("Cl","Chlorine",17);a.Ar=new c("Ar","Argon",18);a.K=new c("K","Potassium",19);a.Ca=new c("Ca","Calcium",20);a.Sc=new c("Sc","Scandium",21);a.Ti=new c("Ti","Titanium",22);a.V=new c("V","Vanadium",23);a.Cr=new c("Cr","Chromium",24);a.Mn=new c("Mn","Manganese",25);a.Fe=new c("Fe","Iron",26);a.Co=new c("Co","Cobalt",27);a.Ni=new c("Ni","Nickel",28);a.Cu=new c("Cu","Copper",29);a.Zn=new c("Zn","Zinc",30);a.Ga=new c("Ga","Gallium",
31);a.Ge=new c("Ge","Germanium",32);a.As=new c("As","Arsenic",33);a.Se=new c("Se","Selenium",34);a.Br=new c("Br","Bromine",35);a.Kr=new c("Kr","Krypton",36);a.Rb=new c("Rb","Rubidium",37);a.Sr=new c("Sr","Strontium",38);a.Y=new c("Y","Yttrium",39);a.Zr=new c("Zr","Zirconium",40);a.Nb=new c("Nb","Niobium",41);a.Mo=new c("Mo","Molybdenum",42);a.Tc=new c("Tc","Technetium",43);a.Ru=new c("Ru","Ruthenium",44);a.Rh=new c("Rh","Rhodium",45);a.Pd=new c("Pd","Palladium",46);a.Ag=new c("Ag","Silver",47);a.Cd=
new c("Cd","Cadmium",48);a.In=new c("In","Indium",49);a.Sn=new c("Sn","Tin",50);a.Sb=new c("Sb","Antimony",51);a.Te=new c("Te","Tellurium",52);a.I=new c("I","Iodine",53);a.Xe=new c("Xe","Xenon",54);a.Cs=new c("Cs","Cesium",55);a.Ba=new c("Ba","Barium",56);a.La=new c("La","Lanthanum",57);a.Ce=new c("Ce","Cerium",58);a.Pr=new c("Pr","Praseodymium",59);a.Nd=new c("Nd","Neodymium",60);a.Pm=new c("Pm","Promethium",61);a.Sm=new c("Sm","Samarium",62);a.Eu=new c("Eu","Europium",63);a.Gd=new c("Gd","Gadolinium",
64);a.Tb=new c("Tb","Terbium",65);a.Dy=new c("Dy","Dysprosium",66);a.Ho=new c("Ho","Holmium",67);a.Er=new c("Er","Erbium",68);a.Tm=new c("Tm","Thulium",69);a.Yb=new c("Yb","Ytterbium",70);a.Lu=new c("Lu","Lutetium",71);a.Hf=new c("Hf","Hafnium",72);a.Ta=new c("Ta","Tantalum",73);a.W=new c("W","Tungsten",74);a.Re=new c("Re","Rhenium",75);a.Os=new c("Os","Osmium",76);a.Ir=new c("Ir","Iridium",77);a.Pt=new c("Pt","Platinum",78);a.Au=new c("Au","Gold",79);a.Hg=new c("Hg","Mercury",80);a.Tl=new c("Tl",
"Thallium",81);a.Pb=new c("Pb","Lead",82);a.Bi=new c("Bi","Bismuth",83);a.Po=new c("Po","Polonium",84);a.At=new c("At","Astatine",85);a.Rn=new c("Rn","Radon",86);a.Fr=new c("Fr","Francium",87);a.Ra=new c("Ra","Radium",88);a.Ac=new c("Ac","Actinium",89);a.Th=new c("Th","Thorium",90);a.Pa=new c("Pa","Protactinium",91);a.U=new c("U","Uranium",92);a.Np=new c("Np","Neptunium",93);a.Pu=new c("Pu","Plutonium",94);a.Am=new c("Am","Americium",95);a.Cm=new c("Cm","Curium",96);a.Bk=new c("Bk","Berkelium",97);
a.Cf=new c("Cf","Californium",98);a.Es=new c("Es","Einsteinium",99);a.Fm=new c("Fm","Fermium",100);a.Md=new c("Md","Mendelevium",101);a.No=new c("No","Nobelium",102);a.Lr=new c("Lr","Lawrencium",103);a.Rf=new c("Rf","Rutherfordium",104);a.Db=new c("Db","Dubnium",105);a.Sg=new c("Sg","Seaborgium",106);a.Bh=new c("Bh","Bohrium",107);a.Hs=new c("Hs","Hassium",108);a.Mt=new c("Mt","Meitnerium",109);a.Ds=new c("Ds","Darmstadtium",110);a.Rg=new c("Rg","Roentgenium",111);a.Cn=new c("Cn","Copernicium",112);
a.Uut=new c("Uut","Ununtrium",113);a.Uuq=new c("Uuq","Ununquadium",114);a.Uup=new c("Uup","Ununpentium",115);a.Uuh=new c("Uuh","Ununhexium",116);a.Uus=new c("Uus","Ununseptium",117);a.Uuo=new c("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 g=0,e=b.length;g<e;g++)a[b[g]].pymolColor=a[b[g]].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 b(a,c){this.symbol=a;this.name=c;return!0}var c=[];c.Ala=new b("Ala","Alanine");c.Arg=new b("Arg","Arginine");c.Asn=new b("Asn","Asparagine");c.Asp=new b("Asp","Aspartic Acid");c.Cys=new b("Cys","Cysteine");c.Gln=new b("Gln","Glutamine");c.Glu=new b("Glu","Glutamic Acid");c.Gly=new b("Gly","Glycine");c.His=new b("His","Histidine");c.Ile=new b("Ile","Isoleucine");c.Leu=new b("Leu","Leucine");c.Lys=new b("Lys","Lysine");c.Met=new b("Met","Methionine");c.Phe=new b("Phe",
"Phenylalanine");c.Pro=new b("Pro","Proline");c.Ser=new b("Ser","Serine");c.Thr=new b("Thr","Threonine");c.Trp=new b("Trp","Tryptophan");c.Tyr=new b("Tyr","Tyrosine");c.Val=new b("Val","Valine");c.Asx=new b("Asx","Asparagine/Aspartic Acid");c.Glx=new b("Glx","Glutamine/Glutamic Acid");c["*"]=new b("*","Other");c.A=new b("A","Adenine");c.G=new b("G","Guanine");c.I=new b("I","");c.C=new b("C","Cytosine");c.T=new b("T","Thymine");c.U=new b("U","Uracil");c.Ala.polar=!1;c.Arg.polar=!0;c.Asn.polar=!0;c.Asp.polar=
!0;c.Cys.polar=!0;c.Gln.polar=!0;c.Glu.polar=!0;c.Gly.polar=!1;c.His.polar=!0;c.Ile.polar=!1;c.Leu.polar=!1;c.Lys.polar=!0;c.Met.polar=!1;c.Phe.polar=!1;c.Pro.polar=!1;c.Ser.polar=!0;c.Thr.polar=!0;c.Trp.polar=!0;c.Tyr.polar=!0;c.Val.polar=!1;c.Asx.polar=!0;c.Glx.polar=!0;c.Ala.aminoColor="#C8C8C8";c.Arg.aminoColor="#145AFF";c.Asn.aminoColor="#00DCDC";c.Asp.aminoColor="#E60A0A";c.Cys.aminoColor="#E6E600";c.Gln.aminoColor="#00DCDC";c.Glu.aminoColor="#E60A0A";c.Gly.aminoColor="#EBEBEB";c.His.aminoColor=
"#8282D2";c.Ile.aminoColor="#0F820F";c.Leu.aminoColor="#0F820F";c.Lys.aminoColor="#145AFF";c.Met.aminoColor="#E6E600";c.Phe.aminoColor="#3232AA";c.Pro.aminoColor="#DC9682";c.Ser.aminoColor="#FA9600";c.Thr.aminoColor="#FA9600";c.Trp.aminoColor="#B45AB4";c.Tyr.aminoColor="#3232AA";c.Val.aminoColor="#0F820F";c.Asx.aminoColor="#FF69B4";c.Glx.aminoColor="#FF69B4";c["*"].aminoColor="#BEA06E";c.A.aminoColor="#BEA06E";c.G.aminoColor="#BEA06E";c.I.aminoColor="#BEA06E";c.C.aminoColor="#BEA06E";c.T.aminoColor=
"#BEA06E";c.U.aminoColor="#BEA06E";c.Ala.shapelyColor="#8CFF8C";c.Arg.shapelyColor="#00007C";c.Asn.shapelyColor="#FF7C70";c.Asp.shapelyColor="#A00042";c.Cys.shapelyColor="#FFFF70";c.Gln.shapelyColor="#FF4C4C";c.Glu.shapelyColor="#660000";c.Gly.shapelyColor="#FFFFFF";c.His.shapelyColor="#7070FF";c.Ile.shapelyColor="#004C00";c.Leu.shapelyColor="#455E45";c.Lys.shapelyColor="#4747B8";c.Met.shapelyColor="#B8A042";c.Phe.shapelyColor="#534C52";c.Pro.shapelyColor="#525252";c.Ser.shapelyColor="#FF7042";c.Thr.shapelyColor=
"#B84C00";c.Trp.shapelyColor="#4F4600";c.Tyr.shapelyColor="#8C704C";c.Val.shapelyColor="#FF8CFF";c.Asx.shapelyColor="#FF00FF";c.Glx.shapelyColor="#FF00FF";c["*"].shapelyColor="#FF00FF";c.A.shapelyColor="#A0A0FF";c.G.shapelyColor="#FF7070";c.I.shapelyColor="#80FFFF";c.C.shapelyColor="#FF8C4B";c.T.shapelyColor="#A0FFA0";c.U.shapelyColor="#FF8080";return c}();
(function(b){b.Queue=function(){var c=[],a=0;this.getSize=function(){return c.length-a};this.isEmpty=function(){return 0==c.length};this.enqueue=function(a){c.push(a)};this.dequeue=function(){var b=void 0;c.length&&(b=c[a],2*++a>=c.length&&(c=c.slice(a),a=0));return b};this.getOldestElement=function(){var b=void 0;c.length&&(b=c[a]);return b}}})(ChemDoodle.structures);
(function(b,c){b.Point=function(a,b){this.x=a?a:0;this.y=b?b:0;this.sub=function(a){this.x-=a.x;this.y-=a.y};this.add=function(a){this.x+=a.x;this.y+=a.y};this.distance=function(a){var b=a.x-this.x,a=a.y-this.y;return c.sqrt(b*b+a*a)};this.angleForStupidCanvasArcs=function(a){for(var b=a.x-this.x,a=a.y-this.y,g=0,g=0==b?0==a?0:0<a?c.PI/2:3*c.PI/2:0==a?0<b?0:c.PI:0>b?c.atan(a/b)+c.PI:0>a?c.atan(a/b)+2*c.PI:c.atan(a/b);0>g;)g+=2*c.PI;return g%=2*c.PI};this.angle=function(a){for(var b=a.x-this.x,a=this.y-
a.y,g=0,g=0==b?0==a?0:0<a?c.PI/2:3*c.PI/2:0==a?0<b?0:c.PI:0>b?c.atan(a/b)+c.PI:0>a?c.atan(a/b)+2*c.PI:c.atan(a/b);0>g;)g+=2*c.PI;return g%=2*c.PI};return!0}})(ChemDoodle.structures,Math);
(function(b,c,a,g,e){a.Atom=function(a,k,f,m){this.x=k?k:0;this.y=f?f:0;this.z=m?m:0;this.numLonePair=this.charge=0;this.mass=-1;this.angleOfLeastInterference=this.bondNumber=this.coordinationNumber=0;this.isHidden=!1;this.label=a?a.replace(/\s/g,""):"C";this.altLabel=null;b[this.label]||(this.label="C");this.isSelected=this.isHover=this.isLone=!1;this.add3D=function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z};this.sub3D=function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-
a.z};this.distance3D=function(a){var b=a.x-this.x,c=a.y-this.y,a=a.z-this.z;return g.sqrt(b*b+c*c+a*a)};this.draw=function(a,d){this.textBounds=[];if(this.specs)d=this.specs;var f=d.getFontString(d.atoms_font_size_2D,d.atoms_font_families_2D,d.atoms_font_bold_2D,d.atoms_font_italic_2D);a.font=f;a.fillStyle=d.atoms_color;if(d.atoms_useJMOLColors)a.fillStyle=b[this.label].jmolColor;else if(d.atoms_usePYMOLColors)a.fillStyle=b[this.label].pymolColor;if(this.isLone&&!d.atoms_displayAllCarbonLabels_2D||
d.atoms_circles_2D){a.beginPath();a.arc(this.x,this.y,d.atoms_circleDiameter_2D/2,0,g.PI*2,false);a.fill();if(d.atoms_circleBorderWidth_2D>0){a.lineWidth=d.atoms_circleBorderWidth_2D;a.strokeStyle="black";a.stroke(this.x,this.y,0,g.PI*2,d.atoms_circleDiameter_2D/2)}}else if(this.isLabelVisible(d)){a.textAlign="center";a.textBaseline="middle";if(this.altLabel!=void 0){a.fillText(this.altLabel,this.x,this.y);var e=a.measureText(this.altLabel).width;this.textBounds.push({x:this.x-e/2,y:this.y-d.atoms_font_size_2D/
2+1,w:e,h:d.atoms_font_size_2D-2})}else{a.fillText(this.label,this.x,this.y);e=a.measureText(this.label).width;this.textBounds.push({x:this.x-e/2,y:this.y-d.atoms_font_size_2D/2+1,w:e,h:d.atoms_font_size_2D-2});if(this.mass!=-1){var k=d.getFontString(d.atoms_font_size_2D*0.7,d.atoms_font_families_2D,d.atoms_font_bold_2D,d.atoms_font_italic_2D),m=a.font;a.font=k;k=a.measureText(this.mass).width;a.fillText(this.mass,this.x-k-0.5,this.y-d.atoms_font_size_2D*0.3);a.font=m}m=this.getImplicitHydrogenCount();
if(d.atoms_implicitHydrogens_2D&&m>0){var q=a.measureText("H").width;if(m>1){var u=e/2+q/2,t=0,k=d.getFontString(d.atoms_font_size_2D*0.8,d.atoms_font_families_2D,d.atoms_font_bold_2D,d.atoms_font_italic_2D);a.font=k;var w=a.measureText(m).width;if(this.bondNumber==1)this.angleOfLeastInterference>g.PI/2&&this.angleOfLeastInterference<3*g.PI/2&&(u=-e/2-w-q/2);else if(!(this.angleOfLeastInterference<=g.PI/4))if(this.angleOfLeastInterference<3*g.PI/4){u=0;t=-d.atoms_font_size_2D*0.9}else if(this.angleOfLeastInterference<=
5*g.PI/4)u=-e/2-w-q/2;else if(this.angleOfLeastInterference<7*g.PI/4){u=0;t=d.atoms_font_size_2D*0.9}a.font=f;a.fillText("H",this.x+u,this.y+t);a.font=k;a.fillText(m,this.x+u+q/2+w/2,this.y+t+d.atoms_font_size_2D*0.3);this.textBounds.push({x:this.x+u-q/2,y:this.y+t-d.atoms_font_size_2D/2+1,w:q,h:d.atoms_font_size_2D-2});this.textBounds.push({x:this.x+u+q/2,y:this.y+t+d.atoms_font_size_2D*0.3-d.atoms_font_size_2D/2+1,w:w,h:d.atoms_font_size_2D*0.8-2})}else{u=e/2+q/2;t=0;if(this.bondNumber==1)this.angleOfLeastInterference>
g.PI/2&&this.angleOfLeastInterference<3*g.PI/2&&(u=-e/2-q/2);else if(!(this.angleOfLeastInterference<=g.PI/4))if(this.angleOfLeastInterference<3*g.PI/4){u=0;t=-d.atoms_font_size_2D*0.9}else if(this.angleOfLeastInterference<=5*g.PI/4)u=-e/2-q/2;else if(this.angleOfLeastInterference<7*g.PI/4){u=0;t=d.atoms_font_size_2D*0.9}a.fillText("H",this.x+u,this.y+t);this.textBounds.push({x:this.x+u-q/2,y:this.y+t-d.atoms_font_size_2D/2+1,w:q,h:d.atoms_font_size_2D-2})}}}if(this.charge!=0){f=this.charge.toFixed(0);
f=f=="1"?"+":f=="-1"?"\u2013":c.stringStartsWith(f,"-")?f.substring(1)+"\u2013":f+"+";e=this.angleOfLeastInterference;k=d.atoms_font_size_2D;this.isLabelVisible(d)&&m>0&&(e=e+g.PI/4);a.textAlign="center";a.textBaseline="middle";a.fillText(f,this.x+k*g.cos(e),this.y-k*g.sin(e))}if(this.numLonePair>0){a.fillStyle="black";if(this.bondNumber==2&&g.abs(this.largestAngle-g.PI)<g.PI/60){this.drawLonePairs(a,d,g.floor(this.numLonePair/2),this.angleOfLeastInterference,this.largestAngle);this.drawLonePairs(a,
d,g.floor(this.numLonePair/2)+this.numLonePair%2,this.angleOfLeastInterference+g.PI,this.largestAngle)}else this.drawLonePairs(a,d,this.numLonePair,this.angleOfLeastInterference,this.largestAngle)}}};this.drawLonePairs=function(a,b,c,d,f){for(var e=f/(c+(this.bondNumber==0?0:1)),f=d-f/2+e,k=0;k<c;k++){var d=f+k*e,m=this.x+Math.cos(d)*b.atoms_lonePairDistance_2D,t=this.y-Math.sin(d)*b.atoms_lonePairDistance_2D,w=d+Math.PI/2,d=Math.cos(w)*b.atoms_lonePairSpread_2D/2,w=-Math.sin(w)*b.atoms_lonePairSpread_2D/
2;a.beginPath();a.arc(m+d,t+w,b.atoms_lonePairDiameter_2D,0,g.PI*2,false);a.fill();a.beginPath();a.arc(m-d,t-w,b.atoms_lonePairDiameter_2D,0,g.PI*2,false);a.fill()}};this.drawDecorations=function(a){if(this.isHover||this.isSelected){a.strokeStyle=this.isHover?"#885110":"#0060B2";a.lineWidth=1.2;a.beginPath();a.arc(this.x,this.y,this.isHover?7:15,0,g.PI*2,false);a.stroke()}};this.render=function(a,d){if(this.specs)d=this.specs;var c=e.translate(a.modelViewMatrix,[this.x,this.y,this.z],[]),f=d.atoms_useVDWDiameters_3D?
b[this.label].vdWRadius*d.atoms_vdwMultiplier_3D:d.atoms_sphereDiameter_3D/2;f==0&&(f=1);e.scale(c,[f,f,f]);f=d.atoms_color;if(d.atoms_useJMOLColors)f=b[this.label].jmolColor;else if(d.atoms_usePYMOLColors)f=b[this.label].pymolColor;a.material.setDiffuseColor(f);a.setMatrixUniforms(c);a.drawElements(a.TRIANGLES,(this.renderAsStar?a.starBuffer:a.sphereBuffer).vertexIndexBuffer.numItems,a.UNSIGNED_SHORT,0)};this.isLabelVisible=function(a){return a.atoms_displayAllCarbonLabels_2D||this.label!="C"||this.altLabel||
this.mass!=-1||this.charge!=0||this.numLonePair!=0||this.isHidden&&a.atoms_showHiddenCarbons_2D||a.atoms_displayTerminalCarbonLabels_2D&&this.bondNumber==1};this.getImplicitHydrogenCount=function(){if(this.label=="H"||b[this.label]==null)return 0;var a=b[this.label].valency,d=a-this.coordinationNumber;if(this.charge>0){a=4-a;d=this.charge<=a?d+this.charge:4-this.coordinationNumber-this.charge+a}else d=d+this.charge;return d<0?0:d};return!0};a.Atom.prototype=new a.Point(0,0)})(ChemDoodle.ELEMENT,ChemDoodle.extensions,
ChemDoodle.structures,Math,mat4);
(function(b,c,a,g,e,d,k){a.Bond=function(f,m,n){this.a1=f;this.a2=m;this.bondOrder=n?n:1;this.stereo=a.Bond.STEREO_NONE;this.isHover=!1;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(a){return a==this.a1||a==this.a2};this.getNeighbor=function(a){return a==this.a1?this.a2:a==this.a2?this.a1:
null};this.draw=function(d,f){if(!(this.a1.x==this.a2.x&&this.a1.y==this.a2.y)){this.specs&&(f=this.specs);var k=this.a1.x,m=this.a2.x,n=this.a1.y,q=this.a2.y,u=this.a1.distance(this.a2),t=m-k,w=q-n;if(f.atoms_display&&!f.atoms_circles_2D&&this.a1.isLabelVisible(f)){for(var r=0,A=0,B=this.a1.textBounds.length;A<B;A++)r=Math.max(r,g.calculateDistanceInterior(this.a1,this.a2,this.a1.textBounds[A]));r+=f.bonds_atomLabelBuffer_2D;r/=u;k+=t*r;n+=w*r}if(f.atoms_display&&!f.atoms_circles_2D&&this.a2.isLabelVisible(f)){A=
r=0;for(B=this.a2.textBounds.length;A<B;A++)r=Math.max(r,g.calculateDistanceInterior(this.a2,this.a1,this.a2.textBounds[A]));r+=f.bonds_atomLabelBuffer_2D;r/=u;m-=t*r;q-=w*r}f.bonds_clearOverlaps_2D&&(r=k+0.15*t,u=n+0.15*w,A=m-0.15*t,B=q-0.15*w,d.strokeStyle=f.backgroundColor,d.lineWidth=f.bonds_width_2D+2*f.bonds_overlapClearWidth_2D,d.lineCap="round",d.beginPath(),d.moveTo(r,u),d.lineTo(A,B),d.closePath(),d.stroke());d.strokeStyle=f.bonds_color;d.fillStyle=f.bonds_color;d.lineWidth=f.bonds_width_2D;
d.lineCap=f.bonds_ends_2D;if(f.bonds_useJMOLColors||f.bonds_usePYMOLColors)r=d.createLinearGradient(k,n,m,q),u=b[this.a1.label].jmolColor,A=b[this.a2.label].jmolColor,f.atoms_usePYMOLColors&&(u=b[this.a1.label].pymolColor,A=b[this.a2.label].pymolColor),r.addColorStop(0,u),f.bonds_colorGradient||(r.addColorStop(0.5,u),r.addColorStop(0.51,A)),r.addColorStop(1,A),d.strokeStyle=r,d.fillStyle=r;switch(this.bondOrder){case 0.5:d.beginPath();d.moveTo(k,n);c.contextHashTo(d,k,n,m,q,f.bonds_hashSpacing_2D,
f.bonds_hashSpacing_2D);d.stroke();break;case 1:if(this.stereo==a.Bond.STEREO_PROTRUDING||this.stereo==a.Bond.STEREO_RECESSED){var x=f.bonds_width_2D/2,w=this.a1.distance(this.a2)*f.bonds_wedgeThickness_2D/2,r=this.a1.angle(this.a2)+e.PI/2,u=e.cos(r),r=e.sin(r),t=k-u*x,A=n+r*x,B=k+u*x,x=n-r*x,z=m+u*w,D=q-r*w,u=m-u*w,r=q+r*w;d.beginPath();d.moveTo(t,A);d.lineTo(B,x);d.lineTo(z,D);d.lineTo(u,r);d.closePath();this.stereo==a.Bond.STEREO_PROTRUDING?d.fill():(d.save(),d.clip(),d.lineWidth=2*w,d.lineCap=
"butt",d.beginPath(),d.moveTo(k,n),c.contextHashTo(d,k,n,m,q,f.bonds_hashWidth_2D,f.bonds_hashSpacing_2D),d.stroke(),d.restore())}else if(this.stereo==a.Bond.STEREO_AMBIGUOUS){d.beginPath();d.moveTo(k,n);m=e.floor(e.sqrt(t*t+w*w)/f.bonds_wavyLength_2D);q=k;r=this.a1.angle(this.a2)+e.PI/2;u=e.cos(r);r=e.sin(r);k=t/m;w/=m;A=0;for(B=m;A<B;A++)q+=k,n+=w,m=f.bonds_wavyLength_2D*u+q-0.5*k,x=f.bonds_wavyLength_2D*-r+n-0.5*w,t=f.bonds_wavyLength_2D*-u+q-0.5*k,z=f.bonds_wavyLength_2D*r+n-0.5*w,0==A%2?d.quadraticCurveTo(m,
x,q,n):d.quadraticCurveTo(t,z,q,n);d.stroke();break}else d.beginPath(),d.moveTo(k,n),d.lineTo(m,q),d.stroke();break;case 1.5:d.beginPath();d.moveTo(k,n);d.lineTo(m,q);d.stroke();break;case 2:this.stereo==a.Bond.STEREO_AMBIGUOUS?(w=this.a1.distance(this.a2)*f.bonds_saturationWidth_2D/2,r=this.a1.angle(this.a2)+e.PI/2,t=k-e.cos(r)*w,A=n+e.sin(r)*w,B=k+e.cos(r)*w,x=n-e.sin(r)*w,z=m+e.cos(r)*w,D=q-e.sin(r)*w,u=m-e.cos(r)*w,r=q+e.sin(r)*w,d.beginPath(),d.moveTo(t,A),d.lineTo(z,D),d.moveTo(B,x),d.lineTo(u,
r),d.stroke()):!f.bonds_symmetrical_2D&&(null!=this.ring||"C"==this.a1.label&&"C"==this.a2.label)?(d.beginPath(),d.moveTo(k,n),d.lineTo(m,q),t=0,u=this.a1.distance(this.a2),A=this.a1.angle(this.a2),r=A+e.PI/2,w=u*f.bonds_saturationWidth_2D,B=f.bonds_saturationAngle_2D,B<e.PI/2&&(t=-(w/e.tan(B))),e.abs(t)<u/2&&(u=k-e.cos(A)*t,k=m+e.cos(A)*t,m=n+e.sin(A)*t,n=q-e.sin(A)*t,t=u-e.cos(r)*w,A=m+e.sin(r)*w,B=u+e.cos(r)*w,x=m-e.sin(r)*w,z=k-e.cos(r)*w,D=n+e.sin(r)*w,u=k+e.cos(r)*w,r=n-e.sin(r)*w,null==this.ring||
this.ring.center.angle(this.a1)>this.ring.center.angle(this.a2)&&!(this.ring.center.angle(this.a1)-this.ring.center.angle(this.a2)>e.PI)||this.ring.center.angle(this.a1)-this.ring.center.angle(this.a2)<-e.PI?(d.moveTo(t,A),d.lineTo(z,D)):(d.moveTo(B,x),d.lineTo(u,r)),d.stroke())):(w=this.a1.distance(this.a2)*f.bonds_saturationWidth_2D/2,r=this.a1.angle(this.a2)+e.PI/2,t=k-e.cos(r)*w,A=n+e.sin(r)*w,B=k+e.cos(r)*w,x=n-e.sin(r)*w,z=m+e.cos(r)*w,D=q-e.sin(r)*w,u=m-e.cos(r)*w,r=q+e.sin(r)*w,d.beginPath(),
d.moveTo(t,A),d.lineTo(u,r),d.moveTo(B,x),d.lineTo(z,D),d.stroke());break;case 3:w=this.a1.distance(this.a2)*f.bonds_saturationWidth_2D,r=this.a1.angle(this.a2)+e.PI/2,t=k-e.cos(r)*w,A=n+e.sin(r)*w,B=k+e.cos(r)*w,x=n-e.sin(r)*w,z=m+e.cos(r)*w,D=q-e.sin(r)*w,u=m-e.cos(r)*w,r=q+e.sin(r)*w,d.beginPath(),d.moveTo(t,A),d.lineTo(u,r),d.moveTo(B,x),d.lineTo(z,D),d.moveTo(k,n),d.lineTo(m,q),d.stroke()}}};this.drawDecorations=function(a){if(this.isHover||this.isSelected){var d=2*e.PI,b=(this.a1.angleForStupidCanvasArcs(this.a2)+
e.PI/2)%d;a.strokeStyle=this.isHover?"#885110":"#0060B2";a.lineWidth=1.2;a.beginPath();var c=(b+e.PI)%d,c=c%(2*e.PI);a.arc(this.a1.x,this.a1.y,7,b,c,!1);a.stroke();a.beginPath();b+=e.PI;c=(b+e.PI)%d;a.arc(this.a2.x,this.a2.y,7,b,c,!1);a.stroke()}};this.render=function(a,f){this.specs&&(f=this.specs);var g=(f.bonds_renderAsLines_3D?1.1:1.001)*this.a1.distance3D(this.a2)/(f.bonds_useJMOLColors||f.bonds_usePYMOLColors?2:1);if(0==g)return!1;var g=[f.bonds_cylinderDiameter_3D/2,g,f.bonds_cylinderDiameter_3D/
2],m=d.translate(a.modelViewMatrix,[this.a1.x,this.a1.y,this.a1.z],[]),n=null,q=[this.a2.x-this.a1.x,this.a2.y-this.a1.y,this.a2.z-this.a1.z];if(f.bonds_useJMOLColors||f.bonds_usePYMOLColors)k.scale(q,0.5),n=d.translate(a.modelViewMatrix,[this.a2.x,this.a2.y,this.a2.z],[]);var u=[0],t=null;if(f.bonds_showBondOrders_3D){switch(this.bondOrder){case 2:u=[-f.bonds_cylinderDiameter_3D,f.bonds_cylinderDiameter_3D];break;case 3:u=[-1.2*f.bonds_cylinderDiameter_3D,0,1.2*f.bonds_cylinderDiameter_3D]}if(1<
u.length){var t=[0,0,1],w=d.inverse(a.rotationMatrix,[]);d.multiplyVec3(w,t);t=k.cross(q,t,[]);k.normalize(t)}}var r=[0,1,0],w=0,A=null;this.a1.x==this.a2.x&&this.a1.z==this.a2.z?(A=[0,0,1],this.a2.y<this.a1.y&&(w=e.PI)):(w=c.vec3AngleFrom(r,q),A=k.cross(r,q,[]));q=0;for(r=u.length;q<r;q++){var B=d.set(m,[]);0!=u[q]&&d.translate(B,k.scale(t,u[q],[]));0!=w&&d.rotate(B,w,A);d.scale(B,g);var x=f.bonds_color;f.bonds_useJMOLColors?x=b[this.a1.label].jmolColor:f.bonds_usePYMOLColors&&(x=b[this.a1.label].pymolColor);
a.material.setDiffuseColor(x);a.setMatrixUniforms(B);f.bonds_renderAsLines_3D?a.drawArrays(a.LINES,0,a.lineBuffer.vertexPositionBuffer.numItems):a.drawArrays(a.TRIANGLE_STRIP,0,a.cylinderBuffer.vertexPositionBuffer.numItems);if(f.bonds_useJMOLColors||f.bonds_usePYMOLColors)d.set(n,B),0!=u[q]&&d.translate(B,k.scale(t,u[q],[])),d.rotate(B,w+e.PI,A),d.scale(B,g),a.material.setDiffuseColor(f.bonds_usePYMOLColors?b[this.a2.label].pymolColor:b[this.a2.label].jmolColor),a.setMatrixUniforms(B),f.bonds_renderAsLines_3D?
a.drawArrays(a.LINES,0,a.lineBuffer.vertexPositionBuffer.numItems):a.drawArrays(a.TRIANGLE_STRIP,0,a.cylinderBuffer.vertexPositionBuffer.numItems)}};return!0};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,ChemDoodle.math,Math,mat4,vec3);
(function(b,c){b.Ring=function(){this.atoms=[];this.bonds=[];this.center=null;this.setupBonds=function(){for(var a=0,b=this.bonds.length;a<b;a++)this.bonds[a].ring=this;this.center=this.getCenter()};this.getCenter=function(){for(var a=minY=Infinity,g=maxY=-Infinity,e=0,d=this.atoms.length;e<d;e++)a=c.min(this.atoms[e].x,a),minY=c.min(this.atoms[e].y,minY),g=c.max(this.atoms[e].x,g),maxY=c.max(this.atoms[e].y,maxY);return new b.Point((g+a)/2,(maxY+minY)/2)};return!0}})(ChemDoodle.structures,Math);
(function(b,c,a,g,e){a.Molecule=function(){this.atoms=[];this.bonds=[];this.rings=[];this.findRings=!0;this.draw=function(a,b){this.specs&&(b=this.specs);if(b.atoms_display&&!b.atoms_circles_2D)for(var c=0,e=this.atoms.length;c<e;c++)this.atoms[c].draw(a,b);if(b.bonds_display){c=0;for(e=this.bonds.length;c<e;c++)this.bonds[c].draw(a,b)}if(b.atoms_display&&b.atoms_circles_2D){c=0;for(e=this.atoms.length;c<e;c++)this.atoms[c].draw(a,b)}};this.render=function(d,b){this.specs&&(b=this.specs);var c=0<
this.atoms.length&&void 0!=this.atoms[0].hetatm;if(c){if(b.macro_displayBonds){0<this.bonds.length&&(b.bonds_renderAsLines_3D&&!this.residueSpecs||this.residueSpecs&&this.residueSpecs.bonds_renderAsLines_3D?(d.lineWidth(this.residueSpecs?this.residueSpecs.bonds_width_2D:b.bonds_width_2D),d.lineBuffer.bindBuffers(d)):d.cylinderBuffer.bindBuffers(d),d.material.setTempColors(b.bonds_materialAmbientColor_3D,null,b.bonds_materialSpecularColor_3D,b.bonds_materialShininess_3D));for(var e=0,n=this.bonds.length;e<
n;e++){var j=this.bonds[e];if(!j.a1.hetatm&&(-1==b.macro_atomToLigandDistance||void 0!=j.a1.closestDistance&&b.macro_atomToLigandDistance>=j.a1.closestDistance&&b.macro_atomToLigandDistance>=j.a2.closestDistance))j.render(d,this.residueSpecs?this.residueSpecs:b)}}if(b.macro_displayAtoms){0<this.atoms.length&&(d.sphereBuffer.bindBuffers(d),d.material.setTempColors(b.atoms_materialAmbientColor_3D,null,b.atoms_materialSpecularColor_3D,b.atoms_materialShininess_3D));e=0;for(n=this.atoms.length;e<n;e++){var p=
this.atoms[e];if(!p.hetatm&&(-1==b.macro_atomToLigandDistance||void 0!=p.closestDistance&&b.macro_atomToLigandDistance>=p.closestDistance))p.render(d,this.residueSpecs?this.residueSpecs:b)}}}if(b.bonds_display){0<this.bonds.length&&(b.bonds_renderAsLines_3D?(d.lineWidth(b.bonds_width_2D),d.lineBuffer.bindBuffers(d)):d.cylinderBuffer.bindBuffers(d),d.material.setTempColors(b.bonds_materialAmbientColor_3D,null,b.bonds_materialSpecularColor_3D,b.bonds_materialShininess_3D));e=0;for(n=this.bonds.length;e<
n;e++)j=this.bonds[e],(!c||j.a1.hetatm)&&j.render(d,b)}if(b.atoms_display){e=0;for(n=this.atoms.length;e<n;e++)p=this.atoms[e],p.bondNumber=0,p.renderAsStar=!1;e=0;for(n=this.bonds.length;e<n;e++)j=this.bonds[e],j.a1.bondNumber++,j.a2.bondNumber++;0<this.atoms.length&&(d.sphereBuffer.bindBuffers(d),d.material.setTempColors(b.atoms_materialAmbientColor_3D,null,b.atoms_materialSpecularColor_3D,b.atoms_materialShininess_3D));j=[];e=0;for(n=this.atoms.length;e<n;e++)if(p=this.atoms[e],!c||p.hetatm&&(b.macro_showWater||
!p.isWater))b.atoms_nonBondedAsStars_3D&&0==p.bondNumber?(p.renderAsStar=!0,j.push(p)):p.render(d,b);if(0<j.length){d.starBuffer.bindBuffers(d);e=0;for(n=j.length;e<n;e++)j[e].render(d,b)}}if(this.chains){d.setMatrixUniforms(d.modelViewMatrix);if(b.proteins_displayRibbon){d.material.setTempColors(b.proteins_materialAmbientColor_3D,null,b.proteins_materialSpecularColor_3D,b.proteins_materialShininess_3D);c=0;for(p=this.ribbons.length;c<p;c++)if(b.proteins_useShapelyColors||b.proteins_useAminoColors||
b.proteins_usePolarityColors){j=b.proteins_ribbonCartoonize?this.cartoons[c]:this.ribbons[c];j.front.bindBuffers(d);e=0;for(n=j.front.segments.length;e<n;e++)j.front.segments[e].render(d,b);j.back.bindBuffers(d);e=0;for(n=j.back.segments.length;e<n;e++)j.back.segments[e].render(d,b)}else if(b.proteins_ribbonCartoonize){j=this.cartoons[c];j.front.bindBuffers(d);e=0;for(n=j.front.cartoonSegments.length;e<n;e++)j.front.cartoonSegments[e].render(d,b);j.back.bindBuffers(d);e=0;for(n=j.back.cartoonSegments.length;e<
n;e++)j.back.cartoonSegments[e].render(d,b)}else j=this.ribbons[c],j.front.render(d,b),j.back.render(d,b)}if(b.proteins_displayBackbone){if(!this.alphaCarbonTrace){this.alphaCarbonTrace={nodes:[],edges:[]};c=0;for(p=this.chains.length;c<p;c++){var l=this.chains[c];if(!(2<l.length&&g[l[2].name]&&"#BEA06E"==g[l[2].name].aminoColor)&&0<l.length){e=1;for(n=l.length-2;e<n;e++)j=l[e].cp1,j.chainColor=l.chainColor,this.alphaCarbonTrace.nodes.push(j),j=new a.Bond(l[e].cp1,l[e+1].cp1),j.residueName=l[e].name,
j.chainColor=l.chainColor,this.alphaCarbonTrace.edges.push(j),e==l.length-3&&(j=l[e+1].cp1,j.chainColor=l.chainColor,this.alphaCarbonTrace.nodes.push(j))}}}if(0<this.alphaCarbonTrace.nodes.length){c=new a.VisualSpecifications;c.atoms_display=!0;c.bonds_display=!0;c.atoms_sphereDiameter_3D=b.proteins_backboneThickness;c.bonds_cylinderDiameter_3D=b.proteins_backboneThickness;c.bonds_useJMOLColors=!1;c.atoms_color=b.proteins_backboneColor;c.bonds_color=b.proteins_backboneColor;c.atoms_useVDWDiameters_3D=
!1;d.material.setTempColors(b.proteins_materialAmbientColor_3D,null,b.proteins_materialSpecularColor_3D,b.proteins_materialShininess_3D);d.material.setDiffuseColor(b.proteins_backboneColor);e=0;for(n=this.alphaCarbonTrace.nodes.length;e<n;e++)j=this.alphaCarbonTrace.nodes[e],b.macro_colorByChain&&(c.atoms_color=j.chainColor),d.sphereBuffer.bindBuffers(d),j.render(d,c);e=0;for(n=this.alphaCarbonTrace.edges.length;e<n;e++)p=this.alphaCarbonTrace.edges[e],j=null,l=g[p.residueName]?g[p.residueName]:g["*"],
b.macro_colorByChain?j=p.chainColor:b.proteins_useShapelyColors?j=l.shapelyColor:b.proteins_useAminoColors?j=l.aminoColor:b.proteins_usePolarityColors&&(j=l.polar?"#C10000":"#FFFFFF"),null!=j&&(c.bonds_color=j),d.cylinderBuffer.bindBuffers(d),p.render(d,c)}}if(b.nucleics_display){d.material.setTempColors(b.nucleics_materialAmbientColor_3D,null,b.nucleics_materialSpecularColor_3D,b.nucleics_materialShininess_3D);c=0;for(p=this.tubes.length;c<p;c++)d.setMatrixUniforms(d.modelViewMatrix),j=this.tubes[c],
j.render(d,b)}}b.crystals_displayUnitCell&&this.unitCell&&(d.setMatrixUniforms(d.modelViewMatrix),this.unitCell.bindBuffers(d),d.material.setDiffuseColor(b.crystals_unitCellColor),d.lineWidth(b.crystals_unitCellLineWidth),d.drawElements(d.LINES,this.unitCell.vertexIndexBuffer.numItems,d.UNSIGNED_SHORT,0));this.surface&&b.surfaces_display&&(d.setMatrixUniforms(d.modelViewMatrix),this.surface.bindBuffers(d),d.material.setTempColors(b.surfaces_materialAmbientColor_3D,b.surfaces_color,b.surfaces_materialSpecularColor_3D,
b.surfaces_materialShininess_3D),"Dot"==b.surfaces_style?d.drawArrays(d.POINTS,0,this.surface.vertexPositionBuffer.numItems):d.drawElements(d.TRIANGLES,this.surface.vertexIndexBuffer.numItems,d.UNSIGNED_SHORT,0))};this.getCenter3D=function(){if(1==this.atoms.length)return new a.Atom("C",this.atoms[0].x,this.atoms[0].y,this.atoms[0].z);var b=minY=minZ=Infinity,c=maxY=maxZ=-Infinity;if(this.chains)for(var f=0,g=this.chains.length;f<g;f++)for(var n=this.chains[f],j=0,p=n.length;j<p;j++){var l=n[j],b=
e.min(l.cp1.x,b);minY=e.min(l.cp1.y,minY);minZ=e.min(l.cp1.z,minZ);c=e.max(l.cp1.x,c);maxY=e.max(l.cp1.y,maxY);maxZ=e.max(l.cp1.z,maxZ);b=e.min(l.cp2.x,b);minY=e.min(l.cp2.y,minY);minZ=e.min(l.cp2.z,minZ);c=e.max(l.cp2.x,c);maxY=e.max(l.cp2.y,maxY);maxZ=e.max(l.cp2.z,maxZ)}f=0;for(g=this.atoms.length;f<g;f++)b=e.min(this.atoms[f].x,b),minY=e.min(this.atoms[f].y,minY),minZ=e.min(this.atoms[f].z,minZ),c=e.max(this.atoms[f].x,c),maxY=e.max(this.atoms[f].y,maxY),maxZ=e.max(this.atoms[f].z,maxZ);return new a.Atom("C",
(c+b)/2,(maxY+minY)/2,(maxZ+minZ)/2)};this.getCenter=function(){if(1==this.atoms.length)return new a.Point(this.atoms[0].x,this.atoms[0].y);for(var b=minY=Infinity,c=maxY=-Infinity,f=0,g=this.atoms.length;f<g;f++)b=e.min(this.atoms[f].x,b),minY=e.min(this.atoms[f].y,minY),c=e.max(this.atoms[f].x,c),maxY=e.max(this.atoms[f].y,maxY);return new a.Point((c+b)/2,(maxY+minY)/2)};this.getDimension=function(){if(1==this.atoms.length)return new a.Point(0,0);var b=minY=Infinity,c=maxY=-Infinity;if(this.chains){for(var f=
0,g=this.chains.length;f<g;f++)for(var n=this.chains[f],j=0,p=n.length;j<p;j++){var l=n[j],b=e.min(l.cp1.x,b);minY=e.min(l.cp1.y,minY);c=e.max(l.cp1.x,c);maxY=e.max(l.cp1.y,maxY);b=e.min(l.cp2.x,b);minY=e.min(l.cp2.y,minY);c=e.max(l.cp2.x,c);maxY=e.max(l.cp2.y,maxY)}b-=30;minY-=30;minZ-=30;c+=30;maxY+=30;maxZ+=30}f=0;for(g=this.atoms.length;f<g;f++)b=e.min(this.atoms[f].x,b),minY=e.min(this.atoms[f].y,minY),c=e.max(this.atoms[f].x,c),maxY=e.max(this.atoms[f].y,maxY);return new a.Point(c-b,maxY-minY)};
this.check=function(a){if(a&&this.doChecks){if(this.findRings)if(this.bonds.length-this.atoms.length!=this.fjNumCache){this.rings=(new b.informatics.SSSRFinder(this)).rings;for(var c=0,e=this.bonds.length;c<e;c++)this.bonds[c].ring=null;c=0;for(e=this.rings.length;c<e;c++)this.rings[c].setupBonds()}else{c=0;for(e=this.rings.length;c<e;c++){var g=this.rings[c];g.center=g.getCenter()}}if(this.atoms.length!=this.atomNumCache&&this.bonds.length!=this.bondNumCache){c=0;for(e=this.atoms.length;c<e;c++)if(this.atoms[c].isLone=
!1,"C"==this.atoms[c].label){for(var n=g=0,j=this.bonds.length;n<j;n++)(this.bonds[n].a1==this.atoms[c]||this.bonds[n].a2==this.atoms[c])&&g++;0==g&&(this.atoms[c].isLone=!0)}}g=!1;c=0;for(e=this.atoms.length;c<e;c++)0!=this.atoms[c].z&&(g=!0);g&&(this.sortAtomsByZ(),this.sortBondsByZ());this.setupMetaData();this.atomNumCache=this.atoms.length;this.bondNumCache=this.bonds.length;this.fjNumCache=this.bonds.length-this.atoms.length}this.doChecks=!a};this.getAngles=function(a){for(var b=[],c=0,e=this.bonds.length;c<
e;c++)this.bonds[c].contains(a)&&b.push(a.angle(this.bonds[c].getNeighbor(a)));b.sort();return b};this.getCoordinationNumber=function(a){for(var b=0,c=0,e=a.length;c<e;c++)b+=a[c].bondOrder;return b};this.getBonds=function(a){for(var b=[],c=0,e=this.bonds.length;c<e;c++)this.bonds[c].contains(a)&&b.push(this.bonds[c]);return b};this.sortAtomsByZ=function(){for(var a=1,b=this.atoms.length;a<b;a++)for(var c=a;0<c&&this.atoms[c].z<this.atoms[c-1].z;){var e=this.atoms[c];this.atoms[c]=this.atoms[c-1];
this.atoms[c-1]=e;c--}};this.sortBondsByZ=function(){for(var a=1,b=this.bonds.length;a<b;a++)for(var c=a;0<c&&this.bonds[c].a1.z+this.bonds[c].a2.z<this.bonds[c-1].a1.z+this.bonds[c-1].a2.z;){var e=this.bonds[c];this.bonds[c]=this.bonds[c-1];this.bonds[c-1]=e;c--}};this.setupMetaData=function(){for(var a=0,c=this.atoms.length;a<c;a++){var f=this.atoms[a],g=this.getBonds(f),n=this.getAngles(f);f.isHidden=2==g.length&&e.abs(e.abs(n[1]-n[0])-e.PI)<e.PI/30&&g[0].bondOrder==g[1].bondOrder;n=b.math.angleBetweenLargest(n);
f.angleOfLeastInterference=n.angle%(2*e.PI);f.largestAngle=n.largest;f.coordinationNumber=this.getCoordinationNumber(g);f.bondNumber=g.length}};this.scaleToAverageBondLength=function(a){var b=this.getAverageBondLength();if(0!=b)for(var a=a/b,b=0,c=this.atoms.length;b<c;b++)this.atoms[b].x*=a,this.atoms[b].y*=a};this.getAverageBondLength=function(){if(0==this.bonds.length)return 0;for(var a=0,b=0,c=this.bonds.length;b<c;b++)a+=this.bonds[b].getLength();return a/=this.bonds.length};return!0}})(ChemDoodle,
ChemDoodle.math,ChemDoodle.structures,ChemDoodle.RESIDUE,Math);
(function(b,c,a,g){var e=null,d=-1;b.Residue=function(k){this.resSeq=k;this.setup=function(a,c){this.horizontalResolution=c;var d=[a.x-this.cp1.x,a.y-this.cp1.y,a.z-this.cp1.z],e=g.cross(d,[this.cp2.x-this.cp1.x,this.cp2.y-this.cp1.y,this.cp2.z-this.cp1.z],[]);this.D=g.cross(e,d,[]);g.normalize(e);g.normalize(this.D);this.guidePointsSmall=[];this.guidePointsLarge=[];d=[(a.x+this.cp1.x)/2,(a.y+this.cp1.y)/2,(a.z+this.cp1.z)/2];this.helix&&(g.scale(e,1.5),g.add(d,e));this.guidePointsSmall[0]=new b.Atom("",
d[0]-this.D[0]/2,d[1]-this.D[1]/2,d[2]-this.D[2]/2);for(e=1;e<c;e++)this.guidePointsSmall[e]=new b.Atom("",this.guidePointsSmall[0].x+this.D[0]*e/c,this.guidePointsSmall[0].y+this.D[1]*e/c,this.guidePointsSmall[0].z+this.D[2]*e/c);g.scale(this.D,4);this.guidePointsLarge[0]=new b.Atom("",d[0]-this.D[0]/2,d[1]-this.D[1]/2,d[2]-this.D[2]/2);for(e=1;e<c;e++)this.guidePointsLarge[e]=new b.Atom("",this.guidePointsLarge[0].x+this.D[0]*e/c,this.guidePointsLarge[0].y+this.D[1]*e/c,this.guidePointsLarge[0].z+
this.D[2]*e/c)};this.getGuidePointSet=function(a){if(0==a)return this.helix||this.sheet?this.guidePointsLarge:this.guidePointsSmall;if(1==a)return this.guidePointsSmall;if(2==a)return this.guidePointsLarge};this.computeLineSegments=function(b,c,g,j,k){if(k!=d){var l=k*k,h=k*k*k;e=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],[6/h,0,0,0,6/h,2/l,0,0,1/h,1/l,1/k,0,0,0,0,1],[]);d=k}this.split=c.helix!=this.helix||c.sheet!=this.sheet;this.lineSegments=this.innerCompute(0,b,c,g,
!1,k);j&&(this.lineSegmentsCartoon=this.innerCompute(c.helix||c.sheet?2:1,b,c,g,!0,k))};this.innerCompute=function(d,k,n,j,p,l){for(var h=[],v=this.getGuidePointSet(d),k=k.getGuidePointSet(d),n=n.getGuidePointSet(d),q=j.getGuidePointSet(d),u=0,t=this.guidePointsLarge.length;u<t;u++){for(var w=a.multiply([k[u].x,k[u].y,k[u].z,1,v[u].x,v[u].y,v[u].z,1,n[u].x,n[u].y,n[u].z,1,q[u].x,q[u].y,q[u].z,1],e,[]),r=[],A=0;A<l;A++){for(d=3;0<d;d--)for(j=0;4>j;j++)w[4*d+j]+=w[4*(d-1)+j];r[A]=new b.Atom("",w[12]/
w[15],w[13]/w[15],w[14]/w[15])}h[u]=r}if(p&&this.arrow)for(d=0;d<l;d++){p=1.5-1.3*d/l;v=c.floor(this.horizontalResolution/2);k=h[v];j=0;for(n=h.length;j<n;j++)j!=v&&(q=k[d],u=h[j][d],t=[u.x-q.x,u.y-q.y,u.z-q.z],g.scale(t,p),u.x=q.x+t[0],u.y=q.y+t[1],u.z=q.z+t[2])}return h}}})(ChemDoodle.structures,Math,mat4,vec3);
(function(b,c,a,g,e){c.Spectrum=function(){this.data=[];this.metadata=[];this.dataDisplay=[];this.yUnit=this.xUnit=this.title=null;this.continuous=!0;this.integrationSensitivity=0.01;this.memory={offsetTop:0,offsetLeft:0,offsetBottom:0,flipXAxis:!1,scale:1,width:0,height:0};this.draw=function(a,c,f,m){this.specs&&(c=this.specs);var n=5,j=0,p=0;a.fillStyle=c.text_color;a.textAlign="center";a.textBaseline="alphabetic";a.font=c.getFontString(c.text_font_size,c.text_font_families);this.xUnit&&(p+=c.text_font_size,
a.fillText(this.xUnit,f/2,m-2));this.yUnit&&c.plots_showYAxis&&(j+=c.text_font_size,a.save(),a.translate(c.text_font_size,m/2),a.rotate(-e.PI/2),a.fillText(this.yUnit,0,0),a.restore());null!=this.title&&(n+=c.text_font_size,a.fillText(this.title,f/2,c.text_font_size));p+=5+c.text_font_size;c.plots_showYAxis&&(j+=5+a.measureText("1000").width);c.plots_showGrid&&(a.strokeStyle=c.plots_gridColor,a.lineWidth=c.plots_gridLineWidth,a.strokeRect(j,n,f-j,m-p-n));a.textAlign="center";a.textBaseline="top";
for(var l=this.maxX-this.minX,h=l/100,v=0.0010;v<h||25<l/v;)v*=10;for(var q=0,u=c.plots_flipXAxis?f:0,l=e.round(this.minX/v)*v;l<=this.maxX;l+=v/2){var t=this.getTransformedX(l,c,f,j);if(t>j)if(a.strokeStyle="black",a.lineWidth=1,0==q%2){a.beginPath();a.moveTo(t,m-p);a.lineTo(t,m-p+2);a.stroke();for(h=l.toFixed(5);"0"==h.charAt(h.length-1);)h=h.substring(0,h.length-1);"."==h.charAt(h.length-1)&&(h=h.substring(0,h.length-1));var w=a.measureText(h).width;c.plots_flipXAxis&&(w*=-1);var r=t-w/2;if(c.plots_flipXAxis?
r<u:r>u)a.fillText(h,t,m-p+2),u=t+w/2;c.plots_showGrid&&(a.strokeStyle=c.plots_gridColor,a.lineWidth=c.plots_gridLineWidth,a.beginPath(),a.moveTo(t,m-p),a.lineTo(t,n),a.stroke())}else a.beginPath(),a.moveTo(t,m-p),a.lineTo(t,m-p+2),a.stroke();q++}if(c.plots_showYAxis||c.plots_showGrid){v=1/c.scale;a.textAlign="right";a.textBaseline="middle";for(l=0;10>=l;l++)if(h=v/10*l,q=n+(m-p-n)*(1-h*c.scale),c.plots_showGrid&&(a.strokeStyle=c.plots_gridColor,a.lineWidth=c.plots_gridLineWidth,a.beginPath(),a.moveTo(j,
q),a.lineTo(f,q),a.stroke()),c.plots_showYAxis){a.strokeStyle="black";a.lineWidth=1;a.beginPath();a.moveTo(j,q);a.lineTo(j-3,q);a.stroke();h*=100;u=e.max(0,3-e.floor(h).toString().length);h=h.toFixed(u);if(0<u)for(;"0"==h.charAt(h.length-1);)h=h.substring(0,h.length-1);"."==h.charAt(h.length-1)&&(h=h.substring(0,h.length-1));a.fillText(h,j-3,q)}}a.strokeStyle="black";a.lineWidth=1;a.beginPath();a.moveTo(f,m-p);a.lineTo(j,m-p);c.plots_showYAxis&&a.lineTo(j,n);a.stroke();if(0<this.dataDisplay.length){a.textAlign=
"left";a.textBaseline="top";l=h=0;for(v=this.dataDisplay.length;l<v;l++)if(this.dataDisplay[l].value)a.fillText([this.dataDisplay[l].display,": ",this.dataDisplay[l].value].join(""),j+10,n+10+h*(c.text_font_size+5)),h++;else if(this.dataDisplay[l].tag){q=0;for(u=this.metadata.length;q<u;q++)if(b.stringStartsWith(this.metadata[q],this.dataDisplay[l].tag)){u=this.metadata[q];this.dataDisplay[l].display&&(u=g.inArray("=",this.metadata[q]),u=[this.dataDisplay[l].display,": ",-1<u?this.metadata[q].substring(u+
2):this.metadata[q]].join(""));a.fillText(u,j+10,n+10+h*(c.text_font_size+5));h++;break}}}this.drawPlot(a,c,f,m,n,j,p);this.memory.offsetTop=n;this.memory.offsetLeft=j;this.memory.offsetBottom=p;this.memory.flipXAxis=c.plots_flipXAxis;this.memory.scale=c.scale;this.memory.width=f;this.memory.height=m};this.drawPlot=function(a,b,g,m,n,j,p){this.specs&&(b=this.specs);a.strokeStyle=b.plots_color;a.lineWidth=b.plots_width;var l=[];a.beginPath();if(this.continuous)for(var h=!1,v=0,q=0,u=this.data.length;q<
u;q++){var t=this.getTransformedX(this.data[q].x,b,g,j);if(t>=j&&t<g){var w=this.getTransformedY(this.data[q].y,b,m,p,n);b.plots_showIntegration&&e.abs(this.data[q].y)>this.integrationSensitivity&&l.push(new c.Point(this.data[q].x,this.data[q].y));h||(a.moveTo(t,w),h=!0);a.lineTo(t,w);v++;0==v%1E3&&(a.stroke(),a.beginPath(),a.moveTo(t,w))}else if(h)break}else{q=0;for(u=this.data.length;q<u;q++)t=this.getTransformedX(this.data[q].x,b,g,j),t>=j&&t<g&&(a.moveTo(t,m-p),a.lineTo(t,this.getTransformedY(this.data[q].y,
b,m,p,n)))}a.stroke();if(b.plots_showIntegration&&1<l.length){a.strokeStyle=b.plots_integrationColor;a.lineWidth=b.plots_integrationLineWidth;a.beginPath();q=l[1].x>l[0].x;if(this.flipXAxis&&!q||!this.flipXAxis&&q){for(q=l.length-2;0<=q;q--)l[q].y+=l[q+1].y;h=l[0].y}else{q=1;for(u=l.length;q<u;q++)l[q].y+=l[q-1].y;h=l[l.length-1].y}q=0;for(u=l.length;q<u;q++)t=this.getTransformedX(l[q].x,b,g,j),w=this.getTransformedY(l[q].y/b.scale/h,b,m,p,n),0==q?a.moveTo(t,w):a.lineTo(t,w);a.stroke()}};this.getTransformedY=
function(a,c,b,e,g){return g+(b-e-g)*(1-a*c.scale)};this.getInverseTransformedY=function(a){return 100*((1-(a-this.memory.offsetTop)/(this.memory.height-this.memory.offsetBottom-this.memory.offsetTop))/this.memory.scale)};this.getTransformedX=function(a,c,b,e){a=e+(a-this.minX)/(this.maxX-this.minX)*(b-e);c.plots_flipXAxis&&(a=b+e-a);return a};this.getInverseTransformedX=function(a){this.memory.flipXAxis&&(a=this.memory.width+this.memory.offsetLeft-a);return(a-this.memory.offsetLeft)*(this.maxX-this.minX)/
(this.memory.width-this.memory.offsetLeft)+this.minX};this.setup=function(){for(var a=Number.MAX_VALUE,c=Number.MIN_VALUE,b=Number.MIN_VALUE,g=0,n=this.data.length;g<n;g++)a=e.min(a,this.data[g].x),c=e.max(c,this.data[g].x),b=e.max(b,this.data[g].y);this.continuous?(this.minX=a,this.maxX=c):(this.minX=a-1,this.maxX=c+1);g=0;for(n=this.data.length;g<n;g++)this.data[g].y/=b};this.zoom=function(c,b,g,m){c=this.getInverseTransformedX(c);b=this.getInverseTransformedX(b);this.minX=e.min(c,b);this.maxX=
e.max(c,b);if(m){m=Number.MIN_VALUE;b=0;for(c=this.data.length;b<c;b++)a.isBetween(this.data[b].x,this.minX,this.maxX)&&(m=e.max(m,this.data[b].y));return 1/m}};this.translate=function(a,c){var b=a/(c-this.memory.offsetLeft)*(this.maxX-this.minX)*(this.memory.flipXAxis?1:-1);this.minX+=b;this.maxX+=b};this.alertMetadata=function(){alert(this.metadata.join("\n"))};this.getInternalCoordinates=function(a,c){return new ChemDoodle.structures.Point(this.getInverseTransformedX(a),this.getInverseTransformedY(c))};
this.getClosestPlotInternalCoordinates=function(c){var b=this.getInverseTransformedX(c-1),c=this.getInverseTransformedX(c+1);if(b>c)var e=b,b=c,c=e;for(var e=-1,g=-Infinity,n=!1,j=0,p=this.data.length;j<p;j++){var l=this.data[j];if(a.isBetween(l.x,b,c))l.y>g&&(n=!0,g=l.y,e=j);else if(n)break}if(-1==e)return null;l=this.data[e];return new ChemDoodle.structures.Point(l.x,100*l.y)};this.getClosestPeakInternalCoordinates=function(a){for(var c=this.getInverseTransformedX(a),a=0,b=Infinity,g=0,n=this.data.length;g<
n;g++){var j=e.abs(this.data[g].x-c);if(j<=b)b=j,a=g;else break}c=highestRight=a;b=maxRight=this.data[a].y;g=a+1;for(n=this.data.length;g<n;g++)if(this.data[g].y+0.05>maxRight)maxRight=this.data[g].y,highestRight=g;else break;for(g=a-1;0<=g;g--)if(this.data[g].y+0.05>b)b=this.data[g].y,c=g;else break;a=this.data[c-a>highestRight-a?highestRight:c];return new ChemDoodle.structures.Point(a.x,100*a.y)};return!0}})(ChemDoodle.extensions,ChemDoodle.structures,ChemDoodle.math,jQuery,Math);
(function(b){b._Mesh=function(){return!0};b._Mesh.prototype.storeData=function(c,a,b){this.positionData=c;this.normalData=a;this.indexData=b};b._Mesh.prototype.setupBuffers=function(c){this.vertexPositionBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,this.vertexPositionBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(this.positionData),c.STATIC_DRAW);this.vertexPositionBuffer.itemSize=3;this.vertexPositionBuffer.numItems=this.positionData.length/3;this.vertexNormalBuffer=c.createBuffer();
c.bindBuffer(c.ARRAY_BUFFER,this.vertexNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(this.normalData),c.STATIC_DRAW);this.vertexNormalBuffer.itemSize=3;this.vertexNormalBuffer.numItems=this.normalData.length/3;this.indexData&&(this.vertexIndexBuffer=c.createBuffer(),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.indexData),c.STATIC_DRAW),this.vertexIndexBuffer.itemSize=1,this.vertexIndexBuffer.numItems=this.indexData.length);
if(this.partitions)for(var a=0,b=this.partitions.length;a<b;a++){var e=this.partitions[a],d=this.generateBuffers(c,e.positionData,e.normalData,e.indexData);e.vertexPositionBuffer=d[0];e.vertexNormalBuffer=d[1];e.vertexIndexBuffer=d[2]}};b._Mesh.prototype.generateBuffers=function(c,a,b,e){var d=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d);c.bufferData(c.ARRAY_BUFFER,new Float32Array(a),c.STATIC_DRAW);d.itemSize=3;d.numItems=a.length/3;a=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,a);c.bufferData(c.ARRAY_BUFFER,
new Float32Array(b),c.STATIC_DRAW);a.itemSize=3;a.numItems=b.length/3;b=null;e&&(b=c.createBuffer(),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b),c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(e),c.STATIC_DRAW),b.itemSize=1,b.numItems=e.length);return[d,a,b]};b._Mesh.prototype.bindBuffers=function(b){this.vertexPositionBuffer||this.setupBuffers(b);b.bindBuffer(b.ARRAY_BUFFER,this.vertexPositionBuffer);b.vertexAttribPointer(b.shader.vertexPositionAttribute,this.vertexPositionBuffer.itemSize,b.FLOAT,
!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.vertexNormalBuffer);b.vertexAttribPointer(b.shader.vertexNormalAttribute,this.vertexNormalBuffer.itemSize,b.FLOAT,!1,0,0);this.vertexIndexBuffer&&b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer)}})(ChemDoodle.structures,Math);
(function(b,c){b.Cylinder=function(a,b,e){for(var d=[],k=[],f=0;f<e;f++){var m=2*f*c.PI/e,n=c.cos(m),m=c.sin(m);k.push(n,0,m);d.push(a*n,0,a*m);k.push(n,0,m);d.push(a*n,b,a*m)}k.push(1,0,0);d.push(a,0,0);k.push(1,0,0);d.push(a,b,0);this.storeData(d,k);return!0};b.Cylinder.prototype=new b._Mesh})(ChemDoodle.structures,Math);
(function(b,c){b.Sphere=function(a,b,e){for(var d=[],k=[],f=0;f<=b;f++)for(var m=f*c.PI/b,n=c.sin(m),j=c.cos(m),m=0;m<=e;m++){var p=2*m*c.PI/e,l=c.sin(p),p=c.cos(p)*n,h=j,l=l*n;k.push(p,h,l);d.push(a*p,a*h,a*l)}a=[];e+=1;for(f=0;f<b;f++)for(m=0;m<e;m++)n=f*e+m%e,j=n+e,a.push(n),a.push(j),a.push(n+1),m<e-1&&(a.push(j),a.push(j+1),a.push(n+1));this.storeData(d,k,a);return!0};b.Sphere.prototype=new b._Mesh})(ChemDoodle.structures,Math);
(function(b,c,a,g){function e(a,c,e,g){this.name=c;this.entire=a;this.pi=g;this.getColor=function(c){return c.macro_colorByChain?this.chainColor:this.name?this.getResidueColor(b[this.name]?this.name:"*",c):this.helix?a.front?c.proteins_ribbonCartoonHelixPrimaryColor:c.proteins_ribbonCartoonHelixSecondaryColor:this.sheet?c.proteins_ribbonCartoonSheetColor:a.front?c.proteins_primaryColor:c.proteins_secondaryColor};this.getResidueColor=function(a,c){var e=b[a];return c.proteins_useShapelyColors?e.shapelyColor:
c.proteins_useAminoColors?e.aminoColor:c.proteins_usePolarityColors&&e.polar?"#C10000":"#FFFFFF"};this.render=function(a,b){null!=this.entire.partitions&&this.pi!=this.entire.partitions.lastRender&&(d(a,this.entire.partitions[this.pi]),this.entire.partitions.lastRender=this.pi);this.vertexIndexBuffer||(this.vertexIndexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,new Uint16Array(e),a.STATIC_DRAW),this.vertexIndexBuffer.itemSize=
1,this.vertexIndexBuffer.numItems=e.length);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer);a.material.setDiffuseColor(this.getColor(b));a.drawElements(a.TRIANGLES,this.vertexIndexBuffer.numItems,a.UNSIGNED_SHORT,0)}}var d=function(a,b){a.bindBuffer(a.ARRAY_BUFFER,b.vertexPositionBuffer);a.vertexAttribPointer(a.shader.vertexPositionAttribute,b.vertexPositionBuffer.itemSize,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,b.vertexNormalBuffer);a.vertexAttribPointer(a.shader.vertexNormalAttribute,
b.vertexNormalBuffer.itemSize,a.FLOAT,!1,0,0);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,b.vertexIndexBuffer)};c.Ribbon=function(b,c,m){var n=b[0].lineSegments.length,j=b[0].lineSegments[0].length;this.partitions=[];this.partitions.lastRender=0;var p=null;this.front=0<c;for(var l=0,h=b.length-1;l<h;l++){if(null==p||65E3<p.positionData.length)0<this.partitions.length&&l--,p={count:0,positionData:[],normalData:[],indexData:[]},this.partitions.push(p);var v=b[l];p.count++;for(var q=0;q<n;q++)for(var u=m?v.lineSegmentsCartoon[q]:
v.lineSegments[q],t=0==q,w=!1,r=0;r<j;r++){var A=u[r],B=l,x=r+1;l==b.length-2&&r==j-1?x--:r==j-1&&(B++,x=0);var x=m?b[B].lineSegmentsCartoon[q][x]:b[B].lineSegments[q][x],B=!1,z=q+1;q==n-1&&(z-=2,B=!0);var z=m?v.lineSegmentsCartoon[z][r]:v.lineSegments[z][r],x=[x.x-A.x,x.y-A.y,x.z-A.z],z=[z.x-A.x,z.y-A.y,z.z-A.z],D=g.cross(x,z,[]);0==r&&(g.normalize(x),g.scale(x,-1),p.normalData.push(x[0],x[1],x[2]),p.positionData.push(A.x,A.y,A.z));t||w?(g.normalize(z),g.scale(z,-1),p.normalData.push(z[0],z[1],z[2]),
p.positionData.push(A.x,A.y,A.z),t&&r==j-1&&(t=!1,r=-1)):(g.normalize(D),(B&&!this.front||!B&&this.front)&&g.scale(D,-1),p.normalData.push(D[0],D[1],D[2]),g.scale(D,a.abs(c)),p.positionData.push(A.x+D[0],A.y+D[1],A.z+D[2]),q==n-1&&r==j-1&&(w=!0,r=-1));if(-1==r||r==j-1)g.normalize(x),p.normalData.push(x[0],x[1],x[2]),p.positionData.push(A.x,A.y,A.z)}}n+=2;j+=2;m&&(this.cartoonSegments=[]);this.segments=[];c=0;for(v=this.partitions.length;c<v;c++){p=this.partitions[c];t=null;m&&(t=[]);l=0;for(h=p.count-
1;l<h;l++){u=l;for(q=0;q<c;q++)u+=this.partitions[q].count-1;q=b[u];0<l&&m&&q.split&&(r=new e(this,null,t,c),q.helix&&(r.helix=!0),q.sheet&&(r.sheet=!0),this.cartoonSegments.push(r),t=[]);w=l*n*j;A=[];q=0;for(B=n-1;q<B;q++){x=w+q*j;for(r=0;r<j;r++){z=1;l==p.count-1?z=0:r==j-1&&(z=n*j-r);z=[x+r,x+j+r,x+j+r+z,x+r,x+r+z,x+j+r+z];if(r!=j-1)for(D=0;6>D;D++)A.push(z[D]);r==j-2&&l<p.count-1&&(D=n*j-r,z[2]+=D,z[4]+=D,z[5]+=D);for(D=0;6>D;D++)p.indexData.push(z[D]);if(m)for(D=0;6>D;D++)t.push(z[D])}}this.segments.push(new e(this,
b[u+1].name,A,c))}if(m){r=new e(this,null,t,c);u=p.count-1;for(q=0;q<c;q++)u+=this.partitions[q].count-1;q=b[u];q.helix&&(r.helix=!0);q.sheet&&(r.sheet=!0);this.cartoonSegments.push(r)}}this.storeData(this.partitions[0].positionData,this.partitions[0].normalData,this.partitions[0].indexData);1==this.partitions.length&&(this.partitions=null);this.render=function(a,b){this.bindBuffers(a);var c=b.macro_colorByChain?this.chainColor:null;c||(c=this.front?b.proteins_primaryColor:b.proteins_secondaryColor);
a.material.setDiffuseColor(c);a.drawElements(a.TRIANGLES,this.vertexIndexBuffer.numItems,a.UNSIGNED_SHORT,0);if(this.partitions)for(var c=1,e=this.partitions.length;c<e;c++){var g=this.partitions[c];d(a,g);a.drawElements(a.TRIANGLES,g.vertexIndexBuffer.numItems,a.UNSIGNED_SHORT,0)}};return!0};c.Ribbon.prototype=new c._Mesh})(ChemDoodle.RESIDUE,ChemDoodle.structures,Math,vec3);
(function(b,c,a){c.Light=function(c,e,d){this.diffuseRGB=b.getRGB(c,1);this.specularRGB=b.getRGB(e,1);this.direction=d;this.lightScene=function(b){b.uniform3f(b.getUniformLocation(b.program,"u_light.diffuse_color"),this.diffuseRGB[0],this.diffuseRGB[1],this.diffuseRGB[2]);b.uniform3f(b.getUniformLocation(b.program,"u_light.specular_color"),this.specularRGB[0],this.specularRGB[1],this.specularRGB[2]);var c=a.create(this.direction);a.normalize(c);a.negate(c);b.uniform3f(b.getUniformLocation(b.program,
"u_light.direction"),c[0],c[1],c[2]);var e=[0,0,0],c=[e[0]+c[0],e[1]+c[1],e[2]+c[2]],e=a.length(c);0==e?c=[0,0,1]:a.scale(1/e);b.uniform3f(b.getUniformLocation(b.program,"u_light.half_vector"),c[0],c[1],c[2])};return!0}})(ChemDoodle.math,ChemDoodle.structures,vec3);(function(b){b.Line=function(){this.storeData([0,0,0,0,1,0],[0,0,0,0,0,0]);return!0};b.Line.prototype=new b._Mesh})(ChemDoodle.structures);
(function(b,c){c.Material=function(a){var c=a.getUniformLocation(a.program,"u_material.ambient_color"),e=a.getUniformLocation(a.program,"u_material.diffuse_color"),d=a.getUniformLocation(a.program,"u_material.specular_color"),k=a.getUniformLocation(a.program,"u_material.shininess"),f=a.getUniformLocation(a.program,"u_material.alpha");this.setTempColors=function(m,n,j,p){if(!this.aCache||this.aCache!=m)this.aCache=m,m=b.getRGB(m,1),a.uniform3f(c,m[0],m[1],m[2]);if(null!=n&&(!this.dCache||this.dCache!=
n))this.dCache=n,m=b.getRGB(n,1),a.uniform3f(e,m[0],m[1],m[2]);if(!this.sCache||this.sCache!=j)this.sCache=j,m=b.getRGB(j,1),a.uniform3f(d,m[0],m[1],m[2]);if(!this.snCache||this.snCache!=p)this.snCache=p,a.uniform1f(k,p);this.alCache=1;a.uniform1f(f,1)};this.setDiffuseColor=function(c){if(!this.dCache||this.dCache!=c)this.dCache=c,c=b.getRGB(c,1),a.uniform3f(e,c[0],c[1],c[2])};this.setAlpha=function(b){if(!this.alCache||this.alCache!=b)this.alCache=b,a.uniform1f(f,b)};return!0}})(ChemDoodle.math,
ChemDoodle.structures);
(function(b,c,a){b.MolecularSurface=function(g,e,d,k,f){function m(a,b,c,e){var d=a.index;if(a.contained)for(var d=-1,g=Infinity,f=0,j=b.length;f<j;f++)for(var n=b[f],l=0,m=n.length;l<m;l++){var p=n[l];if(!p.contained&&p.index!=c&&p.index!=e){var k=p.distance3D(a);k<g&&(d=p.index,g=k)}}return d}for(var n=[],j=[],p=[],l=[],h=0;h<=e;h++)for(var v=h*a.PI/e,q=a.sin(v),u=a.cos(v),v=0;v<=d;v++){var t=2*v*a.PI/d;l.push(a.cos(t)*q,u,a.sin(t)*q)}q=[];h=0;for(v=g.atoms.length;h<v;h++){for(var u=[],w=g.atoms[h],
r=c[w.label][f]+k,A=[],t=0,B=g.atoms.length;t<B;t++)if(t!=h){var x=g.atoms[t];x.index=t;w.distance3D(x)<r+c[x.label][f]+k&&A.push(x)}t=0;for(B=l.length;t<B;t+=3){for(var z=new b.Atom("C",w.x+r*l[t],w.y+r*l[t+1],w.z+r*l[t+2]),D=0,I=A.length;D<I;D++)if(x=A[D],z.distance3D(x)<c[x.label][f]+k){z.contained=!0;break}u.push(z)}q.push(u)}g=[];d++;for(h=0;h<e;h++)for(v=0;v<d;v++)f=h*d+v%d,k=f+d,g.push(f),g.push(k),g.push(f+1),v<d-1&&(g.push(k),g.push(k+1),g.push(f+1));h=D=0;for(v=q.length;h<v;h++){u=q[h];
t=0;for(B=u.length;t<B;t++)z=u[t],z.contained||(z.index=D,D++,n.push(z.x,z.y,z.z),j.push(l[3*t],l[3*t+1],l[3*t+2]));t=0;for(B=g.length;t<B;t+=3)f=u[g[t]],k=u[g[t+1]],z=u[g[t+2]],!f.contained&&!k.contained&&!z.contained&&p.push(f.index,k.index,z.index)}l=[];h=0;for(v=q.length;h<v;h++){u=q[h];t=0;for(B=g.length;t<B;t+=3){f=u[g[t]];k=u[g[t+1]];z=u[g[t+2]];A=[];D=0;for(I=q.length;D<I;D++)D!=h&&A.push(q[D]);if((!f.contained||!k.contained||!z.contained)&&(f.contained||k.contained||z.contained))if(e=m(f,
A,-1,-1),d=m(k,A,e,-1),A=m(z,A,e,d),-1!=e&&-1!=d&&-1!=A){k=!1;D=0;for(I=l.length;D<I;D+=3)if(f=l[D],z=l[D+1],w=l[D+2],r=d==f||d==z||d==w,x=A==f||A==z||A==w,(e==f||e==z||e==w)&&r&&x){k=!0;break}k||l.push(e,d,A)}}}p=p.concat(l);this.storeData(n,j,p);return!0};b.MolecularSurface.prototype=new b._Mesh})(ChemDoodle.structures,ChemDoodle.ELEMENT,Math);
(function(b,c){b.Shader=function(){this.init=function(a){var b=this.getShader(a,"vertex-shader");null==b&&(b=this.loadDefaultVertexShader(a));var c=this.getShader(a,"fragment-shader");null==c&&(c=this.loadDefaultFragmentShader(a));a.attachShader(a.program,b);a.attachShader(a.program,c);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,b){var e=c.getElementById(b);if(!e)return null;for(var d=[],k=e.firstChild;k;)3==k.nodeType&&d.push(k.textContent),k=k.nextSibling;if("x-shader/x-fragment"==e.type)k=a.createShader(a.FRAGMENT_SHADER);else if("x-shader/x-vertex"==e.type)k=a.createShader(a.VERTEX_SHADER);
else return null;a.shaderSource(k,d.join(""));a.compileShader(k);return!a.getShaderParameter(k,a.COMPILE_STATUS)?(alert(e.type+" "+a.getShaderInfoLog(k)),null):k};this.loadDefaultVertexShader=function(a){var b=[];b.push("struct Light");b.push("{");b.push("vec3 diffuse_color;");b.push("vec3 specular_color;");b.push("vec3 direction;");b.push("vec3 half_vector;");b.push("};");b.push("struct Material");b.push("{");b.push("vec3 ambient_color;");b.push("vec3 diffuse_color;");b.push("vec3 specular_color;");
b.push("float shininess;");b.push("float alpha;");b.push("};");b.push("attribute vec3 a_vertex_position;");b.push("attribute vec3 a_vertex_normal;");b.push("uniform Light u_light;");b.push("uniform Material u_material;");b.push("uniform mat4 u_model_view_matrix;");b.push("uniform mat4 u_projection_matrix;");b.push("uniform mat3 u_normal_matrix;");b.push("varying vec4 v_diffuse;");b.push("varying vec4 v_ambient;");b.push("varying vec3 v_normal;");b.push("varying vec3 v_light_direction;");b.push("void main(void)");
b.push("{");b.push("if(length(a_vertex_normal)==0.0){");b.push("v_normal = a_vertex_normal;");b.push("}else{");b.push("v_normal = normalize(u_normal_matrix * a_vertex_normal);");b.push("}");b.push("vec4 diffuse = vec4(u_light.diffuse_color, 1.0);");b.push("v_light_direction = u_light.direction;");b.push("v_ambient = vec4(u_material.ambient_color, 1.0);");b.push("v_diffuse = vec4(u_material.diffuse_color, 1.0) * diffuse;");b.push("gl_Position = u_projection_matrix * u_model_view_matrix * vec4(a_vertex_position, 1.0);");
b.push("}");var c=a.createShader(a.VERTEX_SHADER);a.shaderSource(c,b.join(""));a.compileShader(c);return!a.getShaderParameter(c,a.COMPILE_STATUS)?(alert("Vertex shader failed to compile: "+a.getShaderInfoLog(c)),null):c};this.loadDefaultFragmentShader=function(a){var b=[];b.push("precision mediump float;\n");b.push("struct Light");b.push("{");b.push("vec3 diffuse_color;");b.push("vec3 specular_color;");b.push("vec3 direction;");b.push("vec3 half_vector;");b.push("};");b.push("struct Material");b.push("{");
b.push("vec3 ambient_color;");b.push("vec3 diffuse_color;");b.push("vec3 specular_color;");b.push("float shininess;");b.push("float alpha;");b.push("};");b.push("uniform Light u_light;");b.push("uniform Material u_material;");b.push("varying vec4 v_diffuse;");b.push("varying vec4 v_ambient;");b.push("varying vec3 v_normal;");b.push("varying vec3 v_light_direction;");b.push("void main(void)");b.push("{");b.push("if(length(v_normal)==0.0){");b.push("gl_FragColor = vec4(v_diffuse.rgba);");b.push("}else{");
b.push("float nDotL = max(dot(v_normal, v_light_direction), 0.0);");b.push("vec4 color = vec4(v_diffuse.rgb*nDotL, v_diffuse.a);");b.push("float nDotHV = max(dot(v_normal, u_light.half_vector), 0.0);");b.push("vec4 specular = vec4(u_material.specular_color * u_light.specular_color, 1.0);");b.push("color+=vec4(specular.rgb * pow(nDotHV, u_material.shininess), specular.a);");b.push("gl_FragColor = color+v_ambient;");b.push("gl_FragColor.a*=u_material.alpha;");b.push("}");b.push("}");var c=a.createShader(a.FRAGMENT_SHADER);
a.shaderSource(c,b.join(""));a.compileShader(c);return!a.getShaderParameter(c,a.COMPILE_STATUS)?(alert("Fragment shader failed to compile: "+a.getShaderInfoLog(c)),null):c};return!0}})(ChemDoodle.structures,document);
(function(b,c){b.Shape=function(a,g){for(var e=a.length,d=[],k=[],f=new b.Point,m=0,n=e;m<n;m++){var j=m+1;m==n-1&&(j=0);for(var p=a[m],j=a[j],l=c.cross([0,0,1],[j.x-p.x,j.y-p.y,0]),h=0;2>h;h++)d.push(p.x,p.y,g/2),d.push(p.x,p.y,-g/2),d.push(j.x,j.y,g/2),d.push(j.x,j.y,-g/2);for(h=0;4>h;h++)k.push(l[0],l[1],l[2]);k.push(0,0,1);k.push(0,0,-1);k.push(0,0,1);k.push(0,0,-1);f.add(p)}f.x/=e;f.y/=e;k.push(0,0,1);d.push(f.x,f.y,g/2);k.push(0,0,-1);d.push(f.x,f.y,-g/2);f=[];p=8*e;m=0;for(n=e;m<n;m++)e=8*
m,f.push(e),f.push(e+1),f.push(e+3),f.push(e),f.push(e+2),f.push(e+3),f.push(e+4),f.push(e+6),f.push(p),f.push(e+5),f.push(e+7),f.push(p+1);this.storeData(d,k,f);return!0};b.Shape.prototype=new b._Mesh})(ChemDoodle.structures,vec3);
(function(b,c,a){b.Star=function(){for(var b=[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],c=[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],d=[],k=[],f=[],m=0,n=c.length;m<n;m+=3){var j=3*c[m],p=3*c[m+1],l=3*c[m+2],j=[b[j],b[j+1],b[j+2]],p=[b[p],b[p+1],b[p+2]],l=[b[l],b[l+1],b[l+2]],h=a.cross([l[0]-p[0],l[1]-p[1],l[2]-p[2]],[j[0]-p[0],j[1]-p[1],j[2]-p[2]],[]);a.normalize(h);d.push(j[0],j[1],j[2],p[0],p[1],p[2],l[0],l[1],l[2]);k.push(h[0],h[1],h[2],h[0],h[1],
h[2],h[0],h[1],h[2]);f.push(m,m+1,m+2)}this.storeData(d,k,f);return!0};b.Star.prototype=new b._Mesh})(ChemDoodle.structures,Math,vec3);
(function(b,c,a,g,e,d){var k=function(a,b,c){var d=g.sqrt(b[1]*b[1]+b[2]*b[2]),p=[1,0,0,0,0,b[2]/d,-b[1]/d,0,0,b[1]/d,b[2]/d,0,0,0,0,1],l=[1,0,0,0,0,b[2]/d,b[1]/d,0,0,-b[1]/d,b[2]/d,0,0,0,0,1],k=[d,0,-b[0],0,0,1,0,0,b[0],0,d,0,0,0,0,1],b=[d,0,b[0],0,0,1,0,0,-b[0],0,d,0,0,0,0,1],c=[g.cos(c),-g.sin(c),0,0,g.sin(c),g.cos(c),0,0,0,0,1,0,0,0,0,1],v=e.multiply(p,e.multiply(k,e.multiply(c,e.multiply(b,l,[]))));this.rotate=function(){return e.multiplyVec3(v,a)}};a.Tube=function(f,m,n){var j=f[0].lineSegments[0].length;
this.partitions=[];var p=null;this.ends=[];this.ends.push(f[0].lineSegments[0][0]);this.ends.push(f[f.length-2].lineSegments[0][0]);for(var l=[1,0,0],h=0,v=f.length-1;h<v;h++){if(null==p||65E3<p.positionData.length)0<this.partitions.length&&h--,p={count:0,positionData:[],normalData:[],indexData:[]},this.partitions.push(p);var q=f[h];p.count++;for(var u=Infinity,t=new a.Atom("",f[h+1].cp1.x,f[h+1].cp1.y,f[h+1].cp1.z),w=0;w<j;w++){var r=q.lineSegments[0][w],A=null,A=w==j-1?h==f.length-2?q.lineSegments[0][w-
1]:f[h+1].lineSegments[0][0]:q.lineSegments[0][w+1],A=[A.x-r.x,A.y-r.y,A.z-r.z];d.normalize(A);h==f.length-2&&w==j-1&&d.scale(A,-1);var B=vec3.cross(A,l,[]);d.normalize(B);d.scale(B,m/2);for(var B=new k(B,A,2*Math.PI/n),A=0,x=n;A<x;A++){var z=B.rotate();A==g.floor(n/4)&&(l=[z[0],z[1],z[2]]);p.normalData.push(z[0],z[1],z[2]);p.positionData.push(r.x+z[0],r.y+z[1],r.z+z[2])}null!=t&&(A=r.distance3D(t),A<u&&(u=A,f[h+1].pPoint=r))}}l=0;for(q=this.partitions.length;l<q;l++){p=this.partitions[l];h=0;for(v=
p.count-1;h<v;h++){u=h*j*n;w=0;for(t=j;w<t;w++){r=u+w*n;for(A=0;A<n;A++)A==n-1&&(nextRes=h==f.length-2?0:-A),B=r+A,p.indexData.push(B),p.indexData.push(B+n),p.indexData.push(B+n+1),p.indexData.push(B),p.indexData.push(B+1),p.indexData.push(B+n+1)}}}this.storeData(this.partitions[0].positionData,this.partitions[0].normalData,this.partitions[0].indexData);n=[new a.Point(2,0)];for(h=0;60>h;h++)j=h/60*g.PI,n.push(new a.Point(2*g.cos(j),-2*g.sin(j)));n.push(new a.Point(-2,0),new a.Point(-2,4),new a.Point(2,
4));var D=new a.Shape(n,1);this.render=function(j,n){this.bindBuffers(j);j.material.setDiffuseColor(n.macro_colorByChain?this.chainColor:n.nucleics_tubeColor);j.drawElements(j.TRIANGLES,this.vertexIndexBuffer.numItems,j.UNSIGNED_SHORT,0);if(this.partitions)for(var l=1,p=this.partitions.length;l<p;l++){var k=this.partitions[l],h=j,v=k;h.bindBuffer(h.ARRAY_BUFFER,v.vertexPositionBuffer);h.vertexAttribPointer(h.shader.vertexPositionAttribute,v.vertexPositionBuffer.itemSize,h.FLOAT,!1,0,0);h.bindBuffer(h.ARRAY_BUFFER,
v.vertexNormalBuffer);h.vertexAttribPointer(h.shader.vertexNormalAttribute,v.vertexNormalBuffer.itemSize,h.FLOAT,!1,0,0);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,v.vertexIndexBuffer);j.drawElements(j.TRIANGLES,k.vertexIndexBuffer.numItems,j.UNSIGNED_SHORT,0)}j.sphereBuffer.bindBuffers(j);for(l=0;2>l;l++)k=this.ends[l],k=e.translate(j.modelViewMatrix,[k.x,k.y,k.z],[]),p=m/2,e.scale(k,[p,p,p]),j.setMatrixUniforms(k),j.drawElements(j.TRIANGLES,j.sphereBuffer.vertexIndexBuffer.numItems,j.UNSIGNED_SHORT,0);
j.cylinderBuffer.bindBuffers(j);l=1;for(p=f.length-1;l<p;l++){var v=f[l],q=v.pPoint,r=new a.Atom("",v.cp2.x,v.cp2.y,v.cp2.z),k=1.001*q.distance3D(r),v=[m/4,k,m/4],k=e.translate(j.modelViewMatrix,[q.x,q.y,q.z],[]),u=[0,1,0],t=0,A=null,h=[r.x-q.x,r.y-q.y,r.z-q.z];q.x==r.x&&q.z==r.z?(A=[0,0,1],q.y<q.y&&(t=g.PI)):(t=b.vec3AngleFrom(u,h),A=d.cross(u,h,[]));0!=t&&e.rotate(k,t,A);e.scale(k,v);j.setMatrixUniforms(k);j.drawArrays(j.TRIANGLE_STRIP,0,j.cylinderBuffer.vertexPositionBuffer.numItems)}D.bindBuffers(j);
!n.nucleics_useShapelyColors&&!n.macro_colorByChain&&j.material.setDiffuseColor(n.nucleics_baseColor);l=1;for(p=f.length-1;l<p;l++)v=f[l],r=v.cp2,k=e.translate(j.modelViewMatrix,[r.x,r.y,r.z],[]),u=[0,1,0],t=0,q=v.cp3,h=[q.x-r.x,q.y-r.y,q.z-r.z],r.x==q.x&&r.z==q.z?(A=[0,0,1],r.y<r.y&&(t=g.PI)):(t=b.vec3AngleFrom(u,h),A=d.cross(u,h,[])),0!=t&&e.rotate(k,t,A),r=[1,0,0],t=e.rotate(e.identity([]),t,A),e.multiplyVec3(t,r),t=v.cp4,q=v.cp5,t.y==q.y&&t.z==q.z||(t=[q.x-t.x,q.y-t.y,q.z-t.z],q=b.vec3AngleFrom(r,
t),0>d.dot(h,d.cross(r,t))&&(q*=-1),e.rotateY(k,q)),n.nucleics_useShapelyColors&&!n.macro_colorByChain&&(c[v.name]?j.material.setDiffuseColor(c[v.name].shapelyColor):j.material.setDiffuseColor(c["*"].shapelyColor)),j.setMatrixUniforms(k),j.drawElements(j.TRIANGLES,D.vertexIndexBuffer.numItems,j.UNSIGNED_SHORT,0)};return!0};a.Tube.prototype=new a._Mesh})(ChemDoodle.extensions,ChemDoodle.RESIDUE,ChemDoodle.structures,Math,mat4,vec3);
(function(b){b.UnitCell=function(b){var a=[],g=[],e=function(b,c,d,e){a.push(b[0],b[1],b[2]);a.push(c[0],c[1],c[2]);a.push(d[0],d[1],d[2]);a.push(e[0],e[1],e[2]);for(b=0;4>b;b++)g.push(0,0,0)};e(b.o,b.x,b.xy,b.y);e(b.o,b.y,b.yz,b.z);e(b.o,b.z,b.xz,b.x);e(b.yz,b.y,b.xy,b.xyz);e(b.xyz,b.xz,b.z,b.yz);e(b.xy,b.x,b.xz,b.xyz);b=[];for(e=0;6>e;e++){var d=4*e;b.push(d,d+1,d+1,d+2,d+2,d+3,d+3,d)}this.storeData(a,g,b);return!0};b.UnitCell.prototype=new b._Mesh})(ChemDoodle.structures,vec3);
(function(b,c,a){b.Plate=function(b){this.lanes=Array(b);i=0;for(ii=b;i<ii;i++)this.lanes[i]=[];this.sort=function(){i=0;for(ii=this.lanes.length;i<ii;i++)this.lanes[i].sort(function(a,b){return a-b})};this.draw=function(b){var d=b.canvas.width,g=b.canvas.height;this.origin=9*g/10;this.front=g/10;this.laneLength=this.origin-this.front;b.strokeStyle="#000000";b.beginPath();b.moveTo(0,this.front);c.contextHashTo(b,0,this.front,d,this.front,3,3);b.closePath();b.stroke();b.beginPath();b.moveTo(0,this.origin);
b.lineTo(d,this.origin);b.closePath();b.stroke();i=0;for(ii=this.lanes.length;i<ii;i++){g=(i+1)*d/(ii+1);b.beginPath();b.moveTo(g,this.origin);b.lineTo(g,this.origin+3);b.closePath();b.stroke();s=0;for(ss=this.lanes[i].length;s<ss;s++){var f=this.origin-this.laneLength*this.lanes[i][s].rf;switch(this.lanes[i][s].type){case "compact":b.beginPath();b.arc(g,f,3,0,2*a.PI,!1);b.closePath();break;case "expanded":b.beginPath();b.arc(g,f,7,0,2*a.PI,!1);b.closePath();break;case "widened":c.contextOval(b,g-
18,f-10,36,10);break;case "cresent":b.beginPath(),b.arc(g,f,9,0,a.PI,!0),b.closePath()}switch(this.lanes[i][s].style){case "solid":b.fillStyle="#000000";b.fill();break;case "transparent":b.stroke()}}}};return!0};b.Plate.Spot=function(a,b,c){this.type=a;this.rf=b;this.style=c?c:"solid"}})(ChemDoodle.structures,ChemDoodle.extensions,Math);
(function(b,c,a){b.default_backgroundColor="#FFFFFF";b.default_scale=1;b.default_rotateAngle=0;b.default_bondLength_2D=20;b.default_angstromsPerBondLength=1.25;b.default_lightDirection_3D=[-0.1,-0.1,-1];b.default_lightDiffuseColor_3D="#FFFFFF";b.default_lightSpecularColor_3D="#FFFFFF";b.default_projectionPerspective_3D=!0;b.default_projectionPerspectiveVerticalFieldOfView_3D=45;b.default_projectionOrthoWidth_3D=40;b.default_projectionWidthHeightRatio_3D=null;b.default_projectionFrontCulling_3D=0.1;
b.default_projectionBackCulling_3D=1E4;b.default_atoms_display=!0;b.default_atoms_color="#000000";b.default_atoms_font_size_2D=12;b.default_atoms_font_families_2D=["Helvetica","Arial","Dialog"];b.default_atoms_font_bold_2D=!1;b.default_atoms_font_italic_2D=!1;b.default_atoms_circles_2D=!1;b.default_atoms_circleDiameter_2D=10;b.default_atoms_circleBorderWidth_2D=1;b.default_atoms_lonePairDistance_2D=8;b.default_atoms_lonePairSpread_2D=4;b.default_atoms_lonePairDiameter_2D=1;b.default_atoms_useJMOLColors=
!1;b.default_atoms_usePYMOLColors=!1;b.default_atoms_resolution_3D=60;b.default_atoms_sphereDiameter_3D=0.8;b.default_atoms_useVDWDiameters_3D=!1;b.default_atoms_vdwMultiplier_3D=1;b.default_atoms_materialAmbientColor_3D="#000000";b.default_atoms_materialSpecularColor_3D="#555555";b.default_atoms_materialShininess_3D=32;b.default_atoms_implicitHydrogens_2D=!0;b.default_atoms_displayTerminalCarbonLabels_2D=!1;b.default_atoms_showHiddenCarbons_2D=!0;b.default_atoms_displayAllCarbonLabels_2D=!1;b.default_atoms_nonBondedAsStars_3D=
!1;b.default_bonds_display=!0;b.default_bonds_color="#000000";b.default_bonds_width_2D=1;b.default_bonds_saturationWidth_2D=0.2;b.default_bonds_ends_2D="round";b.default_bonds_useJMOLColors=!1;b.default_bonds_usePYMOLColors=!1;b.default_bonds_colorGradient=!1;b.default_bonds_saturationAngle_2D=a.PI/3;b.default_bonds_symmetrical_2D=!1;b.default_bonds_clearOverlaps_2D=!1;b.default_bonds_overlapClearWidth_2D=0.5;b.default_bonds_atomLabelBuffer_2D=1;b.default_bonds_wedgeThickness_2D=0.22;b.default_bonds_hashWidth_2D=
1;b.default_bonds_hashSpacing_2D=2.5;b.default_bonds_showBondOrders_3D=!1;b.default_bonds_resolution_3D=60;b.default_bonds_renderAsLines_3D=!1;b.default_bonds_cylinderDiameter_3D=0.3;b.default_bonds_materialAmbientColor_3D="#222222";b.default_bonds_materialSpecularColor_3D="#555555";b.default_bonds_materialShininess_3D=32;b.default_proteins_displayRibbon=!0;b.default_proteins_displayBackbone=!1;b.default_proteins_backboneThickness=1.5;b.default_proteins_backboneColor="#CCCCCC";b.default_proteins_ribbonCartoonize=
!1;b.default_proteins_useShapelyColors=!1;b.default_proteins_useAminoColors=!1;b.default_proteins_usePolarityColors=!1;b.default_proteins_primaryColor="#FF0D0D";b.default_proteins_secondaryColor="#FFFF30";b.default_proteins_ribbonCartoonHelixPrimaryColor="#00E740";b.default_proteins_ribbonCartoonHelixSecondaryColor="#9905FF";b.default_proteins_ribbonCartoonSheetColor="#E8BB99";b.default_proteins_ribbonThickness=0.2;b.default_proteins_verticalResolution=10;b.default_proteins_horizontalResolution=9;
b.default_proteins_materialAmbientColor_3D="#222222";b.default_proteins_materialSpecularColor_3D="#555555";b.default_proteins_materialShininess_3D=32;b.default_nucleics_display=!0;b.default_nucleics_tubeColor="#CCCCCC";b.default_nucleics_baseColor="#C10000";b.default_nucleics_useShapelyColors=!0;b.default_nucleics_tubeThickness=1.5;b.default_nucleics_tubeResolution_3D=60;b.default_nucleics_verticalResolution=10;b.default_nucleics_materialAmbientColor_3D="#222222";b.default_nucleics_materialSpecularColor_3D=
"#555555";b.default_nucleics_materialShininess_3D=32;b.default_macro_displayAtoms=!1;b.default_macro_displayBonds=!1;b.default_macro_atomToLigandDistance=-1;b.default_macro_showWater=!1;b.default_macro_colorByChain=!1;b.default_surfaces_display=!0;b.default_surfaces_style="Dot";b.default_surfaces_color="#E9B862";b.default_surfaces_materialAmbientColor_3D="#000000";b.default_surfaces_materialSpecularColor_3D="#000000";b.default_surfaces_materialShininess_3D=32;b.default_crystals_displayUnitCell=!0;
b.default_crystals_unitCellColor="green";b.default_crystals_unitCellLineWidth=1;b.default_plots_color="#000000";b.default_plots_width=1;b.default_plots_showIntegration=!1;b.default_plots_integrationColor="#c10000";b.default_plots_integrationLineWidth=1;b.default_plots_showGrid=!1;b.default_plots_gridColor="gray";b.default_plots_gridLineWidth=0.5;b.default_plots_showYAxis=!0;b.default_plots_flipXAxis=!1;b.default_text_font_size=12;b.default_text_font_families=["Helvetica","Arial","Dialog"];b.default_text_color=
"#000000";c.VisualSpecifications=function(){this.backgroundColor=b.default_backgroundColor;this.scale=b.default_scale;this.rotateAngle=b.default_rotateAngle;this.bondLength=b.default_bondLength_2D;this.angstromsPerBondLength=b.default_angstromsPerBondLength;this.lightDirection_3D=b.default_lightDirection_3D;this.lightDiffuseColor_3D=b.default_lightDiffuseColor_3D;this.lightSpecularColor_3D=b.default_lightSpecularColor_3D;this.projectionPerspective_3D=b.default_projectionPerspective_3D;this.projectionPerspectiveVerticalFieldOfView_3D=
b.default_projectionPerspectiveVerticalFieldOfView_3D;this.projectionOrthoWidth_3D=b.default_projectionOrthoWidth_3D;this.projectionWidthHeightRatio_3D=b.default_projectionWidthHeightRatio_3D;this.projectionFrontCulling_3D=b.default_projectionFrontCulling_3D;this.projectionBackCulling_3D=b.default_projectionBackCulling_3D;this.atoms_display=b.default_atoms_display;this.atoms_color=b.default_atoms_color;this.atoms_font_size_2D=b.default_atoms_font_size_2D;this.atoms_font_families_2D=[];for(var a=0,
c=b.default_atoms_font_families_2D.length;a<c;a++)this.atoms_font_families_2D[a]=b.default_atoms_font_families_2D[a];this.atoms_font_bold_2D=b.default_atoms_font_bold_2D;this.atoms_font_italic_2D=b.default_atoms_font_italic_2D;this.atoms_circles_2D=b.default_atoms_circles_2D;this.atoms_circleDiameter_2D=b.default_atoms_circleDiameter_2D;this.atoms_circleBorderWidth_2D=b.default_atoms_circleBorderWidth_2D;this.atoms_lonePairDistance_2D=b.default_atoms_lonePairDistance_2D;this.atoms_lonePairSpread_2D=
b.default_atoms_lonePairSpread_2D;this.atoms_lonePairDiameter_2D=b.default_atoms_lonePairDiameter_2D;this.atoms_useJMOLColors=b.default_atoms_useJMOLColors;this.atoms_usePYMOLColors=b.default_atoms_usePYMOLColors;this.atoms_resolution_3D=b.default_atoms_resolution_3D;this.atoms_sphereDiameter_3D=b.default_atoms_sphereDiameter_3D;this.atoms_useVDWDiameters_3D=b.default_atoms_useVDWDiameters_3D;this.atoms_vdwMultiplier_3D=b.default_atoms_vdwMultiplier_3D;this.atoms_materialAmbientColor_3D=b.default_atoms_materialAmbientColor_3D;
this.atoms_materialSpecularColor_3D=b.default_atoms_materialSpecularColor_3D;this.atoms_materialShininess_3D=b.default_atoms_materialShininess_3D;this.atoms_implicitHydrogens_2D=b.default_atoms_implicitHydrogens_2D;this.atoms_displayTerminalCarbonLabels_2D=b.default_atoms_displayTerminalCarbonLabels_2D;this.atoms_showHiddenCarbons_2D=b.default_atoms_showHiddenCarbons_2D;this.atoms_displayAllCarbonLabels_2D=b.default_atoms_displayAllCarbonLabels_2D;this.atoms_nonBondedAsStars_3D=b.default_atoms_nonBondedAsStars_3D;
this.bonds_display=b.default_bonds_display;this.bonds_color=b.default_bonds_color;this.bonds_width_2D=b.default_bonds_width_2D;this.bonds_saturationWidth_2D=b.default_bonds_saturationWidth_2D;this.bonds_ends_2D=b.default_bonds_ends_2D;this.bonds_useJMOLColors=b.default_bonds_useJMOLColors;this.bonds_usePYMOLColors=b.default_bonds_usePYMOLColors;this.bonds_colorGradient=b.default_bonds_colorGradient;this.bonds_saturationAngle_2D=b.default_bonds_saturationAngle_2D;this.bonds_symmetrical_2D=b.default_bonds_symmetrical_2D;
this.bonds_clearOverlaps_2D=b.default_bonds_clearOverlaps_2D;this.bonds_overlapClearWidth_2D=b.default_bonds_overlapClearWidth_2D;this.bonds_atomLabelBuffer_2D=b.default_bonds_atomLabelBuffer_2D;this.bonds_wedgeThickness_2D=b.default_bonds_wedgeThickness_2D;this.bonds_hashWidth_2D=b.default_bonds_hashWidth_2D;this.bonds_hashSpacing_2D=b.default_bonds_hashSpacing_2D;this.bonds_showBondOrders_3D=b.default_bonds_showBondOrders_3D;this.bonds_resolution_3D=b.default_bonds_resolution_3D;this.bonds_renderAsLines_3D=
b.default_bonds_renderAsLines_3D;this.bonds_cylinderDiameter_3D=b.default_bonds_cylinderDiameter_3D;this.bonds_materialAmbientColor_3D=b.default_bonds_materialAmbientColor_3D;this.bonds_materialSpecularColor_3D=b.default_bonds_materialSpecularColor_3D;this.bonds_materialShininess_3D=b.default_bonds_materialShininess_3D;this.proteins_displayRibbon=b.default_proteins_displayRibbon;this.proteins_displayBackbone=b.default_proteins_displayBackbone;this.proteins_backboneThickness=b.default_proteins_backboneThickness;
this.proteins_backboneColor=b.default_proteins_backboneColor;this.proteins_ribbonCartoonize=b.default_proteins_ribbonCartoonize;this.proteins_useShapelyColors=b.default_proteins_useShapelyColors;this.proteins_useAminoColors=b.default_proteins_useAminoColors;this.proteins_usePolarityColors=b.default_proteins_usePolarityColors;this.proteins_primaryColor=b.default_proteins_primaryColor;this.proteins_secondaryColor=b.default_proteins_secondaryColor;this.proteins_ribbonCartoonHelixPrimaryColor=b.default_proteins_ribbonCartoonHelixPrimaryColor;
this.proteins_ribbonCartoonHelixSecondaryColor=b.default_proteins_ribbonCartoonHelixSecondaryColor;this.proteins_ribbonCartoonSheetColor=b.default_proteins_ribbonCartoonSheetColor;this.proteins_ribbonThickness=b.default_proteins_ribbonThickness;this.proteins_verticalResolution=b.default_proteins_verticalResolution;this.proteins_horizontalResolution=b.default_proteins_horizontalResolution;this.proteins_materialAmbientColor_3D=b.default_proteins_materialAmbientColor_3D;this.proteins_materialSpecularColor_3D=
b.default_proteins_materialSpecularColor_3D;this.proteins_materialShininess_3D=b.default_proteins_materialShininess_3D;this.macro_displayAtoms=b.default_macro_displayAtoms;this.macro_displayBonds=b.default_macro_displayBonds;this.macro_atomToLigandDistance=b.default_macro_atomToLigandDistance;this.nucleics_display=b.default_nucleics_display;this.nucleics_tubeColor=b.default_nucleics_tubeColor;this.nucleics_baseColor=b.default_nucleics_baseColor;this.nucleics_useShapelyColors=b.default_nucleics_useShapelyColors;
this.nucleics_tubeThickness=b.default_nucleics_tubeThickness;this.nucleics_tubeResolution_3D=b.default_nucleics_tubeResolution_3D;this.nucleics_verticalResolution=b.default_nucleics_verticalResolution;this.nucleics_materialAmbientColor_3D=b.default_nucleics_materialAmbientColor_3D;this.nucleics_materialSpecularColor_3D=b.default_nucleics_materialSpecularColor_3D;this.nucleics_materialShininess_3D=b.default_nucleics_materialShininess_3D;this.macro_showWater=b.default_macro_showWater;this.macro_colorByChain=
b.default_macro_colorByChain;this.surfaces_display=b.default_surfaces_display;this.surfaces_style=b.default_surfaces_style;this.surfaces_color=b.default_surfaces_color;this.surfaces_materialAmbientColor_3D=b.default_surfaces_materialAmbientColor_3D;this.surfaces_materialSpecularColor_3D=b.default_surfaces_materialSpecularColor_3D;this.surfaces_materialShininess_3D=b.default_surfaces_materialShininess_3D;this.crystals_displayUnitCell=b.default_crystals_displayUnitCell;this.crystals_unitCellColor=b.default_crystals_unitCellColor;
this.crystals_unitCellLineWidth=b.default_crystals_unitCellLineWidth;this.plots_color=b.default_plots_color;this.plots_width=b.default_plots_width;this.plots_showIntegration=b.default_plots_showIntegration;this.plots_integrationColor=b.default_plots_integrationColor;this.plots_integrationLineWidth=b.default_plots_integrationLineWidth;this.plots_showGrid=b.default_plots_showGrid;this.plots_gridColor=b.default_plots_gridColor;this.plots_gridLineWidth=b.default_plots_gridLineWidth;this.plots_showYAxis=
b.default_plots_showYAxis;this.plots_flipXAxis=b.default_plots_flipXAxis;this.text_font_size=b.default_text_font_size;this.text_font_families=[];a=0;for(c=b.default_text_font_families.length;a<c;a++)this.text_font_families[a]=b.default_text_font_families[a];this.text_color=b.default_text_color;this.set3DRepresentation=function(a){this.bonds_display=this.atoms_display=!0;this.bonds_color="#777777";this.bonds_showBondOrders_3D=this.bonds_useJMOLColors=this.atoms_useJMOLColors=this.atoms_useVDWDiameters_3D=
!0;this.bonds_renderAsLines_3D=!1;"Ball and Stick"==a?(this.atoms_vdwMultiplier_3D=0.3,this.bonds_useJMOLColors=!1,this.bonds_cylinderDiameter_3D=0.3,this.bonds_materialAmbientColor_3D=b.default_atoms_materialAmbientColor_3D):"van der Waals Spheres"==a?(this.bonds_display=!1,this.atoms_vdwMultiplier_3D=1):"Stick"==a?(this.bonds_showBondOrders_3D=this.atoms_useVDWDiameters_3D=!1,this.bonds_cylinderDiameter_3D=this.atoms_sphereDiameter_3D=0.8,this.bonds_materialAmbientColor_3D=this.atoms_materialAmbientColor_3D):
"Wireframe"==a?(this.atoms_useVDWDiameters_3D=!1,this.bonds_cylinderDiameter_3D=0.05,this.atoms_sphereDiameter_3D=0.15,this.bonds_materialAmbientColor_3D=b.default_atoms_materialAmbientColor_3D):"Line"==a?(this.atoms_display=!1,this.bonds_renderAsLines_3D=!0,this.bonds_width_2D=1,this.bonds_cylinderDiameter_3D=0.05):alert('"'+a+'" 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(a,
b,c,e){var g=[];c&&g.push("bold ");e&&g.push("italic ");g.push(a+"px ");a=0;for(c=b.length;a<c;a++)e=b[a],-1!=e.indexOf(" ")&&(e='"'+e+'"'),g.push((0!=a?",":"")+e);return g.join("")}}})(ChemDoodle,ChemDoodle.structures,Math);
(function(b,c,a,g){a.getPointsPerAngstrom=function(){return b.default_bondLength_2D/b.default_angstromsPerBondLength};a.BondDeducer=function(){this.margin=1.1;this.deduceCovalentBonds=function(b,d){var k=a.getPointsPerAngstrom();d&&(k=d);for(var f=0,m=b.atoms.length;f<m;f++)for(var n=f+1;n<m;n++){var j=b.atoms[f],p=b.atoms[n];j.distance3D(p)<(c[j.label].covalentRadius+c[p.label].covalentRadius)*k*this.margin&&b.bonds.push(new g.Bond(j,p,1))}};return!0}})(ChemDoodle,ChemDoodle.ELEMENT,ChemDoodle.informatics,
ChemDoodle.structures);(function(b){b.HydrogenDeducer=function(){this.removeHydrogens=function(b){for(var a=[],g=[],e=0,d=b.bonds.length;e<d;e++)"H"!=b.bonds[e].a1.label&&"H"!=b.bonds[e].a2.label&&g.push(b.bonds[e]);e=0;for(d=b.atoms.length;e<d;e++)"H"!=b.atoms[e].label&&a.push(b.atoms[e]);b.atoms=a;b.bonds=g};return!0}})(ChemDoodle.informatics);
(function(b,c,a){c.MolecularSurfaceGenerator=function(){this.generateSurface=function(b,c,d,k,f){return new a.MolecularSurface(b,c,d,k,f)};return!0}})(ChemDoodle,ChemDoodle.informatics,ChemDoodle.structures);
(function(b,c){b.Splitter=function(){this.split=function(a){for(var b=[],e=0,d=a.atoms.length;e<d;e++)a.atoms[e].visited=!1;e=0;for(d=a.bonds.length;e<d;e++)a.bonds[e].visited=!1;e=0;for(d=a.atoms.length;e<d;e++){var k=a.atoms[e];if(!k.visited){var f=new c.Molecule;f.atoms.push(k);k.visited=!0;var m=new c.Queue;for(m.enqueue(k);!m.isEmpty();)for(var k=m.dequeue(),n=0,j=a.bonds.length;n<j;n++){var p=a.bonds[n];p.contains(k)&&!p.visited&&(p.visited=!0,f.bonds.push(p),p=p.getNeighbor(k),p.visited||(p.visited=
!0,f.atoms.push(p),m.enqueue(p)))}b.push(f)}}return b};return!0}})(ChemDoodle.informatics,ChemDoodle.structures);
(function(b,c){b.StructureBuilder=function(){this.copy=function(a){for(var b=0,e=a.atoms.length;b<e;b++)a.atoms[b].metaID=b;for(var d=new c.Molecule,b=0,e=a.atoms.length;b<e;b++)d.atoms[b]=new c.Atom(a.atoms[b].label,a.atoms[b].x,a.atoms[b].y,a.atoms[b].z);b=0;for(e=a.bonds.length;b<e;b++)d.bonds[b]=new c.Bond(d.atoms[a.bonds[b].a1.metaID],d.atoms[a.bonds[b].a2.metaID],a.bonds[b].bondOrder);return d};return!0}})(ChemDoodle.informatics,ChemDoodle.structures);
(function(b){b._Counter=function(){this.value=0;this.molecule=null;this.setMolecule=function(b){this.value=0;this.molecule=b;this.innerCalculate&&this.innerCalculate()};return!0}})(ChemDoodle.informatics);(function(b){b.FrerejacqueNumberCounter=function(b){this.setMolecule(b);return!0};b.FrerejacqueNumberCounter.prototype=new b._Counter;b.FrerejacqueNumberCounter.prototype.innerCalculate=function(){this.value=this.molecule.bonds.length-this.molecule.atoms.length+(new b.NumberOfMoleculesCounter(this.molecule)).value}})(ChemDoodle.informatics);
(function(b,c){c.NumberOfMoleculesCounter=function(a){this.setMolecule(a);return!0};c.NumberOfMoleculesCounter.prototype=new c._Counter;c.NumberOfMoleculesCounter.prototype.innerCalculate=function(){for(var a=0,c=this.molecule.atoms.length;a<c;a++)this.molecule.atoms[a].visited=!1;a=0;for(c=this.molecule.atoms.length;a<c;a++)if(!this.molecule.atoms[a].visited){this.value++;var e=new b.Queue;this.molecule.atoms[a].visited=!0;for(e.enqueue(this.molecule.atoms[a]);!e.isEmpty();)for(var d=e.dequeue(),
k=0,f=this.molecule.bonds.length;k<f;k++){var m=this.molecule.bonds[k];m.contains(d)&&(m=m.getNeighbor(d),m.visited||(m.visited=!0,e.enqueue(m)))}}}})(ChemDoodle.structures,ChemDoodle.informatics);
(function(b,c){b._RingFinder=function(){this.rings=this.bonds=this.atoms=null;this.reduce=function(a){for(var b=0,c=a.atoms.length;b<c;b++)a.atoms[b].visited=!1;b=0;for(c=a.bonds.length;b<c;b++)a.bonds[b].visited=!1;for(var d=!0;d;){d=!1;b=0;for(c=a.atoms.length;b<c;b++){for(var k=0,f=null,m=0,n=a.bonds.length;m<n;m++)if(a.bonds[m].contains(a.atoms[b])&&!a.bonds[m].visited){k++;if(2==k)break;f=a.bonds[m]}1==k&&(d=!0,f.visited=!0,a.atoms[b].visited=!0)}}b=0;for(c=a.atoms.length;b<c;b++)a.atoms[b].visited||
this.atoms.push(a.atoms[b]);b=0;for(c=a.bonds.length;b<c;b++)a.bonds[b].visited||this.bonds.push(a.bonds[b]);0==this.bonds.length&&0!=this.atoms.length&&(this.atoms=[])};this.setMolecule=function(a){this.atoms=[];this.bonds=[];this.rings=[];this.reduce(a);2<this.atoms.length&&this.innerGetRings&&this.innerGetRings()};this.fuse=function(){for(var a=0,b=this.rings.length;a<b;a++)for(var e=0,d=this.bonds.length;e<d;e++)-1!=c(this.bonds[e].a1,this.rings[a].atoms)&&-1!=c(this.bonds[e].a2,this.rings[a].atoms)&&
this.rings[a].bonds.push(this.bonds[e])};return!0}})(ChemDoodle.informatics,jQuery.inArray);
(function(b,c,a){function g(b,d){this.atoms=[];if(d)for(var k=0,f=d.atoms.length;k<f;k++)this.atoms[k]=d.atoms[k];this.atoms.push(b);this.grow=function(b,c){for(var d=this.atoms[this.atoms.length-1],e=[],f=0,h=b.length;f<h;f++)if(b[f].contains(d)){var k=b[f].getNeighbor(d);-1==a(k,c)&&e.push(k)}d=[];f=0;for(h=e.length;f<h;f++)d.push(new g(e[f],this));return d};this.check=function(b,d,e){for(var f=0,g=d.atoms.length-1;f<g;f++)if(-1!=a(d.atoms[f],this.atoms))return null;var h=null;if(d.atoms[d.atoms.length-
1]==this.atoms[this.atoms.length-1]){h=new c.Ring;h.atoms[0]=e;f=0;for(g=this.atoms.length;f<g;f++)h.atoms.push(this.atoms[f]);for(f=d.atoms.length-2;0<=f;f--)h.atoms.push(d.atoms[f])}else{for(var k=[],f=0,g=b.length;f<g;f++)b[f].contains(d.atoms[d.atoms.length-1])&&k.push(b[f]);f=0;for(g=k.length;f<g;f++)if((1==d.atoms.length||!k[f].contains(d.atoms[d.atoms.length-2]))&&k[f].contains(this.atoms[this.atoms.length-1])){h=new c.Ring;h.atoms[0]=e;b=0;for(e=this.atoms.length;b<e;b++)h.atoms.push(this.atoms[b]);
for(b=d.atoms.length-1;0<=b;b--)h.atoms.push(d.atoms[b]);break}}return h};return!0}b.EulerFacetRingFinder=function(a){this.fingerBreak=5;this.setMolecule(a);return!0};b.EulerFacetRingFinder.prototype=new b._RingFinder;b.EulerFacetRingFinder.prototype.innerGetRings=function(){for(var b=0,c=this.atoms.length;b<c;b++){for(var k=[],f=0,m=this.bonds.length;f<m;f++)this.bonds[f].contains(this.atoms[b])&&k.push(this.bonds[f].getNeighbor(this.atoms[b]));f=0;for(m=k.length;f<m;f++)for(var n=f+1;n<k.length;n++){var j=
[];j[0]=new g(k[f]);j[1]=new g(k[n]);var p=[];p[0]=this.atoms[b];for(var l=0,h=k.length;l<h;l++)l!=f&&l!=n&&p.push(k[l]);var v=[];for((l=j[0].check(this.bonds,j[1],this.atoms[b]))&&(v[0]=l);0==v.length&&0<j.length&&j[0].atoms.length<this.fingerBreak;){for(var q=[],l=0,h=j.length;l<h;l++)for(var u=j[l].grow(this.bonds,p),t=0,w=u.length;t<w;t++)q.push(u[t]);j=q;l=0;for(h=j.length;l<h;l++)for(t=l+1;t<h;t++)(w=j[l].check(this.bonds,j[t],this.atoms[b]))&&v.push(w);if(0==v.length){q=[];l=0;for(h=p.length;l<
h;l++){t=0;for(w=this.bonds.length;t<w;t++)this.bonds[t].contains(p[l])&&(k=this.bonds[t].getNeighbor(p[l]),-1==a(k,p)&&-1==a(k,q)&&q.push(k))}l=0;for(h=q.length;l<h;l++)p.push(q[l])}}if(0<v.length){j=null;l=0;for(h=v.length;l<h;l++)if(!j||j.atoms.length>v[l].atoms.length)j=v[l];v=!1;l=0;for(h=this.rings.length;l<h;l++){p=!0;t=0;for(w=j.atoms.length;t<w;t++)if(-1==a(j.atoms[t],this.rings[l].atoms)){p=!1;break}if(p){v=!0;break}}v||this.rings.push(j)}}}this.fuse()}})(ChemDoodle.informatics,ChemDoodle.structures,
jQuery.inArray);
(function(b){b.SSSRFinder=function(c){this.rings=[];if(0<c.atoms.length){var a=(new b.FrerejacqueNumberCounter(c)).value,g=(new b.EulerFacetRingFinder(c)).rings;g.sort(function(a,b){return a.atoms.length-b.atoms.length});for(var e=0,d=c.bonds.length;e<d;e++)c.bonds[e].visited=!1;e=0;for(d=g.length;e<d;e++){for(var c=!1,k=0,f=g[e].bonds.length;k<f;k++)if(!g[e].bonds[k].visited){c=!0;break}if(c){k=0;for(f=g[e].bonds.length;k<f;k++)g[e].bonds[k].visited=!0;this.rings.push(g[e])}if(this.rings.length==a)break}}return!0}})(ChemDoodle.informatics);
(function(b,c,a,g,e,d,k,f){var m=/\s+/g,n=/\(|\)|\s+/g,j=/\'|\s+/g,p=/,|\'|\s+/g,l=/^\s+/,h=/[0-9]/g,v=/[0-9]|\+|\-/g,q=function(a){return 0!=a.length},u={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]]},t=function(a){var b=0,c=0,d=0,e=0,f=a.indexOf("x"),g=a.indexOf("y"),j=a.indexOf("z");-1!=f&&(c++,0<f&&"+"!=a.charAt(f-1)&&(c*=-1));-1!=g&&
(d++,0<g&&"+"!=a.charAt(g-1)&&(d*=-1));-1!=j&&(e++,0<j&&"+"!=a.charAt(j-1)&&(e*=-1));if(2<a.length){f="+";g=0;for(j=a.length;g<j;g++){var l=a.charAt(g);if(("-"==l||"/"==l)&&(g==a.length-1||a.charAt(g+1).match(h)))f=l;l.match(h)&&("+"==f?b+=parseInt(l):"-"==f?b-=parseInt(l):"/"==f&&(b/=parseInt(l)))}}return[b,c,d,e]};a.CIFInterpreter=function(){this.read=function(a,h,k,w){var h=h?h:1,k=k?k:1,w=w?w:1,z=new g.Molecule;if(null==a||0==a.length)return z;for(var D=a.split("\n"),I=0,M=0,H=0,F=0,J=0,E=0,L=
"P",K=null,G=null,C=a=null,Q=!0;0<D.length;)if(Q?C=D.shift():Q=!0,0<C.length)if(c.stringStartsWith(C,"_cell_length_a"))I=parseFloat(C.split(n)[1]);else if(c.stringStartsWith(C,"_cell_length_b"))M=parseFloat(C.split(n)[1]);else if(c.stringStartsWith(C,"_cell_length_c"))H=parseFloat(C.split(n)[1]);else if(c.stringStartsWith(C,"_cell_angle_alpha"))F=e.PI*parseFloat(C.split(n)[1])/180;else if(c.stringStartsWith(C,"_cell_angle_beta"))J=e.PI*parseFloat(C.split(n)[1])/180;else if(c.stringStartsWith(C,"_cell_angle_gamma"))E=
e.PI*parseFloat(C.split(n)[1])/180;else if(c.stringStartsWith(C,"_symmetry_space_group_name_H-M"))L=C.split(j)[1];else if(c.stringStartsWith(C,"loop_")){for(var N={fields:[],lines:[]},R=!1;null!=(C=D.shift())&&!c.stringStartsWith(C=C.replace(l,""),"loop_")&&0<C.length;)if(c.stringStartsWith(C,"_")){if(R)break;N.fields=N.fields.concat(C.split(m).filter(q))}else R=!0,N.lines.push(C);if(0!=D.length&&(c.stringStartsWith(C,"loop_")||c.stringStartsWith(C,"_")))Q=!1;-1!=f("_symmetry_equiv_pos_as_xyz",N.fields)||
-1!=f("_space_group_symop_operation_xyz",N.fields)?K=N:-1!=f("_atom_site_label",N.fields)?G=N:-1!=f("_geom_bond_atom_site_label_1",N.fields)&&(a=N)}C=I;F=(e.cos(F)-e.cos(E)*e.cos(J))/e.sin(E);F=[C,0,0,0,M*e.cos(E),M*e.sin(E),0,0,H*e.cos(J),H*F,H*e.sqrt(1-e.pow(e.cos(J),2)-F*F),0,0,0,0,1];if(null!=G){H=altLabelIndex=xIndex=yIndex=zIndex=-1;E=0;for(J=G.fields.length;E<J;E++)C=G.fields[E],"_atom_site_type_symbol"==C?H=E:"_atom_site_label"==C?altLabelIndex=E:"_atom_site_fract_x"==C?xIndex=E:"_atom_site_fract_y"==
C?yIndex=E:"_atom_site_fract_z"==C&&(zIndex=E);E=0;for(J=G.lines.length;E<J;E++)C=G.lines[E],M=C.split(m).filter(q),C=new g.Atom(M[-1==H?altLabelIndex:H].split(v)[0],parseFloat(M[xIndex]),parseFloat(M[yIndex]),parseFloat(M[zIndex])),z.atoms.push(C),-1!=altLabelIndex&&(C.cifId=M[altLabelIndex],C.cifPart=0)}if(null!=K&&null==a){E=M=0;for(J=K.fields.length;E<J;E++)if(C=K.fields[E],"_symmetry_equiv_pos_as_xyz"==C||"_space_group_symop_operation_xyz"==C)M=E;Q=u[L];D=[];E=0;for(J=K.lines.length;E<J;E++)for(var C=
K.lines[E].split(p).filter(q),N=t(C[M]),R=t(C[M+1]),O=t(C[M+2]),L=0,I=z.atoms.length;L<I;L++){var C=z.atoms[L],S=C.x*N[1]+C.y*N[2]+C.z*N[3]+N[0],U=C.x*R[1]+C.y*R[2]+C.z*R[3]+R[0],T=C.x*O[1]+C.y*O[2]+C.z*O[3]+O[0],G=new g.Atom(C.label,S,U,T);D.push(G);null!=C.cifId&&(G.cifId=C.cifId,G.cifPart=E+1);if(Q){G=0;for(H=Q.length;G<H;G++){var P=Q[G],P=new g.Atom(C.label,S+P[0],U+P[1],T+P[2]);D.push(P);null!=C.cifId&&(P.cifId=C.cifId,P.cifPart=E+1)}}}E=0;for(J=D.length;E<J;E++){for(C=D[E];1<=C.x;)C.x--;for(;0>
C.x;)C.x++;for(;1<=C.y;)C.y--;for(;0>C.y;)C.y++;for(;1<=C.z;)C.z--;for(;0>C.z;)C.z++}G=[];E=0;for(J=D.length;E<J;E++){H=!1;C=D[E];L=0;for(I=z.atoms.length;L<I;L++)if(1.0E-4>z.atoms[L].distance3D(C)){H=!0;break}if(!H){L=0;for(I=G.length;L<I;L++)if(1.0E-4>G[L].distance3D(C)){H=!0;break}H||G.push(C)}}z.atoms=z.atoms.concat(G)}J=[];for(E=0;E<h;E++)for(L=0;L<k;L++)for(G=0;G<w;G++)if(!(0==E&&0==L&&0==G)){H=0;for(M=z.atoms.length;H<M;H++)C=z.atoms[H],D=new g.Atom(C.label,C.x+E,C.y+L,C.z+G),J.push(D),null!=
C.cifId&&(D.cifId=C.cifId,D.cifPart=C.cifPart+(K?K.lines.length:0)+E+10*L+100*G)}z.atoms=z.atoms.concat(J);E=0;for(J=z.atoms.length;E<J;E++)C=z.atoms[E],K=d.multiplyVec3(F,[C.x,C.y,C.z]),C.x=K[0],C.y=K[1],C.z=K[2];if(null!=a){K=atom2=-1;E=0;for(J=a.fields.length;E<J;E++)C=a.fields[E],"_geom_bond_atom_site_label_1"==C?K=E:"_geom_bond_atom_site_label_2"==C&&(atom2=E);G=0;for(H=a.lines.length;G<H;G++){M=a.lines[G].split(m).filter(q);C=M[K];M=M[atom2];E=0;for(J=z.atoms.length;E<J;E++)for(L=E+1;L<J;L++){D=
z.atoms[E];I=z.atoms[L];if(D.cifPart!=I.cifPart)break;(D.cifId==C&&I.cifId==M||D.cifId==M&&I.cifId==C)&&z.bonds.push(new g.Bond(D,I))}}}else(new b.informatics.BondDeducer).deduceCovalentBonds(z,1);h=[-h/2,-k/2,-w/2];z.unitCellVectors={o:d.multiplyVec3(F,h,[]),x:d.multiplyVec3(F,[h[0]+1,h[1],h[2]]),y:d.multiplyVec3(F,[h[0],h[1]+1,h[2]]),z:d.multiplyVec3(F,[h[0],h[1],h[2]+1]),xy:d.multiplyVec3(F,[h[0]+1,h[1]+1,h[2]]),xz:d.multiplyVec3(F,[h[0]+1,h[1],h[2]+1]),yz:d.multiplyVec3(F,[h[0],h[1]+1,h[2]+1]),
xyz:d.multiplyVec3(F,[h[0]+1,h[1]+1,h[2]+1])};return z}};var w=new a.CIFInterpreter;b.readCIF=function(a,b,c,d){return w.read(a,b,c,d)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,Math,mat4,vec3,jQuery.inArray);
(function(b,c,a,g,e){function d(a,b,c){for(var d=a.length,e="",g=0;g<b-d;g++)e+=" ";return c?a+e:e+a}a.MOLInterpreter=function(){this.read=function(a,d){d||(d=b.default_bondLength_2D);var e=new g.Molecule;if(null==a||0==a.length)return e;for(var j=a.split("\n"),k=j[3],l=parseInt(k.substring(0,3)),k=parseInt(k.substring(3,6)),h=0;h<l;h++){var v=j[4+h];e.atoms[h]=new g.Atom(v.substring(31,34),parseFloat(v.substring(0,10))*d,(1==d?1:-1)*parseFloat(v.substring(10,20))*d,parseFloat(v.substring(20,30))*
d);var q=parseInt(v.substring(34,36));0!=q&&null!=c[e.atoms[h].label]&&(e.atoms[h].mass=c[e.atoms[h].label].mass+q);switch(parseInt(v.substring(36,39))){case 1:e.atoms[h].charge=3;break;case 2:e.atoms[h].charge=2;break;case 3:e.atoms[h].charge=1;break;case 5:e.atoms[h].charge=-1;break;case 6:e.atoms[h].charge=-2;break;case 7:e.atoms[h].charge=-3}}for(h=0;h<k;h++){var v=j[4+l+h],u=parseInt(v.substring(6,9)),q=parseInt(v.substring(9,12));if(3<u)switch(u){case 4:u=1.5;break;default:u=1}v=new g.Bond(e.atoms[parseInt(v.substring(0,
3))-1],e.atoms[parseInt(v.substring(3,6))-1],u);switch(q){case 3:v.stereo=g.Bond.STEREO_AMBIGUOUS;break;case 1:v.stereo=g.Bond.STEREO_PROTRUDING;break;case 6:v.stereo=g.Bond.STEREO_RECESSED}e.bonds[h]=v}return e};this.write=function(a){var k;k="Molecule from ChemDoodle Web Components\n\nhttp://www.ichemlabs.com\n"+d(a.atoms.length.toString(),3)+d(a.bonds.length.toString(),3)+"  0  0  0  0            999 v2000\n";for(var n=a.getCenter(),j=0,p=a.atoms.length;j<p;j++){var l=a.atoms[j],h=" 0";if(-1!=
l.mass&&null!=c[l.label]){var v=l.mass-c[l.label].mass;5>v&&-4<v&&(h=(-1<v?" ":"")+v)}v="  0";if(0!=l.charge)switch(l.charge){case 3:v="  1";break;case 2:v="  2";break;case 1:v="  3";break;case -1:v="  5";break;case -2:v="  6";break;case -3:v="  7"}k=k+d(((l.x-n.x)/b.default_bondLength_2D).toFixed(4),10)+d((-(l.y-n.y)/b.default_bondLength_2D).toFixed(4),10)+d((l.z/b.default_bondLength_2D).toFixed(4),10)+" "+d(l.label,3,!0)+h+v+"  0  0  0  0\n"}j=0;for(p=a.bonds.length;j<p;j++)n=a.bonds[j],l=0,n.stereo==
g.Bond.STEREO_AMBIGUOUS?l=3:n.stereo==g.Bond.STEREO_PROTRUDING?l=1:n.stereo==g.Bond.STEREO_RECESSED&&(l=6),k=k+d((e(n.a1,a.atoms)+1).toString(),3)+d((e(n.a2,a.atoms)+1).toString(),3)+d(n.bondOrder.toString(),3)+"  "+l+"     0  0\n";return k+"M  END"}};var k=new a.MOLInterpreter;b.readMOL=function(a,b){return k.read(a,b)};b.writeMOL=function(a){return k.write(a)}})(ChemDoodle,ChemDoodle.ELEMENT,ChemDoodle.io,ChemDoodle.structures,jQuery.inArray);
(function(b,c,a,g,e,d,k){a.PDBInterpreter=function(){function a(b,c,d,e,f){for(var g=0,k=c.length;g<k;g++){var m=c[g];if(m.id==d&&e>=m.start&&e<=m.end){f?b.helix=!0:b.sheet=!0;e+1==m.end&&(b.arrow=!0);break}}}this.deduceResidueBonds=this.calculateRibbonDistances=!1;this.read=function(f,j){var p=new g.Molecule;p.chains=[];if(null==f||0==f.length)return p;var l=f.split("\n");j||(j=1);for(var h=[],v=[],q=null,u=[],t=[],w=[],r=0,A=l.length;r<A;r++){var B=l[r];if(c.stringStartsWith(B,"HELIX"))h.push({id:B.substring(19,
20),start:parseInt(B.substring(21,25)),end:parseInt(B.substring(33,37))});else if(c.stringStartsWith(B,"SHEET"))v.push({id:B.substring(21,22),start:parseInt(B.substring(22,26)),end:parseInt(B.substring(33,37))});else if(c.stringStartsWith(B,"ATOM")){var x=B.substring(16,17);if(" "==x||"A"==x){x=d(B.substring(76,78));if(0==x.length){var z=d(B.substring(12,14));"HD"==z?x="H":0<z.length&&(x=1<z.length?z.charAt(0)+z.substring(1).toLowerCase():z)}z=new g.Atom(x,parseFloat(B.substring(30,38))*j,parseFloat(B.substring(38,
46))*j,parseFloat(B.substring(46,54))*j);z.hetatm=!1;t.push(z);var D=parseInt(B.substring(22,26));if(0==u.length)for(x=0;2>x;x++){var I=new g.Residue(-1);I.cp1=z;I.cp2=z;u.push(I)}D!=Number.NaN&&u[u.length-1].resSeq!=D&&(x=new g.Residue(D),x.name=d(B.substring(17,20)),3==x.name.length?x.name=x.name.substring(0,1)+x.name.substring(1).toLowerCase():2==x.name.length&&"D"==x.name.charAt(0)&&(x.name=x.name.substring(1)),u.push(x),I=B.substring(21,22),a(x,h,I,D,!0),a(x,v,I,D,!1));B=d(B.substring(12,16));
x=u[u.length-1];if("CA"==B||"P"==B||"O5'"==B)x.cp1||(x.cp1=z);else if("N3"==B&&("C"==x.name||"U"==x.name||"T"==x.name)||"N1"==B&&("A"==x.name||"G"==x.name))x.cp3=z;else if("C2"==B)x.cp4=z;else if("C4"==B&&("C"==x.name||"U"==x.name||"T"==x.name)||"C6"==B&&("A"==x.name||"G"==x.name))x.cp5=z;else if("O"==B||"C6"==B&&("C"==x.name||"U"==x.name||"T"==x.name)||"N9"==B){if(!u[u.length-1].cp2){if("C6"==B||"N9"==B)q=z;x.cp2=z}}else"C"==B&&(q=z)}}else if(c.stringStartsWith(B,"HETATM"))x=d(B.substring(76,78)),
1<x.length&&(x=x.substring(0,1)+x.substring(1).toLowerCase()),x=new g.Atom(x,parseFloat(B.substring(30,38))*j,parseFloat(B.substring(38,46))*j,parseFloat(B.substring(46,54))*j),x.hetatm=!0,"HOH"==d(B.substring(17,20))&&(x.isWater=!0),p.atoms.push(x),w[parseInt(d(B.substring(6,11)))]=x;else if(c.stringStartsWith(B,"CONECT")){if(x=parseInt(d(B.substring(6,11))),w[x]){z=w[x];for(r=0;4>r;r++)if(x=d(B.substring(11+5*r,16+5*r)),0!=x.length&&(x=parseInt(x),w[x])){for(var D=w[x],I=!1,x=0,M=p.bonds.length;x<
M;x++){var H=p.bonds[x];if(H.a1==z&&H.a2==D||H.a1==D&&H.a2==z){I=!0;break}}I||p.bonds.push(new g.Bond(z,D))}}}else if(c.stringStartsWith(B,"TER"))this.endChain(p,u,q),u=[];else if(c.stringStartsWith(B,"ENDMDL"))break}this.endChain(p,u,q);0==p.bonds.size&&(new b.informatics.BondDeducer).deduceCovalentBonds(p,j);if(this.deduceResidueBonds){r=0;for(A=t.length;r<A;r++){l=k.min(A,r+20);for(x=r+1;x<l;x++)h=t[r],v=t[x],h.distance3D(v)<1.1*(e[h.label].covalentRadius+e[v.label].covalentRadius)&&p.bonds.push(new g.Bond(h,
v,1))}}p.atoms=p.atoms.concat(t);this.calculateRibbonDistances&&this.calculateDistances(p,t);return p};this.endChain=function(a,b,c){if(0<b.length){var d=b[b.length-1];d.cp1||(d.cp1=a.atoms[a.atoms.length-2]);d.cp2||(d.cp2=a.atoms[a.atoms.length-1]);for(d=0;4>d;d++){var e=new g.Residue(-1);e.cp1=c;e.cp2=b[b.length-1].cp2;b.push(e)}a.chains.push(b)}};this.calculateDistances=function(a,b){for(var c=[],d=0,e=a.atoms.length;d<e;d++){var f=a.atoms[d];f.hetatm&&(f.isWater||c.push(f))}d=0;for(e=b.length;d<
e;d++)if(f=b[d],f.closestDistance=Number.POSITIVE_INFINITY,0==c.length)f.closestDistance=0;else for(var g=0,k=c.length;g<k;g++)f.closestDistance=Math.min(f.closestDistance,f.distance3D(c[g]))}};var f=new a.PDBInterpreter;b.readPDB=function(a,b){return f.read(a,b)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,ChemDoodle.ELEMENT,jQuery.trim,Math);
(function(b,c,a,g,e,d){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},f={"%":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},m={S:1,T:2,U:3,V:4,W:5,X:6,Y:7,Z:8,s:9};a.JCAMPInterpreter=function(){this.convertHZ2PPM=!1;this.read=function(a){this.isBreak=function(a){return null!=k[a]||null!=f[a]||null!=m[a]||" "==a||"-"==a||"+"==a};this.getValue=function(a,b){var c=a.charAt(0),d=a.substring(1);return null!=k[c]?parseFloat(k[c]+
d):null!=f[c]?parseFloat(f[c]+d)+b:parseFloat(d)};var b=new g.Spectrum;if(null==a||0==a.length)return b;for(var a=a.split("\n"),l=[],h,n,q,u,t=1,w=1,r=1,A=-1,B=-1,x=-1,z=!0,D=!1,I=0,M=a.length;I<M;I++){var H=d(a[I]),F=e.inArray("$$",H);-1!=F&&(H=H.substring(0,F));if(0==l.length||!c.stringStartsWith(a[I],"##"))0!=l.length&&l.push("\n"),l.push(d(H));else if(F=l.join(""),z&&100>F.length&&b.metadata.push(F),l=[H],c.stringStartsWith(F,"##TITLE="))b.title=d(F.substring(8));else if(c.stringStartsWith(F,
"##XUNITS="))b.xUnit=d(F.substring(9)),this.convertHZ2PPM&&"HZ"==b.xUnit.toUpperCase()&&(b.xUnit="PPM",D=!0);else if(c.stringStartsWith(F,"##YUNITS="))b.yUnit=d(F.substring(9));else if(!c.stringStartsWith(F,"##XYPAIRS="))if(c.stringStartsWith(F,"##FIRSTX="))n=parseFloat(d(F.substring(9)));else if(c.stringStartsWith(F,"##LASTX="))h=parseFloat(d(F.substring(8)));else if(c.stringStartsWith(F,"##FIRSTY="))q=parseFloat(d(F.substring(9)));else if(c.stringStartsWith(F,"##NPOINTS="))u=parseFloat(d(F.substring(10)));
else if(c.stringStartsWith(F,"##XFACTOR="))t=parseFloat(d(F.substring(10)));else if(c.stringStartsWith(F,"##YFACTOR="))w=parseFloat(d(F.substring(10)));else if(c.stringStartsWith(F,"##DELTAX="))A=parseFloat(d(F.substring(9)));else if(c.stringStartsWith(F,"##.OBSERVE FREQUENCY="))this.convertHZ2PPM&&(r=parseFloat(d(F.substring(21))));else if(c.stringStartsWith(F,"##.SHIFT REFERENCE="))this.convertHZ2PPM&&(x=F.substring(19).split(","),B=parseInt(d(x[2])),x=parseFloat(d(x[3])));else if(c.stringStartsWith(F,
"##XYDATA=")){D||(r=1);var H=z=!1,F=F.split("\n"),J=(h-n)/(u-1);if(-1!=A)for(var E=1,L=F.length;E<L;E++)if("|"==F[E].charAt(0)){J=A;break}for(var K=n-J,G=q,C=0,Q,E=1,L=F.length;E<L;E++){for(var N=[],K=d(F[E]),l=[],R=!1,O=0,S=K.length;O<S;O++)this.isBreak(K.charAt(O))?(0<l.length&&!(1==l.length&&" "==l[0])&&N.push(l.join("")),l=[K.charAt(O)]):"|"==K.charAt(O)?R=!0:l.push(K.charAt(O));N.push(l.join(""));K=parseFloat(N[0])*t-J;O=1;for(S=N.length;O<S;O++)if(G=N[O],null!=m[G.charAt(0)])for(var U=parseInt(m[G.charAt(0)]+
G.substring(1))-1,T=0;T<U;T++)K+=J,C=this.getValue(Q,C),G=C*w,P++,b.data[b.data.length-1]=new g.Point(K/r,G);else null!=k[G.charAt(0)]&&H?(G=this.getValue(G,C)*w,R&&(K+=J,b.data.push(new g.Point(K/r,G)))):(H=null!=f[G.charAt(0)],Q=G,K+=J,C=this.getValue(G,C),G=C*w,P++,b.data.push(new g.Point(K/r,G)))}if(-1!=B){H=x-b.data[B-1].x;I=0;for(M=b.data.length;I<M;I++)b.data[I].x+=H}}else if(c.stringStartsWith(F,"##PEAK TABLE=")){z=!1;b.continuous=!1;for(var F=F.split("\n"),P=0,E=1,L=F.length;E<L;E++){H=F[E].split(/[\s,]+/);
P+=H.length/2;O=0;for(S=H.length;O+1<S;O+=2)b.data.push(new g.Point(parseFloat(d(H[O])),parseFloat(d(H[O+1]))))}}}b.setup();return b}};var n=new a.JCAMPInterpreter;n.convertHZ2PPM=!0;b.readJCAMP=function(a){return n.read(a)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,jQuery,jQuery.trim);
(function(b,c,a){b.fromJSONChains=function(a){for(var b=[],d=0,k=a.cs.length;d<k;d++){for(var f=a.cs[d],m=[],n=0,j=f.length;n<j;n++){var p=f[n],l=new c.Residue;l.name=p.n;l.cp1=new c.Atom("",p.x1,p.y1,p.z1);l.cp2=new c.Atom("",p.x2,p.y2,p.z2);p.x3&&(l.cp3=new c.Atom("",p.x3,p.y3,p.z3),l.cp4=new c.Atom("",p.x4,p.y4,p.z4),l.cp5=new c.Atom("",p.x5,p.y5,p.z5));l.helix=p.h;l.sheet=p.s;l.arrow=p.a;m.push(l)}b.push(m)}return b};b.fromJSONPDB=function(a){var c=b.fromJSONDummy(a.mol);c.findRings=!1;c.fromJSON=
!0;c.chains=b.fromJSONChains(a.ribbons);return c};b.fromJSONDummy=function(a){for(var b=new c.Molecule,d=0,k=a.a.length;d<k;d++){var f=a.a[d],m=new c.Atom(f.l?f.l:"C",f.x,f.y);f.z&&(m.z=f.z);f.c&&(m.charge=f.c);f.m&&(m.mass=f.m);void 0!=f.p_h&&(m.hetatm=f.p_h);void 0!=f.p_w&&(m.isWater=f.p_w);void 0!=f.p_d&&(m.closestDistance=f.p_d);b.atoms.push(m)}d=0;for(k=a.b.length;d<k;d++)f=a.b[d],m=new c.Bond(b.atoms[f.b],b.atoms[f.e],f.o?f.o:1),f.s&&(m.stereo=f.s),b.bonds.push(m);return b};b.toJSONDummy=function(b){for(var e=
{a:[],b:[]},d=0,k=b.atoms.length;d<k;d++){var f=b.atoms[d];e.a[d]={x:f.x,y:f.y};"C"!=f.label&&(e.a[d].l=f.label);0!=f.z&&(e.a[d].z=f.z);0!=f.charge&&(e.a[d].c=f.charge);-1!=f.mass&&(e.a[d].m=f.mass)}d=0;for(k=b.bonds.length;d<k;d++)if(f=b.bonds[d],e.b[d]={b:a(f.a1,b.atoms),e:a(f.a2,b.atoms)},1!=f.bondOrder&&(e.b[d].o=f.bondOrder),f.stereo!=c.Bond.STEREO_NONE)e.b[d].s=f.stereo;return e}})(ChemDoodle.io,ChemDoodle.structures,jQuery.inArray);
(function(b,c,a,g,e,d){g.XYZInterpreter=function(){this.deduceCovalentBonds=!0;this.read=function(c){var g=new e.Molecule;if(null==c||0==c.length)return g;for(var c=c.split("\n"),k=parseInt(d(c[0])),j=0;j<k;j++){var p=c[j+2].split(/\s+/g);g.atoms[j]=new e.Atom(isNaN(p[0])?p[0]:a[parseInt(p[0])-1],parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3]))}this.deduceCovalentBonds&&(new b.informatics.BondDeducer).deduceCovalentBonds(g,1);return g}};var k=new g.XYZInterpreter;b.readXYZ=function(a){return k.read(a)}})(ChemDoodle,
ChemDoodle.ELEMENT,ChemDoodle.SYMBOLS,ChemDoodle.io,ChemDoodle.structures,jQuery.trim);
ChemDoodle.monitor=function(b,c,a){var g={CANVAS_DRAGGING:null,CANVAS_OVER:null,ALT:!1,SHIFT:!1,META:!1};b.supports_touch()||c(a).ready(function(){c(a).mousemove(function(a){null!=g.CANVAS_DRAGGING&&g.CANVAS_DRAGGING.drag&&(g.CANVAS_DRAGGING.prehandleEvent(a),g.CANVAS_DRAGGING.drag(a))});c(a).mouseup(function(a){null!=g.CANVAS_DRAGGING&&g.CANVAS_DRAGGING!=g.CANVAS_OVER&&g.CANVAS_DRAGGING.mouseup&&(g.CANVAS_DRAGGING.prehandleEvent(a),g.CANVAS_DRAGGING.mouseup(a));g.CANVAS_DRAGGING=null});c(a).keydown(function(a){g.SHIFT=
a.shiftKey;g.ALT=a.altKey;g.META=a.metaKey;var b=g.CANVAS_OVER;null!=g.CANVAS_DRAGGING&&(b=g.CANVAS_DRAGGING);null!=b&&b.keydown&&(b.prehandleEvent(a),b.keydown(a))});c(a).keypress(function(a){var b=g.CANVAS_OVER;null!=g.CANVAS_DRAGGING&&(b=g.CANVAS_DRAGGING);null!=b&&b.keypress&&(b.prehandleEvent(a),b.keypress(a))});c(a).keyup(function(a){g.SHIFT=a.shiftKey;g.ALT=a.altKey;g.META=a.metaKey;var b=g.CANVAS_OVER;null!=g.CANVAS_DRAGGING&&(b=g.CANVAS_DRAGGING);null!=b&&b.keyup&&(b.prehandleEvent(a),b.keyup(a))})});
return g}(ChemDoodle.featureDetection,jQuery,document);
(function(b,c,a,g,e,d,k,f,m){b._Canvas=function(){this.image=this.emptyMessage=this.molecule=null;return!0};b._Canvas.prototype.repaint=function(){var a=f.getElementById(this.id);if(a.getContext){var b=a.getContext("2d"),c=m.devicePixelRatio?m.devicePixelRatio:1;1!=c&&(a.width=this.width*c,a.height=this.height*c,b.scale(c,c));null==this.image?null!=this.specs.backgroundColor&&(b.fillStyle=this.specs.backgroundColor,b.fillRect(0,0,this.width,this.height)):b.drawImage(this.image,0,0);this.innerRepaint?
this.innerRepaint(b):null!=this.molecule&&0<this.molecule.atoms.length?(b.save(),b.translate(this.width/2,this.height/2),b.rotate(this.specs.rotateAngle),b.scale(this.specs.scale,this.specs.scale),b.translate(-this.width/2,-this.height/2),this.molecule.check(!0),this.molecule.draw(b,this.specs),b.restore()):null!=this.emptyMessage&&(b.fillStyle="#737683",b.textAlign="center",b.textBaseline="middle",b.font="18px Helvetica, Verdana, Arial, Sans-serif",b.fillText(this.emptyMessage,this.width/2,this.height/
2));this.drawChildExtras&&this.drawChildExtras(b)}};b._Canvas.prototype.resize=function(a,b){var c=e("#"+this.id);c.attr({width:a,height:b});c.css("width",a);c.css("height",b);this.width=a;this.height=b;this instanceof ChemDoodle._Canvas3D?(this.gl.viewport(0,0,a,b),this.setupScene()):this.molecule&&(this.center(),this.molecule.check());this.repaint()};b._Canvas.prototype.setBackgroundImage=function(a){this.image=new Image;var b=this;this.image.onload=function(){b.repaint()};this.image.src=a};b._Canvas.prototype.loadMolecule=
function(a){this.molecule=a;this.center();this instanceof ChemDoodle._Canvas3D||this.molecule.check();this.afterLoadMolecule&&this.afterLoadMolecule();this.repaint()};b._Canvas.prototype.center=function(){var a=this.molecule.getCenter3D(),b=new g.Atom("C",this.width/2,this.height/2,0);b.sub3D(a);for(var a=0,c=this.molecule.atoms.length;a<c;a++)this.molecule.atoms[a].add3D(b);b=this.molecule.getDimension();this.specs.scale=1;if(b.x>this.width||b.y>this.height)this.specs.scale=0.85*k.min(this.width/
b.x,this.height/b.y)};b._Canvas.prototype.create=function(k,j,m){this.id=k;this.width=j;this.height=m;if(f.getElementById(k)){var l=e("#"+k);j?l.attr("width",j):this.width=l.attr("width");m?l.attr("height",m):this.height=l.attr("height")}else!b.featureDetection.supports_canvas_text()&&d.msie&&"6"<=d.version?f.writeln('<div style="border: 1px solid black;" width="'+j+'" height="'+m+'">Please install <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a>, then restart Internet Explorer.</div>'):
f.writeln('<canvas class="ChemDoodleWebComponent" id="'+k+'" width="'+j+'" height="'+m+'" alt="ChemDoodle Web Component">This browser does not support HTML5/Canvas.</canvas>');k=e("#"+k);k.css("width",this.width);k.css("height",this.height);this.specs=new g.VisualSpecifications;var h=this;c.supports_touch()?(k.bind("touchstart",function(a){var b=(new Date).getTime();h.lastTouch&&1==a.originalEvent.touches.length&&500>b-h.lastTouch?h.dbltap?(h.prehandleEvent(a),h.dbltap(a)):h.dblclick?(h.prehandleEvent(a),
h.dblclick(a)):h.touchstart?(h.prehandleEvent(a),h.touchstart(a)):h.mousedown&&(h.prehandleEvent(a),h.mousedown(a)):h.touchstart?(h.prehandleEvent(a),h.touchstart(a),this.hold&&clearTimeout(this.hold),this.touchhold&&(this.hold=setTimeout(function(){h.touchhold(a)},1E3))):h.mousedown&&(h.prehandleEvent(a),h.mousedown(a));h.lastTouch=b}),k.bind("touchmove",function(a){null!=this.hold&&(clearTimeout(this.hold),this.hold=null);if(1<a.originalEvent.touches.length&&h.multitouchmove){var b=a.originalEvent.touches.length;
h.prehandleEvent(a);for(var c=new g.Point(-a.offset.left*b,-a.offset.top*b),d=0;d<b;d++)c.x+=a.originalEvent.changedTouches[d].pageX,c.y+=a.originalEvent.changedTouches[d].pageY;c.x/=b;c.y/=b;a.p=c;h.multitouchmove(a,b)}else h.touchmove?(h.prehandleEvent(a),h.touchmove(a)):h.drag&&(h.prehandleEvent(a),h.drag(a))}),k.bind("touchend",function(a){null!=this.hold&&(clearTimeout(this.hold),this.hold=null);h.touchend?(h.prehandleEvent(a),h.touchend(a)):h.mouseup&&(h.prehandleEvent(a),h.mouseup(a));250>
(new Date).getTime()-h.lastTouch&&(h.tap?(h.prehandleEvent(a),h.tap(a)):h.click&&(h.prehandleEvent(a),h.click(a)))}),k.bind("gesturestart",function(a){h.gesturestart&&(h.prehandleEvent(a),h.gesturestart(a))}),k.bind("gesturechange",function(a){h.gesturechange&&(h.prehandleEvent(a),h.gesturechange(a))}),k.bind("gestureend",function(a){h.gestureend&&(h.prehandleEvent(a),h.gestureend(a))})):(k.click(function(a){switch(a.which){case 1:h.click&&(h.prehandleEvent(a),h.click(a));break;case 2:h.middleclick&&
(h.prehandleEvent(a),h.middleclick(a));break;case 3:h.rightclick&&(h.prehandleEvent(a),h.rightclick(a))}}),k.dblclick(function(a){h.dblclick&&(h.prehandleEvent(a),h.dblclick(a))}),k.mousedown(function(b){switch(b.which){case 1:a.CANVAS_DRAGGING=h;h.mousedown&&(h.prehandleEvent(b),h.mousedown(b));break;case 2:h.middlemousedown&&(h.prehandleEvent(b),h.middlemousedown(b));break;case 3:h.rightmousedown&&(h.prehandleEvent(b),h.rightmousedown(b))}}),k.mousemove(function(b){null==a.CANVAS_DRAGGING&&h.mousemove&&
(h.prehandleEvent(b),h.mousemove(b))}),k.mouseout(function(b){a.CANVAS_OVER=null;h.mouseout&&(h.prehandleEvent(b),h.mouseout(b))}),k.mouseover(function(b){a.CANVAS_OVER=h;h.mouseover&&(h.prehandleEvent(b),h.mouseover(b))}),k.mouseup(function(a){switch(a.which){case 1:h.mouseup&&(h.prehandleEvent(a),h.mouseup(a));break;case 2:h.middlemouseup&&(h.prehandleEvent(a),h.middlemouseup(a));break;case 3:h.rightmouseup&&(h.prehandleEvent(a),h.rightmouseup(a))}}),k.mousewheel(function(a,b){h.mousewheel&&(h.prehandleEvent(a),
h.mousewheel(a,b))}));this.subCreate&&this.subCreate()};b._Canvas.prototype.getMolecule=function(){return this.molecule};b._Canvas.prototype.prehandleEvent=function(a){a.originalEvent.changedTouches&&(a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY);a.preventDefault();a.offset=e("#"+this.id).offset();a.p=new g.Point(a.pageX-a.offset.left,a.pageY-a.offset.top)}})(ChemDoodle,ChemDoodle.featureDetection,ChemDoodle.monitor,ChemDoodle.structures,jQuery,jQuery.browser,
Math,document,window);
(function(b){b._AnimatorCanvas=function(b,a,g){b&&this.create(b,a,g);this.timeout=33;return!0};b._AnimatorCanvas.prototype=new b._Canvas;b._AnimatorCanvas.prototype.startAnimation=function(){this.stopAnimation();this.lastTime=(new Date).getTime();var b=this;this.nextFrame&&(this.handle=setInterval(function(){var a=(new Date).getTime();b.nextFrame(a-b.lastTime);b.repaint();b.lastTime=a},this.timeout))};b._AnimatorCanvas.prototype.stopAnimation=function(){null!=this.handle&&(clearInterval(this.handle),this.handle=
null)};b._AnimatorCanvas.prototype.isRunning=function(){return null!=this.handle}})(ChemDoodle);
(function(b,c){b.FileCanvas=function(a,b,e,d){a&&this.create(a,b,e);form='<br><form name="FileForm" enctype="multipart/form-data" method="POST" action="'+d+'" 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>';c.writeln(form);this.emptyMessage="Click below to load file";this.repaint();
return!0};b.FileCanvas.prototype=new b._Canvas})(ChemDoodle,document);
(function(b){b.HyperlinkCanvas=function(b,a,g,e,d,k){b&&this.create(b,a,g);this.urlOrFunction=e;this.color=d?d:"blue";this.size=k?k:2;this.openInNewWindow=!0;this.e=this.hoverImage=null;return!0};b.HyperlinkCanvas.prototype=new b._Canvas;b.HyperlinkCanvas.prototype.drawChildExtras=function(b){null!=this.e&&(null==this.hoverImage?(b.strokeStyle=this.color,b.lineWidth=2*this.size,b.strokeRect(0,0,this.width,this.height)):b.drawImage(this.hoverImage,0,0))};b.HyperlinkCanvas.prototype.setHoverImage=function(b){this.hoverImage=
new Image;this.hoverImage.src=b};b.HyperlinkCanvas.prototype.click=function(){this.e=null;this.repaint();this.urlOrFunction instanceof Function?this.urlOrFunction():this.openInNewWindow?window.open(this.urlOrFunction):location.href=this.urlOrFunction};b.HyperlinkCanvas.prototype.mouseout=function(){this.e=null;this.repaint()};b.HyperlinkCanvas.prototype.mouseover=function(b){this.e=b;this.repaint()}})(ChemDoodle);
(function(b,c,a,g){b.MolGrabberCanvas=function(b,c,k){b&&this.create(b,c,k);c=[];c.push('<br><input type="text" id="');c.push(b);c.push('_query" size="32" value="" />');c.push("<br><nobr>");c.push('<select id="');c.push(b);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(b);c.push('_submit">Show Molecule</button>');c.push("</nobr>");
g.writeln(c.join(""));var f=this;a("#"+b+"_submit").click(function(){f.search()});a("#"+b+"_query").keypress(function(a){13==a.which&&f.search()});this.emptyMessage="Enter search term below";this.repaint();return!0};b.MolGrabberCanvas.prototype=new b._Canvas;b.MolGrabberCanvas.prototype.setSearchTerm=function(b){a("#"+this.id+"_query").val(b);this.search()};b.MolGrabberCanvas.prototype.search=function(){this.emptyMessage="Searching...";this.molecule=null;this.repaint();var b=this;c.getMoleculeFromDatabase(a("#"+
this.id+"_select").val(),a("#"+this.id+"_query").val(),function(a){b.loadMolecule(a)})}})(ChemDoodle,ChemDoodle.iChemLabs,jQuery,document);
(function(b,c,a){var g=[],e=[1,0,0],d=[0,1,0],k=[0,0,1];b.RotatorCanvas=function(a,b,d,e){a&&this.create(a,b,d);this.rotate3D=e;this.zIncrement=this.yIncrement=this.xIncrement=a=c.PI/15;return!0};b.RotatorCanvas.prototype=new b._AnimatorCanvas;b.RotatorCanvas.prototype.nextFrame=function(b){if(null==this.molecule)this.stopAnimation();else if(b/=1E3,this.rotate3D){a.identity(g);a.rotate(g,this.xIncrement*b,e);a.rotate(g,this.yIncrement*b,d);a.rotate(g,this.zIncrement*b,k);for(var b=0,c=this.molecule.atoms.length;b<
c;b++){var n=this.molecule.atoms[b],j=[n.x-this.width/2,n.y-this.height/2,n.z];a.multiplyVec3(g,j);n.x=j[0]+this.width/2;n.y=j[1]+this.height/2;n.z=j[2]}b=0;for(c=this.molecule.rings.length;b<c;b++)this.molecule.rings[b].center=this.molecule.rings[b].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*b};b.RotatorCanvas.prototype.dblclick=
function(){this.isRunning()?this.stopAnimation():this.startAnimation()}})(ChemDoodle,Math,mat4);
(function(b){b.SlideshowCanvas=function(b,a,g){b&&this.create(b,a,g);this.molecules=[];this.curIndex=0;this.timeout=5E3;this.alpha=0;this.innerHandle=null;this.phase=0;return!0};b.SlideshowCanvas.prototype=new b._AnimatorCanvas;b.SlideshowCanvas.prototype.drawChildExtras=function(b){b.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+")";b.fillRect(0,
0,this.width,this.height)};b.SlideshowCanvas.prototype.nextFrame=function(){if(0==this.molecules.length)this.stopAnimation();else{this.phase=0;var b=this,a=1;this.innerHandle=setInterval(function(){b.alpha=a/15;b.repaint();15==a&&b.breakInnerHandle();a++},33)}};b.SlideshowCanvas.prototype.breakInnerHandle=function(){null!=this.innerHandle&&(clearInterval(this.innerHandle),this.innerHandle=null);if(0==this.phase){this.curIndex++;this.curIndex>this.molecules.length-1&&(this.curIndex=0);this.alpha=1;
this.loadMolecule(this.molecules[this.curIndex]);this.phase=1;var b=this,a=1;this.innerHandle=setInterval(function(){b.alpha=(15-a)/15;b.repaint();a==15&&b.breakInnerHandle();a++},33)}else 1==this.phase&&(this.alpha=0,this.repaint())};b.SlideshowCanvas.prototype.addMolecule=function(b){0==this.molecules.length&&this.loadMolecule(b);this.molecules.push(b)}})(ChemDoodle);
(function(b,c,a,g,e){b.TransformCanvas=function(a,b,c,e){a&&this.create(a,b,c);this.lastPoint=null;this.rotate3D=e;this.rotationMultMod=1.3;this.lastPinchScale=1;this.lastGestureRotate=0;return!0};b.TransformCanvas.prototype=new b._Canvas;b.TransformCanvas.prototype.mousedown=function(a){this.lastPoint=a.p};b.TransformCanvas.prototype.dblclick=function(){var b=new a.Point(this.width/2,this.height/2);b.sub(this.molecule.getCenter());for(var c=0,e=this.molecule.atoms.length;c<e;c++)this.molecule.atoms[c].add(b);
this.molecule.check();this.repaint()};b.TransformCanvas.prototype.drag=function(b){if(!this.lastPoint.multi){if(c.ALT){var k=new a.Point(b.p.x,b.p.y);k.sub(this.lastPoint);for(var f=0,m=this.molecule.atoms.length;f<m;f++)this.molecule.atoms[f].add(k);this.lastPoint=b.p;this.molecule.check()}else if(!0==this.rotate3D){k=g.max(this.width/4,this.height/4);f=(b.p.x-this.lastPoint.x)/k*this.rotationMultMod;m=-(b.p.y-this.lastPoint.y)/k*this.rotationMultMod;k=[];e.identity(k);e.rotate(k,m,[1,0,0]);e.rotate(k,
f,[0,1,0]);f=0;for(m=this.molecule.atoms.length;f<m;f++){var n=this.molecule.atoms[f],j=[n.x-this.width/2,n.y-this.height/2,n.z];e.multiplyVec3(k,j);n.x=j[0]+this.width/2;n.y=j[1]+this.height/2;n.z=j[2]}f=0;for(m=this.molecule.rings.length;f<m;f++)this.molecule.rings[f].center=this.molecule.rings[f].getCenter();this.lastPoint=b.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),f=k.angle(this.lastPoint),this.specs.rotateAngle-=k.angle(b.p)-f,this.lastPoint=b.p;this.repaint()}};b.TransformCanvas.prototype.mousewheel=function(a,b){this.specs.scale+=b/10;0.01>this.specs.scale&&(this.specs.scale=0.01);this.repaint()};b.TransformCanvas.prototype.multitouchmove=function(b,c){if(2==c)if(this.lastPoint.multi){var e=new a.Point(b.p.x,b.p.y);e.sub(this.lastPoint);for(var g=0,n=this.molecule.atoms.length;g<n;g++)this.molecule.atoms[g].add(e);
this.lastPoint=b.p;this.lastPoint.multi=!0;this.molecule.check();this.repaint()}else this.lastPoint=b.p,this.lastPoint.multi=!0};b.TransformCanvas.prototype.gesturechange=function(b){0!=b.originalEvent.scale-this.lastPinchScale&&(this.specs.scale*=b.originalEvent.scale/this.lastPinchScale,0.01>this.specs.scale&&(this.specs.scale=0.01),this.lastPinchScale=b.originalEvent.scale);if(0!=this.lastGestureRotate-b.originalEvent.rotation){for(var c=(this.lastGestureRotate-b.originalEvent.rotation)/180*g.PI,
e=new a.Point(this.width/2,this.height/2),m=0,n=this.molecule.atoms.length;m<n;m++){var j=e.distance(this.molecule.atoms[m]),p=e.angle(this.molecule.atoms[m])+c;this.molecule.atoms[m].x=e.x+j*g.cos(p);this.molecule.atoms[m].y=e.y-j*g.sin(p)}this.lastGestureRotate=b.originalEvent.rotation;this.molecule.check()}this.repaint()};b.TransformCanvas.prototype.gestureend=function(){this.lastPinchScale=1;this.lastGestureRotate=0}})(ChemDoodle,ChemDoodle.monitor,ChemDoodle.structures,Math,mat4);
(function(b){b.ViewerCanvas=function(b,a,g){b&&this.create(b,a,g);return!0};b.ViewerCanvas.prototype=new b._Canvas})(ChemDoodle);
(function(b){b._SpectrumCanvas=function(b,a,g){b&&this.create(b,a,g);this.spectrum=null;this.emptyMessage="No Spectrum Loaded or Recognized";this.getMolecule=this.loadMolecule=null;return!0};b._SpectrumCanvas.prototype=new b._Canvas;b._SpectrumCanvas.prototype.innerRepaint=function(b){null!=this.spectrum&&0<this.spectrum.data.length?this.spectrum.draw(b,this.specs,this.width,this.height):null!=this.emptyMessage&&(b.fillStyle="#737683",b.textAlign="center",b.textBaseline="middle",b.font="18px Helvetica, Verdana, Arial, Sans-serif",
b.fillText(this.emptyMessage,this.width/2,this.height/2))};b._SpectrumCanvas.prototype.loadSpectrum=function(b){this.spectrum=b;this.repaint()};b._SpectrumCanvas.prototype.getSpectrum=function(){return this.spectrum};b._SpectrumCanvas.prototype.getSpectrumCoordinates=function(b,a){return spectrum.getInternalCoordinates(b,a,this.width,this.height)}})(ChemDoodle,document);(function(b){b.ObserverCanvas=function(b,a,g){b&&this.create(b,a,g);return!0};b.ObserverCanvas.prototype=new b._SpectrumCanvas})(ChemDoodle);
(function(b){b.OverlayCanvas=function(b,a,g){b&&this.create(b,a,g);this.overlaySpectra=[];return!0};b.OverlayCanvas.prototype=new b._SpectrumCanvas;b.OverlayCanvas.prototype.superRepaint=b.OverlayCanvas.prototype.innerRepaint;b.OverlayCanvas.prototype.innerRepaint=function(b){this.superRepaint(b);if(null!=this.spectrum&&0<this.spectrum.data.length)for(var a=0,g=this.overlaySpectra.length;a<g;a++){var e=this.overlaySpectra[a];null!=e&&0<e.data.length&&(e.minX=this.spectrum.minX,e.maxX=this.spectrum.maxX,
e.drawPlot(b,this.specs,this.width,this.height,this.spectrum.memory.offsetTop,this.spectrum.memory.offsetLeft,this.spectrum.memory.offsetBottom))}};b.OverlayCanvas.prototype.addSpectrum=function(b){null==this.spectrum?this.spectrum=b:this.overlaySpectra.push(b)}})(ChemDoodle);
(function(b,c,a){b.PerspectiveCanvas=function(a,b,c){a&&this.create(a,b,c);this.dragRange=null;this.rescaleYAxisOnZoom=!0;this.lastPinchScale=1;return!0};b.PerspectiveCanvas.prototype=new b._SpectrumCanvas;b.PerspectiveCanvas.prototype.mousedown=function(a){this.dragRange=new b.structures.Point(a.p.x,a.p.x)};b.PerspectiveCanvas.prototype.mouseup=function(a){null!=this.dragRange&&this.dragRange.x!=this.dragRange.y&&(this.dragRange.multi||(a=this.spectrum.zoom(this.dragRange.x,a.p.x,this.width,this.rescaleYAxisOnZoom),
this.rescaleYAxisOnZoom&&(this.specs.scale=a)),this.dragRange=null,this.repaint())};b.PerspectiveCanvas.prototype.drag=function(a){null!=this.dragRange&&(this.dragRange.multi?this.dragRange=null:(c.SHIFT&&(this.spectrum.translate(a.p.x-this.dragRange.x,this.width),this.dragRange.x=a.p.x),this.dragRange.y=a.p.x),this.repaint())};b.PerspectiveCanvas.prototype.drawChildExtras=function(b){if(null!=this.dragRange){var c=a.min(this.dragRange.x,this.dragRange.y),d=a.max(this.dragRange.x,this.dragRange.y);
b.strokeStyle="gray";b.lineStyle=1;b.beginPath();for(b.moveTo(c,this.height/2);c<=d;c++)5>c%10?b.lineTo(c,a.round(this.height/2)):b.moveTo(c,a.round(this.height/2));b.stroke()}};b.PerspectiveCanvas.prototype.mousewheel=function(a,b){this.specs.scale+=b/10;0.01>this.specs.scale&&(this.specs.scale=0.01);this.repaint()};b.PerspectiveCanvas.prototype.dblclick=function(){this.spectrum.setup();this.specs.scale=1;this.repaint()};b.PerspectiveCanvas.prototype.multitouchmove=function(a,c){2==c&&(null==this.dragRange||
!this.dragRange.multi?(this.dragRange=new b.structures.Point(a.p.x,a.p.x),this.dragRange.multi=!0):(this.spectrum.translate(a.p.x-this.dragRange.x,this.width),this.dragRange.x=a.p.x,this.dragRange.y=a.p.x,this.repaint()))};b.PerspectiveCanvas.prototype.gesturechange=function(a){this.specs.scale*=a.originalEvent.scale/this.lastPinchScale;0.01>this.specs.scale&&(this.specs.scale=0.01);this.lastPinchScale=a.originalEvent.scale;this.repaint()};b.PerspectiveCanvas.prototype.gestureend=function(){this.lastPinchScale=
1}})(ChemDoodle,ChemDoodle.monitor,Math);
(function(b,c){b.SeekerCanvas=function(a,b,c,d){a&&this.create(a,b,c);this.seekType=d;this.p=null;return!0};b.SeekerCanvas.prototype=new b._SpectrumCanvas;b.SeekerCanvas.prototype.superRepaint=b.SeekerCanvas.prototype.innerRepaint;b.SeekerCanvas.prototype.innerRepaint=function(a){this.superRepaint(a);if(null!=this.spectrum&&0<this.spectrum.data.length&&null!=this.p){var g=null,e=null;if(this.seekType==b.SeekerCanvas.SEEK_POINTER)g=this.p,e=this.spectrum.getInternalCoordinates(g.x,g.y);else if(this.seekType==
b.SeekerCanvas.SEEK_PLOT||this.seekType==b.SeekerCanvas.SEEK_PEAK){e=this.seekType==b.SeekerCanvas.SEEK_PLOT?this.spectrum.getClosestPlotInternalCoordinates(this.p.x):this.spectrum.getClosestPeakInternalCoordinates(this.p.x);if(null==e)return;g={x:this.spectrum.getTransformedX(e.x,this.specs,this.width,this.spectrum.memory.offsetLeft),y:this.spectrum.getTransformedY(e.y/100,this.specs,this.height,this.spectrum.memory.offsetBottom,this.spectrum.memory.offsetTop)}}a.fillStyle="white";a.strokeStyle=
this.specs.plots_color;a.lineWidth=this.specs.plots_width;a.beginPath();a.arc(g.x,g.y,3,0,2*c.PI,!1);a.fill();a.stroke();a.font=this.specs.getFontString(this.specs.text_font_size,this.specs.text_font_families);a.textAlign="left";a.textBaseline="bottom";var e="x:"+e.x.toFixed(3)+", y:"+e.y.toFixed(3),d=g.x+3,k=a.measureText(e).width;d+k>this.width-2&&(d-=6+k);g=g.y;0>g-this.specs.text_font_size-2&&(g+=this.specs.text_font_size);a.fillRect(d,g-this.specs.text_font_size,k,this.specs.text_font_size);
a.fillStyle="black";a.fillText(e,d,g)}};b.SeekerCanvas.prototype.mouseout=function(){this.p=null;this.repaint()};b.SeekerCanvas.prototype.mousemove=function(a){this.p={x:a.p.x-2,y:a.p.y-3};this.repaint()};b.SeekerCanvas.prototype.touchstart=function(a){this.mousemove(a)};b.SeekerCanvas.prototype.touchmove=function(a){this.mousemove(a)};b.SeekerCanvas.prototype.touchend=function(a){this.mouseout(a)};b.SeekerCanvas.SEEK_POINTER="pointer";b.SeekerCanvas.SEEK_PLOT="plot";b.SeekerCanvas.SEEK_PEAK="peak"})(ChemDoodle,
Math);
(function(b,c,a,g,e,d,k,f,m,n){b._Canvas3D=function(a,b,c){a&&this.create(a,b,c);this.rotationMatrix=f.identity([]);this.translationMatrix=f.identity([]);this.lastPoint=null;this.emptyMessage="WebGL is Unavailable!";return!0};b._Canvas3D.prototype=new b._Canvas;b._Canvas3D.prototype.afterLoadMolecule=function(){var a=this.molecule.getDimension();this.maxDimension=d.max(a.x,a.y);this.translationMatrix=f.translate(f.identity([]),[0,0,-this.maxDimension-10]);this.setupScene()};b._Canvas3D.prototype.setViewDistance=function(a){this.translationMatrix=
f.translate(f.identity([]),[0,0,-a])};b._Canvas3D.prototype.repaint=function(){this.gl&&(this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT),this.gl.modelViewMatrix=f.multiply(this.translationMatrix,this.rotationMatrix,[]),this.gl.rotationMatrix=this.rotationMatrix,null!=this.molecule&&this.molecule.render(this.gl,this.specs),this.gl.flush())};b._Canvas3D.prototype.center=function(){k.getElementById(this.id);for(var a=this.molecule.getCenter3D(),b=0,c=this.molecule.atoms.length;b<c;b++)this.molecule.atoms[b].sub3D(a);
if(this.molecule.chains&&this.molecule.fromJSON){b=0;for(c=this.molecule.chains.length;b<c;b++)for(var d=this.molecule.chains[b],e=0,f=d.length;e<f;e++){var g=d[e];g.cp1.sub3D(a);g.cp2.sub3D(a);g.cp3&&(g.cp3.sub3D(a),g.cp4.sub3D(a),g.cp5.sub3D(a))}}};b._Canvas3D.prototype.subCreate=function(){try{var a=k.getElementById(this.id);this.gl=a.getContext("webgl");this.gl||(this.gl=a.getContext("experimental-webgl"))}catch(b){}this.gl?(this.gl.viewport(0,0,this.width,this.height),this.gl.program=this.gl.createProgram(),
this.gl.shader=new g.Shader,this.gl.shader.init(this.gl),this.setupScene()):(this.molecule=null,this.displayMessage())};b._Canvas.prototype.displayMessage=function(){var a=k.getElementById(this.id);if(a.getContext&&(a=a.getContext("2d"),null!=this.specs.backgroundColor&&(a.fillStyle=this.specs.backgroundColor,a.fillRect(0,0,this.width,this.height)),null!=this.emptyMessage))a.fillStyle="#737683",a.textAlign="center",a.textBaseline="middle",a.font="18px Helvetica, Verdana, Arial, Sans-serif",a.fillText(this.emptyMessage,
this.width/2,this.height/2)};b._Canvas3D.prototype.setupScene=function(){if(this.gl){var b=a.getRGB(this.specs.backgroundColor,1);this.gl.clearColor(b[0],b[1],b[2],1);this.gl.clearDepth(1);this.gl.enable(this.gl.DEPTH_TEST);this.gl.depthFunc(this.gl.LEQUAL);this.gl.sphereBuffer=new g.Sphere(1,this.specs.atoms_resolution_3D,this.specs.atoms_resolution_3D);this.gl.starBuffer=new g.Star;this.gl.cylinderBuffer=new g.Cylinder(1,1,this.specs.bonds_resolution_3D);this.gl.lineBuffer=new g.Line;if(this.molecule&&
this.molecule!=this.previousMolecule&&(this.previousMolecule=this.molecule,this.molecule.unitCellVectors&&(this.molecule.unitCell=new g.UnitCell(this.molecule.unitCellVectors)),this.molecule.chains)){this.molecule.ribbons=[];this.molecule.cartoons=[];this.molecule.tubes=[];for(var b=0,k=this.molecule.chains.length;b<k;b++){var l=this.molecule.chains[b],h=2<l.length&&e[l[2].name]&&"#BEA06E"==e[l[2].name].aminoColor;if(0<l.length&&!l[0].lineSegments){for(var v=0,q=l.length-1;v<q;v++)l[v].setup(l[v+
1].cp1,h?1:this.specs.proteins_horizontalResolution);if(!h){v=1;for(q=l.length-1;v<q;v++)c.vec3AngleFrom(l[v-1].D,l[v].D)>d.PI/2&&(l[v].guidePointsSmall.reverse(),l[v].guidePointsLarge.reverse(),n.scale(l[v].D,-1))}v=1;for(q=l.length-3;v<q;v++)l[v].computeLineSegments(l[v-1],l[v+1],l[v+2],!h,h?this.specs.nucleics_verticalResolution:this.specs.proteins_verticalResolution);l.pop();l.pop();l.pop();l.shift()}var u=a.hsl2rgb(1==k?0.5:b/k,1,0.5),u="rgb("+u[0]+","+u[1]+","+u[2]+")";l.chainColor=u;if(h)l=
new g.Tube(l,this.specs.nucleics_tubeThickness,this.specs.nucleics_tubeResolution_3D),l.chainColor=u,this.molecule.tubes.push(l);else{h={front:new g.Ribbon(l,this.specs.proteins_ribbonThickness,!1),back:new g.Ribbon(l,-this.specs.proteins_ribbonThickness,!1)};h.front.chainColor=u;h.back.chainColor=u;v=0;for(q=h.front.segments.length;v<q;v++)h.front.segments[v].chainColor=u;v=0;for(q=h.back.segments.length;v<q;v++)h.back.segments[v].chainColor=u;this.molecule.ribbons.push(h);l={front:new g.Ribbon(l,
this.specs.proteins_ribbonThickness,!0),back:new g.Ribbon(l,-this.specs.proteins_ribbonThickness,!0)};l.front.chainColor=u;l.back.chainColor=u;v=0;for(q=l.front.segments.length;v<q;v++)l.front.segments[v].chainColor=u;v=0;for(q=l.back.segments.length;v<q;v++)l.back.segments[v].chainColor=u;v=0;for(q=l.front.cartoonSegments.length;v<q;v++)l.front.cartoonSegments[v].chainColor=u;v=0;for(q=l.back.cartoonSegments.length;v<q;v++)l.back.cartoonSegments[v].chainColor=u;this.molecule.cartoons.push(l)}}}this.gl.lighting=
new g.Light(this.specs.lightDiffuseColor_3D,this.specs.lightSpecularColor_3D,this.specs.lightDirection_3D);this.gl.lighting.lightScene(this.gl);this.gl.material=new g.Material(this.gl);b=this.width/this.height;this.specs.projectionWidthHeightRatio_3D&&(b=this.specs.projectionWidthHeightRatio_3D);this.gl.projectionMatrix=this.specs.projectionPerspective_3D?f.perspective(this.specs.projectionPerspectiveVerticalFieldOfView_3D,b,this.specs.projectionFrontCulling_3D,this.specs.projectionBackCulling_3D):
f.ortho(-this.specs.projectionOrthoWidth_3D/2,this.specs.projectionOrthoWidth_3D/2,-this.specs.projectionOrthoWidth_3D/2/b,this.specs.projectionOrthoWidth_3D/2/b,this.specs.projectionFrontCulling_3D,this.specs.projectionBackCulling_3D);this.gl.uniformMatrix4fv(this.gl.getUniformLocation(this.gl.program,"u_projection_matrix"),!1,this.gl.projectionMatrix);var t=this.gl.getUniformLocation(this.gl.program,"u_model_view_matrix"),w=this.gl.getUniformLocation(this.gl.program,"u_normal_matrix");this.gl.setMatrixUniforms=
function(a){this.uniformMatrix4fv(t,false,a);a=m.transpose(f.toInverseMat3(a,[]));this.uniformMatrix3fv(w,false,a)}}};b._Canvas3D.prototype.mousedown=function(a){this.lastPoint=a.p};b._Canvas3D.prototype.rightmousedown=function(a){this.lastPoint=a.p};b._Canvas3D.prototype.drag=function(a){if(b.monitor.ALT){var c=new g.Point(a.p.x,a.p.y);c.sub(this.lastPoint);f.translate(this.translationMatrix,[c.x/20,-c.y/20,0])}else{var e=a.p.x-this.lastPoint.x,c=a.p.y-this.lastPoint.y,e=f.rotate(f.identity([]),
e*d.PI/180,[0,1,0]);f.rotate(e,c*d.PI/180,[1,0,0]);this.rotationMatrix=f.multiply(e,this.rotationMatrix)}this.lastPoint=a.p;this.repaint()};b._Canvas3D.prototype.mousewheel=function(a,b){var c=b*this.maxDimension/8;this.specs.projectionPerspective_3D?f.translate(this.translationMatrix,[0,0,c]):(this.specs.projectionOrthoWidth_3D-=c,this.setupScene());this.repaint()}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.math,ChemDoodle.structures,ChemDoodle.RESIDUE,Math,document,mat4,mat3,vec3,window);
(function(b,c,a,g){b.MolGrabberCanvas3D=function(b,c,k){b&&this.create(b,c,k);c=[];c.push('<br><input type="text" id="');c.push(b);c.push('_query" size="32" value="" />');c.push("<br><nobr>");c.push('<select id="');c.push(b);c.push('_select">');c.push('<option value="pubchem" selected>PubChem');c.push("</select>");c.push('<button id="');c.push(b);c.push('_submit">Show Molecule</button>');c.push("</nobr>");g.writeln(c.join(""));var f=this;a("#"+b+"_submit").click(function(){f.search()});a("#"+b+"_query").keypress(function(a){13==
a.which&&f.search()});return!0};b.MolGrabberCanvas3D.prototype=new b._Canvas3D;b.MolGrabberCanvas3D.prototype.setSearchTerm=function(b){a("#"+this.id+"_query").val(b);this.search()};b.MolGrabberCanvas3D.prototype.search=function(){var b=this;c.getMoleculeFromDatabase(a("#"+this.id+"_select").val(),a("#"+this.id+"_query").val(),function(a){b.loadMolecule(a)},3)}})(ChemDoodle,ChemDoodle.iChemLabs,jQuery,document);
(function(b,c){b.MovieCanvas3D=function(a,b,c){a&&this.create(a,b,c);this.timeout=50;this.molecules=[];this.frameNumber=0;this.playMode=2;this.reverse=!1;return!0};b.MovieCanvas3D.PLAY_ONCE=0;b.MovieCanvas3D.PLAY_LOOP=1;b.MovieCanvas3D.PLAY_SPRING=2;b.MovieCanvas3D.prototype=new b._Canvas3D;b.MovieCanvas3D.prototype.startAnimation=b._AnimatorCanvas.prototype.startAnimation;b.MovieCanvas3D.prototype.stopAnimation=b._AnimatorCanvas.prototype.stopAnimation;b.MovieCanvas3D.prototype.isRunning=b._AnimatorCanvas.prototype.isRunning;
b.MovieCanvas3D.prototype.dblclick=b.RotatorCanvas.prototype.dblclick;b.MovieCanvas3D.prototype.nextFrame=function(){this.molecule=this.molecules[this.frameNumber];2==this.playMode&&this.reverse?(this.frameNumber--,0>this.frameNumber&&(this.frameNumber=1,this.reverse=!1)):(this.frameNumber++,this.frameNumber>=this.molecules.length&&(2==this.playMode?(this.frameNumber-=2,this.reverse=!0):(this.frameNumber=0,0==this.playMode&&this.stopAnimation())))};b.MovieCanvas3D.prototype.center=function(){var a=
this.molecule.getCenter3D(),b=new c.Atom;b.sub3D(a);for(var a=0,e=this.molecules.length;a<e;a++)for(var d=this.molecules[a],k=0,f=d.atoms.length;k<f;k++)d.atoms[k].add3D(b)}})(ChemDoodle,ChemDoodle.structures);
(function(b,c,a){var g=[],e=[1,0,0],d=[0,1,0],k=[0,0,1];b.RotatorCanvas3D=function(a,b,d){a&&this.create(a,b,d);this.timeout=33;this.zIncrement=this.yIncrement=this.xIncrement=a=c.PI/15;return!0};b.RotatorCanvas3D.prototype=new b._Canvas3D;b.RotatorCanvas3D.prototype.startAnimation=b._AnimatorCanvas.prototype.startAnimation;b.RotatorCanvas3D.prototype.stopAnimation=b._AnimatorCanvas.prototype.stopAnimation;b.RotatorCanvas3D.prototype.isRunning=b._AnimatorCanvas.prototype.isRunning;b.RotatorCanvas3D.prototype.dblclick=
b.RotatorCanvas.prototype.dblclick;b.RotatorCanvas3D.prototype.mousedown=null;b.RotatorCanvas3D.prototype.rightmousedown=null;b.RotatorCanvas3D.prototype.drag=null;b.RotatorCanvas3D.prototype.mousewheel=null;b.RotatorCanvas3D.prototype.nextFrame=function(b){null==this.molecule?this.stopAnimation():(a.identity(g),b/=1E3,a.rotate(g,this.xIncrement*b,e),a.rotate(g,this.yIncrement*b,d),a.rotate(g,this.zIncrement*b,k),a.multiply(this.rotationMatrix,g))}})(ChemDoodle,Math,mat4);
(function(b){b.TransformCanvas3D=function(b,a,g){b&&this.create(b,a,g);return!0};b.TransformCanvas3D.prototype=new b._Canvas3D})(ChemDoodle);(function(b){b.ViewerCanvas3D=function(b,a,g){b&&this.create(b,a,g);return!0};b.ViewerCanvas3D.prototype=new b._Canvas3D;b.ViewerCanvas3D.prototype.mousedown=null;b.ViewerCanvas3D.prototype.rightmousedown=null;b.ViewerCanvas3D.prototype.drag=null;b.ViewerCanvas3D.prototype.mousewheel=null})(ChemDoodle);
(function(b,c,a){function g(a,b,c,f){this.element=a;this.x=b;this.y=c;this.dimension=f}b.PeriodicTableCanvas=function(a,b){this.padding=5;a&&this.create(a,18*b+2*this.padding,10*b+2*this.padding);this.getMolecule=this.loadMolecule=null;this.cellDimension=b?b:20;this.setupTable();this.repaint();return!0};b.PeriodicTableCanvas.prototype=new b._Canvas;b.PeriodicTableCanvas.prototype.getHoveredElement=function(){return null!=this.hovered?this.hovered.element:null};b.PeriodicTableCanvas.prototype.innerRepaint=
function(a){for(var b=0,c=this.cells.length;b<c;b++)this.drawCell(a,this.specs,this.cells[b]);null!=this.hovered&&this.drawCell(a,this.specs,this.hovered);null!=this.selected&&this.drawCell(a,this.specs,this.selected)};b.PeriodicTableCanvas.prototype.setupTable=function(){this.cells=[];for(var a=y=this.padding,c=0,k=0,f=b.SYMBOLS.length;k<f;k++){18==c&&(c=0,y+=this.cellDimension,a=this.padding);var m=b.ELEMENT[b.SYMBOLS[k]];if(2==m.atomicNumber)a+=16*this.cellDimension,c+=16;else if(5==m.atomicNumber||
13==m.atomicNumber)a+=10*this.cellDimension,c+=10;if((58>m.atomicNumber||71<m.atomicNumber&&90>m.atomicNumber||103<m.atomicNumber)&&113>m.atomicNumber)this.cells.push(new g(m,a,y,this.cellDimension)),a+=this.cellDimension,c++}y+=2*this.cellDimension;a=3*this.cellDimension+this.padding;for(k=57;104>k;k++)if(m=b.ELEMENT[b.SYMBOLS[k]],90==m.atomicNumber&&(y+=this.cellDimension,a=3*this.cellDimension+this.padding),58<=m.atomicNumber&&71>=m.atomicNumber||90<=m.atomicNumber&&103>=m.atomicNumber)this.cells.push(new g(m,
a,y,this.cellDimension)),a+=this.cellDimension};b.PeriodicTableCanvas.prototype.drawCell=function(a,b,g){var f=a.createRadialGradient(g.x+g.dimension/3,g.y+g.dimension/3,1.5*g.dimension,g.x+g.dimension/3,g.y+g.dimension/3,g.dimension/10);f.addColorStop(0,"#000000");f.addColorStop(0.7,g.element.jmolColor);f.addColorStop(1,"#FFFFFF");a.fillStyle=f;c.contextRoundRect(a,g.x,g.y,g.dimension,g.dimension,g.dimension/8);if(g==this.hovered||g==this.selected)a.lineWidth=2,a.strokeStyle="#c10000",a.stroke(),
a.fillStyle="white";a.fill();a.font=b.getFontString(b.text_font_size,b.text_font_families);a.fillStyle=b.text_color;a.textAlign="center";a.textBaseline="middle";a.fillText(g.element.symbol,g.x+g.dimension/2,g.y+g.dimension/2)};b.PeriodicTableCanvas.prototype.click=function(){null!=this.hovered&&(this.selected=this.hovered,this.repaint())};b.PeriodicTableCanvas.prototype.mousemove=function(b){var c=b.p.x,b=b.p.y;this.hovered=null;for(var g=0,f=this.cells.length;g<f;g++){var m=this.cells[g];if(a.isBetween(c,
m.x,m.x+m.dimension)&&a.isBetween(b,m.y,m.y+m.dimension)){this.hovered=m;break}}this.repaint()};b.PeriodicTableCanvas.prototype.mouseout=function(){this.hovered=null;this.repaint()}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.math,document);(function(b,c){b._Layout=function(){return!0};b._Layout.prototype.layout=function(){this.innerLayout&&this.innerLayout()};b._Layout.prototype.create=function(a){this.name=a;this.specs=new c.VisualSpecifications}})(ChemDoodle,ChemDoodle.structures);
(function(b,c,a){b.SimpleReactionLayout=function(a){this.reactants=[];this.products=[];this.textBelow=this.textAbove=null;this.arrow="&rarr;";this.plus="+";this.create(a);return!0};b.SimpleReactionLayout.prototype=new b._Layout;b.SimpleReactionLayout.prototype.addReactant=function(a){this.reactants.push(a)};b.SimpleReactionLayout.prototype.addProduct=function(a){this.products.push(a)};b.SimpleReactionLayout.prototype.innerLayout=function(){a.writeln("<table><tr>");for(var g=0,e=this.reactants.length;g<
e;g++){0<g&&a.writeln('<td><span style="font-size:25px;">'+this.plus+"</span></td>");a.writeln("<td>");var d=this.reactants[g].getDimension(),d=new b.ViewerCanvas(this.name+"_reactant"+g,d.x+60,d.y+60);null==this.specs.backgroundColor&&c("#"+this.name+"_reactant"+g).css("border","0px");d.specs=this.specs;d.loadMolecule(this.reactants[g]);a.writeln("</td>")}a.writeln("<td>");a.writeln("<table>");a.writeln("<tr><td>");null!=this.textAbove?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>");null!=this.textBelow?a.writeln("<center>"+this.textBelow+"</center>"):a.writeln("&nbsp;");a.writeln("</td></tr>");a.writeln("</table>");a.writeln("</td>");g=0;for(e=this.products.length;g<e;g++)0<g&&a.writeln('<td><span style="font-size:25px;">'+this.plus+"</td>"),a.writeln("<td>"),d=this.products[g].getDimension(),d=new b.ViewerCanvas(this.name+"_product"+
g,d.x+60,d.y+60),null==this.specs.backgroundColor&&c("#"+this.name+"_product"+g).css("border","0px"),d.specs=this.specs,d.loadMolecule(this.products[g]),a.writeln("</td>");a.writeln("</tr></table>")}})(ChemDoodle,jQuery,document);(function(b,c,a){b.png={};b.png.create=function(b){a.open(c.getElementById(b.id).toDataURL("image/png"))}})(ChemDoodle.io,document,window);(function(b,c){b.file={};b.file.content=function(a,b){c.get(a,"",b)}})(ChemDoodle.io,jQuery);