(function(G,H,I,K,F,L,p,D,r,q,s,M,N,v,O,y,m,w,x,u,E,z,P,Q,R,S,T,U,V,W,j,X,Y,Z,$,aa,ba,ca,t,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,d,l){p("JM");r(null,"JM.Minimizer","java.lang.Float java.util.Hashtable JU.AU $.BS $.Lst J.i18n.GT JM.MMConstraint $.MinAngle $.MinAtom $.MinBond $.MinTorsion $.MinimizationThread JM.FF.ForceFieldMMFF $.ForceFieldUFF JU.BSUtil $.Escape $.Logger".split(" "),function(){c$=s(function(){this.bonds=this.atoms=this.vwr=null;this.rawBondCount=0;this.bsMinFixed=
this.minPositions=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null;this.bondCount=this.ac=0;this.partialCharges=this.atomMap=null;this.steps=50;this.crit=0.001;this.units="kJ/mol";this.pFF=null;this.ff="UFF";this.constraints=this.bsFixed=this.bsFixedDefault=this.bsAtoms=this.bsSelected=this.bsTaint=null;this.isSilent=!1;this.constraintMap=null;this.elemnoMax=0;this.$minimizationOn=this.isQuick=!1;this.coordSaved=this.minimizationThread=null;q(this,arguments)},JM,"Minimizer");v(c$,
function(){});d(c$,"setProperty",function(a,b){switch("ff        cancel    clear     constraintfixed     stop      vwr    ".indexOf(a)){case 0:this.ff.equals(b)||(this.setProperty("clear",null),this.ff=b);break;case 10:this.stopMinimization(!1);break;case 20:null!=this.minAtoms&&(this.stopMinimization(!1),this.clear());break;case 30:this.addConstraint(b);break;case 40:this.bsFixedDefault=b;break;case 50:this.stopMinimization(!0);break;case 60:this.vwr=b}return this},"~S,~O");d(c$,"getProperty",function(a){return a.equals("log")?
null==this.pFF?"":this.pFF.getLogData():null},"~S,~N");d(c$,"addConstraint",function(a){if(null!=a){var b=a[0],c=b[0];if(0==c)this.constraints=null;else{a=a[1].doubleValue();null==this.constraints&&(this.constraints=new JU.Lst,this.constraintMap=new java.util.Hashtable);b[1]>b[c]&&(JU.AU.swapInt(b,1,c),4==c&&JU.AU.swapInt(b,2,3));var c=JU.Escape.eAI(b),e=this.constraintMap.get(c);null==e?(e=new JM.MMConstraint(b,a),this.constraintMap.put(c,e),this.constraints.addLast(e)):e.value=a}}},"~A");d(c$,"clear",
function(){this.setMinimizationOn(!1);this.bondCount=this.ac=0;this.bonds=this.atoms=null;this.rawBondCount=0;this.pFF=this.constraintMap=this.constraints=this.bsSelected=this.bsMinFixed=this.bsFixedDefault=this.bsFixed=this.bsAtoms=this.bsTaint=this.atomMap=this.coordSaved=this.partialCharges=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null});d(c$,"minimize",function(a,b,c,e,f,h){this.isSilent=1==(f&1);this.isQuick=0<=h.indexOf("2D")||4==(f&4);f=2==(f&2);var g;this.setEnergyUnits();
2147483647==a&&(g=this.vwr.getP("minimizationSteps"),null!=g&&D(g,Integer)&&(a=g.intValue()));this.steps=a;!f&&null!=this.bsFixedDefault&&e.and(this.bsFixedDefault);0>=b&&(g=this.vwr.getP("minimizationCriterion"),null!=g&&D(g,Float)&&(b=g.floatValue()));this.crit=Math.max(b,1E-4);if(this.$minimizationOn)return!1;f=this.pFF;this.getForceField(h);if(null==this.pFF)return JU.Logger.error(J.i18n.GT.o(J.i18n.GT.$("Could not get class for force field {0}"),h)),!1;JU.Logger.info("minimize: initializing "+
this.pFF.name+" (steps = "+a+" criterion = "+b+") ...");if(0>c.nextSetBit(0))return JU.Logger.error(J.i18n.GT.$("No atoms selected -- nothing to do!")),!1;this.atoms=this.vwr.ms.at;this.bsAtoms=JU.BSUtil.copy(c);for(b=this.bsAtoms.nextSetBit(0);0<=b;b=this.bsAtoms.nextSetBit(b+1))0==this.atoms[b].getElementNumber()&&this.bsAtoms.clear(b);null!=e&&this.bsAtoms.or(e);this.ac=this.bsAtoms.cardinality();b=JU.BSUtil.areEqual(c,this.bsSelected);this.bsSelected=c;null!=f&&this.pFF!==f&&(b=!1);b||this.pFF.clear();
if((!b||!JU.BSUtil.areEqual(e,this.bsFixed))&&!this.setupMinimization())return this.clear(),!1;0<a&&(this.bsTaint=JU.BSUtil.copy(this.bsAtoms),JU.BSUtil.andNot(this.bsTaint,e),this.vwr.ms.setTaintedAtoms(this.bsTaint,2));null!=e&&(this.bsFixed=e);this.setAtomPositions();if(null!=this.constraints)for(b=this.constraints.size();0<=--b;)this.constraints.get(b).set(a,this.bsAtoms,this.atomMap);this.pFF.setConstraints(this);0>=a?this.getEnergyOnly():this.isSilent||!this.vwr.useMinimizationThread()?this.minimizeWithoutThread():
this.setMinimizationOn(!0);return!0},"~N,~N,JU.BS,JU.BS,~N,~S");d(c$,"setEnergyUnits",function(){this.units=this.vwr.g.energyUnits.equalsIgnoreCase("kcal")?"kcal":"kJ"});d(c$,"setupMinimization",function(){this.coordSaved=null;this.atomMap=m(this.atoms.length,0);this.minAtoms=Array(this.ac);this.elemnoMax=0;for(var a=new JU.BS,b=this.bsAtoms.nextSetBit(0),c=0;0<=b;b=this.bsAtoms.nextSetBit(b+1),c++){var e=this.atoms[b];this.atomMap[b]=c;var f=this.atoms[b].getElementNumber();this.elemnoMax=Math.max(this.elemnoMax,
f);a.set(f);this.minAtoms[c]=new JM.MinAtom(c,e,t(-1,[e.x,e.y,e.z]),this.ac);this.minAtoms[c].sType=e.getAtomName()}JU.Logger.info(J.i18n.GT.i(J.i18n.GT.$("{0} atoms will be minimized."),this.ac));JU.Logger.info("minimize: getting bonds...");this.bonds=this.vwr.ms.bo;this.rawBondCount=this.vwr.ms.bondCount;this.getBonds();JU.Logger.info("minimize: getting angles...");this.getAngles();JU.Logger.info("minimize: getting torsions...");this.getTorsions();return this.setModel(a)});d(c$,"setModel",function(a){return!this.pFF.setModel(a,
this.elemnoMax)?(JU.Logger.error(J.i18n.GT.o(J.i18n.GT.$("could not setup force field {0}"),this.ff)),this.ff.startsWith("MMFF")?(this.getForceField("UFF"),this.setModel(a)):!1):!0},"JU.BS");d(c$,"setAtomPositions",function(){for(var a=0;a<this.ac;a++)this.minAtoms[a].set();this.bsMinFixed=null;if(null!=this.bsFixed){this.bsMinFixed=new JU.BS;for(var a=this.bsAtoms.nextSetBit(0),b=0;0<=a;a=this.bsAtoms.nextSetBit(a+1),b++)this.bsFixed.get(a)&&this.bsMinFixed.set(b)}});d(c$,"getBonds",function(){var a=
new JU.Lst;this.bondCount=0;for(var b,c,e=0;e<this.rawBondCount;e++){var f=this.bonds[e];if(this.bsAtoms.get(b=f.atom1.i)&&this.bsAtoms.get(c=f.atom2.i)){if(c<b){var h=b;b=c;c=h}f=f.getCovalentOrder();switch(f){case 0:continue;case 1:case 2:case 3:break;case 515:f=5;break;default:f=1}a.addLast(new JM.MinBond(e,this.bondCount++,this.atomMap[b],this.atomMap[c],f,0,null))}}this.minBonds=Array(this.bondCount);for(e=0;e<this.bondCount;e++)f=this.minBonds[e]=a.get(e),b=f.data[0],c=f.data[1],this.minAtoms[b].addBond(f,
c),this.minAtoms[c].addBond(f,b);for(e=0;e<this.ac;e++)this.minAtoms[e].getBondedAtomIndexes()});d(c$,"getAngles",function(){for(var a=new JU.Lst,b,c,e=0;e<this.bondCount;e++){b=this.minBonds[e];var f=b.data[0],h=b.data[1];if(1<this.minAtoms[h].nBonds){b=this.minAtoms[h].getBondedAtomIndexes();for(var g=b.length;0<=--g;)if((c=b[g])>f)a.addLast(new JM.MinAngle(m(-1,[f,h,c,e,this.minAtoms[h].getBondIndex(g)]))),this.minAtoms[f].bsVdw.clear(c)}if(1<this.minAtoms[f].nBonds){b=this.minAtoms[f].getBondedAtomIndexes();
for(g=b.length;0<=--g;)if((c=b[g])<h&&c>f)a.addLast(new JM.MinAngle(m(-1,[c,f,h,this.minAtoms[f].getBondIndex(g),e]))),this.minAtoms[c].bsVdw.clear(h)}}this.minAngles=a.toArray(Array(a.size()));JU.Logger.info(this.minAngles.length+" angles")});d(c$,"getTorsions",function(){for(var a=new JU.Lst,b,c=this.minAngles.length;0<=--c;){var e=this.minAngles[c].data,f=e[0],h=e[1],g=e[2],d;if(g>h&&1<this.minAtoms[g].nBonds){d=this.minAtoms[g].getBondedAtomIndexes();for(var n=0;n<d.length;n++)b=d[n],b!=f&&b!=
h&&(a.addLast(new JM.MinTorsion(m(-1,[f,h,g,b,e[3],e[4],this.minAtoms[g].getBondIndex(n)]))),this.minAtoms[Math.min(f,b)].bs14.set(Math.max(f,b)))}if(f>h&&1!=this.minAtoms[f].nBonds){d=this.minAtoms[f].getBondedAtomIndexes();for(n=0;n<d.length;n++)b=d[n],b!=g&&b!=h&&(a.addLast(new JM.MinTorsion(m(-1,[g,h,f,b,e[4],e[3],this.minAtoms[f].getBondIndex(n)]))),this.minAtoms[Math.min(g,b)].bs14.set(Math.max(g,b)))}}this.minTorsions=a.toArray(Array(a.size()));JU.Logger.info(this.minTorsions.length+" torsions")});
d(c$,"getForceField",function(a){a.startsWith("MMFF")&&(a="MMFF");if(null==this.pFF||!a.equals(this.ff)||0<=this.pFF.name.indexOf("2D")!=this.isQuick)a.equals("MMFF")?this.pFF=new JM.FF.ForceFieldMMFF(this,this.isQuick):(this.pFF=new JM.FF.ForceFieldUFF(this,this.isQuick),a="UFF"),this.ff=a,this.isQuick||this.vwr.setStringProperty("_minimizationForceField",a);return this.pFF},"~S");d(c$,"minimizationOn",function(){return this.$minimizationOn});d(c$,"getThread",function(){return this.minimizationThread});
d(c$,"setMinimizationOn",function(a){(this.$minimizationOn=a)?null==this.minimizationThread&&(this.minimizationThread=new JM.MinimizationThread,this.minimizationThread.setManager(this,this.vwr,null),this.minimizationThread.start()):null!=this.minimizationThread&&(this.minimizationThread=null)},"~B");d(c$,"getEnergyOnly",function(){null==this.pFF||null==this.vwr||(this.pFF.steepestDescentInitialize(this.steps,this.crit),this.vwr.setFloatProperty("_minimizationEnergyDiff",0),this.reportEnergy(),this.vwr.setStringProperty("_minimizationStatus",
"calculate"),this.vwr.notifyMinimizationStatus())});d(c$,"reportEnergy",function(){this.vwr.setFloatProperty("_minimizationEnergy",this.pFF.toUserUnits(this.pFF.getEnergy()))});d(c$,"startMinimization",function(){try{JU.Logger.info("minimizer: startMinimization"),this.vwr.setIntProperty("_minimizationStep",0),this.vwr.setStringProperty("_minimizationStatus","starting"),this.vwr.setFloatProperty("_minimizationEnergy",0),this.vwr.setFloatProperty("_minimizationEnergyDiff",0),this.vwr.notifyMinimizationStatus(),
this.vwr.stm.saveCoordinates("minimize",this.bsTaint),this.pFF.steepestDescentInitialize(this.steps,this.crit),this.reportEnergy(),this.saveCoordinates()}catch(a){if(y(a,Exception))return JU.Logger.error("minimization error vwr="+this.vwr+" pFF = "+this.pFF),!1;throw a;}return this.$minimizationOn=!0});d(c$,"stepMinimization",function(){if(!this.$minimizationOn)return!1;var a=!this.isSilent&&this.vwr.getBooleanProperty("minimizationRefresh");this.vwr.setStringProperty("_minimizationStatus","running");
var b=this.pFF.steepestDescentTakeNSteps(1),c=this.pFF.getCurrentStep();this.vwr.setIntProperty("_minimizationStep",c);this.reportEnergy();this.vwr.setFloatProperty("_minimizationEnergyDiff",this.pFF.toUserUnits(this.pFF.getEnergyDiff()));this.vwr.notifyMinimizationStatus();a&&(this.updateAtomXYZ(),this.vwr.refresh(3,"minimization step "+c));return b});d(c$,"endMinimization",function(){this.updateAtomXYZ();this.setMinimizationOn(!1);if(null==this.pFF)Zystem.out.println("pFF was null");else{var a=
this.pFF.detectExplosion();a&&this.restoreCoordinates();this.vwr.setIntProperty("_minimizationStep",this.pFF.getCurrentStep());this.reportEnergy();this.vwr.setStringProperty("_minimizationStatus",a?"failed":"done");this.vwr.notifyMinimizationStatus();this.vwr.refresh(3,"Minimizer:done"+(a?" EXPLODED":"OK"))}JU.Logger.info("minimizer: endMinimization")});d(c$,"saveCoordinates",function(){null==this.coordSaved&&(this.coordSaved=t(this.ac,3,0));for(var a=0;a<this.ac;a++)for(var b=0;3>b;b++)this.coordSaved[a][b]=
this.minAtoms[a].coord[b]});d(c$,"restoreCoordinates",function(){if(null!=this.coordSaved){for(var a=0;a<this.ac;a++)for(var b=0;3>b;b++)this.minAtoms[a].coord[b]=this.coordSaved[a][b];this.updateAtomXYZ()}});d(c$,"stopMinimization",function(a){this.$minimizationOn&&(this.setMinimizationOn(!1),a?this.endMinimization():this.restoreCoordinates())},"~B");d(c$,"updateAtomXYZ",function(){if(!(0>=this.steps)){for(var a=0;a<this.ac;a++){var b=this.minAtoms[a],c=b.atom;c.x=b.coord[0];c.y=b.coord[1];c.z=b.coord[2]}this.vwr.refreshMeasures(!1)}});
d(c$,"minimizeWithoutThread",function(){if(this.startMinimization()){for(;this.stepMinimization(););this.endMinimization()}});d(c$,"report",function(a,b){this.isSilent?JU.Logger.info(a):b?this.vwr.showString(a,!1):this.vwr.scriptEcho(a)},"~S,~B");d(c$,"calculatePartialCharges",function(a,b,c){var e=new JM.FF.ForceFieldMMFF(this,!1);e.setArrays(a.at,b,a.bo,a.bondCount,!0,!0);this.vwr.setAtomProperty(b,1086326785,0,0,null,null,e.getAtomTypeDescriptions());this.vwr.setAtomProperty(null==c?b:c,1111492619,
0,0,null,e.getPartialCharges(),null)},"JM.ModelSet,JU.BS,JU.BS")});p("JM");c$=s(function(){this.data=null;this.type=0;this.ddata=this.key=null;q(this,arguments)},JM,"MinObject");l(c$,"toString",function(){return this.type+" "+this.data[0]+","+this.data[1]+(2<this.data.length?","+this.data[2]+","+this.data[3]:"")+" "+JM.MinObject.decodeKey(this.key)});c$.getKey=d(c$,"getKey",function(a,b,c,e,f){return Integer.$valueOf(((((f<<7)+e<<7)+c<<7)+b<<4)+a)},"~N,~N,~N,~N,~N");c$.decodeKey=d(c$,"decodeKey",
function(a){if(null==a)return null;var b=a.intValue();a=b&15;var b=b>>4,c=b&127,b=b>>7,e=b&127,b=b>>7,f=b&127,b=b>>7&127;return(0>a?a+": ":"")+(10>c?"  ":" ")+c+(10>e?"  ":" ")+e+(10>f?"  ":" ")+f+(120<b?"":(10>b?"  ":" ")+b)},"Integer");p("JM");r(["JM.MinObject"],"JM.MinAngle",null,function(){c$=s(function(){this.sbType=0;this.sbKey=null;this.ka=0;this.theta0=NaN;q(this,arguments)},JM,"MinAngle",JM.MinObject);v(c$,function(a){z(this,JM.MinAngle,[]);this.data=a},"~A")});p("JM");r(["JU.BS","$.Lst"],
"JM.MinAtom",null,function(){c$=s(function(){this.index=0;this.ffAtomType=this.atom=this.sType=null;this.ffType=0;this.bonds=this.force=this.coord=this.vdwKey=null;this.partialCharge=this.hCount=this.nBonds=0;this.bondedAtoms=this.bs14=this.bsVdw=null;q(this,arguments)},JM,"MinAtom");E(c$,function(){this.coord=t(3,0);this.force=t(3,0);this.bonds=new JU.Lst;this.bsVdw=new JU.BS;this.bs14=new JU.BS});l(c$,"toString",function(){return"#"+this.index+" "+this.sType});v(c$,function(a,b,c,e){this.index=
a;this.atom=b;this.coord=c;this.bsVdw.setBits(a+1,e);this.bsVdw.clear(a);this.hCount=b.getCovalentHydrogenCount()},"~N,JM.Atom,~A,~N");d(c$,"set",function(){this.coord[0]=this.atom.x;this.coord[1]=this.atom.y;this.coord[2]=this.atom.z});d(c$,"getBondTo",function(a){this.getBondedAtomIndexes();for(var b=0;b<this.nBonds;b++)if(this.bondedAtoms[b]==a)return this.bonds.get(b);return null},"~N");d(c$,"getBondedAtomIndexes",function(){if(null==this.bondedAtoms){this.bondedAtoms=m(this.nBonds,0);for(var a=
this.nBonds;0<=--a;)this.bondedAtoms[a]=this.bonds.get(a).getOtherAtom(this.index)}return this.bondedAtoms});d(c$,"getIdentity",function(){return this.atom.getInfo()});d(c$,"addBond",function(a,b){this.bonds.addLast(a);this.nBonds++;this.bsVdw.clear(b)},"JM.MinBond,~N");d(c$,"getBondIndex",function(a){return this.bonds.get(a).index},"~N");c$.isLinear=d(c$,"isLinear",function(a){switch(a.ffType){case 4:case 53:case 61:return!0}return!1},"JM.MinAtom")});p("JM");r(["JM.MinObject"],"JM.MinBond",null,
function(){c$=s(function(){this.order=this.index=this.rawIndex=0;this.isAmide=this.isAromatic=!1;q(this,arguments)},JM,"MinBond",JM.MinObject);v(c$,function(a,b,c,e,f,h,g){z(this,JM.MinBond,[]);this.rawIndex=a;this.index=b;this.type=h;this.data=m(-1,[c,e]);this.order=f;this.key=g},"~N,~N,~N,~N,~N,~N,Integer");d(c$,"getOtherAtom",function(a){return this.data[this.data[0]==a?1:0]},"~N")});p("JM");r(["JM.MinObject"],"JM.MinTorsion",null,function(){c$=u(JM,"MinTorsion",JM.MinObject);v(c$,function(a){z(this,
JM.MinTorsion,[]);this.data=a},"~A")});p("JM");r(null,"JM.Util",["java.lang.Double","java.util.Random"],function(){c$=u(JM,"Util");c$.sub=d(c$,"sub",function(a,b,c){c.set(a[0]-b[0],a[1]-b[1],a[2]-b[2])},"~A,~A,JU.V3d");c$.putCoord=d(c$,"putCoord",function(a,b){b[0]=a.x;b[1]=a.y;b[2]=a.z},"JU.V3d,~A");c$.distance2=d(c$,"distance2",function(a,b){var c=a[0]-b[0],e=a[1]-b[1],f=a[2]-b[2];return c*c+e*e+f*f},"~A,~A");c$.distance2V=d(c$,"distance2V",function(a,b){var c=a.x-b.x,e=a.y-b.y,f=a.z-b.z;return c*
c+e*e+f*f},"JU.V3d,JU.V3d");c$.getAngleRadiansABC=d(c$,"getAngleRadiansABC",function(a,b,c){var e=JM.Util.distance2(a,b);b=JM.Util.distance2(b,c);a=JM.Util.distance2(a,c);return JM.Util.isNearZero2(e,0.001)||JM.Util.isNearZero2(b,0.001)?0:Math.acos((e+b-a)/2/Math.sqrt(e*b))},"~A,~A,~A");c$.isApprox=d(c$,"isApprox",function(a,b,c){return JM.Util.distance2V(a,b)<=c*c*Math.min(a.lengthSquared(),b.lengthSquared())},"JU.V3d,JU.V3d,~N");c$.canBeSquared=d(c$,"canBeSquared",function(a){return 0==a?!0:1E150>
(a=Math.abs(a))&&1E-150<a},"~N");c$.isNegligible=d(c$,"isNegligible",function(a,b){return JM.Util.isNegligible3(a,b,1E-11)},"~N,~N");c$.isFinite=d(c$,"isFinite",function(a){return!Double.isInfinite(a)&&!Double.isNaN(a)},"~N");c$.isNegligible3=d(c$,"isNegligible3",function(a,b,c){return Math.abs(a)<=c*Math.abs(b)},"~N,~N,~N");c$.isNear=d(c$,"isNear",function(a,b){return JM.Util.isNear3(a,b,2E-6)},"~N,~N");c$.isNear3=d(c$,"isNear3",function(a,b,c){return Math.abs(a-b)<c},"~N,~N,~N");c$.isNearZero=d(c$,
"isNearZero",function(a){return JM.Util.isNearZero2(a,2E-6)},"~N");c$.isNearZero2=d(c$,"isNearZero2",function(a,b){return Math.abs(a)<b},"~N,~N");c$.canBeNormalized=d(c$,"canBeNormalized",function(a){return 0==a.x&&0==a.y&&0==a.z?!1:JM.Util.canBeSquared(a.x)&&JM.Util.canBeSquared(a.y)&&JM.Util.canBeSquared(a.z)},"JU.V3d");c$.pointPlaneAngleRadians=d(c$,"pointPlaneAngleRadians",function(a,b,c,e,f,h,g,d){f.sub2(b,c);h.sub2(b,e);g.cross(f,h);h.add(f);f.sub2(b,a);a=d?JM.Util.vectorAngleRadians(h,f):3.141592653589793;
f=JM.Util.vectorAngleRadians(g,f);1.5707963267948966<f&&(f=3.141592653589793-f);return 1.5707963267948966+(1.5707963267948966<a?-f:f)},"JU.V3d,JU.V3d,JU.V3d,JU.V3d,JU.V3d,JU.V3d,JU.V3d,~B");c$.vectorAngleRadians=d(c$,"vectorAngleRadians",function(a,b){var c=a.length(),e=b.length();return JM.Util.isNearZero(c)||JM.Util.isNearZero(e)?0:Math.acos(a.dot(b)/(c*e))},"JU.V3d,JU.V3d");c$.getTorsionAngleRadians=d(c$,"getTorsionAngleRadians",function(a,b,c,e,f,h,g){JM.Util.sub(b,a,f);JM.Util.sub(c,b,h);h.normalize();
f.cross(f,h);JM.Util.sub(e,c,g);g.cross(h,g);a=f.dot(g);f.cross(g,f);return Math.atan2(-h.dot(f),a)},"~A,~A,~A,~A,JU.V3d,JU.V3d,JU.V3d");c$.restorativeForceAndDistance=d(c$,"restorativeForceAndDistance",function(a,b,c){c.sub2(a,b);var e=c.length();0.1>e&&(JM.Util.randomizeUnitVector(c),e=0.1);c.normalize();a.setT(c);a.scale(-1);b.setT(c);return e},"JU.V3d,JU.V3d,JU.V3d");c$.randomizeUnitVector=d(c$,"randomizeUnitVector",function(a){var b=new java.util.Random,c;do a.set(b.nextFloat()-0.5,b.nextFloat()-
0.5,b.nextFloat()-0.5),c=a.lengthSquared();while(1<c||1E-4>c);a.normalize()},"JU.V3d");c$.restorativeForceAndAngleRadians=d(c$,"restorativeForceAndAngleRadians",function(a,b,c){a.sub(b);c.sub(b);var e=a.length(),f=c.length();if(JM.Util.isNearZero(e)||JM.Util.isNearZero(f))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),0;e=1/e;f=1/f;a.scale(e);c.scale(f);b.cross(a,c);var h=b.length();if(JM.Util.isNearZero(h))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),0;b.scale(1/h);h=a.dot(c);h=1<h?0:-1>h?3.141592653589793:
Math.acos(h);a.cross(a,b);a.normalize();b.cross(c,b);b.normalize();a.scale(-e);b.scale(f);c.setT(b);b.add(a);b.scale(-1);return h},"JU.V3d,JU.V3d,JU.V3d");c$.restorativeForceAndOutOfPlaneAngleRadians=d(c$,"restorativeForceAndOutOfPlaneAngleRadians",function(a,b,c,e,f,h,g){a.sub2(a,b);c.sub2(c,b);e.sub2(e,b);var d=a.length(),n=c.length(),j=e.length();if(JM.Util.isNearZero(d)||JM.Util.isNearZero(n)||JM.Util.isNearZero(j))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),0;a.normalize();c.normalize();
e.normalize();var m=a.dot(c),k=Math.acos(m);if(JM.Util.isNearZero(k)||JM.Util.isNearZero(Math.abs(k-3.141592653589793)))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),0;k=1/Math.sin(k);f.cross(a,c);h.cross(c,e);g.cross(e,a);var l=f.dot(e)*k,p=Math.asin(l);if(1E-4>Math.cos(p)||JM.Util.isNearZero(p)||JM.Util.isNearZero(Math.abs(p-3.141592653589793)))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),p;e.scaleAdd(-l/k,e,f);e.scale(k/j);b.setT(a);a.scaleAdd(-m,c,a);a.scaleAdd(-l*k,
a,h);a.scale(k/d);c.scaleAdd(-m,b,c);c.scaleAdd(-l*k,c,g);c.scale(k/n);b.setT(a);b.add(c);b.add(e);b.scale(-1);return p},"JU.V3d,JU.V3d,JU.V3d,JU.V3d,JU.V3d,JU.V3d,JU.V3d");c$.restorativeForceAndTorsionAngleRadians=d(c$,"restorativeForceAndTorsionAngleRadians",function(a,b,c,e){a.sub2(b,a);b.sub2(c,b);c.sub2(e,c);var f=a.length(),h=b.length(),g=c.length();if(JM.Util.isNearZero(f)||JM.Util.isNearZero(h)||JM.Util.isNearZero(g))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),0;var d=JM.Util.vectorAngleRadians(a,
b),n=Math.sin(d),j=Math.cos(d),d=JM.Util.vectorAngleRadians(b,c),m=Math.sin(d),d=Math.cos(d);a.normalize();b.normalize();c.normalize();a.cross(a,b);e.cross(b,c);c.cross(a,e);var k=-Math.atan2(c.dot(b),a.dot(e));a.scale(1/f/n/n);e.scale(-1/g/m/m);b.setT(a);b.scale(-f/h*j-1);c.setT(e);c.scale(-g/h*d);b.sub(c);c.setT(a);c.add(b);c.add(e);c.scale(-1);return k},"JU.V3d,JU.V3d,JU.V3d,JU.V3d");w(c$,"RAD_TO_DEG",57.29577951308232,"DEG_TO_RAD",0.017453292519943295,"max_squarable_double",1E150,"min_squarable_double",
1E-150)});p("JM.FF");c$=s(function(){this.elemNo=0;this.smartsCode=this.descr=null;this.fcadj=this.formalCharge=this.hType=this.mmType=0;this.pilp=this.arom=this.sbmb=!1;this.val=this.mltb=0;q(this,arguments)},JM.FF,"AtomType");v(c$,function(a,b,c,e,f,h,g){this.elemNo=a;this.mmType=b;this.hType=c;this.formalCharge=e;this.val=f;this.descr=h;this.smartsCode=g},"~N,~N,~N,~N,~N,~S,~S");p("JM.FF");r(null,"JM.FF.ForceField","java.lang.Float JU.PT JM.Util JU.Logger JV.FileManager $.Viewer".split(" "),function(){c$=
s(function(){this.calc=this.name=null;this.stepMax=this.currentStep=this.dE=this.e0=this.criterion=0;this.coordSaved=null;this.minBondCount=this.minAtomCount=0;this.minimizer=this.bsFixed=this.minPositions=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null;q(this,arguments)},JM.FF,"ForceField");d(c$,"setModelFields",function(){this.minAtoms=this.minimizer.minAtoms;this.minBonds=this.minimizer.minBonds;this.minAngles=this.minimizer.minAngles;this.minTorsions=this.minimizer.minTorsions;
this.bsFixed=this.minimizer.bsMinFixed;this.minAtomCount=this.minAtoms.length;this.minBondCount=this.minBonds.length});d(c$,"setConstraints",function(a){this.bsFixed=a.bsMinFixed;this.calc.setConstraints(a.constraints);this.coordSaved=null},"JM.Minimizer");d(c$,"steepestDescentInitialize",function(a,b){this.stepMax=a;this.criterion=b/this.toUserUnits(1);this.currentStep=0;this.clearForces();this.calc.setLoggingEnabled(!0);this.calc.setLoggingEnabled(0==a||JU.Logger.isActiveLevel(6));var c=this.name+
" "+this.calc.getDebugHeader(-1)+"Jmol Minimization Version "+JV.Viewer.getJmolVersion()+"\n";this.calc.appendLogData(c);JU.Logger.info(c);this.calc.getConstraintList();this.calc.loggingEnabled&&this.calc.appendLogData(this.calc.getAtomList("S T E E P E S T   D E S C E N T"));this.dE=0;this.calc.setPreliminary(0<a);this.e0=this.energyFull(!1,!1);c=JU.PT.sprintf(" Initial "+this.name+" E = %10.3f "+this.minimizer.units+"/mol criterion = %8.6f max steps = "+a,"ff",j(-1,[Float.$valueOf(this.toUserUnits(this.e0)),
Float.$valueOf(this.toUserUnits(b))]));this.minimizer.report(c,!1);this.calc.appendLogData(c)},"~N,~N");d(c$,"clearForces",function(){for(var a=0;a<this.minAtomCount;a++)this.minAtoms[a].force[0]=this.minAtoms[a].force[1]=this.minAtoms[a].force[2]=0});d(c$,"steepestDescentTakeNSteps",function(a){if(0==this.stepMax)return!1;for(var b=!0,c=1;c<=a;c++){this.currentStep++;this.calc.setSilent(!0);for(var e=0;e<this.minAtomCount;e++)(null==this.bsFixed||!this.bsFixed.get(e))&&this.setForcesUsingNumericalDerivative(this.minAtoms[e],
1);this.linearSearch();this.calc.setSilent(!1);this.calc.loggingEnabled&&this.calc.appendLogData(this.calc.getAtomList("S T E P    "+this.currentStep));e=this.energyFull(!1,!1);this.dE=e-this.e0;var f=JM.Util.isNear3(e,this.e0,this.criterion);if(f||0==this.currentStep%10||this.stepMax<=this.currentStep){var h=JU.PT.sprintf(this.name+" Step %-4d E = %10.6f    dE = %8.6f ","Fi",j(-1,[x(-1,[this.toUserUnits(e),this.toUserUnits(this.dE)]),Integer.$valueOf(this.currentStep)]));this.minimizer.report(h,
!1);this.calc.appendLogData(h)}this.e0=e;if(f||this.stepMax<=this.currentStep)return this.calc.loggingEnabled&&this.calc.appendLogData(this.calc.getAtomList("F I N A L  G E O M E T R Y")),f&&(h=JU.PT.formatStringF("\n    "+this.name+" STEEPEST DESCENT HAS CONVERGED: E = %8.5f "+this.minimizer.units+"/mol after "+this.currentStep+" steps","f",this.toUserUnits(e)),this.calc.appendLogData(h),this.minimizer.report(h,!0),JU.Logger.info(h)),!1;b&&2<=this.getNormalizedDE()&&(this.calc.setPreliminary(b=!1),
this.e0=this.energyFull(!1,!1))}return!0},"~N");d(c$,"getEnergies",function(a,b){if(0!=(a&1))return this.energyFull(b,!0);var c=0;0!=(a&2)&&(c+=this.energyBond(b));0!=(a&4)&&(c+=this.energyAngle(b));0!=(a&8)&&(c+=this.energyStretchBend(b));0!=(a&32)&&(c+=this.energyOOP(b));0!=(a&16)&&(c+=this.energyTorsion(b));0!=(a&64)&&(c+=this.energyVDW(b));0!=(a&128)&&(c+=this.energyES(b));return c},"~N,~B");d(c$,"setForcesUsingNumericalDerivative",function(a,b){a.force[0]=-this.getDE(a,b,0,1E-5);a.force[1]=-this.getDE(a,
b,1,1E-5);a.force[2]=-this.getDE(a,b,2,1E-5)},"JM.MinAtom,~N");d(c$,"getDE",function(a,b,c,e){a.coord[c]+=e;b=this.getEnergies(b,!1);a.coord[c]-=e;return(b-this.e0)/e},"JM.MinAtom,~N,~N,~N");d(c$,"energyFull",function(a,b){var c;a&&this.clearForces();c=this.energyBond(a)+this.energyAngle(a)+this.energyTorsion(a)+this.energyStretchBend(a)+this.energyOOP(a)+this.energyVDW(a)+this.energyES(a);!b&&this.calc.loggingEnabled&&this.calc.appendLogData(JU.PT.sprintf("\nTOTAL %s ENERGY = %8.3f %s/mol\n","sfs",
j(-1,[this.name,Float.$valueOf(this.toUserUnits(c)),this.minimizer.units])));return c},"~B,~B");d(c$,"energyStretchBend",function(a){return this.calc.energyStretchBend(a)},"~B");d(c$,"energyBond",function(a){return this.calc.energyBond(a)},"~B");d(c$,"energyAngle",function(a){return this.calc.energyAngle(a)},"~B");d(c$,"energyTorsion",function(a){return this.calc.energyTorsion(a)},"~B");d(c$,"energyOOP",function(a){return this.calc.energyOOP(a)},"~B");d(c$,"energyVDW",function(a){return this.calc.energyVDW(a)},
"~B");d(c$,"energyES",function(a){return this.calc.energyES(a)},"~B");d(c$,"linearSearch",function(){for(var a=0.23,b=this.energyFull(!1,!0),c=0;10>c;c++){this.saveCoordinates();for(var e=0;e<this.minAtomCount;++e)if(null==this.bsFixed||!this.bsFixed.get(e)){var f=this.minAtoms[e].force,h=this.minAtoms[e].coord,g=f[0]*f[0]+f[1]*f[1]+f[2]*f[2];g>0.09/a/a&&(g=0.3/Math.sqrt(g)/a,f[0]*=g,f[1]*=g,f[2]*=g);for(g=0;3>g;++g)if(JM.Util.isFinite(f[g])){var d=f[g]*a;h[g]=0.3<d?h[g]+0.3:-0.3>d?h[g]-0.3:h[g]+
d}}e=this.energyFull(!1,!0);if(JM.Util.isNear3(e,b,0.001))break;e>b?(a*=0.1,this.restoreCoordinates()):e<b&&(b=e,a*=2.15,1<a&&(a=1))}});d(c$,"saveCoordinates",function(){null==this.coordSaved&&(this.coordSaved=t(this.minAtomCount,3,0));for(var a=0;a<this.minAtomCount;a++)for(var b=0;3>b;b++)this.coordSaved[a][b]=this.minAtoms[a].coord[b]});d(c$,"restoreCoordinates",function(){for(var a=0;a<this.minAtomCount;a++)for(var b=0;3>b;b++)this.minAtoms[a].coord[b]=this.coordSaved[a][b]});d(c$,"detectExplosion",
function(){for(var a=0;a<this.minAtomCount;a++)for(var b=this.minAtoms[a],c=0;3>c;c++)if(!JM.Util.isFinite(b.coord[c]))return!0;for(a=0;a<this.minBondCount;a++)if(b=this.minBonds[a],900<JM.Util.distance2(this.minAtoms[b.data[0]].coord,this.minAtoms[b.data[1]].coord))return!0;return!1});d(c$,"getCurrentStep",function(){return this.currentStep});d(c$,"getEnergy",function(){return this.e0});d(c$,"getAtomList",function(a){return this.calc.getAtomList(a)},"~S");d(c$,"getEnergyDiff",function(){return this.dE});
d(c$,"getLogData",function(){return this.calc.getLogData()});d(c$,"getNormalizedDE",function(){return Math.abs(this.dE/this.criterion)});d(c$,"toUserUnits",function(a){return this.toUnits(a,this.calc.getUnits())},"~N");d(c$,"toUnits",function(a,b){return b.equalsIgnoreCase(this.minimizer.units)?a:a*(this.minimizer.units.equals("kJ")?4.1868:0.23884589662749595)},"~N,~S");d(c$,"log",function(a){this.calc.appendLogData(a)},"~S");d(c$,"getBufferedReader",function(a){return JV.FileManager.getBufferedReaderForResource(this.minimizer.vwr,
this,"JM/FF/","data/"+a)},"~S");w(c$,"ENERGY",1,"EBOND",2,"EANGLE",4,"ESTRBND",8,"ETORSION",16,"EOOP",32,"EVDW",64,"EELECTROSTATIC",128,"ABI_IJ",3,"ABI_JK",4,"TBI_AB",4,"TBI_BC",5,"TBI_CD",6,"R3",0,"R4",1,"R5",2,"Raromatic",3)});p("JM.FF");r(["JM.FF.ForceField"],"JM.FF.ForceFieldMMFF","java.lang.Double $.Float java.util.Hashtable JU.AU $.BS $.Lst $.PT JM.MinAtom $.MinObject JM.FF.AtomType $.CalculationsMMFF JU.BSUtil $.Elements $.Escape $.Logger JV.JmolAsyncException".split(" "),function(){c$=s(function(){this.typeData=
this.line=this.vRings=this.rawMMFF94Charges=this.rawBondTypes=this.rawAtomTypes=this.ffParams=null;q(this,arguments)},JM.FF,"ForceFieldMMFF",JM.FF.ForceField);E(c$,function(){this.typeData=m(4,0)});d(c$,"getAtomTypeDescriptions",function(){return JM.FF.ForceFieldMMFF.getAtomTypeDescs(this.rawAtomTypes)});d(c$,"getPartialCharges",function(){return this.rawMMFF94Charges});v(c$,function(a,b){z(this,JM.FF.ForceFieldMMFF,[]);this.minimizer=a;b?(this.name="MMFF2D",this.ffParams=JM.FF.ForceFieldMMFF.mmff2DParams,
null==this.ffParams&&(JM.FF.ForceFieldMMFF.mmff2DParams=this.ffParams=this.getParameters(!0))):(this.name="MMFF",this.ffParams=JM.FF.ForceFieldMMFF.mmffParams,null==this.ffParams&&(JM.FF.ForceFieldMMFF.mmffParams=this.ffParams=this.getParameters(!1)))},"JM.Minimizer,~B");l(c$,"clear",function(){});l(c$,"setModel",function(){var a=this.minimizer;if(!this.setArrays(a.atoms,a.bsAtoms,a.bonds,a.rawBondCount,!1,!1))return!1;this.setModelFields();if(!this.fixTypes())return!1;this.calc=new JM.FF.CalculationsMMFF(this,
this.ffParams,this.minAtoms,this.minBonds,this.minAngles,this.minTorsions,this.minPositions,this.minimizer.constraints);this.calc.setLoggingEnabled(!0);return this.calc.setupCalculations()},"JU.BS,~N");d(c$,"setArrays",function(a,b,c,e,f,h){var g=this.minimizer;this.vRings=JU.AU.createArrayOfArrayList(4);this.rawAtomTypes=JM.FF.ForceFieldMMFF.setAtomTypes(a,b,g.vwr.getSmilesMatcher(),this.vRings,h);if(null==this.rawAtomTypes)return!1;this.rawBondTypes=this.setBondTypes(c,e,b);this.rawMMFF94Charges=
this.calculatePartialCharges(c,this.rawBondTypes,a,this.rawAtomTypes,b,f);return!0},"~A,JU.BS,~A,~N,~B,~B");d(c$,"getParameters",function(a){this.getAtomTypes();a=a?"mmff94.par.txt":"mmff94_2d.par.txt";var b=new java.util.Hashtable;JU.Logger.debugging&&JU.Logger.debug("reading data from "+a);var c=null,e=null;try{for(var c=this.getBufferedReader(a),f=0,h=0;;){for(;0>(f=(e=c.readLine()).indexOf(".PAR")););if(1>(h=JM.FF.ForceFieldMMFF.types[F("END.BCI.CHG.ANG.NDK.OND.OOP.TBN.FSB.TOR.VDW.".indexOf(e.substring(f-
3,f+1))/4)]))break;this.readParams(c,h,b)}c.close()}catch(g){if(y(g,JV.JmolAsyncException))throw new JV.JmolAsyncException(g.getFileName());if(y(g,Exception))Zystem.err.println("Exception "+g.toString()+" in getResource "+a+" line="+e);else throw g;}finally{try{c.close()}catch(d){if(!y(d,Exception))throw d;}}return b},"~B");d(c$,"readParams",function(a,b,c){var e=null,f=0,h=127,g=127,d=127,n=0;switch(b){case 34:d=124;break;case 21:d=125;break;case 546:d=123;n=0;break;case 13:n=6;break;case 1:n=0;
break;case 37:d=126;n=0;break;case 17:d=122,n=0}for(;!a.readLine().startsWith("*"););for(;(this.line=a.readLine()).startsWith("*"););do{switch(b){case 17:if(" "!=this.line.charAt(5))continue;break;case 34:if("4"==this.line.charAt(0))continue;case 5:case 3:case 21:case 9:n=this.line.charCodeAt(0)-48}switch(b){case 13:case 9:d=this.ival(18,20);case 5:case 21:case 37:g=this.ival(13,15);case 546:case 3:case 34:h=this.ival(8,10);case 1:case 17:f=this.ival(3,5)}switch(b){case 546:e=t(-1,[this.dval(19,25),
this.dval(13,18)]);break;case 3:e=t(-1,[this.dval(14,20),this.dval(25,31)]);break;case 5:case 21:e=t(-1,[this.dval(19,25),this.dval(28,35)]);break;case 34:e=Float.$valueOf(this.fval(10,20));break;case 13:e=t(-1,[this.dval(24,30)]);break;case 1:e=Float.$valueOf(this.fval(5,15));break;case 37:var m=this.dval(19,25),j=this.dval(28,35),e=t(-1,[m,j]),k=JM.MinObject.getKey(n,f,h,g,d);c.put(k,e);e=t(-1,[j,m]);m=f;f=g;g=m;break;case 9:e=t(-1,[this.dval(22,28),this.dval(30,36),this.dval(38,44)]);break;case 17:e=
t(-1,[this.dval(10,15),this.dval(20,25),this.dval(30,35),this.dval(40,45),this.line.charAt(46)])}k=JM.MinObject.getKey(n,f,h,g,d);c.put(k,e);JU.Logger.debugging&&JU.Logger.debug(JM.MinObject.decodeKey(k)+" "+(D(e,Float)?e:JU.Escape.eAD(e)))}while(!(this.line=a.readLine()).startsWith("$"))},"java.io.BufferedReader,~N,java.util.Map");d(c$,"ival",function(a,b){return JU.PT.parseInt(this.line.substring(a,b).trim())},"~N,~N");d(c$,"fval",function(a,b){return Float.$valueOf(this.line.substring(a,b).trim()).floatValue()},
"~N,~N");d(c$,"dval",function(a,b){return Double.$valueOf(this.line.substring(a,b).trim()).doubleValue()},"~N,~N");d(c$,"getAtomTypes",function(){var a=new JU.Lst;try{var b=this.getBufferedReader("MMFF94-smarts.txt"),c;for(a.addLast(new JM.FF.AtomType(0,0,0,0,1,"H or NOT FOUND",""));null!=(this.line=b.readLine());)if(!(0==this.line.length||this.line.startsWith("#"))){var e=this.ival(3,5),f=this.ival(6,8),h=this.ival(9,11),g=this.fval(12,15)/12,d=this.ival(16,18),n=this.line.substring(19,44).trim(),
m=this.line.substring(45).trim();a.addLast(c=new JM.FF.AtomType(e,f,h,g,d,n,m));JM.FF.ForceFieldMMFF.setFlags(c)}b.close()}catch(j){if(y(j,JV.JmolAsyncException))throw new JV.JmolAsyncException(j.getFileName());if(y(j,Exception))Zystem.err.println("Exception "+j.toString()+" in getResource MMFF94-smarts.txt line="+this.line);else throw j;}JU.Logger.info(a.size()-1+" SMARTS-based atom types read");JM.FF.ForceFieldMMFF.atomTypes=a});c$.setFlags=d(c$,"setFlags",function(a){switch(a.mmType){case 32:case 35:case 72:a.fcadj=
0.5;break;case 62:case 76:a.fcadj=0.25}switch(a.mmType){case 37:case 38:case 39:case 44:case 58:case 59:case 63:case 64:case 65:case 66:case 69:case 78:case 79:case 81:case 82:a.arom=!0}switch(a.mmType){case 2:case 3:case 4:case 9:case 30:case 37:case 39:case 54:case 57:case 58:case 63:case 64:case 67:case 75:case 78:case 80:case 81:a.sbmb=!0}switch(a.mmType){case 6:case 8:case 10:case 11:case 12:case 13:case 14:case 15:case 26:case 32:case 35:case 39:case 40:case 43:case 44:case 59:case 62:case 70:case 72:case 76:a.pilp=
!0}switch(a.mmType){case 10:case 32:case 35:case 39:case 41:case 44:case 55:case 56:case 58:case 59:case 69:case 72:case 81:case 82:a.mltb=1;break;case 2:case 3:case 7:case 9:case 16:case 17:case 30:case 37:case 38:case 45:case 46:case 47:case 51:case 53:case 54:case 57:case 63:case 64:case 65:case 66:case 67:case 74:case 75:case 78:case 79:case 80:a.mltb=2;break;case 4:case 42:case 60:case 61:a.mltb=3}},"JM.FF.AtomType");d(c$,"calculatePartialCharges",function(a,b,c,e,f,h){c=x(c.length,0);for(var g=
f.nextSetBit(0);0<=g;g=f.nextSetBit(g+1))c[g]=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,e[g])).formalCharge;for(var d=null,g=b.length;0<=--g;){var d=a[g].atom1,n=a[g].atom2,j=f.get(d.i),m=f.get(n.i);if(j||m){var k=e[d.i],l=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,k)),p=0>k?-k:l.mmType,k=e[n.i],t=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,k)),k=0>k?-k:t.mmType,r;try{var q=p<k?-1:1,s=JM.MinObject.getKey(b[g],1==q?k:p,1==q?p:k,127,124),v=this.ffParams.get(s),w,u=JU.Logger.debugging?d+"/"+
n+" mmTypes="+p+"/"+k+" formalCharges="+l.formalCharge+"/"+t.formalCharge+" bci = ":null;if(null==v){var z=this.ffParams.get(JM.MinObject.getKey(0,p,127,127,127)).floatValue(),B=this.ffParams.get(JM.MinObject.getKey(0,k,127,127,127)).floatValue();w=z-B;JU.Logger.debugging&&(u+=z+" - "+B+" = ")}else w=q*v.floatValue();JU.Logger.debugging&&(u+=w,JU.Logger.debug(u));r=t.fcadj*t.formalCharge-l.fcadj*l.formalCharge+w}catch(A){if(y(A,Exception))r=NaN;else throw A;}j&&(c[d.i]+=r);m&&(c[n.i]-=r)}}if(h){a=
0;for(g=c.length;0<=--g;)c[g]=Math.round(1E3*c[g])/1E3,a+=Math.abs(c[g]);0==a&&null!=d&&(c[d.i]=-0)}return c},"~A,~A,~A,~A,JU.BS,~B");c$.isSpecialBondType=d(c$,"isSpecialBondType",function(a,b){return a.sbmb&&b.sbmb||a.arom&&b.arom},"JM.FF.AtomType,JM.FF.AtomType");d(c$,"getBondType",function(a,b,c,e,f){return JM.FF.ForceFieldMMFF.isSpecialBondType(b,c)&&1==a.getCovalentOrder()&&!this.isAromaticBond(e,f)?1:0},"JM.Bond,JM.FF.AtomType,JM.FF.AtomType,~N,~N");d(c$,"isAromaticBond",function(a,b){if(null!=
this.vRings[3])for(var c=this.vRings[3].size();0<=--c;){var e=this.vRings[3].get(c);if(e.get(a)&&e.get(b))return!0}return!1},"~N,~N");c$.getAtomTypeDescs=d(c$,"getAtomTypeDescs",function(a){for(var b=Array(a.length),c=a.length;0<=--c;)b[c]=String.valueOf(0>a[c]?-a[c]:JM.FF.ForceFieldMMFF.atomTypes.get(a[c]).mmType);return b},"~A");c$.setAtomTypes=d(c$,"setAtomTypes",function(a,b,c,e,f){for(var h=new JU.Lst,d=Array(JM.FF.ForceFieldMMFF.atomTypes.size()),j=m(a.length,0),n=new JU.BS,l=new JU.BS,p=JU.BSUtil.copy(b),
k=b.nextSetBit(0);0<=k;k=b.nextSetBit(k+1)){var t=a[k],r=t.bonds;if(null!=r)for(var q=r.length;0<=--q;)r[q].isCovalent()&&p.set(r[q].getOtherAtom(t).i)}for(k=p.nextSetBit(0);0<=k;k=p.nextSetBit(k+1))switch(q=a[k].getElementNumber(),q){case 1:l.set(k);break;default:n.set(q)}q=0;for(k=1;k<JM.FF.ForceFieldMMFF.atomTypes.size();k++)r=JM.FF.ForceFieldMMFF.atomTypes.get(k),n.get(r.elemNo)&&(d[k]=r.smartsCode,q++);JU.Logger.info(q+" SMARTS matches used");try{c.getMMFF94AtomTypes(d,a,a.length,p,h,e)}catch(s){if(y(s,
Exception))JU.Logger.error(s.toString());else throw s;}c=new JU.BS;for(q=0;q<h.size();q++)if(e=h.get(q),null!=e){e.andNot(c);for(k=e.nextSetBit(0);0<=k;k=e.nextSetBit(k+1))j[k]=q;c.or(e)}for(k=l.nextSetBit(0);0<=k;k=l.nextSetBit(k+1))r=a[k].bonds,null!=r&&(q=j[r[0].getOtherAtom(a[k]).i],0!=q&&c.set(k),j[k]=-JM.FF.ForceFieldMMFF.atomTypes.get(q).hType);if(JU.Logger.debugging)for(k=p.nextSetBit(0);0<=k;k=p.nextSetBit(k+1))JU.Logger.debug("atom "+a[k]+"\ttype "+(0>j[k]?""+-j[k]:JM.FF.ForceFieldMMFF.atomTypes.get(j[k]).mmType+
"\t"+JM.FF.ForceFieldMMFF.atomTypes.get(j[k]).smartsCode+"\t"+JM.FF.ForceFieldMMFF.atomTypes.get(j[k]).descr));return!f&&c.cardinality()!=p.cardinality()?null:j},"~A,JU.BS,J.api.SmilesMatcherInterface,~A,~B");d(c$,"setBondTypes",function(a,b,c){for(var e=m(b,0);0<=--b;){var f=a[b].atom1,h=a[b].atom2,d=c.get(f.i),j=c.get(h.i);if(d||j)j=this.rawAtomTypes[f.i],d=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,j)),j=this.rawAtomTypes[h.i],j=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,j)),e[b]=this.getBondType(a[b],
d,j,f.i,h.i)}return e},"~A,~N,JU.BS");d(c$,"fixTypes",function(){for(var a=this.minAtomCount;0<=--a;){var b=this.minAtoms[a],c=b.atom.i,e=this.rawAtomTypes[c];b.ffAtomType=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,e));e=0>e?-e:JM.FF.ForceFieldMMFF.atomTypes.get(e).mmType;b.ffType=e;b.vdwKey=JM.MinObject.getKey(0,e,127,127,122);b.partialCharge=this.rawMMFF94Charges[c]}for(a=this.minBonds.length;0<=--a;)if(b=this.minBonds[a],b.type=this.rawBondTypes[b.rawIndex],b.key=this.getKey(b,b.type,3),null==
b.key)return!1;for(a=this.minAngles.length;0<=--a;)b=this.minAngles[a],b.key=this.getKey(b,b.type,5),b.sbKey=this.getKey(b,b.sbType,21);for(a=this.minTorsions.length;0<=--a;)b=this.minTorsions[a],b.key=this.getKey(b,b.type,9);return!0});d(c$,"setAngleType",function(a){a.type=this.minBonds[a.data[3]].type+this.minBonds[a.data[4]].type;this.checkRings(this.vRings[0],a.data,3)?a.type+=0==a.type?3:4:this.checkRings(this.vRings[1],a.data,3)&&(a.type+=0==a.type?4:6);a.sbType=JM.FF.ForceFieldMMFF.sbMap[a.type];
switch(a.type){case 1:case 5:case 7:a.sbType+=this.minBonds[a.data[4]].type}return a.type},"JM.MinAngle");d(c$,"setTorsionType",function(a){if(this.checkRings(this.vRings[1],a.data,4))return a.type=4;a.type=1==this.minBonds[a.data[5]].type?1:0==this.minBonds[a.data[4]].type&&0==this.minBonds[a.data[6]].type?0:2;0==a.type&&this.checkRings(this.vRings[2],a.data,4)&&(a.type=5);return a.type},"JM.MinTorsion");d(c$,"typeOf",function(a){return this.minAtoms[a].ffType},"~N");d(c$,"checkRings",function(a,
b,c){if(null!=a)for(var e=a.size();0<=--e;){var f=a.get(e);if(f.get(this.minAtoms[b[0]].atom.i)&&f.get(this.minAtoms[b[1]].atom.i)&&(3>c||f.get(this.minAtoms[b[2]].atom.i))&&(4>c||f.get(this.minAtoms[b[3]].atom.i)))return!0}return!1},"JU.Lst,~A,~N");d(c$,"getKey",function(a,b,c){var e=D(a,JM.MinObject)?a:null;a=null==e?a:e.data;var f=4;switch(c){case 3:this.fixOrder(a,0,1);f=2;break;case 5:-1==this.fixOrder(a,0,2)&&JM.FF.ForceFieldMMFF.swap(a,3,4);b=this.setAngleType(e);f=3;break;case 21:f=3;break;
case 9:switch(this.fixOrder(a,1,2)){case -1:JM.FF.ForceFieldMMFF.swap(a,0,3);JM.FF.ForceFieldMMFF.swap(a,4,6);break;case 0:-1==this.fixOrder(a,0,3)&&JM.FF.ForceFieldMMFF.swap(a,4,6)}b=this.setTorsionType(e)}for(var h=null,d=0;4>d;d++)this.typeData[d]=d<f?this.typeOf(a[d]):127;switch(c){case 21:this.typeData[3]=125;break;case 13:JM.FF.ForceFieldMMFF.sortOop(this.typeData)}h=JM.MinObject.getKey(b,this.typeData[0],this.typeData[1],this.typeData[2],this.typeData[3]);d=this.ffParams.get(h);switch(c){case 3:return null!=
d&&0<d[0]?h:this.applyEmpiricalRules(e,d,3);case 5:if(null!=d&&0!=d[0])return h;break;case 9:if(null==d){if(!this.ffParams.containsKey(h=this.getTorsionKey(b,0,2))&&!this.ffParams.containsKey(h=this.getTorsionKey(b,2,0))&&!this.ffParams.containsKey(h=this.getTorsionKey(b,2,2)))h=this.getTorsionKey(0,2,2);d=this.ffParams.get(h)}return null!=d?h:this.applyEmpiricalRules(e,d,9);case 21:if(null!=d)return h;b=this.getRowFor(a[0]);c=this.getRowFor(a[1]);a=this.getRowFor(a[2]);return JM.MinObject.getKey(0,
b,c,a,126);case 13:if(null!=d)return h}for(var j=!1,n=!1,d=0;3>d&&!n;d++){h=0;for(n=1;h<f;h++,n<<=1)(c&n)==n&&(this.typeData[h]=JM.FF.ForceFieldMMFF.getEquivalentType(this.typeOf(a[h]),d));switch(c){case 3:j=JM.FF.ForceFieldMMFF.fixTypeOrder(this.typeData,0,1);break;case 5:j=JM.FF.ForceFieldMMFF.fixTypeOrder(this.typeData,0,2);break;case 13:JM.FF.ForceFieldMMFF.sortOop(this.typeData)}h=JM.MinObject.getKey(b,this.typeData[0],this.typeData[1],this.typeData[2],this.typeData[3]);n=this.ffParams.containsKey(h)}if(n){if(j)switch(c){case 5:JM.FF.ForceFieldMMFF.swap(a,
0,2),JM.FF.ForceFieldMMFF.swap(a,3,4),this.setAngleType(e)}}else 0!=b&&5==c&&(h=Integer.$valueOf(h.intValue()^255));d=this.ffParams.get(h);switch(c){case 5:return null!=d&&0!=d[0]?h:this.applyEmpiricalRules(e,d,5)}return h},"~O,~N,~N");d(c$,"getTorsionKey",function(a,b,c){return JM.MinObject.getKey(a,JM.FF.ForceFieldMMFF.getEquivalentType(this.typeData[0],b),this.typeData[1],this.typeData[2],JM.FF.ForceFieldMMFF.getEquivalentType(this.typeData[3],c))},"~N,~N,~N");d(c$,"applyEmpiricalRules",function(a,
b,c){var e=0,f;switch(c){case 3:e=this.minAtoms[a.data[0]];c=this.minAtoms[a.data[1]];var d=e.atom.getElementNumber();b=c.atom.getElementNumber();d=JM.MinObject.getKey(0,Math.min(d,b),Math.max(d,b),127,123);b=this.ffParams.get(d);if(null==b)return null;d=b[0];b=b[1];e=JM.FF.ForceFieldMMFF.getRuleBondLength(e,c,a.order,this.isAromaticBond(a.data[0],a.data[1]));if(0==e)return null;c=b/e;c*=c;a.ddata=t(-1,[d*c*c*c,e]);return Integer.$valueOf(-1);case 5:if(null==b||0==(d=b[1]))switch(c=this.minAtoms[a.data[1]],
e=c.atom,b=e.getElementNumber(),a.type){case 3:case 5:case 6:d=60;break;case 4:case 7:case 8:d=90;break;default:switch(d=120,e.getCovalentBondCount()){case 2:JM.MinAtom.isLinear(c)?d=180:8==b?d=105:10<b&&(d=95);break;case 3:0==c.ffAtomType.mltb&&3==c.ffAtomType.val&&(d=7==b?107:92);break;case 4:d=109.45}}e=1.75;switch(a.type){case 3:case 5:case 6:e*=0.05;break;case 4:case 7:case 8:e*=0.85}b=JM.FF.ForceFieldMMFF.getZParam(this.minAtoms[a.data[0]].atom.getElementNumber());var g=JM.FF.ForceFieldMMFF.getCParam(this.minAtoms[a.data[1]].atom.getElementNumber()),
j=JM.FF.ForceFieldMMFF.getZParam(this.minAtoms[a.data[2]].atom.getElementNumber()),n=this.getR0(this.minBonds[a.data[3]]),m=this.getR0(this.minBonds[a.data[4]]);c=n+m;n=(n-m)/(c*c);m=0.017453292519943295*d;m*=m;e=e*b*g*j*Math.exp(-2*n)/(c*m);a.ddata=t(-1,[e,d]);return Integer.$valueOf(-1);case 9:var l=a.data[1],k=a.data[2];c=this.minAtoms[l];f=this.minAtoms[k];if(JM.MinAtom.isLinear(c)||JM.MinAtom.isLinear(f))return null;d=this.minBonds[a.data[5]];b=c.atom.getElementNumber();var g=f.atom.getElementNumber(),
j=JM.FF.ForceFieldMMFF.getUParam(b),n=JM.FF.ForceFieldMMFF.getUParam(g),m=JM.FF.ForceFieldMMFF.getVParam(b),p=JM.FF.ForceFieldMMFF.getVParam(g),r=0,q=0,s=-1,w=-1,u=-1,v=0,x=c.ffAtomType.val,y=f.ffAtomType.val,z=c.ffAtomType.pilp,B=f.ffAtomType.pilp,A=c.ffAtomType.mltb,C=f.ffAtomType.mltb;a:for(;;){if(this.isAromaticBond(l,k)){s=z||B?0.3:0.5;e=7==x+y?3:6;break a}if(2==d.order){e=6;s=2==A&&2==C?1:0.4;break a}c=c.atom.getCovalentBondCount();f=f.atom.getCovalentBondCount();if(4==c&&4==f){m=JM.FF.ForceFieldMMFF.getVParam(b);
p=JM.FF.ForceFieldMMFF.getVParam(g);w=9;break a}if(4!=c&&(x>c||0<A)||4!=f&&(y>f||0<C))return null;x=z&&0<C;y=B&&0<A;if(1==d.order&&(0<A&&0<C||x||y)){if(z&&B)return null;e=6;if(x){s=1==C?0.5:10>=b&&10>=g?0.3:0.15;break a}if(y){s=1==A?0.5:10>=b&&10>=g?0.3:0.15;break a}if((1==A||1==C)&&(6==b||6==g)){s=0.4;break a}s=0.15;break a}switch(b<<8+g){case 2056:u=v=2;break a;case 2064:u=2;v=8;break a;case 4104:u=8;v=2;break a;case 4112:u=v=8;break a}w=c*f;break a}0<s?r=e*s*Math.sqrt(j*n):0<w?q=Math.sqrt(m*p)/
w:0!=u&&(r=-Math.sqrt(u*v));a.ddata=t(-1,[0,r,q]);return Integer.$valueOf(-1);default:return null}},"JM.MinObject,~A,~N");d(c$,"getR0",function(a){return(null==a.ddata?this.ffParams.get(a.key):a.ddata)[1]},"JM.MinBond");d(c$,"getRowFor",function(a){a=this.minAtoms[a].atom.getElementNumber();return 3>a?0:11>a?1:19>a?2:37>a?3:4},"~N");d(c$,"getOutOfPlaneParameter",function(a){a=this.ffParams.get(this.getKey(a,6,13));return null==a?0:a[0]},"~A");c$.sortOop=d(c$,"sortOop",function(a){JM.FF.ForceFieldMMFF.fixTypeOrder(a,
0,2);JM.FF.ForceFieldMMFF.fixTypeOrder(a,0,3);JM.FF.ForceFieldMMFF.fixTypeOrder(a,2,3)},"~A");c$.fixTypeOrder=d(c$,"fixTypeOrder",function(a,b,c){return a[b]>a[c]?(JM.FF.ForceFieldMMFF.swap(a,b,c),!0):!1},"~A,~N,~N");d(c$,"fixOrder",function(a,b,c){var e=this.typeOf(a[c])-this.typeOf(a[b]);0>e&&JM.FF.ForceFieldMMFF.swap(a,b,c);return 0>e?-1:0<e?1:0},"~A,~N,~N");c$.swap=d(c$,"swap",function(a,b,c){var e=a[b];a[b]=a[c];a[c]=e},"~A,~N,~N");c$.getEquivalentType=d(c$,"getEquivalentType",function(a,b){return 0==
a?0:70==a||82<a?a:2==b?0:JM.FF.ForceFieldMMFF.equivalentTypes[(a-1<<1)+b]},"~N,~N");c$.getZParam=d(c$,"getZParam",function(a){switch(a){case 1:return 1.395;case 6:return 2.494;case 7:return 2.711;case 8:return 3.045;case 9:return 2.847;case 14:return 2.35;case 15:return 2.35;case 16:return 2.98;case 17:return 2.909;case 35:return 3.017;case 53:return 3.086}return 0},"~N");c$.getCParam=d(c$,"getCParam",function(a){switch(a){case 5:return 0.704;case 6:return 1.016;case 7:return 1.113;case 8:return 1.337;
case 14:return 0.811;case 15:return 1.068;case 16:return 1.249;case 17:return 1.078;case 33:return 0.825}return 0},"~N");c$.getUParam=d(c$,"getUParam",function(a){switch(a){case 6:case 7:case 8:return 2;case 14:case 15:case 16:return 1.25}return 0},"~N");c$.getVParam=d(c$,"getVParam",function(a){switch(a){case 6:return 2.12;case 7:return 1.5;case 8:return 0.2;case 14:return 1.22;case 15:return 2.4;case 16:return 0.49}return 0},"~N");c$.getCovalentRadius=d(c$,"getCovalentRadius",function(a){switch(a){case 1:return 0.33;
case 5:return 0.81;case 6:return 0.77;case 7:return 0.73;case 8:return 0.72;case 9:return 0.74;case 13:return 1.22;case 14:return 1.15;case 15:return 1.09;case 16:return 1.03;case 17:return 1.01;case 31:return 1.19;case 32:return 1.2;case 33:return 1.2;case 34:return 1.16;case 35:return 1.15;case 44:return 1.46;case 50:return 1.4;case 51:return 1.41;case 52:return 1.35;case 53:return 1.33;case 81:return 1.51;case 82:return 1.53;case 83:return 1.55;default:return JU.Elements.getBondingRadius(a,0)}},
"~N");c$.getRuleBondLength=d(c$,"getRuleBondLength",function(a,b,c){switch(c){case 1:case 2:case 3:break;case 5:break;default:return 0}a=a.atom.getElementNumber();b=b.atom.getElementNumber();c=JM.FF.ForceFieldMMFF.getCovalentRadius(a);var e=JM.FF.ForceFieldMMFF.getCovalentRadius(b),f=JU.Elements.getAllredRochowElectroNeg(a),d=JU.Elements.getAllredRochowElectroNeg(b);return a=c+e-(1==a||1==b?0.05:0.085)*Math.pow(Math.abs(f-d),1.4)},"JM.MinAtom,JM.MinAtom,~N,~B");w(c$,"A4_VDW",122,"A4_BNDK",123,"A4_CHRG",
124,"A4_SB",125,"A4_SBDEF",126,"KEY_SBDEF",0,"KEY_PBCI",0,"KEY_VDW",0,"KEY_BNDK",0,"KEY_OOP",6,"TYPE_PBCI",1,"TYPE_VDW",17,"TYPE_BNDK",546,"TYPE_CHRG",34,"TYPE_BOND",3,"TYPE_ANGLE",5,"TYPE_SB",21,"TYPE_SBDEF",37,"TYPE_TORSION",9,"TYPE_OOP",13,"atomTypes",null,"mmffParams",null,"mmff2DParams",null,"names","END.BCI.CHG.ANG.NDK.OND.OOP.TBN.FSB.TOR.VDW.","types",m(-1,[0,1,34,5,546,3,13,21,37,9,17]),"sbMap",m(-1,[0,1,3,5,4,6,8,9,11]),"equivalentTypes",m(-1,[1,1,2,1,3,1,4,1,5,5,6,6,7,6,8,8,9,8,10,8,11,
11,12,12,13,13,14,14,15,15,16,15,17,15,18,15,19,19,1,1,21,5,22,1,23,5,24,5,25,25,26,25,28,5,28,5,29,5,2,1,31,31,7,6,21,5,8,8,6,6,36,5,2,1,9,8,10,8,10,8,3,1,42,8,10,8,16,15,10,8,9,8,42,8,9,8,6,6,21,5,7,6,21,5,42,8,9,8,10,8,10,8,2,1,10,8,6,6,4,1,42,8,10,8,2,1,2,1,9,8,9,8,9,8,8,8,9,8,70,70,5,5,16,15,18,15,17,15,26,25,9,8,12,12,2,1,9,8,2,1,10,8,9,8]))});p("JM.FF");r(["JM.FF.ForceField","JS.T"],"JM.FF.ForceFieldUFF","java.util.Hashtable JU.BS $.Lst $.PT JM.FF.CalculationsUFF $.FFParam JU.Elements $.Logger JV.JmolAsyncException".split(" "),
function(){c$=s(function(){this.bsAromatic=this.ffParams=null;this.is2D=!1;q(this,arguments)},JM.FF,"ForceFieldUFF",JM.FF.ForceField);v(c$,function(a,b){z(this,JM.FF.ForceFieldUFF,[]);this.minimizer=a;b?(this.name="UFF2D",this.is2D=!0,this.ffParams=JM.FF.ForceFieldUFF.uff2DParams,null==this.ffParams&&(JM.FF.ForceFieldUFF.uff2DParams=this.ffParams=this.getParameters())):(this.name="UFF",this.ffParams=JM.FF.ForceFieldUFF.uffParams,null==this.ffParams&&(JM.FF.ForceFieldUFF.uffParams=this.ffParams=this.getParameters()))},
"JM.Minimizer,~B");l(c$,"clear",function(){this.bsAromatic=null});l(c$,"setModel",function(a,b){this.setModelFields();JU.Logger.info("minimize: setting atom types...");if(null==this.ffParams||null==JM.FF.ForceFieldUFF.atomTypes&&null==(JM.FF.ForceFieldUFF.atomTypes=this.getAtomTypes()))return!1;this.setAtomTypes(a,b);this.calc=new JM.FF.CalculationsUFF(this,this.ffParams,this.minAtoms,this.minBonds,this.minAngles,this.minTorsions,this.minPositions,this.minimizer.constraints);return this.calc.setupCalculations()},
"JU.BS,~N");d(c$,"setAtomTypes",function(a,b){var c=JM.FF.ForceFieldUFF.atomTypes.size();a.clear(0);for(var e=0;e<c;e++){var f=JM.FF.ForceFieldUFF.atomTypes.get(e),d=f[0];if(null!=d)if(d=this.getSearch(d,b,a),a.get(0))a.clear(0);else if(null==d)break;else for(var g=this.minimizer.bsAtoms.nextSetBit(0),j=0;g<this.minimizer.atoms.length&&0<=g;g=this.minimizer.bsAtoms.nextSetBit(g+1),j++)d.get(g)&&(this.minAtoms[j].sType=f[1].intern())}},"JU.BS,~N");d(c$,"getSearch",function(a,b,c){var e=null,f=a.length,
e=JM.FF.ForceFieldUFF.tokenTypes[0],d=a.charCodeAt(f-2)-48,g=0;10<=d&&(d=0);var j=!1;"#"==a.charAt(1)?g=JU.PT.parseInt(a.substring(2,f-1)):(g=a.substring(1,0<d?f-3:f-1),g.equals(g.toLowerCase())&&(g=g.toUpperCase(),j=!0),g=JU.Elements.elementNumberFromSymbol(g,!1));if(g>b)return null;if(!c.get(g))return c.set(0),null;switch(a.charAt(f-3)){case "D":e=JM.FF.ForceFieldUFF.tokenTypes[2];e[6].intValue=d;break;case "^":e=JM.FF.ForceFieldUFF.tokenTypes[4+(d-1)];break;case "+":e=JM.FF.ForceFieldUFF.tokenTypes[1];
e[5].intValue=d;break;case "-":e=JM.FF.ForceFieldUFF.tokenTypes[1];e[5].intValue=-d;break;case "A":e=JM.FF.ForceFieldUFF.tokenTypes[6]}e[2].intValue=g;b=this.minimizer.vwr.evaluateExpression(e);if(!D(b,JU.BS))return null;j&&0<=b.nextSetBit(0)&&(null==this.bsAromatic&&(this.bsAromatic=this.minimizer.vwr.evaluateExpression(JM.FF.ForceFieldUFF.tokenTypes[3])),b.and(this.bsAromatic));JU.Logger.debugging&&0<=b.nextSetBit(0)&&JU.Logger.debug(a+" minimize atoms="+b);return b},"~S,~N,JU.BS");d(c$,"getParameters",
function(){var a=new java.util.Hashtable,b=this.is2D?"UFF_2d.txt":"UFF.txt",c=null;try{for(var c=this.getBufferedReader(b),e;null!=(e=c.readLine());){var f=JU.PT.getTokens(e);if(!(13>f.length)&&(JU.Logger.debugging&&JU.Logger.debug(e),e.substring(0,5).equals("param"))){var d=new JM.FF.FFParam;a.put(f[1],d);d.dVal=t(11,0);d.sVal=Array(1);d.sVal[0]=f[1];d.dVal[0]=JU.PT.parseFloat(f[2]);d.dVal[1]=0.017453292519943295*JU.PT.parseFloat(f[3]);d.dVal[2]=JU.PT.parseFloat(f[4]);d.dVal[3]=JU.PT.parseFloat(f[5]);
d.dVal[4]=JU.PT.parseFloat(f[6]);d.dVal[5]=JU.PT.parseFloat(f[7]);d.dVal[6]=JU.PT.parseFloat(f[8]);d.dVal[7]=JU.PT.parseFloat(f[9]);d.dVal[8]=JU.PT.parseFloat(f[10]);d.dVal[9]=JU.PT.parseFloat(f[11]);d.dVal[10]=JU.PT.parseFloat(f[12]);d.iVal=m(1,0);var g=2<f[1].length?f[1].charAt(2):"1";switch(g){case "R":g="2";break;default:g="1";case "1":case "2":case "3":case "4":case "5":case "6":}d.iVal[0]=g.charCodeAt(0)-48}}c.close()}catch(j){if(y(j,Exception)){Zystem.err.println("Exception "+j.toString()+
" in getResource "+b);try{c.close()}catch(n){if(!y(n,Exception))throw n;}return null}throw j;}JU.Logger.info(a.size()+" atom types read from "+b);return a});d(c$,"getAtomTypes",function(){var a=new JU.Lst,b=this.is2D?"UFF_2d.txt":"UFF.txt";try{for(var c=this.getBufferedReader(b),e;null!=(e=c.readLine());)if(4<e.length&&e.substring(0,4).equals("atom")){var d=JU.PT.getTokens(e),h=j(-1,[d[1],d[2]]);a.addLast(h)}c.close()}catch(g){if(y(g,JV.JmolAsyncException))throw new JV.JmolAsyncException(g.getFileName());
if(y(g,Exception))Zystem.err.println("Exception "+g.toString()+" in getResource "+b);else throw g;}JU.Logger.info(a.size()+" UFF parameters read");return 0<a.size()?a:null});w(c$,"atomTypes",null,"uff2DParams",null,"uffParams",null,"TOKEN_ELEMENT_ONLY",0,"TOKEN_ELEMENT_CHARGED",1,"TOKEN_ELEMENT_CONNECTED",2,"TOKEN_AROMATIC",3,"TOKEN_ELEMENT_SP",4,"TOKEN_ELEMENT_ALLYLIC",6,"PT_ELEMENT",2,"PT_CHARGE",5,"PT_CONNECT",6);c$.tokenTypes=c$.prototype.tokenTypes=j(-1,[j(-1,[JS.T.tokenExpressionBegin,JS.T.n(268435860,
1094715402),JS.T.i(0),JS.T.tokenExpressionEnd]),j(-1,[JS.T.tokenExpressionBegin,JS.T.n(268435860,1094715402),JS.T.i(0),JS.T.tokenAnd,JS.T.n(268435860,1631586315),JS.T.i(0),JS.T.tokenExpressionEnd]),j(-1,[JS.T.tokenExpressionBegin,JS.T.n(268435860,1094715402),JS.T.i(0),JS.T.tokenAnd,JS.T.tokenConnected,JS.T.tokenLeftParen,JS.T.i(0),JS.T.tokenRightParen,JS.T.tokenExpressionEnd]),j(-1,[JS.T.tokenExpressionBegin,JS.T.o(1073741824,"flatring"),JS.T.tokenExpressionEnd]),j(-1,[JS.T.tokenExpressionBegin,JS.T.n(268435860,
1094715402),JS.T.i(0),JS.T.tokenAnd,JS.T.tokenLeftParen,JS.T.tokenConnected,JS.T.tokenLeftParen,JS.T.i(1),JS.T.tokenComma,JS.T.o(4,"triple"),JS.T.tokenRightParen,JS.T.tokenOr,JS.T.tokenConnected,JS.T.tokenLeftParen,JS.T.i(2),JS.T.tokenComma,JS.T.o(4,"double"),JS.T.tokenRightParen,JS.T.tokenRightParen,JS.T.tokenExpressionEnd]),j(-1,[JS.T.tokenExpressionBegin,JS.T.n(268435860,1094715402),JS.T.i(0),JS.T.tokenAnd,JS.T.o(134217736,"connected"),JS.T.tokenLeftParen,JS.T.i(1),JS.T.tokenComma,JS.T.o(4,"double"),
JS.T.tokenRightParen,JS.T.tokenExpressionEnd]),j(-1,[JS.T.tokenExpressionBegin,JS.T.n(268435860,1094715402),JS.T.i(0),JS.T.tokenAnd,JS.T.tokenLeftParen,JS.T.n(268435861,1094715402),JS.T.i(6),JS.T.tokenOr,JS.T.n(268435861,1631586315),JS.T.i(0),JS.T.tokenRightParen,JS.T.tokenAnd,JS.T.tokenConnected,JS.T.tokenLeftParen,JS.T.i(3),JS.T.tokenRightParen,JS.T.tokenAnd,JS.T.tokenConnected,JS.T.tokenLeftParen,JS.T.tokenConnected,JS.T.tokenLeftParen,JS.T.o(4,"double"),JS.T.tokenRightParen,JS.T.tokenRightParen,
JS.T.tokenExpressionEnd])])});p("JM.FF");c$=s(function(){this.key=null;this.dE=0;this.d=this.c=this.b=this.a=null;this.id=this.ic=this.ib=this.ia=0;this.dData=this.iData=null;this.energy=this.theta=this.rab=this.delta=0;this.calcs=null;q(this,arguments)},JM.FF,"Calculation");d(c$,"set",function(a){this.calcs=a;return this},"JM.FF.Calculations");d(c$,"setData",function(){},"JU.Lst,~N,~N,~N");d(c$,"getEnergy",function(){return this.energy});d(c$,"getPointers",function(a){this.dData=a[1];this.iData=
a[0];switch(this.iData.length){default:this.id=this.iData[3];case 3:this.ic=this.iData[2];case 2:this.ib=this.iData[1];case 1:this.ia=this.iData[0];case 0:}},"~A");p("JM.FF");r(["JU.AU","$.SB","$.V3d"],"JM.FF.Calculations",["java.lang.Float","JU.Lst","$.PT","JM.Util"],function(){c$=s(function(){this.ffParams=this.calculations=this.ff=this.parC=this.parB=this.parA=null;this.torsionCount=this.angleCount=this.bondCount=this.ac=0;this.constraintsByType=this.minPositions=this.minTorsions=this.minAngles=
this.minBonds=this.minAtoms=null;this.silent=this.gradients=this.isPreliminary=this.haveConstraints=!1;this.logData=null;this.loggingEnabled=this.logging=!1;this.dd=this.dc=this.db=this.da=null;this.id=this.ic=this.ib=this.ia=0;this.v3=this.v2=this.v1=null;q(this,arguments)},JM.FF,"Calculations");E(c$,function(){this.calculations=JU.AU.createArrayOfArrayList(7);this.logData=new JU.SB;this.da=new JU.V3d;this.db=new JU.V3d;this.dc=new JU.V3d;this.dd=new JU.V3d;this.v1=new JU.V3d;this.v2=new JU.V3d;
this.v3=new JU.V3d});d(c$,"getParameter",function(a){return this.ffParams.get(a)},"~O");v(c$,function(a,b,c,e,d,h,g){this.ff=a;this.minAtoms=b;this.minBonds=c;this.minAngles=e;this.minTorsions=d;this.minPositions=h;this.ac=b.length;this.bondCount=c.length;this.angleCount=e.length;this.torsionCount=d.length;this.setConstraints(g)},"JM.FF.ForceField,~A,~A,~A,~A,~A,JU.Lst");d(c$,"setConstraints",function(a){if(!(null==a||a.isEmpty())){this.constraintsByType=j(-1,[null,null,null]);this.haveConstraints=
!0;for(var b=Array(3),c=0,e=a.size();c<e;c++){var d=a.get(c);null==b[d.type]&&(b[d.type]=new JU.Lst);b[d.type].addLast(d)}for(a=0;2>=a;a++)c=b[a],null!=c&&(this.constraintsByType[a]=c.toArray(Array(c.size())))}},"JU.Lst");d(c$,"addForce",function(a,b,c){this.minAtoms[b].force[0]+=a.x*c;this.minAtoms[b].force[1]+=a.y*c;this.minAtoms[b].force[2]+=a.z*c},"JU.V3d,~N,~N");d(c$,"setSilent",function(a){this.silent=a},"~B");d(c$,"getLogData",function(){return this.logData.toString()});d(c$,"appendLogData",
function(a){this.logData.append(a).append("\n")},"~S");d(c$,"setLoggingEnabled",function(a){if(this.loggingEnabled=a)this.logData=new JU.SB},"~B");d(c$,"setPreliminary",function(a){this.isPreliminary=a},"~B");d(c$,"pairSearch",function(a,b,c,e){for(var d=0;d<this.ac-1;d++)for(var h=this.minAtoms[d].bsVdw,g=h.nextSetBit(0);0<=g;g=h.nextSetBit(g+1))b.setData(a,d,g,0),null!=e&&e.setData(c,d,g,0)},"JU.Lst,JM.FF.Calculation,JU.Lst,JM.FF.Calculation");d(c$,"calc",function(a,b,c){this.logging=this.loggingEnabled&&
!this.silent;this.gradients=b;var e=this.calculations[a],d;b=0;if(null==e||0==(d=e.size()))return 0;this.logging&&this.appendLogData(this.getDebugHeader(a));for(e=0;e<d;e++)b+=this.compute(a,this.calculations[a].get(e));this.logging&&this.appendLogData(this.getDebugFooter(a,b));c&&(this.haveConstraints&&null!=this.constraintsByType[a])&&(b+=this.constraintEnergy(a));return b},"~N,~B,~B");d(c$,"energyStrBnd",function(){return 0},"~B");d(c$,"energyBond",function(a){return this.calc(0,a,!0)},"~B");d(c$,
"energyAngle",function(a){return this.calc(1,a,!0)},"~B");d(c$,"energyTorsion",function(a){return this.calc(2,a,!0)},"~B");d(c$,"energyStretchBend",function(a){return this.calc(3,a,!1)},"~B");d(c$,"energyOOP",function(a){return this.calc(4,a,!1)},"~B");d(c$,"energyVDW",function(a){return this.calc(5,a,!1)},"~B");d(c$,"energyES",function(a){return this.calc(6,a,!1)},"~B");d(c$,"constraintEnergy",function(a){for(var b=this.constraintsByType[a],c=0,e=0,d=0,h=b.length;0<=--h;){var g=b[h],e=g.minList,
g=g.value;switch(a){case 2:this.id=e[3],this.gradients&&this.dd.setA(this.minAtoms[this.id].coord);case 1:this.ic=e[2],this.gradients&&this.dc.setA(this.minAtoms[this.ic].coord);case 0:this.ib=e[1],this.ia=e[0],this.gradients&&(this.db.setA(this.minAtoms[this.ib].coord),this.da.setA(this.minAtoms[this.ia].coord))}e=1E4;switch(a){case 2:g*=0.017453292519943295;c=this.gradients?JM.Util.restorativeForceAndTorsionAngleRadians(this.da,this.db,this.dc,this.dd):JM.Util.getTorsionAngleRadians(this.minAtoms[this.ia].coord,
this.minAtoms[this.ib].coord,this.minAtoms[this.ic].coord,this.minAtoms[this.id].coord,this.v1,this.v2,this.v3);0>c&&1.5707963267948966<=g?c+=6.283185307179586:0<c&&-1.5707963267948966>=g&&(g+=6.283185307179586);break;case 1:g*=0.017453292519943295;c=this.gradients?JM.Util.restorativeForceAndAngleRadians(this.da,this.db,this.dc):JM.Util.getAngleRadiansABC(this.minAtoms[this.ia].coord,this.minAtoms[this.ib].coord,this.minAtoms[this.ic].coord);break;case 0:c=this.gradients?JM.Util.restorativeForceAndDistance(this.da,
this.db,this.dc):Math.sqrt(JM.Util.distance2(this.minAtoms[this.ia].coord,this.minAtoms[this.ib].coord))}d+=this.constrainQuadratic(c,g,e,a)}return d},"~N");d(c$,"constrainQuadratic",function(a,b,c,e){if(!JM.Util.isFinite(a))return 0;a-=b;if(this.gradients)switch(b=2*c*a,e){case 2:this.addForce(this.dd,this.id,b);case 1:this.addForce(this.dc,this.ic,b);case 0:this.addForce(this.db,this.ib,b),this.addForce(this.da,this.ia,b)}return c*a*a},"~N,~N,~N,~N");d(c$,"getConstraintList",function(){if(null!=
this.constraintsByType){this.appendLogData("C O N S T R A I N T S\n---------------------");for(var a=0;2>=a;a++){var b=this.constraintsByType[a];if(null!=b)for(var c=0,e=b.length;c<e;c++){var d=b[c],h=d.minList,g=d.value;switch(d.type){case 2:this.id=h[3];case 1:this.ic=h[2];case 0:this.ib=h[1],this.ia=h[0]}switch(d.type){case 0:this.appendLogData(JU.PT.sprintf("%3d %3d  %-5s %-5s  %12.6f","ssFI",j(-1,[this.minAtoms[this.ia].atom.getAtomName(),this.minAtoms[this.ib].atom.getAtomName(),x(-1,[g]),m(-1,
[this.minAtoms[this.ia].atom.getAtomNumber(),this.minAtoms[this.ib].atom.getAtomNumber()])])));break;case 1:this.appendLogData(JU.PT.sprintf("%3d %3d %3d  %-5s %-5s %-5s  %12.6f","sssFI",j(-1,[this.minAtoms[this.ia].atom.getAtomName(),this.minAtoms[this.ib].atom.getAtomName(),this.minAtoms[this.ic].atom.getAtomName(),x(-1,[g]),m(-1,[this.minAtoms[this.ia].atom.getAtomNumber(),this.minAtoms[this.ib].atom.getAtomNumber(),this.minAtoms[this.ic].atom.getAtomNumber()])])));break;case 2:this.appendLogData(JU.PT.sprintf("%3d %3d %3d %3d  %-5s %-5s %-5s %-5s  %3d %8.3f     %8.3f     %8.3f     %8.3f",
"ssssFI",j(-1,[this.minAtoms[this.ia].atom.getAtomName(),this.minAtoms[this.ib].atom.getAtomName(),this.minAtoms[this.ic].atom.getAtomName(),this.minAtoms[this.id].atom.getAtomName(),x(-1,[g]),m(-1,[this.minAtoms[this.ia].atom.getAtomNumber(),this.minAtoms[this.ib].atom.getAtomNumber(),this.minAtoms[this.ic].atom.getAtomNumber(),this.minAtoms[this.id].atom.getAtomNumber()])])))}}}this.appendLogData("---------------------\n")}});d(c$,"getAtomList",function(a){var b=new JU.SB;b.append("\n"+a+"\n\n ATOM    X        Y        Z    TYPE       GRADX    GRADY    GRADZ  ---------BONDED ATOMS--------\n--------------------------------------------------------------------------------------------------\n");
for(a=0;a<this.ac;a++){var c=this.minAtoms[a],e=c.getBondedAtomIndexes(),d=m(e.length+2,0);d[0]=c.atom.getAtomNumber();d[1]=null==c.ffAtomType?0:c.ffAtomType.mmType;for(var h="   ",g=0;g<e.length;g++)h+=" %3d",d[g+2]=this.minAtoms[e[g]].atom.getAtomNumber();b.append(JU.PT.sprintf("%3d %8.3f %8.3f %8.3f %-5s %2d %8.3f %8.3f %8.3f"+h+"\n","sFI",j(-1,[c.sType,x(-1,[c.coord[0],c.coord[1],c.coord[2],c.force[0],c.force[1],c.force[2]]),d])))}b.append("--------------------------------------------------------------------------------------------------\n\n\n");
return b.toString()},"~S");d(c$,"getDebugHeader2",function(a){switch(a){case 0:return"\nB O N D   S T R E T C H I N G ("+this.bondCount+" bonds)\n\n  ATOMS  ATOM TYPES   BOND    BOND       IDEAL      FORCE\n  I   J   I     J     TYPE   LENGTH     LENGTH    CONSTANT      DELTA     ENERGY\n--------------------------------------------------------------------------------";case 1:return"\nA N G L E   B E N D I N G ("+this.minAngles.length+" angles)\n\n    ATOMS      ATOM TYPES        VALENCE    IDEAL        FORCE\n  I   J   K   I     J     K       ANGLE     ANGLE      CONSTANT     ENERGY\n--------------------------------------------------------------------------";
case 3:return"\nS T R E T C H   B E N D I N G ("+2*this.minAngles.length+" angles)\n\n    ATOMS      ATOM TYPES        VALENCE    IDEAL        FORCE\n  I   J   K   I     J     K       ANGLE     ANGLE      CONSTANT     ENERGY\n--------------------------------------------------------------------------";case 2:return"\nT O R S I O N A L ("+this.minTorsions.length+" torsions)\n\n      ATOMS           ATOM TYPES            n    COS          FORCE      TORSION\n  I   J   K   L   I     J     K     L          (n phi0)      CONSTANT     ANGLE        ENERGY\n---------------------------------------------------------------------------------------------";
case 4:return"\nO U T - O F - P L A N E   B E N D I N G\n\n      ATOMS           ATOM TYPES             OOP        FORCE \n  I   J   K   L   I     J     K     L       ANGLE     CONSTANT      ENERGY\n--------------------------------------------------------------------------";case 5:return"\nV A N   D E R   W A A L S  (partial list)\n\n  ATOMS  ATOM TYPES\n  I   J   I     J      Rij       kij     ENERGY\n-----------------------------------------------";case 6:return"\nE L E C T R O S T A T I C   I N T E R A C T I O N S  (partial list)\n\n  ATOMS  ATOM TYPES \n  I   J   I     J      Rij      f          Qi          Qj    ENERGY\n-------------------------------------------------------------------"}return""},
"~N");d(c$,"getDebugLine",function(a,b){return this.getDebugLineC(a,b)},"~N,JM.FF.Calculation");d(c$,"getDebugLineC",function(a,b){var c=this.ff.toUserUnits(b.energy);switch(a){case 0:return JU.PT.sprintf("%3d %3d  %-5s %-5s  %4.2f%8.3f   %8.3f     %8.3f   %8.3f   %8.3f","ssFI",j(-1,[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,x(-1,[0,b.rab,b.dData[1],b.dData[0],b.delta,c]),m(-1,[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber()])]));case 1:case 3:return JU.PT.sprintf("%3d %3d %3d  %-5s %-5s %-5s  %8.3f  %8.3f     %8.3f   %8.3f",
"sssFI",j(-1,[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,x(-1,[57.29577951308232*b.theta,b.dData[1],b.dData[0],c]),m(-1,[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber(),this.minAtoms[b.ic].atom.getAtomNumber()])]));case 2:return JU.PT.sprintf("%3d %3d %3d %3d  %-5s %-5s %-5s %-5s  %3d %8.3f     %8.3f     %8.3f     %8.3f","ssssFI",j(-1,[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,this.minAtoms[b.id].sType,
x(-1,[b.dData[1],b.dData[0],57.29577951308232*b.theta,c]),m(-1,[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber(),this.minAtoms[b.ic].atom.getAtomNumber(),this.minAtoms[b.id].atom.getAtomNumber(),b.iData[4]])]));case 4:return JU.PT.sprintf("%3d %3d %3d %3d  %-5s %-5s %-5s %-5s  %8.3f   %8.3f     %8.3f","ssssFI",j(-1,[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,this.minAtoms[b.id].sType,x(-1,[57.29577951308232*b.theta,b.dData[0],c]),
m(-1,[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber(),this.minAtoms[b.ic].atom.getAtomNumber(),this.minAtoms[b.id].atom.getAtomNumber()])]));case 5:return JU.PT.sprintf("%3d %3d  %-5s %-5s %6.3f  %8.3f  %8.3f","ssFI",j(-1,[this.minAtoms[b.iData[0]].sType,this.minAtoms[b.iData[1]].sType,x(-1,[b.rab,b.dData[0],c]),m(-1,[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber()])]));case 6:return JU.PT.sprintf("%3d %3d  %-5s %-5s %6.3f  %8.3f  %8.3f  %8.3f  %8.3f",
"ssFI",j(-1,[this.minAtoms[b.iData[0]].sType,this.minAtoms[b.iData[1]].sType,x(-1,[b.rab,b.dData[0],b.dData[1],b.dData[2],c]),m(-1,[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber()])]))}return""},"~N,JM.FF.Calculation");d(c$,"getDebugFooter",function(a,b){var c="";switch(a){case 0:c="BOND STRETCHING";break;case 1:c="ANGLE BENDING";break;case 2:c="TORSIONAL";break;case 4:c="OUT-OF-PLANE BENDING";break;case 3:c="STRETCH BENDING";break;case 5:c="VAN DER WAALS";break;
case 6:c="ELECTROSTATIC ENERGY"}return JU.PT.sprintf("\n     TOTAL %s ENERGY = %8.3f %s/mol\n","sfs",j(-1,[c,Float.$valueOf(this.ff.toUserUnits(b)),this.ff.minimizer.units]))},"~N,~N");d(c$,"setPairVariables",function(a){this.gradients?(this.setCoords(a,2),a.rab=JM.Util.restorativeForceAndDistance(this.da,this.db,this.dc)):a.rab=Math.sqrt(JM.Util.distance2(this.minAtoms[a.ia].coord,this.minAtoms[a.ib].coord));JM.Util.isNearZero2(a.rab,0.001)&&(a.rab=0.001)},"JM.FF.Calculation");d(c$,"setAngleVariables",
function(a){this.gradients?(this.setCoords(a,3),a.theta=JM.Util.restorativeForceAndAngleRadians(this.da,this.db,this.dc)):a.theta=JM.Util.getAngleRadiansABC(this.minAtoms[a.ia].coord,this.minAtoms[a.ib].coord,this.minAtoms[a.ic].coord);JM.Util.isFinite(a.theta)||(a.theta=0)},"JM.FF.Calculation");d(c$,"setOopVariables",function(a,b){this.setCoords(a,4);a.theta=this.gradients?JM.Util.restorativeForceAndOutOfPlaneAngleRadians(this.da,this.db,this.dc,this.dd,this.v1,this.v2,this.v3):JM.Util.pointPlaneAngleRadians(this.da,
this.db,this.dc,this.dd,this.v1,this.v2,this.v3,b);JM.Util.isFinite(a.theta)||(a.theta=0)},"JM.FF.Calculation,~B");d(c$,"setTorsionVariables",function(a){this.gradients?(this.setCoords(a,4),a.theta=JM.Util.restorativeForceAndTorsionAngleRadians(this.da,this.db,this.dc,this.dd),JM.Util.isFinite(a.theta)||(a.theta=1.7453292519943296E-5)):a.theta=JM.Util.getTorsionAngleRadians(this.minAtoms[a.ia].coord,this.minAtoms[a.ib].coord,this.minAtoms[a.ic].coord,this.minAtoms[a.id].coord,this.v1,this.v2,this.v3)},
"JM.FF.Calculation");d(c$,"setCoords",function(a,b){switch(b){case 4:this.da.setA(this.minAtoms[a.ia].coord);case 3:this.db.setA(this.minAtoms[a.ib].coord);case 2:this.dc.setA(this.minAtoms[a.ic].coord);case 1:this.dd.setA(this.minAtoms[a.id].coord)}},"JM.FF.Calculation,~N");d(c$,"addForces",function(a,b){switch(b){case 4:this.addForce(this.dd,a.id,a.dE);case 3:this.addForce(this.dc,a.ic,a.dE);case 2:this.addForce(this.db,a.ib,a.dE);case 1:this.addForce(this.da,a.ia,a.dE)}},"JM.FF.Calculation,~N");
d(c$,"isLinear",function(){return!1},"~N");w(c$,"RAD_TO_DEG",57.29577951308232,"DEG_TO_RAD",0.017453292519943295,"KCAL_TO_KJ",4.1868,"CALC_DISTANCE",0,"CALC_ANGLE",1,"CALC_TORSION",2,"CALC_STRETCH_BEND",3,"CALC_OOP",4,"CALC_VDW",5,"CALC_ES",6,"CALC_MAX",7,"PI_OVER_2",1.5707963267948966,"TWO_PI",6.283185307179586)});p("JM.FF");r(["JM.FF.Calculations"],"JM.FF.CalculationsMMFF","JU.Lst $.PT JM.MinAtom $.MinObject JM.FF.MMFFAngleCalc $.MMFFDistanceCalc $.MMFFESCalc $.MMFFOOPCalc $.MMFFSBCalc $.MMFFTorsionCalc $.MMFFVDWCalc".split(" "),
function(){c$=s(function(){this.mmff=this.sbCalc=this.esCalc=this.vdwCalc=this.oopCalc=this.torsionCalc=this.angleCalc=this.bondCalc=null;q(this,arguments)},JM.FF,"CalculationsMMFF",JM.FF.Calculations);v(c$,function(a,b,c,e,d,h,g,j){z(this,JM.FF.CalculationsMMFF,[a,c,e,d,h,g,j]);this.mmff=a;this.ffParams=b;this.bondCalc=(new JM.FF.MMFFDistanceCalc).set(this);this.angleCalc=(new JM.FF.MMFFAngleCalc).set(this);this.sbCalc=(new JM.FF.MMFFSBCalc).set(this);this.torsionCalc=(new JM.FF.MMFFTorsionCalc).set(this);
this.oopCalc=(new JM.FF.MMFFOOPCalc).set(this);this.vdwCalc=(new JM.FF.MMFFVDWCalc).set(this);this.esCalc=(new JM.FF.MMFFESCalc).set(this)},"JM.FF.ForceField,java.util.Map,~A,~A,~A,~A,~A,JU.Lst");l(c$,"getUnits",function(){return"kcal"});l(c$,"setupCalculations",function(){var a,b=(new JM.FF.MMFFDistanceCalc).set(this);a=this.calculations[0]=new JU.Lst;for(var c=0;c<this.bondCount;c++)b.setData(a,this.minBonds[c]);a=this.calculations[1]=new JU.Lst;b=(new JM.FF.MMFFAngleCalc).set(this);for(c=0;c<this.angleCount;c++)b.setData(a,
this.minAngles[c]);a=this.calculations[3]=new JU.Lst;b=(new JM.FF.MMFFSBCalc).set(this);for(c=0;c<this.angleCount;c++)b.setData(a,this.minAngles[c]);a=this.calculations[2]=new JU.Lst;b=(new JM.FF.MMFFTorsionCalc).set(this);for(c=0;c<this.torsionCount;c++)b.setData(a,this.minTorsions[c]);a=this.calculations[4]=new JU.Lst;b=(new JM.FF.MMFFOOPCalc).set(this);for(c=0;c<this.ac;c++)JM.FF.CalculationsMMFF.isInvertible(this.minAtoms[c])&&b.setData(a,c);this.pairSearch(this.calculations[5]=new JU.Lst,(new JM.FF.MMFFVDWCalc).set(this),
this.calculations[6]=new JU.Lst,(new JM.FF.MMFFESCalc).set(this));return!0});l(c$,"isLinear",function(a){return JM.MinAtom.isLinear(this.minAtoms[a])},"~N");c$.isInvertible=d(c$,"isInvertible",function(a){switch(a.ffType){default:return!1;case 2:case 3:case 10:case 30:case 37:case 39:case 40:case 41:case 45:case 49:case 54:case 55:case 56:case 57:case 58:case 63:case 64:case 67:case 69:case 78:case 80:case 81:return!0}},"JM.MinAtom");l(c$,"compute",function(a,b){switch(a){case 0:return this.bondCalc.compute(b);
case 1:return this.angleCalc.compute(b);case 3:return this.sbCalc.compute(b);case 2:return this.torsionCalc.compute(b);case 4:return this.oopCalc.compute(b);case 5:return this.vdwCalc.compute(b);case 6:return this.esCalc.compute(b)}return 0},"~N,~A");l(c$,"getParameterObj",function(a){return null==a.key||null!=a.ddata?a.ddata:this.ffParams.get(a.key)},"JM.MinObject");l(c$,"getDebugHeader",function(a){switch(a){case -1:return"MMFF94 Force Field -- T. A. Halgren, J. Comp. Chem. 5 & 6 490-519ff (1996).\n";
case 2:return"\nT O R S I O N A L ("+this.minTorsions.length+" torsions)\n\n      ATOMS           ATOM TYPES          TORSION\n  I   J   K   L   I     J     K     L      ANGLE       V1       V2       V3     ENERGY\n--------------------------------------------------------------------------------------\n";default:return this.getDebugHeader2(a)}},"~N");l(c$,"getDebugLine",function(a,b){var c=this.ff.toUserUnits(b.energy);switch(a){case 1:case 3:return JU.PT.sprintf("%11s  %-5s %-5s %-5s  %8.3f  %8.3f     %8.3f   %8.3f",
"ssssFI",j(-1,[JM.MinObject.decodeKey(b.key),this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,x(-1,[57.29577951308232*b.theta,b.dData[1],b.dData[0],c]),m(-1,[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber(),this.minAtoms[b.ic].atom.getAtomNumber()])]));case 2:return JU.PT.sprintf("%15s  %-5s %-5s %-5s %-5s  %8.3f %8.3f %8.3f %8.3f %8.3f","sssssF",j(-1,[JM.MinObject.decodeKey(b.key),this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,
this.minAtoms[b.id].sType,x(-1,[57.29577951308232*b.theta,b.dData[0],b.dData[1],b.dData[2],c])]));default:return this.getDebugLineC(a,b)}},"~N,JM.FF.Calculation");w(c$,"FPAR",143.9325,"DA_D","D","DA_DA",133)});p("JM.FF");r(["JM.FF.Calculations"],"JM.FF.CalculationsUFF","JU.Lst JM.FF.UFFAngleCalc $.UFFDistanceCalc $.UFFOOPCalc $.UFFTorsionCalc $.UFFVDWCalc".split(" "),function(){c$=s(function(){this.vdwCalc=this.oopCalc=this.torsionCalc=this.angleCalc=this.bondCalc=null;q(this,arguments)},JM.FF,"CalculationsUFF",
JM.FF.Calculations);v(c$,function(a,b,c,e,d,h,g,j){z(this,JM.FF.CalculationsUFF,[a,c,e,d,h,g,j]);this.ffParams=b;this.bondCalc=(new JM.FF.UFFDistanceCalc).set(this);this.angleCalc=(new JM.FF.UFFAngleCalc).set(this);this.torsionCalc=(new JM.FF.UFFTorsionCalc).set(this);this.oopCalc=(new JM.FF.UFFOOPCalc).set(this);this.vdwCalc=(new JM.FF.UFFVDWCalc).set(this)},"JM.FF.ForceField,java.util.Map,~A,~A,~A,~A,~A,JU.Lst");l(c$,"getUnits",function(){return"kJ"});l(c$,"setupCalculations",function(){var a,b=
(new JM.FF.UFFDistanceCalc).set(this);a=this.calculations[0]=new JU.Lst;for(var c=0;c<this.bondCount;c++){var e=this.minBonds[c],d=e.order;e.isAromatic&&(d=1.5);e.isAmide&&(d=1.41);b.setData(a,e.data[0],e.data[1],d)}a=this.calculations[1]=new JU.Lst;b=(new JM.FF.UFFAngleCalc).set(this);for(c=this.minAngles.length;0<=--c;)b.setData(a,this.minAngles[c].data);a=this.calculations[2]=new JU.Lst;b=(new JM.FF.UFFTorsionCalc).set(this);for(c=this.minTorsions.length;0<=--c;)b.setData(a,this.minTorsions[c].data);
a=this.calculations[4]=new JU.Lst;for(var b=(new JM.FF.UFFOOPCalc).set(this),h,c=0;c<this.ac;c++)e=this.minAtoms[c],3==e.nBonds&&("C_3"!==e.sType&&JM.FF.CalculationsUFF.isInvertible(h=e.atom.getElementNumber()))&&b.setData(a,c,h,0);this.pairSearch(this.calculations[5]=new JU.Lst,(new JM.FF.UFFVDWCalc).set(this),null,null);return!0});c$.isInvertible=d(c$,"isInvertible",function(a){switch(a){case 6:case 7:case 8:case 15:case 33:case 51:case 83:return!0;default:return!1}},"~N");c$.calculateR0=d(c$,"calculateR0",
function(a,b,c,e,d){d=-0.1332*(a+b)*Math.log(d);var h=Math.sqrt(c)-Math.sqrt(e);return a+b+d-a*b*h*h/(c*a+e*b)},"~N,~N,~N,~N,~N");l(c$,"compute",function(a,b){switch(a){case 0:return this.bondCalc.compute(b);case 1:return this.angleCalc.compute(b);case 2:return this.torsionCalc.compute(b);case 4:return this.oopCalc.compute(b);case 5:return this.vdwCalc.compute(b)}return 0},"~N,~A");l(c$,"getDebugHeader",function(a){switch(a){case -1:return"Universal Force Field -- Rappe, A. K., et. al.; J. Am. Chem. Soc. (1992) 114(25) p. 10024-10035\n";
default:return this.getDebugHeader2(a)}},"~N");l(c$,"getParameterObj",function(){return null},"JM.MinObject");w(c$,"KCAL332",1390.2842991599998,"KCAL644",2696.8016159999997,"KCAL6",25.1208,"KCAL22",92.1096,"KCAL44",184.2192,"PAR_R",0,"PAR_THETA",1,"PAR_X",2,"PAR_D",3,"PAR_ZETA",4,"PAR_Z",5,"PAR_V",6,"PAR_U",7,"PAR_XI",8,"PAR_HARD",9,"PAR_RADIUS",10)});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.MMFFAngleCalc",null,function(){c$=u(JM.FF,"MMFFAngleCalc",JM.FF.Calculation);d(c$,"setData",function(a,b){var c=
this.calcs.getParameterObj(b);null!=c&&a.addLast(j(-1,[b.data,c,b.key]))},"JU.Lst,JM.MinAngle");l(c$,"compute",function(a){this.key=a[2];this.getPointers(a);a=this.dData[0];var b=this.dData[1];this.calcs.setAngleVariables(this);var c=57.29577951308232*this.theta-b;180==b?(this.energy=143.9325*a*(1+Math.cos(this.theta)),this.calcs.gradients&&(this.dE=-143.9325*a*Math.sin(this.theta))):(this.energy=0.021922*a*Math.pow(c,2)*(1+-0.006981317007977318*c),this.calcs.gradients&&(this.dE=0.021922*a*c*(2+-0.020943951023931956*
c)));this.calcs.gradients&&this.calcs.addForces(this,3);this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(1,this));return this.energy},"~A");w(c$,"CB",-0.006981317007977318)});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.MMFFDistanceCalc",null,function(){c$=s(function(){this.delta2=this.kb=this.r0=0;q(this,arguments)},JM.FF,"MMFFDistanceCalc",JM.FF.Calculation);d(c$,"setData",function(a,b){this.ia=b.data[0];this.ib=b.data[1];var c=this.calcs.getParameterObj(b);null!=c&&a.addLast(j(-1,
[m(-1,[this.ia,this.ib]),c]))},"JU.Lst,JM.MinBond");l(c$,"compute",function(a){this.getPointers(a);this.kb=this.dData[0];this.r0=this.dData[1];this.calcs.setPairVariables(this);this.delta=this.rab-this.r0;this.delta2=this.delta*this.delta;this.energy=71.96625*this.kb*this.delta2*(1+-2*this.delta+2.3333333333333335*this.delta2);this.calcs.gradients&&(this.dE=71.96625*this.kb*this.delta*(2+-6*this.delta+9.333333333333334*this.delta2),this.calcs.addForces(this,2));this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(0,
this));return this.energy},"~A");w(c$,"FSTRETCH",71.96625,"CS",-2,"CS2",2.3333333333333335)});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.MMFFESCalc",null,function(){c$=u(JM.FF,"MMFFESCalc",JM.FF.Calculation);l(c$,"setData",function(a,b,c){0==this.calcs.minAtoms[b].partialCharge||0==this.calcs.minAtoms[c].partialCharge||a.addLast(j(-1,[m(-1,[b,c]),t(-1,[this.calcs.minAtoms[b].partialCharge,this.calcs.minAtoms[c].partialCharge,this.calcs.minAtoms[b].bs14.get(c)?249.0537:332.0716])]))},"JU.Lst,~N,~N,~N");
l(c$,"compute",function(a){this.getPointers(a);a=this.dData[0]*this.dData[1]*this.dData[2];this.calcs.setPairVariables(this);var b=this.rab+0.05;this.energy=a/b;this.calcs.gradients&&(this.dE=-this.energy/b,this.calcs.addForces(this,2));this.calcs.logging&&20<Math.abs(this.energy)&&this.calcs.appendLogData(this.calcs.getDebugLine(6,this));return this.energy},"~A");w(c$,"BUFF",0.05)});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.MMFFOOPCalc",null,function(){c$=s(function(){this.list=null;q(this,arguments)},
JM.FF,"MMFFOOPCalc",JM.FF.Calculation);E(c$,function(){this.list=m(4,0)});d(c$,"setData",function(a,b){if(3==this.calcs.minAtoms[b].nBonds){var c=this.calcs.minAtoms[b].getBondedAtomIndexes();this.list[0]=c[2];this.list[1]=b;this.list[2]=c[1];this.list[3]=c[0];var e=this.calcs.mmff.getOutOfPlaneParameter(this.list);0!=e&&(e=t(-1,[e]),a.addLast(j(-1,[m(-1,[c[0],b,c[1],c[2]]),e])),a.addLast(j(-1,[m(-1,[c[1],b,c[2],c[0]]),e])),a.addLast(j(-1,[m(-1,[c[2],b,c[0],c[1]]),e])))}},"JU.Lst,~N");l(c$,"compute",
function(a){this.getPointers(a);this.calcs.setOopVariables(this,!1);a=this.dData[0];this.energy=71.96568080495746*a*this.theta*this.theta;this.calcs.gradients&&(this.dE=2.5120761569715815*a*this.theta,this.calcs.addForces(this,4));this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(4,this));return this.energy},"~A");w(c$,"FOOPD",2.5120761569715815,"FOOP",71.96568080495746)});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.MMFFSBCalc",null,function(){c$=u(JM.FF,"MMFFSBCalc",JM.FF.Calculation);
d(c$,"setData",function(a,b){if(!this.calcs.isLinear(b.data[1])){var c=this.calcs.getParameter(b.sbKey),e=this.calcs.getParameterObj(b),d=this.calcs.getParameter(this.calcs.minBonds[b.data[3]]),h=this.calcs.getParameter(this.calcs.minBonds[b.data[4]]);null==c||(null==e||null==d||null==h)||(e=e[1],h=h[1],a.addLast(j(-1,[b.data,t(-1,[c[0],e,d[1]]),b.sbKey])),a.addLast(j(-1,[m(-1,[b.data[2],b.data[1],b.data[0]]),t(-1,[c[1],e,h]),b.sbKey])))}},"JU.Lst,JM.MinAngle");l(c$,"compute",function(a){this.key=
a[2];this.getPointers(a);a=2.5121*this.dData[0];var b=this.dData[1],c=this.dData[2];this.calcs.setPairVariables(this);this.calcs.setAngleVariables(this);c=this.rab-c;this.delta=57.29577951308232*this.theta-b;this.energy=a*c*this.delta;this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(3,this));this.calcs.gradients&&(this.dE=a*c,this.calcs.addForces(this,3),this.calcs.setPairVariables(this),this.dE=a*this.delta,this.calcs.addForces(this,2));return this.energy},"~A")});p("JM.FF");
r(["JM.FF.Calculation"],"JM.FF.MMFFTorsionCalc",null,function(){c$=u(JM.FF,"MMFFTorsionCalc",JM.FF.Calculation);d(c$,"setData",function(a,b){if(!this.calcs.isLinear(b.data[1])&&!this.calcs.isLinear(b.data[2])){var c=this.calcs.getParameterObj(b);null!=c&&a.addLast(j(-1,[b.data,c,b.key]))}},"JU.Lst,JM.MinTorsion");l(c$,"compute",function(a){this.key=a[2];this.getPointers(a);a=this.dData[0];var b=this.dData[1],c=this.dData[2];this.calcs.setTorsionVariables(this);var e=Math.cos(this.theta),d=e*e;this.energy=
0.5*(a*(1+e)+b*(2-2*d)+c*(1+e*(4*d-3)));if(this.calcs.gradients){var h=Math.sin(this.theta);this.dE=0.5*(-a*h+4*b*h*e+3*c*h*(1-4*d));this.calcs.addForces(this,4)}this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(2,this));return this.energy},"~A")});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.MMFFVDWCalc",null,function(){c$=u(JM.FF,"MMFFVDWCalc",JM.FF.Calculation);l(c$,"setData",function(a,b,c){this.a=this.calcs.minAtoms[b];this.b=this.calcs.minAtoms[c];var e=this.calcs.getParameter(this.a.vdwKey),
d=this.calcs.getParameter(this.b.vdwKey);if(!(null==e||null==d)){var h=e[0],g=e[1],l=e[2],n=e[3],e=F(e[4]),p=d[0],r=d[1],k=d[2],q=d[3],d=F(d[4]),l=l*Math.pow(h,0.25),s=k*Math.pow(p,0.25),k=(l-s)/(l+s),l=0.5*(l+s);68!=e&&68!=d&&(l*=1+0.2*(1-Math.exp(-12*k*k)));h=181.16*n*q*h*p/(Math.sqrt(h/g)+Math.sqrt(p/r))*Math.pow(l,-6);133==e+d&&(l*=0.8,h*=0.5);a.addLast(j(-1,[m(-1,[b,c]),t(-1,[l,h])]))}},"JU.Lst,~N,~N,~N");l(c$,"compute",function(a){this.getPointers(a);this.calcs.setPairVariables(this);a=this.dData[0];
var b=this.dData[1],c=this.rab/a,e=1.07/(c+0.07),d=1.12/(Math.pow(c,7)+0.12);this.energy=b*Math.pow(e,7)*(d-2);this.calcs.gradients&&(this.dE=-7*b*Math.pow(e,7)/a*(e/1.07*(d-2)+d*d*Math.pow(c,6)),this.calcs.addForces(this,2));this.calcs.logging&&0.1<Math.abs(this.energy)&&this.calcs.appendLogData(this.calcs.getDebugLine(5,this));return this.energy},"~A")});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.UFFAngleCalc",["JM.FF.CalculationsUFF"],function(){c$=u(JM.FF,"UFFAngleCalc",JM.FF.Calculation);d(c$,
"setData",function(a,b){this.a=this.calcs.minAtoms[this.ia=b[0]];this.b=this.calcs.minAtoms[this.ib=b[1]];this.c=this.calcs.minAtoms[this.ic=b[2]];var c="H_"===this.a.sType&&"H_"===this.c.sType?10:1;this.calcs.parA=this.calcs.getParameter(this.a.sType);this.calcs.parB=this.calcs.getParameter(this.b.sType);this.calcs.parC=this.calcs.getParameter(this.c.sType);var e=this.calcs.parB.iVal[0],d=this.calcs.parA.dVal[5],h=this.calcs.parC.dVal[5],g=this.calcs.parB.dVal[1],l=Math.cos(g),n=Math.sin(g),p,r;
switch(e){case 1:case 2:case 4:case 6:n=p=r=0;break;default:r=1/(4*n*n),p=-4*r*l,n=r*(2*l*l+1)}var k=this.a.getBondTo(this.ib),q=k.order;k.isAromatic&&(q=1.5);k.isAmide&&(q=1.41);this.rab=JM.FF.CalculationsUFF.calculateR0(this.calcs.parA.dVal[0],this.calcs.parB.dVal[0],this.calcs.parA.dVal[8],this.calcs.parB.dVal[8],q);k=this.c.getBondTo(this.ib);q=k.order;k.isAromatic&&(q=1.5);k.isAmide&&(q=1.41);k=JM.FF.CalculationsUFF.calculateR0(this.calcs.parB.dVal[0],this.calcs.parC.dVal[0],this.calcs.parB.dVal[8],
this.calcs.parC.dVal[8],q);q=Math.sqrt(this.rab*this.rab+k*k-2*this.rab*k*l);d=2696.8016159999997*(d*h/Math.pow(q,5))*(3*this.rab*k*(1-l*l)-q*q*l);a.addLast(j(-1,[m(-1,[this.ia,this.ib,this.ic,e]),t(-1,[d,57.29577951308232*g,n-r,p,2*r,c*d])]))},"JU.Lst,~A");l(c$,"compute",function(a){this.getPointers(a);a=this.iData[3];var b=this.calcs.isPreliminary?this.dData[5]:this.dData[0],c=this.dData[2],e=this.dData[3],d=this.dData[4];this.calcs.setAngleVariables(this);if((4==a||6==a)&&(2.35619<this.theta||
0.785398>this.theta))a=1;var h=Math.cos(this.theta),g=Math.sin(this.theta);switch(a){case 0:case 1:this.energy=b*(1+h)*(1+h)/4;break;case 2:this.energy=b*(1+4*h*(1+h))/9;break;case 4:case 6:this.energy=b*h*h;break;default:this.energy=b*(c+e*h+d*h*h)}if(this.calcs.gradients){switch(a){case 0:case 1:this.dE=-0.5*b*g*(1+h);break;case 2:this.dE=-4*g*b*(1-2*h)/9;break;case 4:case 6:this.dE=-b*g*h;break;default:this.dE=-b*(e*g-2*d*h*g)}this.calcs.addForces(this,3)}this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(1,
this));return this.energy},"~A")});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.UFFDistanceCalc",["JM.FF.CalculationsUFF"],function(){c$=s(function(){this.kb=this.r0=0;q(this,arguments)},JM.FF,"UFFDistanceCalc",JM.FF.Calculation);l(c$,"setData",function(a,b,c,e){this.calcs.parA=this.calcs.getParameter(this.calcs.minAtoms[b].sType);this.calcs.parB=this.calcs.getParameter(this.calcs.minAtoms[c].sType);this.r0=JM.FF.CalculationsUFF.calculateR0(this.calcs.parA.dVal[0],this.calcs.parB.dVal[0],this.calcs.parA.dVal[8],
this.calcs.parB.dVal[8],e);this.kb=1390.2842991599998*this.calcs.parA.dVal[5]*this.calcs.parB.dVal[5]/(this.r0*this.r0*this.r0);a.addLast(j(-1,[m(-1,[b,c]),t(-1,[this.r0,this.kb,e])]))},"JU.Lst,~N,~N,~N");l(c$,"compute",function(a){this.getPointers(a);this.r0=this.dData[0];this.kb=this.dData[1];this.calcs.setPairVariables(this);this.delta=this.rab-this.r0;this.energy=this.kb*this.delta*this.delta;this.calcs.gradients&&(this.dE=2*this.kb*this.delta,this.calcs.addForces(this,2));this.calcs.logging&&
this.calcs.appendLogData(this.calcs.getDebugLine(0,this));return this.energy},"~A")});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.UFFOOPCalc",null,function(){c$=u(JM.FF,"UFFOOPCalc",JM.FF.Calculation);l(c$,"setData",function(a,b,c){this.b=this.calcs.minAtoms[b];var e=this.b.getBondedAtomIndexes();this.a=this.calcs.minAtoms[this.ia=e[0]];this.c=this.calcs.minAtoms[this.ic=e[1]];this.d=this.calcs.minAtoms[this.id=e[2]];var d=1,h=-1,g=0,e=25.1208;switch(c){case 6:if("C_2"===this.b.sType&&1<this.b.hCount||
"C_2+"===this.b.sType||"O_2"===this.a.sType||"O_2"===this.c.sType||"O_2"===this.d.sType){e+=184.2192;break}break;case 7:case 8:break;default:e=92.1096;d=0.017453292519943295;switch(c){case 15:d*=84.4339;break;case 33:d*=86.9735;break;case 51:d*=87.7047;break;case 83:d*=90}c=Math.cos(d);d=c*c;h=-2*c;g=1}e/=3;a.addLast(j(-1,[m(-1,[this.ia,b,this.ic,this.id]),t(-1,[e,d,h,g,10*e])]));a.addLast(j(-1,[m(-1,[this.ic,b,this.id,this.ia]),t(-1,[e,d,h,g,10*e])]));a.addLast(j(-1,[m(-1,[this.id,b,this.ia,this.ic]),
t(-1,[e,d,h,g,10*e])]))},"JU.Lst,~N,~N,~N");l(c$,"compute",function(a){this.getPointers(a);a=this.calcs.isPreliminary?this.dData[4]:this.dData[0];var b=this.dData[1],c=this.dData[2],d=this.dData[3];this.calcs.setOopVariables(this,!0);var f=Math.cos(this.theta);this.energy=a*(b+c*f+d*f*f);this.calcs.gradients&&(this.dE=a*(c*Math.sin(this.theta)+2*d*Math.sin(this.theta)*f),this.calcs.addForces(this,4));this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(4,this));return this.energy},
"~A")});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.UFFTorsionCalc",["JM.Util"],function(){c$=u(JM.FF,"UFFTorsionCalc",JM.FF.Calculation);d(c$,"setData",function(a,b){var c=-1,d=0,f=0;this.a=this.calcs.minAtoms[this.ia=b[0]];this.b=this.calcs.minAtoms[this.ib=b[1]];this.c=this.calcs.minAtoms[this.ic=b[2]];this.d=this.calcs.minAtoms[this.id=b[3]];var h=this.c.getBondTo(this.ib),g=h.order;h.isAromatic&&(g=1.5);h.isAmide&&(g=1.41);this.calcs.parB=this.calcs.getParameter(this.b.sType);this.calcs.parC=this.calcs.getParameter(this.c.sType);
switch(this.calcs.parB.iVal[0]*this.calcs.parC.iVal[0]){case 9:d=3;f=this.calcs.parB.dVal[6];h=this.calcs.parC.dVal[6];g=0;switch(this.b.atom.getElementNumber()){case 8:g=2;break;case 16:case 34:case 52:case 84:g=6.8}if(0!=g)switch(this.c.atom.getElementNumber()){case 8:f=g;d=h=2;break;case 16:case 34:case 52:case 84:f=g,h=6.8,d=2}f=2.0934*Math.sqrt(f*h);break;case 4:c=1;d=2;f=2.0934*5*Math.sqrt(this.calcs.parB.dVal[7]*this.calcs.parC.dVal[7])*(1+4.18*Math.log(g));break;case 6:c=1;d=6;f=3==this.calcs.parC.iVal[0];
switch((f?this.c:this.b).atom.getElementNumber()){case 8:case 16:case 34:case 52:case 84:switch((f?this.b:this.c).atom.getElementNumber()){case 8:case 16:case 34:case 52:case 84:break;default:d=2,c=-1}}f=2.0934}JM.Util.isNearZero(f)||a.addLast(j(-1,[m(-1,[this.ia,this.ib,this.ic,this.id,d]),t(-1,[f,c])]))},"JU.Lst,~A");l(c$,"compute",function(a){this.getPointers(a);a=this.iData[4];var b=this.dData[0],c=this.dData[1];this.calcs.setTorsionVariables(this);this.energy=b*(1-c*Math.cos(this.theta*a));this.calcs.gradients&&
(this.dE=b*a*c*Math.sin(a*this.theta),this.calcs.addForces(this,4));this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(2,this));return this.energy},"~A")});p("JM.FF");r(["JM.FF.Calculation"],"JM.FF.UFFVDWCalc",null,function(){c$=u(JM.FF,"UFFVDWCalc",JM.FF.Calculation);l(c$,"setData",function(a,b,c){this.a=this.calcs.minAtoms[b];this.b=this.calcs.minAtoms[c];var d=this.calcs.getParameter(this.a.sType),f=this.calcs.getParameter(this.b.sType),h=d.dVal[2],g=d.dVal[3];(null==f||null==
f.dVal)&&Zystem.out.println("OHOH");d=f.dVal[2];f=4.1868*Math.sqrt(g*f.dVal[3]);h=Math.sqrt(h*d);a.addLast(j(-1,[m(-1,[b,c]),t(-1,[h,f])]))},"JU.Lst,~N,~N,~N");l(c$,"compute",function(a){this.getPointers(a);a=this.dData[0];var b=this.dData[1];this.calcs.setPairVariables(this);var c=a/this.rab,d=c*c*c,d=d*d;this.energy=b*d*(d-2);this.calcs.gradients&&(this.dE=12*b*(1-d)*d*c/a,this.calcs.addForces(this,2));this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(5,this));return this.energy},
"~A")});p("JM.FF");c$=s(function(){this.sVal=this.dVal=this.iVal=null;q(this,arguments)},JM.FF,"FFParam");p("JM");r(["J.thread.JmolThread"],"JM.MinimizationThread",["JU.Logger"],function(){c$=s(function(){this.minimizer=null;q(this,arguments)},JM,"MinimizationThread",J.thread.JmolThread);v(c$,function(){z(this,JM.MinimizationThread,[])});l(c$,"setManager",function(a,b){this.minimizer=a;this.setViewer(b,"MinimizationThread");return 0},"~O,JV.Viewer,~O");l(c$,"run1",function(a){for(;;)switch(a){case -1:this.lastRepaintTime=
this.startTime;this.haveReference=!0;if(!this.minimizer.startMinimization())return;this.vwr.startHoverWatcher(!1);a=0;break;case 0:if(!this.minimizer.minimizationOn()||this.checkInterrupted(this.minimizer.getThread())){a=-2;break}this.currentTime=Zystem.currentTimeMillis();if(!this.runSleep(33-(this.currentTime-this.lastRepaintTime),1))return;a=1;break;case 1:this.lastRepaintTime=this.currentTime=Zystem.currentTimeMillis();a=this.minimizer.stepMinimization()?0:-2;break;case -2:this.minimizer.endMinimization();
this.vwr.startHoverWatcher(!0);return}},"~N");l(c$,"oops",function(a){this.minimizer.minimizationOn()&&JU.Logger.error(a.toString())},"Exception")});p("JM");c$=s(function(){this.indexes=null;this.type=this.value=0;this.minList=null;this.nAtoms=0;q(this,arguments)},JM,"MMConstraint");E(c$,function(){this.minList=m(4,0)});v(c$,function(a,b){this.value=b;this.indexes=a},"~A,~N");d(c$,"set",function(a,b,c){this.nAtoms=Math.abs(this.indexes[0]);this.type=this.nAtoms-2;for(var d=1;d<=this.nAtoms;d++){if(0>=
a||!b.get(this.indexes[d])){this.indexes[0]=-this.nAtoms;break}this.minList[d-1]=c[this.indexes[d]]}},"~N,JU.BS,~A");w(c$,"TYPE_DISTANCE",0,"TYPE_ANGLE",1,"TYPE_DIHEDRAL",2)})(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.defineStatics,
Clazz.newFloatArray,Clazz.declareType,Clazz.prepareFields,Clazz.superConstructor,Clazz.newByteArray,Clazz.declareInterface,Clazz.p0p,Clazz.pu$h,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);
