(function(ca,da,ea,fa,ga,ha,T,O,U,W,X,I,Y,Z,ia,S,P,R,$,ja,aa,ka,la,ma,na,oa,pa,D,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,Ga,Ha,Ia,Ja,Ka,La,Ma,Na,Oa,Pa,Qa,l,ba){T("JS");U(null,"JS.ScriptExt",["JU.AU"],function(){var m=X(function(){this.e=this.vwr=null;this.chk=!1;this.st=null;this.slen=0;W(this,arguments)},JS,"ScriptExt",null);l(m,"init",function(a){this.e=a;this.vwr=this.e.vwr;return this},"~O");l(m,"atomExpressionAt",function(a){return this.e.atomExpressionAt(a)},"~N");l(m,"checkLength",
function(a){this.e.checkLength(a)},"~N");l(m,"error",function(a){this.e.error(a)},"~N");l(m,"invArg",function(){this.e.invArg()});l(m,"invPO",function(){this.error(23)});l(m,"getShapeProperty",function(a,c){return this.e.getShapeProperty(a,c)},"~N,~S");l(m,"paramAsStr",function(a){return this.e.paramAsStr(a)},"~N");l(m,"centerParameter",function(a){return this.e.centerParameter(a,null)},"~N");l(m,"floatParameter",function(a){return this.e.floatParameter(a)},"~N");l(m,"getPoint3f",function(a,c){return this.e.getPoint3f(a,
c,!0)},"~N,~B");l(m,"intParameter",function(a){return this.e.intParameter(a)},"~N");l(m,"isFloatParameter",function(a){switch(this.e.tokAt(a)){case 2:case 3:return!0}return!1},"~N");l(m,"setShapeProperty",function(a,c,b){this.e.setShapeProperty(a,c,b)},"~N,~S,~O");l(m,"showString",function(a){this.e.showString(a)},"~S");l(m,"stringParameter",function(a){return this.e.stringParameter(a)},"~N");l(m,"getToken",function(a){return this.e.getToken(a)},"~N");l(m,"tokAt",function(a){return this.e.tokAt(a)},
"~N");l(m,"setShapeId",function(a,c,b){b&&this.invArg();c=this.e.setShapeNameParameter(c).toLowerCase();this.setShapeProperty(a,"thisID",c);return c},"~N,~N,~B");l(m,"getColorTrans",function(a,c,b,e){b=3.4028235E38;1765808134!=a.theTok&&--c;switch(this.tokAt(c+1)){case 603979967:c++;b=this.isFloatParameter(c+1)?a.getTranslucentLevel(++c):this.vwr.getFloat(570425353);break;case 1073742074:c++,b=0}a.isColorParam(c+1)?e[0]=a.getArgbParam(++c):1073742333==this.tokAt(c+1)?(e[0]=0,a.iToken=c+1):3.4028235E38==
b?this.invArg():e[0]=-2147483648;return b},"JS.ScriptEval,~N,~B,~A");l(m,"finalizeObject",function(a,c,b,e,f,d,h,j){f&&this.setShapeProperty(a,"set",d);-2147483648!=c&&this.e.setShapePropertyBs(a,"color",Integer.$valueOf(c),j);3.4028235E38!=b&&this.e.setShapeTranslucency(a,"","translucent",b,j);0!=e&&this.setShapeProperty(a,"scale",Integer.$valueOf(e));0<h&&(this.e.setMeshDisplayProperty(a,h,0)||this.invArg())},"~N,~N,~N,~N,~B,~O,~N,JU.BS");l(m,"getIntArray2",function(a){a=this.e.getToken(a).getList();
for(var c=JU.AU.newInt2(a.size()),b=c.length;0<=--b;){var e=a.get(b).getList();null==e&&this.invArg();c[b]=P(e.size(),0);for(var f=c[b].length;0<=--f;)c[b][f]=e.get(f).intValue}return c},"~N");l(m,"getAllPoints",function(a,c){var b=null,e=null;try{switch(this.e.tokAt(a)){case 7:b=this.e.getPointArray(a,-1,!1);break;case 12290:case 10:case 1073742325:e=this.atomExpressionAt(a)}null==b&&(null==e&&(e=this.vwr.getAllAtoms()),b=this.bsToArray(e))}catch(f){if(!S(f,Exception))throw f;}(null==b||b.length<
c)&&this.invArg();return b},"~N,~N");l(m,"bsToArray",function(a){for(var c=Array(a.cardinality()),b=a.nextSetBit(0),e=0;0<=b;b=a.nextSetBit(b+1))c[e++]=this.vwr.ms.at[b];return c},"JU.BS")});T("JS");U(["JS.ScriptExt"],"JS.CmdExt","java.util.Hashtable JU.AU $.BS $.Base64 $.Lst $.M3 $.M4 $.Measure $.P3 $.P4 $.PT $.Quat $.SB $.V3 J.api.Interface J.atomdata.RadiusData J.c.STER $.VDW J.i18n.GT JM.AtomCollection $.LabelToken $.Measurement $.ModelSet $.Text JS.SV $.ScriptCompiler $.ScriptError $.ScriptEval $.ScriptInterruption $.ScriptMathProcessor $.T JU.BSUtil $.BoxInfo $.C $.Edge $.Elements $.Escape $.Logger $.Parser $.Point3fi $.SimpleUnitCell JV.FileManager $.StateManager $.Viewer".split(" "),
function(){var m=$(JS,"CmdExt",JS.ScriptExt);Z(m,function(){aa(this,JS.CmdExt,[])});ba(m,"dispatch",function(a,c,b){this.chk=this.e.chk;this.slen=this.e.slen;this.st=b;switch(a){case 1073741866:b[0].value=this.prepareBinaryOutput(b[0]);break;case 4098:this.assign();break;case 134221829:this.cache();break;case 4102:this.calculate();break;case 4103:this.capture();break;case 4105:this.centerAt();break;case 134221831:this.compare();break;case 528395:this.console();break;case 4106:this.connect(1);break;
case 1094717448:this.configuration();break;case 134221834:this.data();break;case 1613238294:this.connect(0);break;case 4120:this.image();break;case 4122:this.invertSelected();break;case 4124:this.macro();break;case 4125:this.mapProperty();break;case 4126:this.minimize(!1);break;case 603983903:this.modelkit();break;case 1275072532:this.modulation();break;case 4130:this.mutate();break;case 4131:this.navigate();break;case 4133:case 134221850:case 4138:this.plot(b);break;case 134222350:this.show();break;
case 528443:this.stereo();break;case 1814695966:this.unitcell(c?2:1,!1);break;case 134221856:return this.write(c?b:null);case 6:this.measure();break;case 21:this.polyhedra();break;case 20:this.ellipsoid();break;case 4:this.struts()}return null},"~N,~B,~A");l(m,"macro",function(){if(!this.chk){var a=this.e.optParameterAsString(1);if(0==a.length)this.showString(this.vwr.getMacro(null));else{var c=this.vwr.getMacro(a);null==c?this.showString("macro "+a+" could not be found. Current macros include:\n"+
this.vwr.getMacro(null)):(this.showString("running "+c),this.e.cmdScript(4124,c,null,null))}}});l(m,"evalParallel",function(a,c){this.chk=this.e.chk;this.slen=this.e.slen;var b=(new JS.ScriptEval).setViewer(this.vwr);b.historyDisabled=!0;b.compiler=new JS.ScriptCompiler(this.vwr);b.sm=c;try{b.restoreScriptContext(a,!0,!1,!1),b.setAllowJSThreads(!1),b.dispatchCommands(!1,!1,!1)}catch(e){if(S(e,Exception))return this.e.vwr.setStringProperty("_errormessage",""+e),null==b.thisContext&&(JU.Logger.error("Error evaluating context "+
e),e.printStackTrace()),!1;throw e;}return!0},"JS.ScriptContext,JV.ShapeManager");l(m,"getBitsetIdent",function(a,c,b,e,f,d){return this.getBitsetIdentFull(a,c,e,f,d,null)},"JU.BS,~S,~O,~B,~N,~B");l(m,"getBitsetIdentFull",function(a,c,b,e,f,d){var h=!O(a,"JM.BondSet");h?null==c?c=this.vwr.getStandardLabelFormat(0):0==c.length&&(c="%[label]"):null!=c&&0==c.length?c="[%a1 #%i1] %4.3LENGTH [%a2 #%i2] #%#":"%U".equals(c)&&(c="");var j=null==c?-1:c.indexOf("%"),g=2147483647!=e;if(null==a||this.chk||h&&
0>j)return null==c&&(c=""),f?D(-1,[c]):c;var j=this.vwr.ms,n=0;null==JS.CmdExt.labeler&&(JS.CmdExt.labeler=j.getLabeler());b=h||!b?null:a.getAssociatedAtoms(j);var p=null==c||0==c.length,q=h||p?null:JS.CmdExt.labeler.getBondLabelValues();c=p?null:h?JS.CmdExt.labeler.compile(this.vwr,c,"\x00",null):JS.CmdExt.labeler.compile(this.vwr,c,"\u0001",q);var s=g?1:a.cardinality(),k=null!=d;k||(d=Array(s));var A=new JU.P3;for(e=g?e:a.nextSetBit(0);0<=e;e=a.nextSetBit(e+1)){var t;h?t=p?j.at[e].getInfo():JS.CmdExt.labeler.formatLabelAtomArray(this.vwr,
j.at[e],c,"\x00",b,A):(t=j.bo[e],t=p?t.getIdentity():JS.CmdExt.labeler.formatLabelBond(this.vwr,t,c,q,b,A));t=JU.PT.formatStringI(t,"#",n+1);d[k?e:n]=t;n++;if(g)break}return 1==s&&!f?d[0]:d},"JU.BS,~S,~B,~N,~B,~A");l(m,"getLoadSymmetryParams",function(a,c,b){var e=this.e;this.chk=e.chk;this.slen=e.slen;var f=!1,d=null,h=this.tokAt(a);if(1073742332==h||8==h)d=e.getFractionalPoint(a),h=this.tokAt(a=e.iToken+1);switch(h){case 134217764:f=b.get("isEmptyLoad")===Boolean.TRUE;case 1073741938:case 1073742080:case 1094713350:case 1073742163:case 1073742114:case 1814695966:null==
d&&(d=JU.P3.new3(555,555,-1)),e.iToken=a-1}h=null;if(null!=d){b.put("lattice",d);a=e.iToken+1;c.append(" "+JU.SimpleUnitCell.escapeMultiplier(d));a=this.checkPacked(a,b,c);1094713350==this.tokAt(a)&&(b.put("centroid",Boolean.TRUE),c.append(" CENTROID"),a=this.checkPacked(++a,b,c));if(1073742163==this.tokAt(a)){var j;c.append(" SUPERCELL ");if(e.isPoint3f(++a)){j=this.getPoint3f(a,!1);if(j.x!=I(j.x)||j.y!=I(j.y)||j.z!=I(j.z)||1>j.x||1>j.y||1>j.z)e.iToken=a,this.invArg();a=e.iToken}else j=this.stringParameter(a);
c.append(JU.Escape.e(j));b.put("supercell",j);a=this.checkPacked(++a,b,c)}j=0;1073742114==this.tokAt(a)&&(a++,j=this.floatParameter(a++),c.append(" range "+j));b.put("symmetryRange",Float.$valueOf(j));j=null;var g,n=-2147483648;134217764==this.tokAt(a)&&(++a,j=JU.PT.rep(this.paramAsStr(a++),"''",'"'),c.append(" spacegroup "+JU.PT.esc(j)),j.equalsIgnoreCase("ignoreOperators")?n=-999:(0==j.length?(g=this.vwr.getCurrentUnitCell(),null!=g&&(j=g.getSpaceGroupName())):0<=j.indexOf(",")&&9>d.x&&(9>d.y&&
0==d.z)&&(j+="#doNormalize=0"),b.put("spaceGroupName",j),n=-2));d=null;if(1814695966==this.tokAt(a)){++a;g=e.optParameterAsString(a);0==g.length?(g=this.vwr.getCurrentUnitCell(),null!=g&&(d=g.getUnitCellAsArray(!0),h=g.getCartesianOffset())):4==this.tokAt(a)?(d=R(6,0),JU.SimpleUnitCell.setAbc(g,d,null)):d=e.floatParameterSet(a,6,9);(null==d||6!=d.length&&9!=d.length)&&this.invArg();c.append(" unitcell [");for(a=0;a<d.length;a++)c.append((0==a?"":" ")+d[a]);c.append("]");b.put("unitcell",d);-2147483648==
n&&(n=-1);a=e.iToken+1}-2147483648!=n&&b.put("spaceGroupIndex",Integer.$valueOf(n));f&&null==d&&null!=j&&JU.PT.parseInt(j)}f=!1;null==h&&1073742066==this.tokAt(a)&&(h=this.getPoint3f(++a,!0),f=e.coordinatesAreFractional);null!=h&&(f?(h.setT(e.fractionalPoint),b.put("unitCellOffsetFractional",f?Boolean.TRUE:Boolean.FALSE),c.append(" offset {"+h.x+" "+h.y+" "+h.z+"/1}")):c.append(" offset "+JU.Escape.eP(h)),b.put("unitCellOffset",h),a=e.iToken+1);return a},"~N,JU.SB,java.util.Map");l(m,"checkPacked",
function(a,c,b){switch(this.tokAt(a)){case 1073741938:c.put("packed",Boolean.TRUE);var e=null,f=this.tokAt(++a);switch(f){case 1812599299:case 1814695966:case 4:break;default:this.e.isArrayParameter(a)?(e=this.e.getPointArray(a,-1,!1),a=this.e.iToken):this.isFloatParameter(a)?(e=this.floatParameter(a),e=D(-1,[new JU.P3,JU.P3.new3(e,e,e)])):(e=[],--a)}a++;if(this.e.chk)break;switch(f){case 4:a--;case 1814695966:e=this.e.optParameterAsString(a++).toLowerCase();if(JU.PT.isOneOf(e,";conventional;primitive;rhombohedral;trigonal;")||
0<=e.indexOf(",")&&0<=e.indexOf("a")&&0<=e.indexOf("b")&&0<=e.indexOf("c"))return c.put("fillRange",e),b.append(' FILL UNITCELL "'+e+'"'),a;e=this.vwr.getCurrentUnitCell();if(null!=e){e=JU.BoxInfo.toOABC(e.getUnitCellVerticesNoOffset(),e.getCartesianOffset());break}case 1812599299:e=JU.BoxInfo.toOABC(this.vwr.ms.getBBoxVertices(),null)}switch(e.length){case 2:f=e[1];e=D(-1,[e[0],JU.P3.newP(e[0]),new JU.P3,new JU.P3]);e[1].x=f.x;e[2].y=f.y;e[3].z=f.z;break;case 3:e=D(-1,[new JU.P3,e[0],e[1],e[2]]);
break;case 4:break;default:e=D(-1,[new JU.P3,JU.P3.new3(10,0,0),JU.P3.new3(0,10,0),JU.P3.new3(0,0,10)])}c.put("fillRange",e);b.append(" FILL ["+e[0]+e[1]+e[2]+e[3]+"]");break;case 1073742080:e=NaN,this.isFloatParameter(++a)&&(e=this.floatParameter(a++)),this.e.chk||(c.put("packed",Boolean.TRUE),b.append(" PACKED"),Float.isNaN(e)||(c.put("packingRange",Float.$valueOf(e)),b.append(" "+e)))}return a},"~N,java.util.Map,JU.SB");l(m,"cache",function(){var a=this.tokAt(1),c=null,b=2;switch(a){case 1275069441:case 1073742119:c=
this.e.optParameterAsString(b++);case 1073741882:this.checkLength(b);this.chk||("all".equals(c)&&(c=null),c=this.vwr.cacheFileByName(c,1275069441==a),this.showString(0>c?"cache cleared":c+" bytes "+(1275069441==a?" cached":" removed")));break;default:this.invArg()}});l(m,"calculate",function(){var a=!1,c=!1,b=null,e=null,f=this.e,d=-2147483648,d=-1;if(2<=(f.iToken=f.slen))switch(f.clearDefinedVariableAtomSets(),this.getToken(1).tok){case 2:if(3!=this.intParameter(1)||!this.paramAsStr(2).equalsIgnoreCase("D"))break;
0>this.vwr.am.cmi&&f.errorStr(30,"calculate 3D");b="load append $ filter '2D';select visible;center selected";f.optParameterAsString(3).equalsIgnoreCase("ZAP")&&(b+=";zap modelIndex="+Math.max(this.vwr.am.cmi,0));this.chk||f.runScript(b);return;case 1073741824:this.checkLength(2);break;case 134217764:f.iToken=1;b=2==this.slen?null:this.atomExpressionAt(2);f.checkLast(f.iToken);this.chk||f.showString(""+this.vwr.findSpaceGroup(b,null,null,null,!0,!1,!1));return;case 1086324752:f.iToken=1;b=2==this.slen?
null:this.atomExpressionAt(2);f.checkLast(f.iToken);this.chk||f.showString(this.vwr.calculateChirality(b));return;case 1631586315:this.checkLength(2);if(this.chk)return;d=this.vwr.calculateFormalCharges(null);this.showString(J.i18n.GT.i(J.i18n.GT.$("{0} charges modified"),d));return;case 1075838996:this.checkLength(2);this.chk||this.vwr.ms.assignAromaticBondsBs(!0,null);return;case 1613238294:2!=f.slen&&(b=(c=1639976963==this.tokAt(++f.iToken))?this.vwr.bsA():this.atomExpressionAt(f.iToken),!c&&1639976963!=
this.tokAt(++f.iToken)&&(e=this.atomExpressionAt(f.iToken)));if(this.chk)return;d=this.vwr.autoHbond(b,e,!1);-2147483648!=d&&f.report(J.i18n.GT.i(J.i18n.GT.$("{0} hydrogen bonds"),Math.abs(d)),!1);return;case 1612709900:a=this.tokAt(2);(c=1073742335==a)?f.iToken++:528443==a&&f.iToken++;b=this.slen==f.iToken+1?null:this.atomExpressionAt(f.iToken+1);null==b&&528443==a&&(b=this.vwr.getAtomBitSet("_C & connected(3) & !connected(double)"));f.checkLast(f.iToken);this.chk||(this.vwr.addHydrogens(b,0),c&&
(null==b&&(b=this.vwr.bsA()),this.vwr.makeConnections(0.1,1E8,515,1073742025,b,b,null,!1,!1,0),this.vwr.ms.assignAromaticBondsBs(!0,null)));return;case 1111492619:f.iToken=1;b=2==this.slen?null:this.atomExpressionAt(2);f.checkLast(f.iToken);this.chk||f.getPartialCharges(b);return;case 1088421903:case 1275068447:this.chk||(1275203608==this.tokAt(2)?(a=4==this.tokAt(3)?this.stringParameter(3):null,b=null!=a||3==this.slen?null:this.atomExpressionAt(3),b=D(-1,[a,null,b]),this.showString(f.getShapePropertyData(21,
"symmetry",b)?b[1]:"")):(b=2==this.slen?this.vwr.bsA():this.atomExpressionAt(2),this.showString(this.vwr.ms.calculatePointGroup(b))));return;case 1111490574:this.checkLength(2);this.chk||(this.vwr.calculateStraightness(),this.vwr.addStateScript("set quaternionFrame '"+this.vwr.getQuaternionFrame()+"'; calculate straightness",!1,!0));return;case 1639976963:b=4>this.slen||this.isFloatParameter(3)?null:this.atomExpressionAt(2);switch(this.tokAt(++f.iToken)){case 4138:break;case 1111490587:if(this.chk)return;
f.showString(this.vwr.getAnnotationParser(!0).calculateDSSRStructure(this.vwr,b));return;case 1073741915:c=!0;d=this.slen==f.iToken+1?-1:I(this.floatParameter(++f.iToken));break;case 0:c=this.vwr.getBoolean(603979826);break;default:this.invArg()}this.chk||this.showString(this.vwr.calculateStructures(b,c,!0,d));return;case 659482:b=f.iToken+1<this.slen?this.atomExpressionAt(++f.iToken):null;e=f.iToken+1<this.slen?this.atomExpressionAt(++f.iToken):null;this.checkLength(++f.iToken);this.chk||(d=this.vwr.calculateStruts(b,
e),0<d&&(this.setShapeProperty(1,"type",Integer.$valueOf(32768)),f.setShapePropertyBs(1,"color",Integer.$valueOf(16777215),null),f.setShapeTranslucency(1,"","translucent",0.5,null),this.setShapeProperty(1,"type",Integer.$valueOf(1023))),this.showString(J.i18n.GT.i(J.i18n.GT.$("{0} struts added"),d)));return;case 2097180:a=!0;case 1111490575:c=!1;switch(this.tokAt(2)){case 134217759:f.iToken++;break;case 0:c=!a;break;case 1073741952:c=!0;f.iToken++;break;default:c=!0}b=f.iToken+1<this.slen?this.atomExpressionAt(++f.iToken):
this.vwr.bsA();this.checkLength(++f.iToken);this.chk||this.vwr.calculateSurface(b,c?3.4028235E38:-1);return}f.errorStr2(53,"CALCULATE","3D? aromatic? hbonds? hydrogen? formalCharge? partialCharge? pointgroup? straightness? structure? struts? surfaceDistance FROM? surfaceDistance WITHIN?")});l(m,"capture",function(){if(!this.chk&&!this.vwr.allowCapture())this.showString("Cannot capture on this platform");else{var a=this.vwr.captureParams,c=null==a?"GIF":a.get("type"),b=0,e=0,f=this.e.slen,d="",h=1073742070!=
this.vwr.am.animationReplayMode,j=1,g=this.tokAt(j),n=603979967==g;n&&(g=this.tokAt(++j));var p=null;switch(0==g?g=102409:g){case 4:d=this.e.optParameterAsString(j++);if(0==d.length){e=102409;break}c=d.toLowerCase();c.endsWith(".gift")||c.endsWith(".pngt")?(n=!0,d=d.substring(0,d.length-1),c=d.toLowerCase()):!c.endsWith(".gif")&&!c.contains(".png")&&(d+=".gif");c.endsWith(".png")?(c.endsWith("0.png")||(d=d.substring(0,d.length-4)+"0000.png"),c="PNG"):c="GIF";n&&(c+="T");g=d.indexOf("0000.");g=0>g||
g!=d.lastIndexOf(".")-4;e=!1;528411==this.tokAt(j)&&(h=!0,this.tokAt(++j));switch(this.tokAt(j)){case 134222850:p=this.stringParameter(++j);break;case 1073742129:e=!0;case 1611141175:a="y";h=!0;j++;e?(j<f&&2!=this.tokAt(j)&&(a=this.e.optParameterAsString(j++).toLowerCase()),p="rotate Y 10 10;rotate Y -10 -10;rotate Y -10 -10;rotate Y 10 10",f=j<f?this.intParameter(j++):5,p=0>f?JU.PT.rep(p,"10;",""+-f+";"):JU.PT.rep(p,"10",""+f)):(j<f&&(a=this.e.optParameterAsString(j++).toLowerCase()),p="rotate Y 360 30;");
if(this.chk)return;this.vwr.setNavigationMode(!1);if(""===a||0>"xyz".indexOf(a))a="y";p=JU.PT.rep(p,"Y",a);break;case 3:case 2:b=this.floatParameter(j++)}if(this.chk)return;if(null!=p){p="set waitformoveto true;"+p+";set waitformoveto "+this.vwr.g.waitForMoveTo;p="capture "+(n?"transparent ":"")+JU.PT.esc(d)+(h?" LOOP;":";")+p+";capture end;";this.e.cmdScript(0,null,p,null);return}e=1073742031;a=new java.util.Hashtable;n=this.vwr.getInt(553648132);g&&(a.put("streaming",Boolean.TRUE),h||this.showString(J.i18n.GT.o(J.i18n.GT.$("Note: Enable looping using the LOOP keyword just after the file name or {0}"),
D(-1,["ANIMATION MODE LOOP"]))),this.showString(J.i18n.GT.o(J.i18n.GT.$("Animation delay based on: {0}"),D(-1,["ANIMATION FPS "+n]))));a.put("captureFps",Integer.$valueOf(n));break;case 102409:case 1073741874:null!=a&&a.put("captureSilent",Boolean.TRUE);case 1073742335:case 1073742334:this.checkLength(-2);e=g;break;default:this.invArg()}this.chk||null==a||(a.put("type",c),c=Integer.$valueOf(this.vwr.getBackgroundArgb()),a.put("backgroundColor",c),a.put("fileName",d),a.put("quality",Integer.$valueOf(-1)),
a.put("endTime",Long.$valueOf(0>=b?-1:System.currentTimeMillis()+Y(1E3*b))),a.put("captureMode",JS.T.nameOf(e).toLowerCase()),a.put("captureLooping",h?Boolean.TRUE:Boolean.FALSE),b=this.vwr.processWriteOrCapture(a),null==b&&(b="canceled"),JU.Logger.info(b))}});l(m,"centerAt",function(){var a=this.getToken(1).tok;switch(a){case 1073741826:case 96:case 1812599299:break;default:this.invArg()}var c=JU.P3.new3(0,0,0);5==this.slen?(c.x=this.floatParameter(2),c.y=this.floatParameter(3),c.z=this.floatParameter(4)):
this.e.isCenterParameter(2)?(c=this.centerParameter(2),this.e.checkLast(this.e.iToken)):this.checkLength(2);!this.chk&&!this.vwr.isJmolDataFrame()&&this.vwr.tm.setCenterAt(a,c)});l(m,"compare",function(){var a=this.e,c=!1,b=!1,e=!1,f=!1,d=!1,h=null,j=null,g=null,n=null,p=null,q=null;a.iToken=0;var s=this.isFloatParameter(1)?this.floatParameter(++a.iToken):NaN,k=null,A=null,t=null,f=0;if(4115==this.tokAt(1))A=this.vwr.bsA();else if(A=this.atomExpressionAt(1),a.isArrayParameter(++a.iToken))k=a.getPointArray(a.iToken,
-1,!1);else if(1153433601!=(f=this.tokAt(a.iToken))&&4115!=f)t=this.atomExpressionAt(a.iToken);var x=null,u=!1,m=!1,l=null,r=JU.BSUtil.copy(A);null!=t&&r.or(t);for(var z=null==k&&null!=t&&r.equals(A),r=z,H=1153433601==f,K=!1,w=a.iToken+1;w<this.slen;++w)switch(this.getToken(w).tok){case 4115:r=!0;null==t&&(t=JU.BSUtil.copy(A));break;case 134218757:if(u=!0,f=this.tokAt(w+1),4!=f&&1275203608!=f){l="*";break}case 134218756:l=(m=1275203608==this.tokAt(++w))?"polyhedra":this.stringParameter(w);if(l.equalsIgnoreCase("polyhedra")||
l.equalsIgnoreCase("polyhedron"))m=!0;break;case 1677721602:b=d=!0;l=this.paramAsStr(++w);l.equalsIgnoreCase("SMILES")&&(u=!0,1612709900==this.e.tokAt(w+1)?(l="H",w++):l="*");break;case 3:case 2:s=Math.abs(this.floatParameter(w));break;case 268436992:break;case 2109448:x=this.atomExpressionAt(++w);w=a.iToken;break;case 10:case 1073742325:null!=q&&this.invArg();g=this.atomExpressionAt(a.iToken);f=z?0:this.tokAt(a.iToken+1);n=null==k&&a.isArrayParameter(a.iToken+1)?null:10==f||1073742325==f?this.atomExpressionAt(++a.iToken):
JU.BSUtil.copy(g);null!=x&&(g.and(x),null!=n&&n.and(x));null==n?(f=a.iToken,k=a.getPointArray(a.iToken+1,-1,!1),null==k?a.iToken=f:K=!0):null!=t&&n.and(t);null==p&&(p=new JU.Lst);p.addLast(D(-1,[g,null==n?k:n]));H&&(k=null);w=a.iToken;break;case 1275203608:u=m=!0;break;case 4125:break;case 7:null!=p&&this.invArg();c=!0;h=a.getQuaternionArray(a.theToken.getList(),1073742001);this.getToken(++w);j=a.getQuaternionArray(a.theToken.getList(),1073742001);null==q&&(q=new JU.Lst);q.addLast(D(-1,[h,j]));break;
case 1073742077:c=!0;break;case 1153433601:H=!0;c=!1;break;case 134217751:c=!1;break;case 528432:b=!0;break;case 4160:e=!0;break;default:this.invArg()}if(!this.chk){r&&(s=0);Float.isNaN(s)||0>s?s=1:!b&&!e&&(b=e=!0);f=0!=s;(H=!c&&null==l&&!m||null!=k)&&J.api.Interface.getInterface("JU.Eigen",this.vwr,"script");null==p&&null==q&&(m&&null==x&&(x=this.vwr.getAtomBitSet("polyhedra")),null==x?(g=H?this.vwr.getAtomBitSet("spine"):new JU.BS,0>g.nextSetBit(0)?(g=A,n=t):(n=JU.BSUtil.copy(g),g.and(A),n.and(t))):
(g=JU.BSUtil.copy(A),n=JU.BSUtil.copy(t),g.and(x),g.and(A),null!=n&&(n.and(x),n.and(t))),p=new JU.Lst,p.addLast(D(-1,[g,n])));z=null;if(r)for(var z=this.vwr.ms.getModelBS(A,!1),x=Array(z.cardinality()),w=0,G=z.nextSetBit(0);0<=G;G=z.nextSetBit(G+1),w++)x[w]=this.vwr.getModelUndeletedAtomsBitSet(G);else z=JU.BSUtil.newAndSetBit(0),x=D(-1,[A]);for(var E=0,G=z.nextSetBit(0);E<x.length;E++,G=z.nextSetBit(G+1)){var A=x[E],v=R(2,0);if(r&&m&&0==E)t=A;else{var F=null,C=new JU.Lst,Q=null,N=r?new JU.Lst:p;
if(!K)for(w=0;w<p.size();++w){var L=p.get(w);r&&N.addLast(L=D(-1,[JU.BSUtil.copy(L[0]),L[1]]));L[0].and(A)}var M=null,I=null;if(H){null!=k&&(N.clear(),N.addLast(D(-1,[g,k])));try{Q=this.vwr.getCenterAndPoints(N,!0)}catch(P){if(S(P,Exception))this.invArg();else throw P;}F=Q[0].length-1;for(w=1;w<=F;w++){C=Q[0][w];L=Q[1][w];if(!O(C,"JM.Atom")||!O(L,"JM.Atom"))break;r||JU.Logger.info(" atom 1 "+C.getInfo()+"\tatom 2 "+L.getInfo())}F=JU.Measure.calculateQuaternionRotation(Q,v);w=Float.isNaN(v[1])?NaN:
Math.round(100*v[0])/100;v=Float.isNaN(v[1])?NaN:Math.round(100*v[1])/100;this.showString("RMSD "+w+" --\x3e "+v+" Angstroms")}else if(c){if(null==q)for(w=0;w<N.size();w++){L=N.get(w);h=this.vwr.getAtomGroupQuaternions(L[0],2147483647);j=this.vwr.getAtomGroupQuaternions(L[1],2147483647);for(F=0;F<h.length&&F<j.length;F++)C.addLast(j[F].div(h[F]))}else for(F=0;F<h.length&&F<j.length;F++)C.addLast(j[F].div(h[F]));v[0]=0;h=C.toArray(Array(C.size()));F=JU.Quat.sphereMean(h,v,1E-4);this.showString("RMSD = "+
v[0]+" degrees")}else{w=new JU.M4;M=new JU.P3;if(null!=A&&null!=l&&("H".equals(l)||"*".equals(l)||"".equals(l)))try{l=this.vwr.getSmilesOpt(null==g?A:g,-1,-1,32768|("H".equals(l)?4096:0),null)}catch(V){if(S(V,Exception))a.evalError(V.getMessage(),null);else throw V;}if(d){var T;if(null==A||null==t||null==(T=a.getSmilesExt().getFlexFitList(A,t,l,!u)))break;this.vwr.setDihedrals(T,null,1)}m?(v=JU.BS.copy(g),v.and(A),C=JU.BS.copy(n),C.and(t),v=a.getSmilesExt().mapPolyhedra(v.nextSetBit(0),C.nextSetBit(0),
u,w)):(this.showString("COMPARE using "+(u?"SMILES ":"SMARTS ")+l),v=new JU.Lst,C=new JU.Lst,v=a.getSmilesExt().getSmilesCorrelation(null==g?A:g,null==n?t:n,l,v,C,w,null,!1,null,M,!1,32|(u?1:2)));if(Float.isNaN(v)){this.showString("structures do not match from "+A+" to "+t);break}e&&(I=new JU.V3,w.getTranslation(I));b&&(F=new JU.M3,w.getRotationScale(F),F=JU.Quat.newM(F));this.showString("RMSD = "+v+" Angstroms");r&&(w=this.vwr.getV0abc(G,D(-1,[w])),null!=w&&this.vwr.setModelCagePts(G,w,null))}null!=
Q&&(M=Q[0][0]);null==M&&(Q=this.vwr.getCenterAndPoints(N,!0),M=Q[0][0]);N=new JU.P3;L=NaN;e&&(null==I&&(I=JU.V3.newVsub(Q[1][0],M)),L=1E10);if(b&&(null==F&&a.evalError("option not implemented",null),N.add2(M,F.getNormal()),L=F.getTheta(),0==L&&e))if(0.01<I.length())L=1E10;else if(r)continue;else b=e=f=!1;if(!Float.isNaN(L)&&!Float.isNaN(N.x)&&(C=null,b&&(e&&0!=s)&&(v=this.vwr.ms.getAtomPointVector(A),w=JS.ScriptMathProcessor.getMatrix4f(F.getMatrix(),I),C=JU.Measure.transformPoints(v,w,M)),a.useThreads()||
(f=!1),this.vwr.rotateAboutPointsInternal(a,M,N,L/s,L,f,A,I,C,null,null)&&f&&a.isJS))throw new JS.ScriptInterruption(a,"compare",1);}}}});l(m,"configuration",function(){var a=null,c=this.chk?null:this.vwr.bsA();if(1==this.slen){if(this.chk)return;a=this.vwr.ms.setConformation(c);this.vwr.ms.addStateScript("select",null,c,null,";configuration",!0,!1)}else{var c=-2147483648,b=null;4==this.tokAt(1)?c=-1E3-(this.stringParameter(this.e.checkLast(1))+" ").codePointAt(0):2==this.tokAt(1)?c=this.intParameter(this.e.checkLast(1)):
(b=a=this.atomExpressionAt(1),c=4==this.tokAt(this.e.iToken)?-1E3-(this.stringParameter(this.e.checkLast(this.e.iToken+1))+" ").codePointAt(0):this.intParameter(this.e.checkLast(this.e.iToken+1)));if(this.chk)return;this.vwr.addStateScript("configuration "+(null==b?"":JU.Escape.eBS(a)+" ")+c+";",!0,!1);a=this.vwr.ms.getConformation(this.vwr.am.cmi,c,!0,b)}this.setShapeProperty(1,"type",Integer.$valueOf(30720));this.e.setShapeSizeBs(1,0,a);this.vwr.autoHbond(a,a,!0);this.vwr.selectStatus(a,!1,0,!this.e.doReport(),
!1)});l(m,"measure",function(){var a=this.e,c=null,b=0,e=null;if(2==this.slen)switch(this.tokAt(1)){case 1073742334:this.setShapeProperty(6,"hideAll",Boolean.TRUE);return;case 12291:this.chk||this.vwr.clearAllMeasurements();return;case 1113589787:this.chk||this.showMeasureCount(!0);return}this.vwr.shm.loadShape(6);switch(this.tokAt(1)){case 134218756:var f=this.stringParameter(3==this.slen?2:4);if(this.chk)return;var d=this.vwr.ms.at,h=this.vwr.ms.ac,c=null;try{c=this.vwr.getSmilesMatcher().getCorrelationMaps(f,
d,h,this.vwr.bsA(),2)}catch(j){if(S(j,Exception))a.evalError(j.getMessage(),null);else throw j;}if(null==c)return;this.setShapeProperty(6,"maps",c);return}switch(this.slen){case 2:switch(this.getToken(1).tok){case 0:case 1073742335:this.vwr.shm.loadShape(6);this.setShapeProperty(6,"hideAll",Boolean.FALSE);return;case 1073742001:this.chk||a.showStringPrint(this.vwr.getMeasurementInfoAsString(),!1);return;case 4:this.setShapeProperty(6,"setFormats",this.stringParameter(1));return}a.errorStr(24,"ON, OFF, DELETE");
break;case 3:switch(this.getToken(1).tok){case 12291:if(1073742327==this.getToken(2).tok)this.chk||this.vwr.clearAllMeasurements();else{var g=this.intParameter(2)-1;this.chk||this.vwr.deleteMeasurement(g)}return}}for(var n=0,p=0,q=-1,s=-1,k=-1,A=P(5,0),t=R(-1,[3.4028235E38,3.4028235E38]),l=!1,u=!1,m=!1,B=!0,r=!1,z=null,H=null,f=268438018,D=d=null,w=h=null,G=new JU.Lst,r=new JU.BS,E=null,v=null,F=null,C=0,Q=0,N=NaN,L=null,g=1;g<this.slen;++g)switch(this.getToken(g).tok){default:this.error(15);break;
case 1073741974:1!=g&&this.invArg();c=a.optParameterAsString(++g);continue;case 1073741824:a.errorStr(24,"ALL, ALLCONNECTED, DELETE");break;case 1275082241:f=1275082241;if(1073742327==this.tokAt(g+1)&&this.slen==g+2){this.chk||(this.vwr.setShapeProperty(6,"selectall",null),this.showMeasureCount(!0));return}break;case 1113589787:(0<G.size()||0<C||null!=c)&&this.invArg();f=1275082241;if(this.chk)E=new JU.BS;else if(E=this.vwr.getShapeProperty(6,"selected"),0==E.cardinality())return;l=!0;break;case 268439040:134217736!=
this.tokAt(g+1)&&this.invArg();g++;m=!0;break;case 1073741832:L=this.paramAsStr(++g).toLowerCase();break;case 134217736:case 1073741834:case 1073742327:u=1073741834==a.theTok;s=-1;l=!0;u&&m&&this.invArg();break;case 1765808134:b=JU.C.getColix(a.getArgbParam(++g));g=a.iToken;break;case 1073742066:a.isPoint3f(++g)?(e=this.getPoint3f(g,!1),e=R(-1,[1,e.x,e.y,e.z,0,0,0])):e=a.floatParameterSet(g,7,7);g=a.iToken;break;case 1665140738:case 1073741917:Q=I((1665140738==a.theTok?2E3:1E3)*this.floatParameter(++g));
null!=c&&0>=Q&&(Q=-1);break;case 3:null!=z&&this.invArg();B=l=!0;k=(k+1)%2;t[k]=this.floatParameter(g);break;case 12291:268438018!=f&&1275082241!=f&&this.invArg();f=12291;break;case 4114:var M=this.floatParameter(++g),T=this.paramAsStr(++g),U=this.paramAsStr(++g);this.chk||(w=this.vwr.getFont3D(T,U,M));break;case 2:M=this.intParameter(g);if(l)B=!0,k=(k+1)%2,t[k]=M;else{s=this.vwr.ms.getFirstAtomIndexFromAtomNumber(M,this.vwr.getVisibleFramesBitSet());if(!this.chk&&0>s)return;null!=v&&this.invArg();
4<(A[0]=++n)&&a.bad();A[n]=s}break;case 1094713359:q=this.intParameter(++g);break;case 1073742334:268438018!=f&&this.invArg();f=1073742334;break;case 1073742335:268438018!=f&&this.invArg();f=1073742335;break;case 1073742114:B=l=!0;s=-1;break;case 1073741989:case 1073741990:H=Boolean.$valueOf(1073741989==a.theTok);l=!0;m=1073741990==a.theTok;break;case 1648363544:0<=k&&this.invArg();z=a.encodeRadiusParameter(g,!1,!0);if(null==z)return;z.values=t;g=a.iToken;l=m=!0;H=Boolean.$valueOf(!1);1==C&&(C++,
n++,M=JU.BSUtil.copy(r),JU.BSUtil.invertInPlace(M,this.vwr.ms.ac),M.and(this.vwr.ms.getAtomsWithinRadius(5,r,!1,null,null)),G.addLast(M));break;case 12290:case 10:case 1073742325:C++;case 1073742332:case 8:case 1073742330:(0<=s||null!=E)&&this.invArg();n=Array(1);v=a.centerParameter(g,n);if(O(n[0],"JU.BS")&&(v=r=n[0],!this.chk&&0==r.length()))return;O(v,"JU.P3")&&(n=new JU.Point3fi,n.setT(v),n.mi=q,v=n);4<(n=++p)&&a.bad();g=a.iToken;G.addLast(v);break;case 1715472409:D=this.paramAsStr(g);break;case 1073742188:N=
this.floatParameter(++g);break;case 4:M=this.stringParameter(g);JM.Measurement.isUnits(M)||M.equals("default")?h=M:d=M;break;case 1073742164:F=a.tickParamAsStr(g,!1,!0,!0),g=a.iToken,f=12290}(null!=z&&(0<=k||2!=n)||1275082241!=f&&null==E&&2>n&&null==c&&(null==F||1==n))&&a.bad();null!=d&&0!=d.indexOf(n+":")&&(d=n+":"+d);B&&t[1]<t[0]&&(t[1]=t[0],t[0]=3.4028235E38==t[1]?3.4028235E38:-200);if(!this.chk)if(r=null!=c&&null==v&&268438018==f,null!=v||null!=E||null!=F||r){null==z&&(z=new J.atomdata.RadiusData(t,
0,null,null));null!=F&&(F.id="default");if(r)f=266284;else if(null!=v&&(null!=D||null!=d)&&268438018==f)f=12290;a=null;if(null!=w||null!=L||0!=b||null!=d&&(r||0<=d.indexOf("\n")))a=JM.Text.newMeasure(this.vwr,w,b);null!=a&&(a.pymolOffset=e,a.setAlignmentLCR(L));this.setShapeProperty(6,"measure",this.vwr.newMeasurementData(c,G).set(f,null,z,D,d,h,F,u,m,H,l,Q,b,a,N,E));1275082241==f&&this.showMeasureCount(!1)}else switch(a=null==c?A:c,f){case 12291:this.setShapeProperty(6,"delete",a);break;case 1073742335:this.setShapeProperty(6,
"show",a);break;case 1073742334:this.setShapeProperty(6,"hide",a);break;default:this.setShapeProperty(6,null==d&&null==h?"toggle":"toggleOn",a),null!=d&&this.setShapeProperty(6,"setFormats",d)}});l(m,"showMeasureCount",function(a){var c=this.vwr.getShapeProperty(6,"selected"),b=c.cardinality();if(a)for(a=c.nextSetBit(0);0<=a;a=c.nextSetBit(a+1))this.showString(this.vwr.shm.getShape(6).getInfoAsString(a));this.showString(b+(1==b?" measure":" measures")+" selected")},"~B");l(m,"connect",function(a){var c=
this.e,b=R(2,0),e=Array(2);e[0]=e[1]=this.vwr.bsA();var f=NaN,d=P(-1,[-2147483648]),h=0,j=131071,g=1073742026,n=!1,p=!1,q=!1,s=3.4028235E38,k=!1,A=0,t=0,l=new JU.BS,m=!1,y=0,B=0,r=0,z=!1;if(1==this.slen)this.chk||this.vwr.rebondState(c.$isStateScript);else if(1073877011==this.tokAt(1))this.chk||this.vwr.connectNBO(this.e.optParameterAsString(2));else{for(;a<this.slen;++a){switch(this.getToken(a).tok){case 1073742335:case 1073742334:this.checkLength(2);this.chk||this.vwr.rebondState(c.$isStateScript);
return;case 2:case 3:if(0<A){(p||k)&&c.error(23);j=JU.Edge.getBondOrderFromFloat(this.floatParameter(a));131071==j&&this.invArg();p=!0;break}2<++t&&c.bad();var H=this.floatParameter(a);268441090==this.tokAt(a+1)&&(H=-H/100,a++);b[h++]=H;break;case 12290:case 10:case 1073742325:(2<A||m&&0<A)&&c.bad();(p||k)&&this.invArg();e[A++]=this.atomExpressionAt(a);m=c.isBondSet;if(2==A){for(var H=c.iToken,K=a;K<H;K++)if(1073741824==this.tokAt(K)&&this.paramAsStr(K).equals("_1")){y=a;break}c.iToken=H}a=c.iToken;
break;case 1086324742:z=!0;break;case 1765808134:case 603979967:case 1073742074:k=!0;s=this.getColorTrans(c,a,!1,d);a=c.iToken;break;case 1073742086:d=1073741852==this.tokAt(2);this.checkLength(d?3:2);if(this.chk)return;this.vwr.clearModelDependentObjects();this.vwr.ms.deleteAllBonds();f=new JU.BS;this.vwr.ms.setPdbConectBonding(0,0,f);if(d){c=c.$isStateScript&&this.vwr.getBoolean(603979872);this.vwr.ms.autoBondBs4(null,null,f,null,this.vwr.getMadBond(),c,null);this.vwr.addStateScript(c?"set legacyAutoBonding TRUE;connect PDB AUTO;set legacyAutoBonding FALSE;":
"connect PDB auto;",!1,!0);return}this.vwr.addStateScript("connect PDB;",!1,!0);return;case 1073741852:case 1073741904:case 1073742025:case 1073742026:q=!0;++a!=this.slen&&this.invArg();g=c.theTok;1073741852==g&&!(131071==j||2048==j||515==j)&&this.invArg();break;case 659482:k||(d[0]=16777215,s=0.5,f=this.vwr.getFloat(570425406),k=!0),q||(g=1073742026,q=!0);case 1073741824:if(c.isColorParam(a)){B=-a;break}case 1075838996:case 1613238294:j=this.paramAsStr(a);131071==(j=JU.Edge.getBondOrderFromString(j))&&
this.invArg();p&&c.error(18);p=!0;switch(j){case 33:switch(this.tokAt(a+1)){case 3:j=JU.Edge.getPartialBondOrderFromFloatEncodedInt(this.st[++a].intValue);break;case 2:j=this.intParameter(++a)}break;case 2048:2==this.tokAt(a+1)&&(j=this.intParameter(++a)<<11,r=this.floatParameter(++a));break;case 65537:q||(g=1073742025,q=!0)}break;case 1665140738:f=this.floatParameter(++a);k=!0;break;case 1073742333:++a!=this.slen&&this.invArg();case 12291:g=12291;n=!0;k=!1;break;default:B=a}0<a&&(B==-a||B==a&&c.isColorParam(a)?
(k=!0,d[0]=c.getArgbParam(a),a=c.iToken):B==a&&this.invArg())}if(!this.chk){2>h&&(0==h&&(b[0]=1E8),b[1]=b[0],b[0]=0.1);k&&(p||(j=65535),q||(g=1073742025));p=h=0;if(0<y){r=new JU.BS;this.vwr.definedAtomSets.put("_1",r);z=e[0];for(q=z.nextSetBit(0);0<=q;q=z.nextSetBit(q+1))r.set(q),e=this.vwr.makeConnections(b[0],b[1],j,g,r,this.atomExpressionAt(y),l,m,!1,0),h+=Math.abs(e[0]),p+=e[1],r.clear(q)}else e=this.vwr.makeConnections(b[0],b[1],j,g,e[0],e[1],l,m,z,r),h+=Math.abs(e[0]),p+=e[1];b=c.doReport();
n?b&&c.report(J.i18n.GT.i(J.i18n.GT.$("{0} connections deleted"),p),!1):(k&&(this.vwr.selectBonds(l),Float.isNaN(f)||c.setShapeSizeBs(1,Math.round(2E3*f),null),this.finalizeObject(1,d[0],s,0,!1,null,0,l),this.vwr.selectBonds(null)),b&&c.report(J.i18n.GT.o(J.i18n.GT.$("{0} new bonds; {1} modified"),D(-1,[Integer.$valueOf(h),Integer.$valueOf(p)])),!1))}}},"~N");l(m,"console",function(){switch(this.getToken(1).tok){case 1073742334:this.chk||this.vwr.showConsole(!1);break;case 1073742335:this.chk||this.vwr.showConsole(!0);
break;case 1073741882:this.chk||this.vwr.sm.clearConsole();break;case 134221856:this.showString(this.stringParameter(2));break;default:this.invArg()}});l(m,"data",function(){var a=this.e,c=null,b=null,e=!1,f;switch(a.iToken=this.slen){case 5:c=this.paramAsStr(2);case 4:case 2:b=this.paramAsStr(1);if(b.equalsIgnoreCase("clear")){this.chk||this.vwr.setData(null,null,0,0,0,0,0);return}if(0<=(f=b.indexOf("@")))c=""+a.getParameter(b.substring(f+1),4,!0),b=b.substring(0,f).trim();else if(null==c&&0<=(f=
b.indexOf(" ")))c=b.substring(f+1).trim(),b=b.substring(0,f).trim(),e=!0;break;default:a.bad()}f=b.substring(0,(b+" ").indexOf(" ")).toLowerCase();if(f.equals("model")||f.equals("append"))a.cmdLoad();else if(!this.chk){var d=0<=b.toLowerCase().indexOf("(default)");if(f.equals("connect_atoms"))this.vwr.ms.connect(this.parseDataArray(c,!1));else if(0==f.indexOf("ligand_"))this.vwr.setLigandModel(b.substring(7).toUpperCase()+"_data",c.trim());else if(0==f.indexOf("file_"))this.vwr.setLigandModel(b.substring(5)+
"_file",c.trim());else if(a=Array(4),f.equals("element_vdw")){a[0]=f;a[1]=c.$replace(";","\n");c=JU.Elements.elementNumberMax;f=P(c+1,0);for(d=1;d<=c;d++)f[d]=d;a[2]=f;a[3]=Integer.$valueOf(0);this.vwr.setData("element_vdw",a,c,0,0,0,0)}else if(0==f.indexOf("data2d_"))a[0]=b,a[1]=this.parseDataArray(c,!1),a[3]=Integer.$valueOf(2),this.vwr.setData(b,a,0,0,0,0,0);else if(0==f.indexOf("data3d_"))a[0]=b,a[1]=this.parseDataArray(c,!0),a[3]=Integer.$valueOf(3),this.vwr.setData(b,a,0,0,0,0,0);else{var h=
JU.PT.getTokens(b);if(0==f.indexOf("property_")&&!(2==h.length&&h[1].equals("set"))){d=this.vwr.bsA();a[0]=f;var j=e?0:this.vwr.getP("propertyAtomNumberField").intValue(),g=e?0:this.vwr.getP("propertyAtomNumberColumnCount").intValue(),n=e?-2147483648:this.vwr.getP("propertyDataField").intValue(),p=e?0:this.vwr.getP("propertyDataColumnCount").intValue();!e&&0<=b.indexOf(" ")&&(3==h.length&&(j=JU.PT.parseInt(h[1]),n=JU.PT.parseInt(h[2])),5==h.length&&(j=JU.PT.parseInt(h[1]),g=JU.PT.parseInt(h[2]),n=
JU.PT.parseInt(h[3]),p=JU.PT.parseInt(h[4])));0>j&&(j=0);0>n&&(n=0);b=this.vwr.ms.ac;e=null;h=JU.BS.newN(b);if(0<j){for(var e=P(b+2,0),q=0;q<=b;q++)e[q]=-1;for(q=d.nextSetBit(0);0<=q;q=d.nextSetBit(q+1)){var s=this.vwr.ms.at[q].getAtomNumber();s>b+1||(0>s||h.get(s))||(h.set(s),e[s]=q)}a[2]=e}else a[2]=JU.BSUtil.copy(d);a[1]=c;a[3]=Integer.$valueOf(0);this.vwr.setData(f,a,b,j,g,n,p)}else"occupany".equals(f)&&(f="occupancy"),j=JM.AtomCollection.getUserSettableType(f),-1<j?this.vwr.setAtomData(j,f,c,
d):(a[0]=b,a[1]=c,a[3]=Integer.$valueOf(0),this.vwr.setData(f,a,0,0,0,0,0))}}});l(m,"ellipsoid",function(){var a=this.e,c=0,b=1,e=3.4028235E38,f=!1,d=!1;this.setShapeProperty(20,"thisID",null);switch(this.getToken(1).tok){case 1073742335:c=2147483647;break;case 1073742334:break;case 2:c=this.intParameter(1);break;case 36867:this.e.sm.loadShape(20);this.setShapeProperty(20,"select",this.paramAsStr(2));b=a.iToken;d=f=!0;break;case 1073741974:case 268441089:case 1073741824:this.e.sm.loadShape(20);1073741974==
a.theTok&&b++;this.setShapeId(20,b,!1);b=a.iToken;f=!0;break;default:this.invArg()}if(f){for(c=P(-1,[-2147483648]);++b<this.slen;){var f=this.paramAsStr(b),h=null;this.getToken(b);if(!d)switch(a.theTok){case 1073742330:f="points";h=Array(3);h[0]=a.objectNameParameter(++b);if(this.chk)continue;a.getShapePropertyData(24,"getVertices",h);break;case 1825200146:h=this.e.optParameterAsString(++b);if(0==h.length)continue;break;case 1611272194:var h=Array(3),j=null;switch(this.getToken(b+1).tok){case 11:for(var b=
a.theToken.value,g=3;0<=--g;)b.getColumnV(g,h[g]=new JU.V3);break;case 1073742195:b+=2;case 268437504:j=new JU.Lst;for(g=3;0<=--g;){switch(this.tokAt(++b)){case 268437504:break;default:a.isCenterParameter(b)?j.addLast(JS.SV.newV(8,this.centerParameter(b))):268437504!=this.tokAt(b)&&j.addLast(this.getToken(b))}b=a.iToken}268437505!=this.getToken(++b).tok&&this.invArg();break;case 7:j=a.theToken.getList();switch(j.size()){case 1:j=new JU.Lst;for(g=3;0<=--g;)j.addLast(this.getToken(++b));break;case 3:break;
default:this.invArg()}break;default:for(g=0;3>g;g++)h[g]=new JU.V3,h[g].setT(this.centerParameter(++b)),b=a.iToken}if(null!=j)for(b=3;0<=--b;)switch(g=j.get(b),g.tok){case 7:h[b]=JU.V3.new3(JS.SV.fValue(g.getList().get(0)),JS.SV.fValue(g.getList().get(1)),JS.SV.fValue(g.getList().get(2)));break;case 8:h[b]=JU.V3.newV(g.value)}b=a.iToken;break;case 12289:h=this.centerParameter(++b);b=a.iToken;break;case 1094713359:h=Integer.$valueOf(this.intParameter(++b));break;case 12291:h=Boolean.TRUE,this.checkLength(b+
1)}if(null==h)switch(a.theTok){case 1073742335:f="on";h=Boolean.TRUE;break;case 1073742334:f="on";h=Boolean.FALSE;break;case 536875059:this.isFloatParameter(b+1)?h=Float.$valueOf(this.floatParameter(++b)):a.isCenterParameter(b)?(b=this.centerParameter(b),h=R(-1,[b.x,b.y,b.z])):h=a.floatParameterSet(++b,3,3);b=a.iToken;break;case 12290:case 10:case 1073742325:f="atoms";h=this.atomExpressionAt(b);b=a.iToken;break;case 1765808134:case 603979967:case 1073742074:e=this.getColorTrans(a,b,!0,c);b=a.iToken;
continue;case 1073742075:h=this.paramAsStr(++b)}null==h&&this.invArg();this.setShapeProperty(20,f.toLowerCase(),h)}this.finalizeObject(20,c[0],e,0,!1,null,0,null);this.setShapeProperty(20,"thisID",null)}else a.setShapeSizeBs(20,c,null)});l(m,"image",function(){this.chk||this.vwr.getConsole();var a=1,c=null;1073741974==this.tokAt(1)&&(c=this.e.optParameterAsString(++a),a++);var b=this.e.optParameterAsString(a),e=this.e.optParameterAsString(this.slen-1).equalsIgnoreCase("close");if(!e&&(this.slen==
a||this.slen==a+2))b=this.slen==a+2?this.intParameter(a++):-1,a=0>b?-1:this.intParameter(a),e=new java.util.Hashtable,e.put("fileName","\u0001\u0001"+c),e.put("backgroundColor",Integer.$valueOf(this.vwr.getBackgroundArgb())),e.put("type","png"),e.put("quality",Integer.$valueOf(-1)),e.put("width",Integer.$valueOf(b)),e.put("height",Integer.$valueOf(a)),this.chk||this.vwr.processWriteOrCapture(e);else{if(e)switch(this.slen){case 2:b="closeall";break;case 3:case 4:break;default:this.checkLength(0)}this.chk||
this.vwr.fm.loadImage(e?"\u0001close":b,"\u0001"+b+"\u0001"+("".equals(c)||null==c?null:c),!1)}});l(m,"invertSelected",function(){var a=this.e,c=null,b=null,e=null,f=-2147483648,d=1;switch(this.tokAt(1)){case 0:if(this.chk)return;e=this.vwr.bsA();c=this.vwr.ms.getAtomSetCenter(e);this.vwr.invertAtomCoord(c,null,e,-1,!1);return;case 528443:case 1153433601:d++;case 10:case 1073742325:case 12290:e=this.atomExpressionAt(d);if(!a.isAtomExpression(a.iToken+1)){a.checkLengthErrorPt(a.iToken+1,a.iToken+1);
if(!this.chk)for(a=e.nextSetBit(0);0<=a;a=e.nextSetBit(a+1))this.vwr.invertAtomCoord(null,null,e,a,!1);return}f=e.nextSetBit(0);e=this.atomExpressionAt(a.iToken+1);break;case 134217751:c=a.centerParameter(2,null);break;case 134217750:b=a.planeParameter(1,!1);break;case 134219777:b=a.hklParameter(2,null,!0)}a.checkLengthErrorPt(a.iToken+1,1);null==b&&(null==c&&-2147483648==f)&&this.invArg();this.chk||-1!=f&&this.vwr.invertSelected(c,b,f,e)});l(m,"mapProperty",function(){for(var a,c,b,e,f,d=0,h=0,j=
0,g=this.e;;){if(1113589787==this.tokAt(1))a=this.vwr.bsA(),c=this.atomExpressionAt(2),b=e="selected";else{a=this.atomExpressionAt(1);if(1073742336!=this.tokAt(++g.iToken)||!JS.T.tokAttr(d=this.tokAt(++g.iToken),1077936128))break;b=this.paramAsStr(g.iToken);c=this.atomExpressionAt(++g.iToken);if(1073742336!=this.tokAt(++g.iToken)||!JS.T.tokAttr(h=this.tokAt(++g.iToken),2048))break;e=this.paramAsStr(g.iToken)}f=JS.T.tokAttr(j=this.tokAt(g.iToken+1),1077936128)?this.paramAsStr(++g.iToken):JS.T.nameOf(j=
1094715393);g.checkLast(g.iToken);if(this.chk)return;var n=null;this.showString("mapping "+b.toUpperCase()+" for "+a.cardinality()+" atoms to "+e.toUpperCase()+" for "+c.cardinality()+" atoms using "+f.toUpperCase());if(JS.T.tokAttrOr(d,1094713344,1111490560)&&JS.T.tokAttrOr(h,1094713344,1111490560)&&JS.T.tokAttrOr(j,1094713344,1111490560)){var p=this.getBitsetPropertyFloat(a,d|224,null,NaN,NaN),q=this.getBitsetPropertyFloat(a,j|224,null,NaN,NaN),d=this.getBitsetPropertyFloat(c,j|224,null,NaN,NaN),
s=1715472409==h,k=R(s?this.vwr.ms.ac:d.length,0),n=new JU.BS;if(p.length==q.length){for(var l=new java.util.Hashtable,j=0;j<p.length;j++)l.put(Float.$valueOf(q[j]),Float.$valueOf(p[j]));p=-1;for(j=q=0;j<d.length;j++){var p=c.nextSetBit(p+1),t=l.get(Float.$valueOf(d[j]));null!=t&&(n.set(p),k[s?p:q]=t.floatValue(),q++)}s?this.vwr.setData(e,D(-1,[e,k,n,Integer.$valueOf(1),Boolean.TRUE]),this.vwr.ms.ac,0,0,2147483647,0):JS.T.tokAttr(h,2048)?this.vwr.setAtomProperty(n,h,0,0,null,k,null):this.error(56)}}if(null==
n){b=this.getBitsetIdent(a,"{"+f+"=%["+f+"]}."+e+" = %["+b+"]",null,!1,2147483647,!1);a=new JU.SB;for(j=0;j<b.length;j++)0>b[j].indexOf("null")&&a.append(b[j]).appendC("\n");JU.Logger.debugging&&JU.Logger.debug(a.toString());b=JU.BSUtil.copy(this.vwr.slm.bsSubset);this.vwr.slm.setSelectionSubset(c);try{g.runScript(a.toString())}catch(m){if(S(m,Exception))c=m,this.vwr.slm.setSelectionSubset(b),g.errorStr(-1,"Error: "+c.getMessage());else if(S(m,Error))c=m,this.vwr.slm.setSelectionSubset(b),g.errorStr(-1,
"Error: "+c.toString());else throw m;}this.vwr.slm.setSelectionSubset(b)}this.showString("DONE");return}this.invArg()});l(m,"minimize",function(a){for(var c=null,b=2147483647,e=0,f=!1,d=!1,h=null,j=!1,g=!1,n=this.vwr.getMinimizer(!1),p=0,q=a?2:1;q<this.slen;q++)switch(this.getToken(q).tok){case 1073741905:e=this.floatParameter(++q);continue;case 1073742114:p=this.floatParameter(++q);continue;case 1073741935:b=0;continue;case 1073741874:case 1073742162:this.checkLength(2);if(this.chk||null==n)return;
n.setProperty(this.paramAsStr(q),null);return;case 1073741882:this.checkLength(2);if(this.chk||null==n)return;n.setProperty("clear",null);return;case 1073741894:1!=q&&this.invArg();c=a=0;b=P(5,0);if(1073741882==this.tokAt(++q))this.checkLength(3);else{for(;4>a&&!this.isFloatParameter(q);)b[++a]=this.atomExpressionAt(q).nextSetBit(0),q=this.e.iToken+1;b[0]=a;1==a&&this.invArg();c=this.floatParameter(this.e.checkLast(q))}this.chk||this.vwr.getMinimizer(!0).setProperty("constraint",D(-1,[b,Float.$valueOf(c)]));
return;case 12293:1!=q&&this.invArg();if(this.slen==++q){this.chk||(q=this.vwr.getMinimizer(!0).getProperty("fixed",0),null==q?this.e.showString("no atoms are fixed for minimization"):(a=q.cardinality(),this.e.showString(a+(1==a?" atom is":" atoms are")+" fixed for minimization: "+q+"\nunfix them with MINIMIZE FIX NONE")));return}h=this.atomExpressionAt(q);0>h.nextSetBit(0)&&(h=null);q=this.e.iToken;this.chk||this.vwr.getMinimizer(!0).setProperty("fixed",h);if(q+1==this.slen)return;continue;case 1073741828:f=
!0;continue;case 1073742072:case 1113589787:j=!0;break;case 1086324742:g=!0;break;case 1073742148:d=!0;break;case 266298:b=this.intParameter(++q);continue;case 10:case 1073742325:j=!0;case 1275082241:1275082241==this.e.theTok&&q++;c=this.atomExpressionAt(q);q=this.e.iToken;1073742072==this.tokAt(q+1)&&(q++,j=!0);continue;default:this.invArg()}a&&(f||j||g)&&this.invArg();if(!this.chk)try{this.vwr.minimize(this.e,b,e,c,h,null,p,(f?16:0)|(a?256:0)|(j?32:0)|(g?64:0)|(d?1:0))}catch(s){if(S(s,Exception))throw new JS.ScriptInterruption(this.e,
"minimize",1);throw s;}},"~B");l(m,"modulation",function(){var a=null,c=this.e,b=!0,e=!1,f=null,d=1;switch(this.getToken(d).tok){case 1073742334:b=!1;case 0:case 1073742335:break;case 12290:case 10:case 1073742325:f=this.atomExpressionAt(1);switch(this.tokAt(c.iToken+1)){case 1073742334:b=!1;case 1073742335:c.iToken++}c.checkLast(c.iToken);break;case 1073742332:case 8:a=c.getPoint3f(1,!1,!0);e=1073742335==this.tokAt(c.iToken+1);break;default:var h=c.theToken.value.toString();d++;h.equalsIgnoreCase("t")?
c.theTok=3:h.equalsIgnoreCase("m")||h.equalsIgnoreCase("q")?c.theTok=2:this.invArg();case 3:case 2:switch(c.theTok){case 3:this.isFloatParameter(d)?(a=this.floatParameter(d),a=JU.P3.new3(a,a,a)):a=c.getPoint3f(d,!1,!0);break;case 2:2==this.tokAt(d)?(e=this.intParameter(d),a=JU.P3.new3(e,e,e)):a=c.getPoint3f(d,!1,!0),e=!0}break;case 536875059:b=this.floatParameter(2);this.chk||this.vwr.setFloatProperty("modulationScale",b);return}this.chk||(this.vwr.tm.setVibrationPeriod(0),this.vwr.setModulation(f,
b,a,e))});l(m,"mutate",function(){var a=this.e.iToken,c,b=null,e=null,f=null,d=!1;switch(this.tokAt(++a)){case 1073741904:b="alpha";d=!0;c=null;switch(this.tokAt(++a)){case 0:this.invArg();break;default:switch(e=this.e.paramAsStr(a),a=this.e.iToken,this.tokAt(a+1)){case 0:break;case 268437504:case 1073742195:case 7:b=null;f=this.e.floatParameterSet(++a,2,2147483647);1==f.length%2&&this.invArg();a=this.e.iToken;break;default:b=this.e.paramAsStr(++a),a=this.e.iToken}}break;case 2:this.st[1]=JS.T.o(4,
""+this.st[1].value);default:c=this.atomExpressionAt(a);a=++this.e.iToken;break;case 268441089:c=this.vwr.getFrameAtoms(),a=++this.e.iToken}if(!this.chk&&null!=c){c.and(this.vwr.getFrameAtoms());var h=c.nextSetBit(0);0>h&&this.invArg();h=this.vwr.ms.at[h].mi;if(this.vwr.ms.isTrajectory(h)||!this.vwr.ms.am[h].isBioModel)return}null==e&&(e=this.e.optParameterAsString(a));this.e.checkLast(a);if(!this.chk){a=e.startsWith("~");if(!a&&!d&&(0<=e.indexOf(".")||0>e.indexOf("-")&&3<e.length&&e.startsWith("==")))d=
D(-1,[e]),e=null;else if(e=JU.PT.replaceAllCharacters(e,",; \t\n"," ").trim().toUpperCase(),!a&&0<=e.indexOf("-"))d=JU.PT.split(e,"-");else{if(a||3!=e.length||!this.vwr.getJBR().isKnownPDBGroup(e,20))e=this.vwr.getJBR().toStdAmino3(a?e.substring(1):e);d=JU.PT.getTokens(e)}this.e.iToken=this.e.slen;0<d.length&&!this.vwr.getJBR().getBioModelSet(this.vwr.ms).mutate(c,e,d,b,f)&&this.invArg()}});l(m,"navigate",function(){var a=this.e;if(1==this.slen)a.setBooleanProperty("navigationMode",!0);else{var c=
JU.V3.new3(0,1,0),b=new JU.Lst,e;if(2==this.slen)switch(this.getToken(1).tok){case 1073742335:case 1073742334:if(this.chk)return;a.setObjectMad10(34,"axes",10);this.setShapeProperty(34,"position",JU.P3.new3(50,50,3.4028235E38));a.setBooleanProperty("navigationMode",!0);this.vwr.tm.setNavOn(1073742335==a.theTok);return;case 1073742162:this.chk||this.vwr.tm.setNavXYZ(0,0,0);return;case 8:case 1112152078:break;default:this.invArg()}!this.chk&&!this.vwr.getBoolean(603979889)&&a.setBooleanProperty("navigationMode",
!0);for(var f=1;f<this.slen;f++){var d=this.isFloatParameter(f)?this.floatParameter(f++):2;0>d&&this.invArg();!this.chk&&0<d&&a.refresh(!1);switch(this.getToken(f).tok){case 8:case 1073742332:e=this.getPoint3f(f,!0);a.iToken++;a.iToken!=this.slen&&this.invArg();this.chk||this.vwr.tm.setNavXYZ(e.x,e.y,e.z);return;case 554176526:e=this.floatParameter(++f);this.chk||b.addLast(D(-1,[Integer.$valueOf(554176526),Float.$valueOf(d),Float.$valueOf(e)]));continue;case 12289:e=this.centerParameter(++f);f=a.iToken;
this.chk||b.addLast(D(-1,[Integer.$valueOf(134217751),Float.$valueOf(d),e]));continue;case 528432:switch(this.getToken(++f).tok){case 1111492629:c.set(1,0,0);f++;break;case 1111492630:c.set(0,1,0);f++;break;case 1111492631:c.set(0,0,1);f++;break;case 8:case 1073742332:c.setT(this.getPoint3f(f,!0));f=a.iToken+1;break;case 1073741824:this.invArg()}e=this.floatParameter(f);this.chk||b.addLast(D(-1,[Integer.$valueOf(528432),Float.$valueOf(d),c,Float.$valueOf(e)]));continue;case 4160:var h=e=NaN;if(this.isFloatParameter(++f))e=
this.floatParameter(f),h=this.floatParameter(++f);else switch(this.tokAt(f)){case 1111492629:e=this.floatParameter(++f);break;case 1111492630:h=this.floatParameter(++f);break;default:e=this.centerParameter(f);f=a.iToken;this.chk||b.addLast(D(-1,[Integer.$valueOf(4160),Float.$valueOf(d),e]));continue}this.chk||b.addLast(D(-1,[Integer.$valueOf(268441090),Float.$valueOf(d),Float.$valueOf(e),Float.$valueOf(h)]));continue;case 268441088:continue;case 1112152078:e=new JU.Lst;a.isAtomExpression(f+1)?(h=
this.atomExpressionAt(++f),f=a.iToken):h=this.vwr.bsA();if(this.chk)return;this.vwr.getPolymerPointsAndVectors(h,e);var j;if(0<(j=e.size())){for(var h=Array(j),g=0;g<j;g++)h[g]=e.get(g);b.addLast(D(-1,[Integer.$valueOf(1112152078),Float.$valueOf(d),h]));continue}break;case 1073742084:if(1073742330==this.getToken(f+1).tok){f++;e=a.objectNameParameter(++f);if(this.chk)return;this.setShapeProperty(22,"thisID",e);e=this.getShapeProperty(22,"vertices");a.refresh(!1);null==e&&this.invArg();h=I(this.isFloatParameter(f+
1)?this.floatParameter(++f):0);j=I(this.isFloatParameter(f+1)?this.floatParameter(++f):2147483647);b.addLast(D(-1,[Integer.$valueOf(1073742084),Float.$valueOf(d),e,null,P(-1,[h,j])]));continue}for(e=new JU.Lst;a.isCenterParameter(f+1);)e.addLast(this.centerParameter(++f)),f=a.iToken;if(0<e.size()){e=e.toArray(Array(e.size()));this.chk||b.addLast(D(-1,[Integer.$valueOf(1073742084),Float.$valueOf(d),e,null,P(-1,[0,2147483647])]));continue}default:this.invArg()}}!this.chk&&!this.vwr.isJmolDataFrame()&&
this.vwr.tm.navigateList(a,b)}});l(m,"plot",function(a){var c=this.e,b=this.vwr.am.cmi;0>b&&c.errorStr(30,"plot");var b=this.vwr.ms.getJmolDataSourceFrame(b),e=a.length-1,f=a!==this.st,d=!0,h=this.st;f&&(c.st=this.st=a);var j=f?134222350:a[0].tok,g=f||134221850==j||4138==j?0:1,n=null,p=!0,q=!1;switch(j){case 135176:p=!1;q=!0;break;case 134222350:d=p=!1;break;case 134221856:p=!1,4==JS.CmdExt.tokAtArray(e,a)?n=this.stringParameter(e--):1073742336==JS.CmdExt.tokAtArray(e-1,a)?(n=this.paramAsStr(e-2)+
"."+this.paramAsStr(e),e-=3):(c.st=this.st=h,c.iToken=this.st.length,this.error(13)),c.slen=this.slen=e+1}var f="",s=null,k="",l=!1,t=!1,m=!1,u=!1,y=Array(3),B=P(3,0),r=JU.BSUtil.copy(this.vwr.bsA()),z="; select "+JU.Escape.eBS(r)+";\n ",u=c.optParameterAsString(e).toLowerCase(),H=null,K=null,w=null,G=JS.CmdExt.tokAtArray(g,a);4==G&&(G=JS.T.getTokFromName(a[g].value));switch(G){default:c.iToken=1;this.invArg();break;case 134221834:c.iToken=1;u="data";z="";break;case 1715472409:c.iToken=g+1;for(a=
0;3>a;a++){switch(this.tokAt(c.iToken)){case 4:B[a]=JS.T.getTokFromName(c.getToken(c.iToken).value);break;default:B[a]=this.tokAt(c.iToken);break;case 0:0==a&&this.invArg();case 1287653388:case 32:case 64:a=2;continue}1715472409!=B[a]&&!JS.T.tokAttr(B[a],1077936128)&&this.invArg();y[a]=this.getToken(c.iToken).value.toString();c.iToken++}1287653388==this.tokAt(c.iToken)&&(w=this.stringParameter(++c.iToken),d=!1,c.iToken++);32==this.tokAt(c.iToken)&&(H=this.getPoint3f(++c.iToken,!1),c.iToken++);64==
this.tokAt(c.iToken)&&(K=this.getPoint3f(++c.iToken,!1),c.iToken++);u="property "+y[0]+(null==y[1]?"":" "+y[1])+(null==y[2]?"":" "+y[2]);0>r.nextSetBit(0)&&(r=this.vwr.getModelUndeletedAtomsBitSet(b));k="select "+JU.Escape.eBS(r)+";\n ";break;case 4138:u.equalsIgnoreCase("draw")&&(u=c.optParameterAsString(--e).toLowerCase());u=e>g&&u.startsWith("r");u="ramachandran"+(u?" r":"")+(135176==j?" draw":"");break;case 134221850:case 136314895:f=' "'+this.vwr.getQuaternionFrame()+'"';k="set quaternionFrame"+
f+";\n  ";l=!0;u.equalsIgnoreCase("draw")&&(q=!0,u=c.optParameterAsString(--e).toLowerCase());m=(t=u.startsWith("deriv")||u.startsWith("diff"))&&0<u.indexOf("2");t&&e--;if(u.equalsIgnoreCase("helix")||u.equalsIgnoreCase("axis"))t=q=!0,e=-1;u=((e<=g?"":c.optParameterAsString(e))+"w").substring(0,1);if(u.equals("a")||u.equals("r"))t=!0;JU.PT.isOneOf(u,";w;x;y;z;r;a;")||c.evalError("QUATERNION [w,x,y,z,a,r] [difference][2]",null);u="quaternion "+u+(t?" difference":"")+(m?"2":"")+(q?" draw":"")}this.st=
h;if(this.chk)return"";if(p&&(k+="plot "+u,h=this.vwr.ms.getJmolDataFrameIndex(b,k),0<h&&134221856!=j&&134222350!=j))return this.vwr.setCurrentModelIndexClear(h,!0),"";p=e=h=null;g=Array(3);if(1715472409==G){h=this.getBitsetPropertyFloat(r,B[0]|224,1715472409==B[0]?y[0]:null,null==H?NaN:H.x,null==K?NaN:K.x);g[0]=y[0]+" "+JU.Escape.eAF(h);null!=y[1]&&(e=this.getBitsetPropertyFloat(r,B[1]|224,1715472409==B[1]?y[1]:null,null==H?NaN:H.y,null==K?NaN:K.y),g[1]=y[1]+" "+JU.Escape.eAF(e));null!=y[2]&&(p=
this.getBitsetPropertyFloat(r,B[2]|224,1715472409==B[2]?y[2]:null,null==H?NaN:H.z,null==K?NaN:K.z),g[2]=y[2]+" "+JU.Escape.eAF(p));null==H&&(H=JU.P3.new3(this.getPlotMinMax(h,!1,B[0]),this.getPlotMinMax(e,!1,B[1]),this.getPlotMinMax(p,!1,B[2])));null==K&&(K=JU.P3.new3(this.getPlotMinMax(h,!0,B[0]),this.getPlotMinMax(e,!0,B[1]),this.getPlotMinMax(p,!0,B[2])));JU.Logger.info("plot min/max: "+H+" "+K);q=s=null;if(d){q=JU.P3.new3(1,1,1);s=new JU.P3;s.ave(K,H);q.sub2(K,H);q.set(q.x/200,q.y/200,q.z/200);
JS.T.tokAttr(B[0],1094713344)?(q.x=1,s.x=0):0.1<q.x&&10>=q.x&&(q.x=1);JS.T.tokAttr(B[1],1094713344)?(q.y=1,s.y=0):0.1<q.y&&10>=q.y&&(q.y=1);JS.T.tokAttr(B[2],1094713344)?(q.z=1,s.z=0):0.1<q.z&&10>=q.z&&(q.z=1);if(null==y[2]||null==y[1])s.z=H.z=K.z=q.z=0;for(a=0;a<h.length;a++)h[a]=(h[a]-s.x)/q.x;if(null!=y[1])for(a=0;a<e.length;a++)e[a]=(e[a]-s.y)/q.y;if(null!=y[2])for(a=0;a<p.length;a++)p[a]=(p[a]-s.z)/q.z}s=D(-1,[r,h,e,p,H,K,q,s,w,g])}if(134221856==j)return this.vwr.writeFileData(n,"PLOT_"+u,b,
s);d=u.equals("data")?"1 0 H 0 0 0 # Jmol PDB-encoded data":this.vwr.getPdbData(b,u,null,s,null,!0);if(134222350==j)return d;JU.Logger.debugging&&JU.Logger.debug(d);if(135176==j)return c.runScript(d),"";j=this.vwr.fm.getFileInfo();n=this.vwr.getBoolean(603979792);this.vwr.g.appendNew=!0;d=null!=d&&null==this.vwr.openStringInlineParamsAppend(d,null,!0);this.vwr.g.appendNew=n;this.vwr.fm.setFileInfo(j);if(!d)return"";j=this.vwr.ms.mc;this.vwr.ms.setJmolDataFrame(k,b,j-1);1715472409!=G&&(k+=";\n"+z);
k=this.vwr.addStateScript(k,!0,!1);d=150;switch(G){default:b="frame 0.0; frame last; reset;select visible;wireframe only;";d=10;break;case 1715472409:this.vwr.setFrameTitle(j-1,u+" plot for model "+this.vwr.getModelNumberDotted(b));b="frame 0.0; frame last; reset;select visible; spacefill 3.0; wireframe 0;draw plotAxisX"+j+' {100 -100 -100} {-100 -100 -100} "'+y[0]+'";draw plotAxisY'+j+' {-100 100 -100} {-100 -100 -100} "'+y[1]+'";';null!=y[2]&&(b+="draw plotAxisZ"+j+' {-100 -100 100} {-100 -100 -100} "'+
y[2]+'";');break;case 4138:this.vwr.setFrameTitle(j-1,"ramachandran plot for model "+this.vwr.getModelNumberDotted(b));b="frame 0.0; frame last; reset;select visible; color structure; spacefill 3.0; wireframe 0;draw ramaAxisX"+j+' {100 0 0} {-100 0 0} "phi";draw ramaAxisY'+j+' {0 100 0} {0 -100 0} "psi";';break;case 134221850:case 136314895:this.vwr.setFrameTitle(j-1,u.$replace("w"," ")+f+" for model "+this.vwr.getModelNumberDotted(b)),b=JU.C.getHexCode(this.vwr.cm.colixBackgroundContrast),b="frame 0.0; frame last; reset;select visible; wireframe 0; spacefill 3.0; isosurface quatSphere"+
j+" color "+b+" sphere 100.0 mesh nofill frontonly translucent 0.8;draw quatAxis"+j+'X {100 0 0} {-100 0 0} color red "x";draw quatAxis'+j+'Y {0 100 0} {0 -100 0} color green "y";draw quatAxis'+j+'Z {0 0 100} {0 0 -100} color blue "z";color structure;draw quatCenter'+j+"{0 0 0} scale 0.02;"}c.runScript(b+z);k.setModelIndex(this.vwr.am.cmi);this.vwr.setRotationRadius(d,!0);c.sm.loadShape(31);this.showString("frame "+this.vwr.getModelNumberDotted(j-1)+(0<u.length?" created: "+u+(l?f:""):""));return""},
"~A");l(m,"polyhedra",function(){var a=this.e,c=1==this.slen,b=!1,e=c,f=!1,d=!1,h=!1,j=NaN,g=0;a.sm.loadShape(21);this.setShapeProperty(21,"init",Boolean.TRUE);var n=3.4028235E38,p=-1,q=P(-1,[-2147483648]),s=-1,k=0,l=null,m=0,x=null,u=!1,y=null,B=null;if(2==this.slen&&1073742001==this.tokAt(1))this.chk||a.showStringPrint(this.getShapeProperty(21,"list"),!1);else{for(var r=1;r<this.slen;++r){var z=null,y=null;switch(this.getToken(r).tok){case 1073742197:j=NaN;case 1073741872:a=1073742197==this.e.theTok?
-1:2==this.tokAt(r+1)?this.intParameter(++r):1;this.chk||J.api.Interface.getInterface("JU.BZone",this.vwr,"script").createBZ(this.vwr,a,null,!1,x,j,m,l);return;case 6:z="info";y=this.e.theToken.getMap();e=!0;break;case 134217751:z="points";y=Float.$valueOf(1073742334==this.tokAt(++r)?0:this.e.floatParameter(r));u=!0;break;case 536875059:j=this.floatParameter(++r);u=!0;continue;case 1814695966:null!=x&&this.invArg();z="unitCell";y=Boolean.TRUE;e=!0;break;case 1073742072:this.e.restrictSelected(!1,
!1),a.theTok=1073742335;case 1073742335:case 12291:case 1073742334:(r+1!=this.slen||e||1<g)&&this.error(18);z=1073742334==a.theTok?"off":1073742335==a.theTok?"on":"delete";f=!0;break;case 7:(null==x||e)&&this.invArg();e=!0;y=this.getIntArray2(r);B=this.getAllPoints(a.iToken+1,3);r=a.iToken;O(B[0],"JM.Atom")&&this.setShapeProperty(21,"model",Integer.$valueOf(B[0].getModelIndex()));z="definedFaces";y=D(-1,[y,B]);break;case 1073741961:z="full";break;case 2:null!=x&&this.invArg();z="nVertices";y=Integer.$valueOf(this.intParameter(r));
e=!0;268436992==this.tokAt(r+1)&&r++;break;case 1677721602:null!=x&&this.invArg();0<g&&this.invPO();e=!0;z="bonds";c=!0;break;case 1073741852:-1!=p&&this.invArg(),p=0,r--;case 1665140738:r++;case 3:null!=x&&this.invArg();0<g&&this.invPO();z=0>=p?"radius":"radius1";y=Float.$valueOf(p=0==p?0:this.floatParameter(r));e=!0;break;case 1073742066:this.isFloatParameter(r+1)?m=this.floatParameter(++r):(l=this.e.centerParameter(++r,null),r=a.iToken);u=!0;continue;case 1073741937:this.setShapeProperty(21,"collapsed",
null);case 1073742099:case 1073741924:z=JS.T.nameOf(a.theTok);switch(this.tokAt(r+1)){case 268440324:case 268436992:r++}y=Float.$valueOf(this.floatParameter(++r));break;case 1094717454:null==x&&this.invArg();z="model";y=Integer.$valueOf(this.intParameter(++r));break;case 1073742170:(1<g||null!=x&&!b||s==r)&&this.invPO();g=3;a.isAtomExpression(++r)?(z=e||b?"to":"toBitSet",y=this.atomExpressionAt(r)):a.isArrayParameter(r)?(z="toVertices",y=a.getPointArray(r,-1,!1)):this.error(19);r=a.iToken;e=!0;break;
case 12290:case 10:case 1073742325:d&&this.invPO();switch(++g){case 1:null!=x&&this.invArg();z="centers";break;case 2:z="to";e=!0;break;default:a.bad()}y=this.atomExpressionAt(r);k=r=a.iToken;e=(new Boolean(e|r+1==this.slen)).valueOf();break;case 1765808134:case 603979967:case 1073742074:k==r-1&&(e=!0);n=this.getColorTrans(a,r,!0,q);r=a.iToken;continue;case 1073741948:case 1073741886:k==r-1&&(e=!0);d&&this.error(18);d=!0;z=1073741886==this.e.theTok?"collapsed":null;e&&this.isFloatParameter(r+1)&&
this.setShapeProperty(21,"faceCenterOffset",Float.$valueOf(this.floatParameter(++r)));break;case 1073742044:case 1073741933:case 1073741956:case 1073741934:k==r-1&&(e=!0);h&&this.error(18);u=h=!0;z=JS.T.nameOf(a.theTok);break;case 1073742182:case 1073742060:case 1073741861:case 1073741958:case 1073741964:continue;case 1073741974:case 268441089:case 1073741824:case 4:if(!a.isColorParam(r)){1!=r&&this.invPO();x=1073741974==a.theTok?this.stringParameter(++r):a.optParameterAsString(r);268441089==this.tokAt(r+
1)&&(x+=this.paramAsStr(++r));this.setShapeProperty(21,"thisID",x);this.setShapeProperty(21,"model",Integer.$valueOf(this.vwr.am.cmi));if(!a.isCenterParameter(r+1))continue;z="center";y=this.centerParameter(++r);r=a.iToken;b=!0;break}default:if(a.isColorParam(r)){k==r-1&&(e=!0);q[0]=a.getArgbParam(r);a.isCenterParameter(r)&&(s=a.iToken+1);r=a.iToken;continue}this.invArg()}null!=z&&this.setShapeProperty(21,z,y);if(f)return}e?(!d&&c&&this.setShapeProperty(21,"bonds",null),this.setShapeProperty(21,"generate",
null)):u||this.error(19);null!=l&&this.setShapeProperty(21,"offset",l);Float.isNaN(j)||this.setShapeProperty(21,"scale",Float.$valueOf(j));-2147483648!=q[0]&&this.setShapeProperty(21,"colorThis",Integer.$valueOf(q[0]));3.4028235E38!=n&&a.setShapeTranslucency(21,"","translucentThis",n,null);this.setShapeProperty(21,"init",Boolean.FALSE)}});l(m,"write",function(a){var c=this.e,b=1,e=1,f=null,d=null,h=null,j=null,g="SPT",n=!0,p=!1,q=!1;null==a?(a=this.st,p=this.vwr.isApplet&&!this.vwr.isSignedApplet||
!this.vwr.haveAccess(JV.Viewer.ACCESS.ALL)||0<this.vwr.fm.getPathForAllFiles().length):(b=e=0,n=!1,p=!n);var s=JS.CmdExt.tokAtArray(b,a);if(4==s&&!n){var k=JS.T.getTokenFromName(JS.SV.sValue(a[0]).toLowerCase());null!=k&&(s=k.tok)}switch(s){case 0:break;case 134221850:case 4138:case 1715472409:return d=this.plot(a),p?d:this.writeMsg(d);case 134222850:c.isArrayParameter(b+1)&&(f=c.stringParameterSet(++b),j=h=".",e=b=c.iToken+1,s=this.tokAt(b));break;default:g=JS.SV.sValue(this.tokenAt(b,a)).toUpperCase()}var l=
this.vwr.getExportDriverList(),k=null,m=n?this.slen:a.length,x="",u=null,y=!1,B=null,r=0,z=null,D=!1,K=null,w=-1,G=-1,E=!1,v=null,F=-2147483648;0!=s&&(n&&1<this.slen&&1073741848==this.tokAt(this.slen-2))&&(g=this.paramAsStr(this.slen-1).toUpperCase(),e=m,m-=2,s=0);switch(s){case 15:case 6:g="VAR";B=this.tokenAt(b++,a);break;case 1073741984:g="INLINE";k=JS.SV.sValue(this.tokenAt(++b,a));b++;break;case 1275068447:g="PGRP";b++;x=JS.SV.sValue(this.tokenAt(b,a)).toLowerCase();x.equals("draw")&&b++;break;
case 1073742329:b++;D=!0;break;case 1073742158:case 134222850:for(u=JS.SV.sValue(this.tokenAt(++b,a)).toLowerCase();u.equals("localpath")||u.equals("remotepath");)u.equals("localpath")?h=JS.SV.sValue(this.tokenAt(++b,a)):j=JS.SV.sValue(this.tokenAt(++b,a)),u=JS.SV.sValue(this.tokenAt(++b,a)).toLowerCase();g="SPT";break;case 1228935687:case 134320141:case 1610616855:case 135180:case 1073742015:case 1073742018:case 1073877011:case 1073877010:case 135188:b++;break;case 1073741991:g="ZIPALL";b++;break;
case 36868:g="VAR";b+=2;break;case 1073741929:case 4115:case 4120:case 1073742062:case 1073742139:case 4166:case 1073741824:case 4:switch(s){case 4115:b+1<m&&1073742325==a[++b].tok||10==a[b].tok?(u=c.atomExpression(a,b,0,!0,!1,null,!0),b=c.iToken+1):u=this.vwr.getAllAtoms();this.chk||(K=this.vwr.ms.getModelBS(u,!0));break;case 1073741929:s=4120,y=!0;case 4120:g="IMAGE";b++;break;case 1073742139:u=JS.SV.sValue(this.tokenAt(++b,a)).toUpperCase();JU.PT.isOneOf(u,";PNG;PNGJ;")?(z=u,b++):z="PNG";break;
case 4166:r=c.intParameterRange(++b,1,10);if(2147483647==r)return"";this.chk||(this.vwr.tm.setVibrationPeriod(0),c.isJS||c.delayScript(100));b++;break;default:s=4120}if(4120==s&&b<a.length)if(s=JS.T.getTokenFromName(JS.SV.sValue(a[b]).toLowerCase()),null!=s&&(g=JS.SV.sValue(s).toUpperCase()),JU.PT.isOneOf(g,l.toUpperCase())){b++;g=g.substring(0,1).toUpperCase()+g.substring(1).toLowerCase();E=!0;n&&(v="Jmol."+g.toLowerCase());break}else if(JU.PT.isOneOf(g,";ZIP;ZIPALL;SPT;STATE;")){b++;break}else g=
"IMAGE";2==JS.CmdExt.tokAtArray(b,a)&&(w=JS.SV.iValue(this.tokenAt(b++,a)),0>=w&&this.invArg(),G=JS.SV.iValue(this.tokenAt(b++,a)),0>=G&&this.invArg())}if(e<m){u=JS.SV.sValue(this.tokenAt(b,a));if(u.equalsIgnoreCase("clipboard")){if(this.chk)return""}else JU.PT.isOneOf(u.toLowerCase(),";jpg;jpeg;jpg64;jpeg64;gif;gift;pdf;ppm;png;pngj;pngt;")?(2==JS.CmdExt.tokAtArray(b+1,a)&&2==JS.CmdExt.tokAtArray(b+2,a)&&(w=JS.SV.iValue(this.tokenAt(++b,a)),0>=w&&this.invArg(),G=JS.SV.iValue(this.tokenAt(++b,a)),
0>=G&&this.invArg()),2==JS.CmdExt.tokAtArray(b+1,a)&&(F=JS.SV.iValue(this.tokenAt(++b,a)))):JU.PT.isOneOf(u.toLowerCase(),";xyz;xyzrn;xyzvib;mol;mol67;sdf;v2000;v3000;json;pdb;pqr;cml;cif;cifp1;pwmat;pwslab;qcjson;xsf;")&&(g=u.toUpperCase(),b+1==m&&b++);g.equals("IMAGE")&&JU.PT.isOneOf(u.toLowerCase(),";jpg;jpeg;jpg64;jpeg64;gif;gift;pdf;ppm;png;pngj;pngt;scene;")&&(g=u.toUpperCase(),F=-2147483648,b++)}b+2==m&&JS.SV.sValue(this.tokenAt(++b,a));switch(JS.CmdExt.tokAtArray(b,a)){case 0:p=!0;break;case 1073741884:break;
case 805307393:v=g.equals("IMAGE")?"?jmol.png":"?jmol."+g.toLowerCase();break;case 1073741824:case 4:v=JS.SV.sValue(this.tokenAt(b,a));if(v.equalsIgnoreCase("clipboard")||!this.vwr.haveAccess(JV.Viewer.ACCESS.ALL))v=null;break;default:this.invArg()}if(g.equals("IMAGE")||g.equals("FRAME")||g.equals("VIBRATION"))g=null!=v&&0<=v.indexOf(".")?v.substring(v.lastIndexOf(".")+1).toUpperCase():"JPG";if(g.equals("ISOSURFACE")||g.equals("CONTACT"))q=g.equals("CONTACT"),g=null!=v&&0<=v.indexOf(".")?v.substring(v.lastIndexOf(".")+
1).toUpperCase():"JVXL",g.equals("PMESH")?g="ISOMESH":g.equals("PMB")&&(g="ISOMESHBIN");s=JU.PT.isOneOf(g.toLowerCase(),";jpg;jpeg;jpg64;jpeg64;gif;gift;pdf;ppm;png;pngj;pngt;scene;");if(!s&&(g.equals("MNU")?g="MENU":g.equals("WRL")||g.equals("VRML")?(g="Vrml",E=!0):g.equals("X3D")?(g="X3d",E=!0):g.equals("STL")?(g="Stl",E=!0):g.equals("IDTF")?(g="Idtf",E=!0):g.equals("MA")?(g="Maya",E=!0):g.equals("JS")?(g="Js",E=!0):g.equals("OBJ")?(g="Obj",E=!0):g.equals("JVXL")?g="ISOSURFACE":g.equals("XJVXL")?
g="ISOSURFACE":g.equals("JMOL")?g="ZIPALL":g.equals("HIS")&&(g="HISTORY"),g.equals("COORD")||g.equals("COORDS")))g=null!=v&&0<=v.indexOf(".")?v.substring(v.lastIndexOf(".")+1).toUpperCase():"XYZ";null!=f&&(JV.FileManager.isJmolType(g)||this.invArg(),g.equals("PNG")&&(g="PNGJ"));!s&&(!E&&!JU.PT.isOneOf(g,";SCENE;JMOL;ZIP;ZIPALL;SPT;HISTORY;MO;NBO;ISOSURFACE;MESH;PMESH;PMB;ISOMESHBIN;ISOMESH;VAR;FILE;FUNCTION;CFI;CIF;CIFP1;CML;JSON;XYZ;XYZRN;XYZVIB;MENU;MOL;MOL67;PDB;PGRP;PQR;PWMAT;PWSLAB;QUAT;RAMA;SDF;V2000;V3000;QCJSON;XSF;INLINE;"))&&
c.errorStr2(54,"COORDS|FILE|FUNCTIONS|HISTORY|IMAGE|INLINE|ISOSURFACE|JMOL|MENU|MO|NBO|POINTGROUP|QUATERNION [w,x,y,z] [derivative]|RAMACHANDRAN|SPT|STATE|VAR x|ZIP|ZIPALL|CLIPBOARD","CIF|CIFP1|CML|CFI|GIF|GIFT|JPG|JPG64|JMOL|JVXL|MESH|MOL|PDB|PMESH|PNG|PNGJ|PNGT|PPM|PQR|PWMAT|PWSLAB|SDF|CD|JSON|QCJSON|V2000|V3000|SPT|XJVXL|XSF|XYZ|XYZRN|XYZVIB|ZIP"+l.toUpperCase().$replace(";","|"));if(this.chk)return"";var b=Array(1),C,e=this.vwr.getBoolean(603979934);if(E){e&&JU.Logger.startTimer("export");d=new java.util.Hashtable;
d.put("type",g);null!=v&&d.put("fileName",v);(n||null!=v)&&d.put("fullPath",b);d.put("width",Integer.$valueOf(w));d.put("height",Integer.$valueOf(G));k=this.vwr.generateOutputForExport(d);if(null==k||0==k.length)return"";if(p)return k;if(!g.equals("Povray")&&!g.equals("Idtf")||null==b[0])return this.writeMsg(k);d=g.equals("Idtf")?".tex":".ini";v=b[0]+d;C=new java.util.Hashtable;C.put("fileName",v);C.put("type",d);C.put("text",k);C.put("fullPath",b);d=this.vwr.processWriteOrCapture(C);g.equals("Idtf")&&
(k=k.substring(0,k.indexOf("\\begin{comment}")));k="Created "+b[0]+":\n\n"+k;e&&this.showString(JU.Logger.getTimerMsg("export",0));null!=d&&((g=!d.startsWith("OK"))&&c.evalError(d,null),c.report(k,g));return""}E=null;l=!1;if(null==k){k=g.intern();if("MENU"===k)k=this.vwr.getMenu("");else if("PGRP"===k)k=this.vwr.ms.getPointGroupAsString(this.vwr.bsA(),null,0,1,null,null,x.equals("draw")?"":null);else if("PDB"===k||"PQR"===k)p?k=this.vwr.getPdbAtomData(null,null,"PQR"===k,D):(l=!0,g="PDB_"+k+"-coord "+
D);else if("FILE"===k)"?".equals(v)&&(v="?Jmol."+this.vwr.getP("_fileType")),p?k=this.e.getCurrentModelFileAsString(null):l=!0;else if(JU.PT.isOneOf(k,";CIF;CIFP1;SDF;MOL;MOL67;V2000;V3000;CD;JSON;XYZ;XYZRN;XYZVIB;CML;QCJSON;PWMAT;PWSLAB;XSF;")){a=this.vwr.bsA();this.vwr.setErrorMessage(null," ("+a.cardinality()+" atoms)");k=this.vwr.getModelExtract(a,D,!1,k);d=this.vwr.getErrorMessageUn();this.vwr.setErrorMessage(null,null);if(0<=this.vwr.am.cmi&&!a.equals(C=this.vwr.getModelUndeletedAtomsBitSet(this.vwr.am.cmi)))d+=
"\nNote! Selected atom set "+a+" is not the same as the current model "+C;k.startsWith("ERROR:")&&(E=k)}else if("CFI"===k)k=this.vwr.getModelFileData("selected","cfi",!1);else if("FUNCTION"===k)k=this.vwr.getFunctionCalls(null),g="TXT";else if("VAR"===k)null==B&&(B=c.getParameter(JS.SV.sValue(this.tokenAt(n?2:1,a)),1073742190,!0)),a=null,15==B.tok?(a=new JU.Lst,a.addLast(B.value.data)):6==B.tok&&(a=null==v?new JU.Lst:this.prepareBinaryOutput(B)),null==a?(k=B.asString(),g="TXT"):null!=v&&(C=new java.util.Hashtable,
C.put("data",a),null==(E=k=this.vwr.createZip(v,1==a.size()||v.endsWith(".png")||v.endsWith(".pngj")?"BINARY":"ZIPDATA",C))&&c.evalError("#CANCELED#",null));else if("SPT"===k)if(D)C=this.vwr.ms.getTaintedAtoms(2),this.vwr.setAtomCoordsRelative(JU.P3.new3(0,0,0),null),k=this.vwr.getStateInfo(),this.vwr.ms.setTaintedAtoms(C,2);else{if(k=this.vwr.getStateInfo(),null!=h||null!=j)k=JV.FileManager.setScriptFileReferences(k,h,j,null)}else"ZIP"===k||"ZIPALL"===k?null!=v&&(C=new java.util.Hashtable,null!=
f&&C.put("data",f),null==(E=k=this.vwr.createZip(v,g,C))&&c.evalError("#CANCELED#",null)):"HISTORY"===k?(k=this.vwr.getSetHistory(2147483647),g="SPT"):"MO"===k||"NBO"===k?(k=this.getMoJvxl(2147483647,"NBO"===k),g="XJVXL"):"PMESH"===k||"PMB"===k?(null==(k=this.getIsosurfaceJvxl(29,k))&&this.error(31),g="XJVXL"):"ISOMESH"===k?(null==(k=this.getIsosurfaceJvxl(24,k))&&this.error(31),g="PMESH"):"ISOMESHBIN"===k?(null==(E=this.getIsosurfaceJvxl(24,"ISOMESHBIN"))&&this.error(31),g="PMB"):"ISOSURFACE"===
k||"MESH"===k?(null==(k=this.getIsosurfaceJvxl(q?25:24,k))&&this.error(31),g=0<=k.indexOf("<?xml")?"XJVXL":"JVXL",p||this.showString(this.getShapeProperty(q?25:24,"jvxlFileInfo"))):(n&&(p&&null==v)&&(p=!1,v="\u0001"),null==z&&0>F&&(F=-1));null==k&&(k="")}if(!n)return k;if(p)return c.showStringPrint(k,!0),"";if(null!=E&&"string"==typeof E)return this.writeMsg(E);if(l)return this.writeMsg(this.vwr.writeFileData(v,g,0,null));if(g.equals("SCENE"))E=z;else if(null==E&&(!s||null!=v))E=k;e&&JU.Logger.startTimer("write");
s&&(c.refresh(!1),0>w&&(w=y?250:this.vwr.getScreenWidth()),0>G&&(G=y?250:this.vwr.getScreenHeight()));C=new java.util.Hashtable;null!=v&&C.put("fileName",v);C.put("backgroundColor",Integer.$valueOf(this.vwr.getBackgroundArgb()));C.put("type",g);if(y){C.put("is2D",Boolean.TRUE);var I,c="smiles could not be generated";try{if(I=this.vwr.getOpenSmiles(null),0<I.length){var N=this.vwr.setLoadFormat(!0,"_"+I,"2",!1),N=N+("?width="+w+"&height="+G+"&format="+g.toLowerCase());this.showString(N);c=this.vwr.fm.getFileAsBytes(N,
null)}}catch(L){if(!S(L,Exception))throw L;}if("string"==typeof c)return this.showString(c),null;E=c}"string"==typeof E&&-2147483648==F?C.put("text",E):O(E,Array)&&C.put("bytes",E);null!=f&&C.put("scripts",f);null!=K&&C.put("bsFrames",K);C.put("fullPath",b);C.put("quality",Integer.$valueOf(F));C.put("width",Integer.$valueOf(w));C.put("height",Integer.$valueOf(G));C.put("nVibes",Integer.$valueOf(r));c=this.vwr.processWriteOrCapture(C);null==c&&(c="canceled");s&&c.startsWith("OK")&&(c+="; width="+w+
"; height="+G);e&&this.showString(JU.Logger.getTimerMsg("write",0));return this.writeMsg(c+(null==d?"":d))},"~A");l(m,"prepareBinaryOutput",function(a){var c=a.getMap();if(null==c||!c.containsKey("$_BINARY_$"))return null;a=new JU.Lst;for(var b,c=c.entrySet().iterator();c.hasNext()&&((b=c.next())||1);){var e=b.getKey();if(!e.equals("$_BINARY_$")){var f=b.getValue(),d=15==f.tok?f.value.data:null;null==d&&(f=f.asString(),d=f.startsWith(";base64,")?JU.Base64.decodeBase64(f):f.getBytes());if(e.equals("_DATA_")){a=
new JU.Lst;a.addLast(d);break}else e.equals("_IMAGE_")?(a.add(0,e),a.add(1,null),a.add(2,d)):(a.addLast(e),a.addLast(null),a.addLast(d))}}return a},"JS.SV");l(m,"writeMsg",function(a){if(this.chk||null==a)return"";var c=!a.startsWith("OK");c&&(this.e.evalError(a,null),alert(a));this.e.report(a,c);return a},"~S");l(m,"show",function(){var a=this.e,c=null,b=this.paramAsStr(1),e=null,f=0;3<this.slen&&268441088==this.tokAt(this.slen-3)&&268439040==this.tokAt(this.slen-2)?(e="!/"+this.paramAsStr(this.slen-
1),this.slen-=3,f=3):2<this.slen&&268441088==this.tokAt(this.slen-2)?(e="/"+this.paramAsStr(this.slen-1),this.slen-=2,f=2):0==(e=this.paramAsStr(this.slen-1)).lastIndexOf("/")?(this.slen--,f=1):e=null;var d=null,h=null,j=2,g=this.getToken(1),h=O(g,"JS.SV")&&1073741824!=g.tok?0:g.tok;4==h&&(g=JS.T.getTokenFromName(b.toLowerCase()),null!=g&&(h=g.tok));1296041985!=h&&(1073742158!=h&&1715472409!=h&&1228935687!=h)&&this.checkLength(-3);2==this.slen&&0<=b.indexOf("?")&&(d=this.vwr.getAllSettings(b.substring(0,
b.indexOf("?"))),h=-1);switch(h){case 0:this.chk||(d=a.theToken.escape());break;case 603984065:this.chk||(d=this.vwr.stm.getUndoInfo());break;case 1073741925:a.checkLength23();j=this.st.length;this.chk||(d=this.vwr.getModelInfo("domains"),d=O(d,"JS.SV")?this.vwr.getAnnotationInfo(d,a.optParameterAsString(2),1073741925):"domain information has not been loaded");break;case 1715472409:d=this.plot(this.st);j=this.st.length;break;case 1073742189:a.checkLength23();j=this.st.length;this.chk||(d=this.vwr.getModelInfo("validation"),
d=O(d,"JS.SV")?this.vwr.getAnnotationInfo(d,a.optParameterAsString(2),1073742189):"validation information has not been loaded");break;case 134221829:this.chk||(d=JU.Escape.e(this.vwr.fm.cacheList()));break;case 1111490587:a.checkLength23();j=this.st.length;this.chk||(d=this.vwr.getModelInfo("dssr"),d=null==d?"no DSSR information has been read":2<j?JS.SV.getVariable(this.vwr.extractProperty(d,this.stringParameter(2),-1)).asString():""+JS.SV.getVariable(d).asString());break;case 1073741915:h=2;3==this.slen?
h=I(this.floatParameter((j=3)-1)):this.checkLength(2+f);this.chk||(d=this.vwr.calculateStructures(null,!0,!1,h));break;case 545259572:this.checkLength(2+f);this.chk||(d=this.vwr.fm.getPathForAllFiles());break;case 1275203608:if(!this.chk){var n=Array(2);this.vwr.shm.getShapePropertyData(21,"allInfo",n);d=JS.SV.getVariable(n[1]).asString()}break;case 1073742038:this.chk||this.vwr.getNMRPredict(a.optParameterAsString(2));return;case 603983903:!this.chk&&3==this.slen&&(d=""+this.vwr.getModelkitPropertySafely(a.stringParameter(2)),
j=3);break;case 1275068433:case 1073741978:case 1073741929:case 1073741879:case 134218757:this.checkLength((1073741879==h||134218757==h&&1073742335==this.tokAt(2)?j=3:2)+f);if(this.chk)return;var p=a.optParameterAsString(2);1073741879==h&&("mf".equals(p)&&(p="formula"),"formula".equals(p)&&(d=this.vwr.getModelInfo("formula"),null!=d&&(d=JU.PT.rep(d," ",""))));if(null==d){try{switch(h){case 1275068433:d=this.vwr.getInchi(this.vwr.bsA(),null,null);null==d&&(d="?");break;case 1073741978:d=this.vwr.getInchi(this.vwr.bsA(),
null,"key");break;case 134218757:p.equalsIgnoreCase("true")?(d=this.vwr.getBioSmiles(null),e=null):null!=e&&(d=this.vwr.getSmilesOpt(null,-1,-1,1,e+"///"),e=null);break;default:d=this.vwr.ms.getModelDataBaseName(this.vwr.bsA()),d=null!=d&&(d.startsWith("$")||d.startsWith(":"))?d.substring(1):null}null==d&&(n=JU.Logger.getLogLevel(),JU.Logger.setLogLevel(4),d=134218757==h?this.vwr.getSmiles(null):this.vwr.getOpenSmiles(null),JU.Logger.setLogLevel(n))}catch(q){if(S(q,Exception))d=q.getMessage(),null==
d&&(d=""),q.printStackTrace();else throw q;}switch(h){case 1073741929:if(0<d.length){this.vwr.fm.loadImage(this.vwr.setLoadFormat(!1,"_"+d,"2",!1),"\u0001"+d,!1);return}d="Could not show drawing -- Either insufficient atoms are selected or the model is a PDB file.";break;case 1073741879:j=3,0<d.length?(d=this.vwr.getChemicalInfo(d,p,this.vwr.bsA()),0<=d.indexOf("FileNotFound")&&(d="?")):d="Could not show name -- Either insufficient atoms are selected or the model is a PDB file."}}break;case 134217764:case 1296041985:d=
"";n=null;if(2==(j=this.slen)){if(this.chk)break;n=this.vwr.getSymTemp().getSpaceGroupInfo(this.vwr.ms,null,-1,!1,null)}else if(134217764==h){n=this.paramAsStr(2);j=3;if(this.chk)break;n=this.vwr.getSymTemp().getSpaceGroupInfo(this.vwr.ms,JU.PT.rep(n,"''",'"'),-1,!1,null)}if(null!=n){d=(134217764==h?""+n.get("spaceGroupInfo")+n.get("spaceGroupNote"):"")+(n.containsKey("symmetryInfo")?n.get("symmetryInfo"):"");break}var h=2==this.tokAt(2)?this.intParameter(2):0,n=4==this.tokAt(2)||12==this.tokAt(2)?
this.paramAsStr(2):null,g=p=null,l=-1;if(3<this.slen&&4!=this.tokAt(3)){j=D(-1,[null,this.vwr.getFrameAtoms()]);p=a.centerParameter(2+(0==h?0:1),j);if(null!=j[0]&&j[0].isEmpty()){j=this.slen;break}j[0]=null;g=a.centerParameter(++a.iToken,j);if(null!=j[0]&&j[0].isEmpty()){j=this.slen;break}0==h&&2==this.tokAt(a.iToken+1)&&(l=a.getToken(++a.iToken).intValue)}var k=1<a.iToken&&4==this.tokAt(a.iToken+1)?this.stringParameter(++a.iToken):null;this.checkLength((j=++a.iToken)+f);this.chk||(d=this.vwr.getSymmetryInfo(this.vwr.getAllAtoms().nextSetBit(0),
n,h,null,p,g,0,k,0,l,0,null),d=null==d?"":O(d,"java.util.Map")?JS.SV.getVariable(d).asString():d.toString());break;case 1648363544:h=null;2<this.slen&&(j=this.slen,h=J.c.VDW.getVdwType(this.paramAsStr(2)),null==h&&this.invArg());this.chk||(d=this.vwr.getDefaultVdwNameOrData(0,h,null));break;case 134320141:a.checkLength23();j=this.slen;h=a.optParameterAsString(2);if(null==e&&0<=(p=h.indexOf("/")))e=h.substring(p+1),h=h.substring(0,p);this.chk||(d=this.vwr.getFunctionCalls(h));break;case 36867:this.checkLength(2+
f);this.chk||(d=this.vwr.getAllSettings(null));break;case 1073742166:d=this.vwr.getFrameTitle();break;case 1073742184:2==this.slen?this.chk||this.vwr.showUrl(a.getFullPathName(!1)):(h=this.paramAsStr(2),this.chk||this.vwr.showUrl(h));return;case 1765808134:b="defaultColorScheme";break;case 1610612740:b="scaleAngstromsPerInch";break;case 134221850:case 4138:if(this.chk)return;0>this.vwr.am.cmi&&a.errorStr(30,"show "+a.theToken.value);d=this.plot(this.st);j=this.slen;break;case 14:case 1112152078:this.chk||
(d=this.getContext(!1));break;case 1073741888:h=a.optParameterAsString(2);0<h.length&&(j=3);this.chk||(c=this.vwr.cm.getColorSchemeList(h));break;case 1073742192:this.chk||(d=this.vwr.getAtomDefs(this.vwr.definedAtomSets)+this.vwr.g.getVariableList()+this.getContext(!0));break;case 536870926:this.chk||(d=this.vwr.getTrajectoryState());break;case 553648144:c=""+JS.ScriptEval.commandHistoryLevelMax;break;case 553648148:c=""+JU.Logger.getLogLevel();break;case 603979825:c=""+this.vwr.getBoolean(603979825);
break;case 553648178:d="set strandCountForStrands "+this.vwr.getStrandCount(12)+"; set strandCountForMeshRibbon "+this.vwr.getStrandCount(13);break;case 536875070:d=this.vwr.showTimeout(2==(j=this.slen)?null:this.paramAsStr(2));break;case 536870918:c=JU.Escape.eP(this.vwr.getDefaultLattice());break;case 4126:this.chk||(d=this.vwr.getMinimizationInfo());break;case 1611272194:switch(this.vwr.g.axesMode){case 603979808:d="set axesUnitcell";break;case 603979804:d="set axesMolecular";break;default:d="set axesWindow"}break;
case 1610612737:d="set bondMode "+(this.vwr.getBoolean(603979812)?"OR":"AND");break;case 1649022989:this.chk||(d="set strandCountForStrands "+this.vwr.getStrandCount(12)+"; set strandCountForMeshRibbon "+this.vwr.getStrandCount(13));break;case 1613238294:d="set hbondsBackbone "+this.vwr.getBoolean(603979852)+";set hbondsSolid "+this.vwr.getBoolean(603979854);break;case 1611141175:this.chk||(d=this.vwr.getSpinState());break;case 1611141176:d="set ssbondsBackbone "+this.vwr.getBoolean(603979952);break;
case 1610625028:case 1611141172:d="selectionHalos "+(this.vwr.getSelectionHalosEnabled()?"ON":"OFF");break;case 1612709894:d="set selectHetero "+this.vwr.getBoolean(1612709894);break;case 1073741828:d=JU.Escape.eAP(this.vwr.getAdditionalHydrogens(null,null,768));break;case 1612709900:d="set selectHydrogens "+this.vwr.getBoolean(1612709900);break;case 553648130:case 553648138:case 536870924:case 553648176:case 553648172:case 1073741995:this.chk||(d=this.vwr.getLightingState());break;case 1073742136:case 4146:this.chk||
(d=this.vwr.stm.listSavedStates());break;case 1814695966:this.chk||(d=this.vwr.getUnitCellInfoText());break;case 1073742329:if(2==(j=this.slen)){this.chk||(d=this.vwr.getCoordinateState(this.vwr.bsA()));break}h=this.paramAsStr(2);this.chk||(d=this.vwr.stm.getSavedCoordinates(h));break;case 1073742158:!this.chk&&(null==a.outputBuffer&&null==e)&&this.vwr.sm.clearConsole();if(2==(j=this.slen)){this.chk||(d=this.vwr.getStateInfo());break}if(null!=e&&3==this.slen){this.chk||(d=this.vwr.getStateInfo());
break}else if(1228935687==this.tokAt(2)&&4==(j=this.slen)){this.chk||(d=this.vwr.fm.getEmbeddedFileState(this.paramAsStr(3),!0,"state.spt"));break}j=3;h=this.paramAsStr(2);this.chk||(d=this.vwr.stm.getSavedState(h));break;case 1639976963:if(2==(j=this.slen)){this.chk||(d=this.vwr.ms.getProteinStructureState(this.vwr.bsA(),134222350));break}h=this.paramAsStr(2);this.chk||(d=this.vwr.stm.getSavedStructure(h));break;case 134221834:h=3==(j=this.slen)?this.paramAsStr(2):null;this.chk||(d=this.vwr.getDataObj(h,
null,-2),d=null==d?"no data":JU.Escape.encapsulateData(d[0],d[1],d[3].intValue()));break;case 1073742330:j=3;d=a.setObjectProperty();break;case 1812599299:this.chk||(d=this.vwr.ms.getBoundBoxCommand(!0));break;case 12289:this.chk||(d="center "+JU.Escape.eP(this.vwr.tm.fixedRotationCenter));break;case 135176:this.chk||(d=this.getShapeProperty(22,"command"));break;case 1228935687:if(2==this.slen){this.chk||(null==e&&this.vwr.sm.clearConsole(),d=this.e.getCurrentModelFileAsString(null));null==d&&(d=
"<unavailable>");break}j=3;c=this.paramAsStr(2);this.chk||(null==e&&this.vwr.sm.clearConsole(),d=this.vwr.getFileAsString3(c,!0,null));break;case 4115:d=1073742327==this.tokAt(2)&&0<(j=3)?this.vwr.getModelFileInfoAll():this.vwr.getModelFileInfo();break;case 1610616855:h=2==(j=this.slen)?2147483647:this.intParameter(2);1>h&&this.invArg();this.chk||(this.vwr.sm.clearConsole(),0==a.scriptLevel&&this.vwr.removeCommand(),d=this.vwr.getSetHistory(h));break;case 135180:this.chk||(d=this.getShapeProperty(24,
"jvxlDataXml"));break;case 1073877011:case 1073877010:a.optParameterAsString(2).equalsIgnoreCase("list")?(this.e.sm.loadShape(27),d=this.chk?"":this.getShapeProperty(27,"list -1"),j=3):(n=2==(j=this.slen)?-2147483648:this.intParameter(2),this.chk||(d=this.getMoJvxl(n,1073877011==h)));break;case 1094717454:this.chk||(d=this.vwr.ms.getModelInfoAsString());break;case 537006096:this.chk||(d=this.vwr.getMeasurementInfoAsString());break;case 1073741864:j=3;!this.chk&&this.slen==j&&(d=this.paramAsStr(2),
d=this.vwr.getOrientation(JS.T.getTokFromName(d.equals("box")?"volume":d.equals("rotation")?"best":d),"best",null,null).toString());break;case 1073742132:h=this.tokAt(2),0==h?h=1073742132:j=3;case 1073742178:case 4129:this.chk||(d=this.vwr.getOrientation(h,null,null,null).toString());break;case 1073742077:j=2;if(3<this.slen)break;switch(h=this.tokAt(2)){case 1073742178:case 1073742132:case 4129:case 0:this.chk||(d=this.vwr.getOrientation(h,null,null,null).toString());break;default:h=a.optParameterAsString(2),
d=this.vwr.getOrientation(1073742034,h,null,null).toString()}j=this.slen;break;case 1073742088:this.chk||(d=this.vwr.ms.getPDBHeader(this.vwr.am.cmi));break;case 1275068447:h=a.optParameterAsString(2);0==h.length&&(h=null);j=this.slen;this.chk||(d=this.vwr.ms.getPointGroupAsString(this.vwr.bsA(),"show:"+h,0,0,null,null,null));break;case 1088421903:this.chk||(d=this.vwr.ms.getSymmetryInfoAsString());break;case 1073742176:this.chk||(d="transform:\n"+this.vwr.tm.matrixRotate.toString());break;case 4168:d=
"zoom "+(this.vwr.tm.zoomEnabled?""+this.vwr.tm.getZoomSetting():"off");break;case 1611272202:d=this.vwr.getShowFrank()?"frank ON":"frank OFF";break;case 1665140738:b="solventProbeRadius";break;case 1086324744:if(3==(j=this.slen)&&1073742334==this.tokAt(2))h=1086324743;case 1073741863:case 1086326788:case 1073742120:case 1113589787:case 1086324742:case 1153433601:case 1073741982:this.chk||(d=this.vwr.getChimeInfo(h));break;case 537022465:case 1610612738:case 20482:case 1612709912:c="?";break;case 1073742030:h=
2==(j=this.slen)?null:this.paramAsStr(2);this.chk||(d=this.vwr.getBindingInfo(h));break;case 1073742015:this.chk||(c=this.vwr.getMenu(""));break;case 1073741824:b.equalsIgnoreCase("fileHeader")&&(this.chk||(d=this.vwr.ms.getPDBHeader(this.vwr.am.cmi)));break;case 1073741992:case 36868:b=this.paramAsStr(j++),n=a.getParameter(b,1073742190,!0),this.chk||(d=1073741992==h?n.toJSON():n.escape())}this.checkLength(j+f);this.chk||(null!=d?this.showString(this.filterShow(d,e)):null!=c?this.showString(b+" = "+
c):null!=b&&(0<=b.indexOf(" ")?this.showString(b):this.showString(b+" = "+a.getParameter(b,1073742190,!0).escape())))});l(m,"filterShow",function(a,c){if(null==c)return a;var b=c.startsWith("!/");c=c.substring(b?2:1).toLowerCase();for(var e=JU.PT.split(a,"\n"),f=new JU.SB,d=0;d<e.length;d++)0>e[d].toLowerCase().indexOf(c)==b&&f.append(e[d]).appendC("\n");return f.toString()},"~S,~S");l(m,"stereo",function(){for(var a=J.c.STER.DOUBLE,c=-5,b=!1,e=null,f=0,d=1;d<this.slen;++d)if(this.e.isColorParam(d))1<
f&&this.e.bad(),0==f&&(e=P(2,0)),b||(c=3),e[f]=this.e.getArgbParam(d),0==f++&&(e[1]=~e[0]),d=this.e.iToken;else switch(this.getToken(d).tok){case 1073742335:this.e.checkLast(this.e.iToken=1);this.e.iToken=1;break;case 1073742334:this.e.checkLast(this.e.iToken=1);a=J.c.STER.NONE;break;case 2:case 3:c=this.floatParameter(d);b=!0;break;case 1073741824:if(b||(c=3),a=J.c.STER.getStereoMode(this.paramAsStr(d)),null!=a)break;default:this.invArg()}this.chk||this.vwr.setStereoMode(e,a,c)});l(m,"struts",function(){var a=
this.e,c=1073742072==this.tokAt(1)||1073742335==this.tokAt(1)||1==this.slen,b=a.getMadParameter();if(2147483647==b)return!1;c&&(b=Math.round(2E3*this.vwr.getFloat(570425406)));this.setShapeProperty(1,"type",Integer.$valueOf(32768));a.setShapeSizeBs(1,b,null);this.setShapeProperty(1,"type",Integer.$valueOf(1023));return!0});l(m,"unitcell",function(a,c){var b=this.e,e=2147483647,f=2147483647,d=null,h=b.tickParamAsStr(a,!0,!1,!1);a=b.iToken;var j=null,g=null,n=null,p=null,q=f=!1,l=this.chk?null:this.vwr.getCurrentUnitCell(),
k=this.tokAt(++a);switch(k){case 4142:case 4141:q=!0;d=JU.P4.new4(0,0,0,-1);b.iToken++;break;case 2097180:f=b.hklParameter(a+1,null,!1);k=b.getPointOrPlane(a+1,7);a=b.iToken;var m=NaN;this.isFloatParameter(a+1)&&(m=this.floatParameter(++a),268441090==this.tokAt(a+1)&&(m=-m/100,a++));var t=NaN,x=!1;this.isFloatParameter(a+1)&&(t=this.floatParameter(++a),268441090==this.tokAt(a+1)&&(x=!0,a++));var u=1073742172==this.tokAt(a+1);u&&a++;b.iToken=a;if(this.chk)break;O(k,"JU.P3")?k=JU.P4.new4(k.x,k.y,k.z,
0):Float.isNaN(t)&&(t=k.w);var g=this.getUVBoxFromHKL(l,k,f),p=new JU.P3,y=new JU.V3;JU.Measure.getPlaneProjection(new JU.P3,f,p,y);0<m?(g[3].normalize(),g[3].scale(m)):0>m&&g[3].scale(-m);!Float.isNaN(t)&&0!=t&&(x&&(t=t/100*g[3].length()),g[0].scaleAdd2(t,y,g[0]));u&&g[0].scaleAdd2(-g[3].length(),y,g[0]);p="surface"+I(k.x)+I(k.y)+I(k.z);break;case 536875059:case 1073742163:d=536875059==k?b.getPointOrPlane(++a,19):b.checkHKL(b.getFractionalPoint(++a));a=b.iToken;if(this.chk)break;g=l.getUnitCellVectors();
g[1].scale(Math.abs(d.x));g[2].scale(Math.abs(d.y));g[3].scale(Math.abs(d.z));d=null;p="supercell";break;case 1073741938:d=b.getFractionalPoint(++a);a=b.iToken;if(this.chk)break;d=JU.SimpleUnitCell.ptToIJK(b.checkHKL(d),1);break;case 135180:case 1073742330:j=b.objectNameParameter(++a);break;case 1812599299:b.iToken=a;if(this.chk)break;g=JU.P3.newP(this.vwr.getBoundBoxCenter());d=this.vwr.getBoundBoxCornerVector();g.sub(d);g=D(-1,[g,JU.P3.new3(2*d.x,0,0),JU.P3.new3(0,2*d.y,0),JU.P3.new3(0,0,2*d.z)]);
d=null;break;case 1073742176:12!=this.tokAt(++a)&&this.invArg();if(this.chk)break;n=D(-1,[this.getToken(a).value]);break;case 11:case 12:n=this.getToken(a).value;break;case 12289:switch(this.tokAt(++a)){case 12290:case 10:case 1073742325:d=this.vwr.ms.getAtomSetCenter(this.atomExpressionAt(a));a=b.iToken;if(this.chk)break;this.vwr.toFractional(d,!0);break;default:if(b.isCenterParameter(a)){d=this.centerParameter(a);a=b.iToken;break}this.invArg()}d.x-=0.5;d.y-=0.5;d.z-=0.5;break;case 12290:case 10:case 1073742325:f=
this.atomExpressionAt(a).nextSetBit(0);a=b.iToken;this.chk||this.vwr.am.setUnitCellAtomIndex(f);if(0>f)return;break;case 1073742066:if(f=!0,b.isAtomExpression(a+1)){d=b.centerParameter(++a,null);a=b.iToken;if(this.chk)break;this.vwr.toFractional(d,!1);break}case 1073742114:d=b.getFractionalPoint(++a);if(O(d,"JU.P4"))f&&this.invArg();else{a=b.iToken;if(this.chk)break;d=!f&&555>d.x?JU.SimpleUnitCell.ptToIJK(b.checkHKL(d),1):JU.P4.new4(d.x,d.y,d.z,f?1:0)}break;case 3:case 2:if(111>this.floatParameter(a)){a--;
break}e=this.intParameter(a);break;case 4:case 1073741824:m=this.paramAsStr(a).toLowerCase();if(m.equals("rhombohedral")){if(null!=l&&0==l.getUnitCellInfoType(7))return;m="2/3a+1/3b+1/3c,-1/3a+1/3b+1/3c,-1/3a-2/3b+1/3c"}else if(m.equals("trigonal")){if(null!=l&&0==l.getUnitCellInfoType(8))return;m="a-b,b-c,a+b+c"}p=m;if(0<=m.indexOf(",")||this.chk){n=m;break}f=null;this.vwr.setModelCagePts(-1,null,null);n=this.vwr.getModelInfo("unitcell_conventional");k=null!=this.vwr.getModelInfo("isprimitive");
if(JU.PT.isOneOf(p,";parent;standard;primitive;")){if(null==n&&k){this.showString("Cannot convert unit cell when file data is primitive and have no lattice information");return}p.equals("primitive")&&4==this.tokAt(a+1)&&(f=this.paramAsStr(++a).toUpperCase())}O(n,Array)&&(g=n);null==f&&(f=this.vwr.getModelInfo("latticeType"));null!=n&&this.vwr.setModelCagePts(-1,this.vwr.getV0abc(-1,n),""+n);if(!p.equals("conventional"))if(this.setShapeProperty(34,"labels",null),m=this.vwr.getModelInfo("unitcell_"+
p),null==m){if((m=p.equals("primitive"))||p.equals("reciprocal")){t=this.slen==a+1?1:2==this.tokAt(a+1)?3.141592653589793*this.intParameter(++a):this.floatParameter(++a);p=(null==l?"":l.getSpaceGroupName()+" ")+p;g=null==l?D(-1,[JU.P3.new3(0,0,0),JU.P3.new3(1,0,0),JU.P3.new3(0,1,0),JU.P3.new3(0,0,1)]):l.getUnitCellVectors();null==f&&(f=this.vwr.getSymmetryInfo(this.vwr.getFrameAtoms().nextSetBit(0),null,0,null,null,null,1073741994,null,0,-1,0,null));null==l&&(l=this.vwr.getSymTemp());k||l.toFromPrimitive(!0,
0==f.length?"P":f.charAt(0),g,this.vwr.getCurrentModelAuxInfo().get("primitiveToCrystal"));m||JU.SimpleUnitCell.getReciprocal(g,g,t);break}}else p=m,0<=m.indexOf(",")&&(n=m);break;default:if(b.isArrayParameter(a)){b.ignoreError=!0;try{n=b.floatParameterSet(a,6,6)}catch(B){if(!S(B,Exception))throw B;}b.ignoreError=!1;null==n&&(g=b.getPointArray(a,4,!1));a=b.iToken}else this.slen>a+1?(d=b.getFractionalPoint(a),a=b.iToken):a--}f=b.getSetAxesTypeMad10(++a);b.checkLast(b.iToken);if(!(this.chk||2147483647==
f)){2147483647==f&&this.vwr.am.setUnitCellAtomIndex(-1);null==g&&null!=n&&(g=this.vwr.getV0abc(-1,n));if(2147483647!=e)JM.ModelSet.setUnitCellOffset(l,null,e);else if(null!=j)this.vwr.setCurrentCage(j);else if(q||null!=g){e=c?l:null;if(null!=e){if(j=this.vwr.getFrameAtoms(),n=j.cardinality(),q=0==n,!q){n=Array(n);l=this.vwr.ms.at;k=j.nextSetBit(0);for(m=0;0<=k;k=j.nextSetBit(k+1),m++)n[m]=JU.P3.newP(l[k]),this.vwr.toFractionalUC(e,n[m],!1);this.vwr.setModelCagePts(-1,g,p);e=this.vwr.getCurrentUnitCell();
k=j.nextSetBit(0);for(m=0;0<=k;k=j.nextSetBit(k+1),m++)l[k].setT(n[m]),this.vwr.toCartesianUC(e,l[k],!1);this.vwr.ms.setTaintedAtoms(j,2)}}else q=!0;q&&this.vwr.setModelCagePts(-1,g,p)}b.setObjectMad10(33,"unitCell",f);null!=d&&JM.ModelSet.setUnitCellOffset(this.vwr.getCurrentUnitCell(),d,0);null!=h&&this.setShapeProperty(33,"tickInfo",h);null!=p&&this.showString(p+(null==g?"":" "+JU.Escape.e(g)))}},"~N,~B");l(m,"getUVBoxFromHKL",function(a,c,b){var e=I(c.x),f=I(c.y),d=I(c.z);for((0==e&&0==f&&0==
d||e!=c.x||f!=c.y||d!=c.z)&&this.invArg();0==e%2&&0==f%2&&0==d%2;)e/=2,f/=2,d/=2;c=a.getUnitCellVectors();for(var h=b.w,j=JU.P4.new4(b.x,b.y,b.z,0),g=Math.max(Math.max(e,f),d),g=JU.Measure.getLatticePoints(a.getLatticeCentering(),g,g,g),n=g.size();0<=--n;)a.toCartesian(g.get(n),!0);for(var g=JU.Measure.getPointsOnPlane(g.toArray(Array(g.size())),j),j=new JU.P3,n=-179,l=3.4028235E38,m=3.4028235E38,s=a=null,k=n,A=3.4028235E38,t,x,u,y,B=g.size();0<=--B;){var r=g.get(B);t=r.length();u=!1;if(!(0.01>t||
null!=a&&(k=Math.abs(JU.Measure.computeTorsion(a,j,b,r,!0)))>-n))if(y=1>k,null==a)a=r,l=t;else{if(t<l-0.01)u=!0,k=A=3.4028235E38;else if(t<m-0.01)A=3.4028235E38;else if(!(t>=m+0.01))continue;u||(x=89<k)&&t<l+0.1&&-0.01<=r.x&&0.01>=r.y&&(3.4028235E38==A||89>A)?(y?(s=null,m=3.4028235E38):(s=a,m=l),a=r,l=t,!u&&k<A&&(A=k)):x&&t<m+0.1&&(s=r,m=t,k<A&&(A=k))}}null==a&&this.invArg();x=null;if(null==s)for(B=g.size();0<=--B;)r=g.get(B),k=JU.Measure.computeTorsion(a,j,b,r,!0),-89.9>k&&k>n+0.01&&(n=k,x=r);else k=
JU.Measure.computeTorsion(a,j,b,s,!0),1<k?(x=a,a=s):x=s;null==x&&this.invArg();c[1]=x;c[2]=a;b=1==((0>e?1:0)+(0>f?1:0)+(0>d?1:0))%2;g=c[3];j=JU.P3.newP(x);n=JU.P3.newP(a);0==e&&0==f?(n.scale(-1),j.scale(-1),c[1]=j,c[2]=n):!(0==e&&0==d)&&(0==f&&0==d)&&(j.scale(-1),n.scale(-1),c[1]=n,c[2]=j);b&&(j=c[1],c[1]=c[2],c[2]=j);g.cross(a,x);g.normalize();g.scale(h);return c},"J.api.SymmetryInterface,JU.P4,JU.P4");l(m,"modelkit",function(){var a=0,c=this.tokAt(1);switch(c){case 603984065:case 4139:this.chk&&
this.e.cmdUndoRedo(603984065==c?4165:4140);return;case 1073742334:if(2==this.slen&&null==this.vwr.getModelkitPropertySafely("exists"))return;case 0:case 1073742335:this.chk||this.vwr.setBooleanProperty("modelkitmode",1073742334!=c);if(0==this.tokAt(a+1))return;a=++this.e.iToken;break;case 4126:0>this.vwr.am.cmi&&this.e.errorStr(30,"MODELKIT MINIMIZE");this.minimize(!0);return;case 528432:case 4145:this.e.cmdRotate(!1,!0);return;case 4098:++this.e.iToken;case 134217764:case 4106:case 12291:case 1275069441:case 4129:case 1073742080:this.assign();
return;case 4130:++this.e.iToken;this.mutate();return}for(var b=this.vwr.getModelkit(!1);0!=(c=this.tokAt(++a));){var e=this.paramAsStr(a).toLowerCase(),f=null;switch(c){case 1073742335:case 1073742334:this.chk||(this.vwr.setBooleanProperty("modelkitmode",1073742335==c),1073742334==c&&this.vwr.setStringProperty("picking","identify"));continue;case 1610625028:case 12294:e="hidden";f=Boolean.$valueOf(1610625028!=c);break;case 12293:var e="constraint",f="",d=c=null,h=null;switch(this.tokAt(++a)){case 1073742334:case 1073742333:this.chk||
this.vwr.setBooleanProperty("dragPicking",!1);break;case 135198:c=this.e.getPoint3f(++a,!0,!0);a=this.e.iToken;d=this.e.getPoint3f(++a,!0,!0);f=null;break;case 134219777:h=this.e.hklParameter(++a,null,!0);f=null;break;case 134217750:h=this.e.planeParameter(++a,!1);f=null;break;default:this.invArg()}null==f?((null==c||null==d)==(null==h)&&this.invArg(),f=D(-1,[c,d,h])):f=null;a=this.e.iToken;break;case 36867:e=this.paramAsStr(++a);f=0==this.tokAt(++a)?"true":this.paramAsStr(a);break;case 1296041985:switch(this.tokAt(++a)){case 4:case 1073742333:f=
this.paramAsStr(a);break;case 12:f=this.getToken(a).value;break;case 2:f=Integer.$valueOf(this.getToken(a).intValue);break;default:this.e.isCenterParameter(a)?(e="center",f=this.e.centerParameter(a,null),a=this.e.iToken):this.invArg()}break;case 1073742066:if(f=this.paramAsStr(a+1),f.equals("none")){++a;break}case 134217751:case 12289:f=this.e.atomCenterOrCoordinateParameter(++a,null);a=this.e.iToken;break;case 1073742024:f=this.paramAsStr(++a).toLowerCase();this.vwr.isModelKitOption("M",f)||this.invArg();
break;case 1814695966:f=this.paramAsStr(++a).toLowerCase();if(!this.vwr.isModelKitOption("U",f)){this.unitcell(2,!0);return}break;case 1088421903:f=this.paramAsStr(++a).toLowerCase();this.vwr.isModelKitOption("S",f)||this.invArg();break;default:if(this.vwr.isModelKitOption("B",e)){f=Boolean.$valueOf(0==(c=this.tokAt(++a))||1073742335==c);break}if(this.vwr.isModelKitOption("M",e)){f=e;e="mode";break}if(this.vwr.isModelKitOption("U",e)){f=e;e="unitcell";break}this.invArg()}!this.chk&&(null!=f&&null!=
(f=b.setProperty(e,f))&&"hidden"!==e&&!b.isHidden())&&this.vwr.showString("modelkit "+e+" "+f.toString(),!1)}});l(m,"assign",function(){var a=1073742335==this.tokAt(this.slen-1),c=++this.e.iToken,b=this.tokAt(c),e=-1,f=-1,d=1153433601==b,h=1677721602==b,j=4106==b,g=12291==b,n=1275069441==b,m=4129==b,l=134217764==b,s=1073742080==b,k=null;d||h||j||l||g||m||n||s?c++:b=1153433601;0>this.vwr.am.cmi&&this.invArg();var A=this.vwr.getThisModelAtoms(),t=null;if(h){if(2==this.tokAt(c))e=this.e.intParameter(c);
else if(O(this.getToken(c).value,"JM.BondSet"))e=this.getToken(c).value.nextSetBit(0);else switch(t=this.expFor(c,A),e=t.nextSetBit(0),t.cardinality()){case 1:t=this.expFor(++this.e.iToken,A),f=t.nextSetBit(0),0>f&&this.invArg(),t.set(e);case 2:t=this.vwr.ms.getBondsForSelectedAtoms(t,!1);t.isEmpty()?(j=!0,b=4106):e=t.nextSetBit(0);break;default:this.invArg()}c=++this.e.iToken}else if(1073742080==b)t=A;else if(!(1153433601==b&&4==this.tokAt(c)||1275069441==b))if(!l||this.e.isAtomExpression(c)){t=
this.expFor(c,A);e=t.nextSetBit(0);if(0>e)return;c=++this.e.iToken}var x=h=null,u=null;if(n)switch(this.e.isAtomExpression(c)?(t=this.expFor(++this.e.iToken,A),c=this.e.iToken,h=this.e.optParameterAsString(c+1),h.toLowerCase().equals("packed")&&(s=!0,h="")):h=this.e.optParameterAsString(c),this.e.isPoint3f(this.e.iToken+1)?x=this.getPoint3f(++this.e.iToken,!0):this.e.isArrayParameter(this.e.iToken+1)&&(k=this.e.getPointArray(this.e.iToken+1,-1,!1)),0==h.length&&(h=null),this.tokAt(this.e.iToken+1)){case 1073742080:s=
!0;++this.e.iToken;break;case 1086324754:++this.e.iToken,u=this.paramAsStr(++this.e.iToken),c=u.equalsIgnoreCase("general")?"G":1<u.length||0==u.length?"\x00":u.charAt(0),("a">c&&"A"!=c&&"G"!=c||"z"<c)&&this.invArg(),"packed".equals(this.e.optParameterAsString(this.e.iToken+1))&&(s=!0,++this.e.iToken)}else m?this.e.isArrayParameter(c)?k=this.e.getPointArray(c,-1,!1):x=this.getPoint3f(c,!0):l?(h=this.e.optParameterAsString(c),1073742080==this.tokAt(this.e.iToken+1)&&(s=!0,++this.e.iToken)):j?!g&&0>
f&&(t=this.expFor(c,A),f=t.nextSetBit(0),h=this.e.optParameterAsString(++this.e.iToken)):(h=this.e.optParameterAsString(c),d&&(x=++this.e.iToken<(a?this.slen-1:this.slen)?this.centerParameter(this.e.iToken):null));if(!this.chk)switch(this.vwr.pushState(),b){case 1153433601:this.e.clearDefinedVariableAtomSets();this.vwr.getModelkit(!1).cmdAssignAtom(e,x,h,this.e.fullCommand,a);break;case 1677721602:this.vwr.getModelkit(!1).cmdAssignBond(e,(h+"-").charAt(0),this.e.fullCommand);break;case 4106:this.vwr.getModelkit(!1).cmdAssignConnect(e,
f,(h+"1").charAt(0),this.e.fullCommand);break;case 1073742080:h=null;case 1275069441:case 1086324754:null==x&&(null==t&&null==k&&null==u)&&this.invArg();null==k&&null!=x&&(k=D(-1,[x]));s=this.vwr.getModelkit(!1).cmdAssignAddAtoms(h+(null!=u?":"+u:""),k,t,s?"packed":"",this.e.fullCommand,a);this.e.doReport()&&this.e.report(J.i18n.GT.i(J.i18n.GT.$("{0} atoms added"),s),!1);break;case 12291:s=this.vwr.getModelkit(!1).cmdAssignDeleteAtoms(t);this.e.doReport()&&this.e.report(J.i18n.GT.i(J.i18n.GT.$("{0} atoms deleted"),
s),!1);break;case 4129:s=this.vwr.getModelkit(!1).cmdAssignMoveAtoms(t,null,null,e,x,k,!0);0<s&&this.vwr.checkCoordinatesChanged();this.e.doReport()&&this.e.report(J.i18n.GT.i(J.i18n.GT.$("{0} atoms moved"),s),!1);break;case 134217764:a=this.vwr.assignSpaceGroup(t,h),this.e.doReport()&&this.e.showString(a),s&&!a.endsWith("!")&&(s=this.vwr.getModelkit(!1).cmdAssignAddAtoms(null,null,A,"packed",this.e.fullCommand,!1),this.e.doReport()&&this.e.report(J.i18n.GT.i(J.i18n.GT.$("{0} atoms added"),s),!1))}});
l(m,"expFor",function(a,c){var b=JU.BS.copy(this.atomExpressionAt(a));b.and(c);return b},"~N,JU.BS");l(m,"getContext",function(a){for(var c=new JU.SB,b=this.e.thisContext;null!=b;)a?null!=b.vars&&(c.append(this.getScriptID(b)),c.append(JV.StateManager.getVariableList(b.vars,80,!0,!1))):c.append(JS.ScriptError.getErrorLineMessage(b.functionName,b.scriptFileName,this.e.getLinenumber(b),b.pc,JS.ScriptEval.statementAsString(this.vwr,b.statement,-9999,this.e.debugHigh))),b=b.parentContext;a?null!=this.e.contextVariables&&
(c.append(this.getScriptID(null)),c.append(JV.StateManager.getVariableList(this.e.contextVariables,80,!0,!1))):c.append(this.e.getErrorLineMessage2());return c.toString()},"~B");l(m,"getIsosurfaceJvxl",function(a,c){return this.chk?"":this.getShapeProperty(a,"PMESH"===c||"MESH"===c?"jvxlMeshX":"ISOMESH"===c?"pmesh":"ISOMESHBIN"===c||"PMB"===c?"pmeshbin":"jvxlDataXml")},"~N,~S");l(m,"getMoJvxl",function(a,c){var b=c?28:27;this.e.sm.loadShape(b);var e=this.vwr.am.cmi;0>e&&this.e.errorStr(30,"show/write MO/NBO");
var f=this.vwr.ms.getInfo(e,"moData");null==f&&this.error(27);var d=this.getShapeProperty(b,"moNumber");(null==d||0==d.intValue())&&this.setShapeProperty(b,"init",Integer.$valueOf(e));this.setShapeProperty(b,"moData",f);return this.e.sm.getShapePropertyIndex(b,"showMO",a)},"~N,~B");l(m,"getScriptID",function(a){return"\n# "+(null==a?this.e.functionName:"function "+a.functionName)+" (file "+(null==a?this.e.scriptFileName:a.scriptFileName)+(null==a?"":" context "+a.id)+")\n"},"JS.ScriptContext");l(m,
"tokenAt",function(a,c){return a<c.length?c[a]:null},"~N,~A");m.tokAtArray=l(m,"tokAtArray",function(a,c){return a<c.length&&null!=c[a]?c[a].tok:0},"~N,~A");l(m,"getPlotMinMax",function(a,c,b){if(null==a)return 0;switch(b){case 1111490568:case 1111490569:case 1111490570:return c?180:-180;case 1111490565:case 1111490576:return c?360:0;case 1111490574:return c?1:-1}b=c?-1E10:1E10;for(var e=a.length;0<=--e;){var f=a[e];Float.isNaN(f)||c==f>b&&(b=f)}return b},"~A,~B,~N");l(m,"parseDataArray",function(a,
c){a=JU.Parser.fixDataString(a);var b=JU.Parser.markLines(a,"\n"),e=b.length;if(!c){for(var f=JU.AU.newFloat2(e),d=0,h=0;d<e;h=b[d++])h=JU.PT.getTokens(a.substring(h,b[d])),JU.PT.parseFloatArrayData(h,f[d]=R(h.length,0));return f}h=JU.PT.getTokens(a.substring(0,b[0]));if(3!=h.length)return R(0,0,0,0);var j=JU.PT.parseInt(h[0]),g=JU.PT.parseInt(h[1]),n=JU.PT.parseInt(h[2]);if(1>j||1>g||1>n)return R(1,1,1,0);for(var f=JU.AU.newFloat3(j,g),l=0,m=0,d=1,h=b[0];d<e&&l<j;h=b[d++])h=JU.PT.getTokens(a.substring(h,
b[d])),h.length<n||(JU.PT.parseFloatArrayData(h,f[l][m]=R(h.length,0)),++m==g&&(l++,m=0));return l!=j?(System.out.println("Error reading 3D data -- nX = "+j+", but only "+l+" blocks read"),R(1,1,1,0)):f},"~S,~B");l(m,"getBitsetPropertyFloat",function(a,c,b,e,f){c=null==b||1086325010==c||1111490843==c?this.e.getBitsetProperty(a,null,c,null,null,b,null,!1,2147483647,!1):this.vwr.getDataObj(b,a,1);if(null==c||!JU.AU.isAF(c))return null==a?null:R(a.cardinality(),0);if(!Float.isNaN(e))for(a=0;a<c.length;a++)c[a]<
e&&(c[a]=NaN);if(!Float.isNaN(f))for(a=0;a<c.length;a++)c[a]>f&&(c[a]=NaN);return c},"JU.BS,~N,~S,~N,~N");m.labeler=null})})(Clazz,Clazz.getClassName,Clazz.newLongArray,Clazz.doubleToByte,Clazz.doubleToInt,Clazz.doubleToLong,Clazz.declarePackage,Clazz.instanceOf,Clazz.load,Clazz.instantialize,Clazz.decorateAsClass,Clazz.floatToInt,Clazz.floatToLong,Clazz.makeConstructor,Clazz.defineEnumConstant,Clazz.exceptionOf,Clazz.newIntArray,Clazz.newFloatArray,Clazz.declareType,Clazz.prepareFields,Clazz.superConstructor,
Clazz.newByteArray,Clazz.declareInterface,Clazz.newShortArray,Clazz.innerTypeInstance,Clazz.isClassDefined,Clazz.prepareCallback,Clazz.newArray,Clazz.castNullAs,Clazz.floatToShort,Clazz.superCall,Clazz.decorateAsType,Clazz.newBooleanArray,Clazz.newCharArray,Clazz.implementOf,Clazz.newDoubleArray,Clazz.overrideConstructor,Clazz.clone,Clazz.doubleToShort,Clazz.getInheritedLevel,Clazz.getParamsType,Clazz.isAF,Clazz.isAB,Clazz.isAI,Clazz.isAS,Clazz.isASS,Clazz.isAP,Clazz.isAFloat,Clazz.isAII,Clazz.isAFF,
Clazz.isAFFF,Clazz.tryToSearchAndExecute,Clazz.getStackTrace,Clazz.inheritArgs,Clazz.alert,Clazz.defineMethod,Clazz.overrideMethod,Clazz.declareAnonymous,Clazz.cloneFinals);
