(function(H,I,K,L,F,M,r,E,p,t,v,N,O,y,P,A,q,w,z,x,B,C,Q,R,S,T,U,V,W,X,l,Y,Z,$,aa,ba,ca,da,s,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,d,m){r("JM");p(["JU.P3"],"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$=v(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.bsBasis=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.minimizationThread=null;this.trustRadius=0.3;this.p=this.coordSaved=
null;t(this,arguments)},JM,"Minimizer");B(c$,function(){this.p=new JU.P3});y(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$,"minimize",function(a,b,c,e,f,g,h){this.bsBasis=f;this.trustRadius=null==f?0.3:0.03;this.isSilent=1==(g&1);this.isQuick=0<=h.indexOf("2D")||4==(g&4);f=2==(g&2);g=32==(g&32)?new JU.BS:null;var d;0>=b&&(d=this.vwr.getP("minimizationCriterion"),null!=d&&E(d,Float)&&(b=d.floatValue()));this.crit=Math.max(b,1E-4);2147483647==a&&(d=this.vwr.getP("minimizationSteps"),null!=d&&E(d,Integer)&&(a=d.intValue()));this.steps=a;try{this.setEnergyUnits();!f&&null!=
this.bsFixedDefault&&e.and(this.bsFixedDefault);if(this.$minimizationOn)return!1;var n=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+") silent="+this.isSilent+" quick="+this.isQuick+" fixed="+f+" Xx="+(null!=g)+" ...");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(var u=this.bsAtoms.nextSetBit(0);0<=u;u=this.bsAtoms.nextSetBit(u+1))0==this.atoms[u].getElementNumber()&&(null==g?(this.bsAtoms.clear(u),JU.Logger.info("minimize: Ignoring Xx for atomIndex="+u)):(g.set(u),JU.Logger.info("minimize: Setting Xx to fluorine for atomIndex="+u),this.atoms[u].setAtomicAndIsotopeNumber(9)));null!=e&&this.bsAtoms.or(e);this.ac=this.bsAtoms.cardinality();var l=JU.BSUtil.areEqual(c,this.bsSelected);this.bsSelected=
c;null!=n&&this.pFF!==n&&(l=!1);l||this.pFF.clear();if((!l||!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(u=this.constraints.size();0<=--u;)this.constraints.get(u).set(a,this.bsAtoms,this.atomMap);this.pFF.setConstraints(this);0>=a?this.getEnergyOnly():this.isSilent||
!this.vwr.useMinimizationThread()?this.minimizeWithoutThread():this.setMinimizationOn(!0)}finally{if(null!=g&&!g.isEmpty())for(u=g.nextSetBit(0);0<=u;u=g.nextSetBit(u+1))this.atoms[u].setAtomicAndIsotopeNumber(0)}return!0},"~N,~N,JU.BS,JU.BS,JU.BS,~N,~S");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$,"setEnergyUnits",function(){this.units=this.vwr.g.energyUnits.equalsIgnoreCase("kcal")?"kcal":"kJ"});d(c$,"setupMinimization",function(){this.coordSaved=null;this.atomMap=q(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,s(-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 g=b;b=c;c=g}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],g=b.data[1];if(1<this.minAtoms[g].nBonds){b=this.minAtoms[g].getBondedAtomIndexes();for(var h=b.length;0<=--h;)if((c=b[h])>f)a.addLast(new JM.MinAngle(q(-1,[f,g,c,e,this.minAtoms[g].getBondIndex(h)]))),
this.minAtoms[f].bsVdw.clear(c)}if(1<this.minAtoms[f].nBonds){b=this.minAtoms[f].getBondedAtomIndexes();for(h=b.length;0<=--h;)if((c=b[h])<g&&c>f)a.addLast(new JM.MinAngle(q(-1,[c,f,g,this.minAtoms[f].getBondIndex(h),e]))),this.minAtoms[c].bsVdw.clear(g)}}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],g=e[1],h=e[2],d;if(h>g&&1<this.minAtoms[h].nBonds){d=
this.minAtoms[h].getBondedAtomIndexes();for(var n=0;n<d.length;n++)b=d[n],b!=f&&b!=g&&(a.addLast(new JM.MinTorsion(q(-1,[f,g,h,b,e[3],e[4],this.minAtoms[h].getBondIndex(n)]))),this.minAtoms[Math.min(f,b)].bs14.set(Math.max(f,b)))}if(f>g&&1!=this.minAtoms[f].nBonds){d=this.minAtoms[f].getBondedAtomIndexes();for(n=0;n<d.length;n++)b=d[n],b!=h&&b!=g&&(a.addLast(new JM.MinTorsion(q(-1,[h,g,f,b,e[4],e[3],this.minAtoms[f].getBondIndex(n)]))),this.minAtoms[Math.min(h,b)].bs14.set(Math.max(h,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.trustRadius),
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("minimize: 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.trustRadius),this.reportEnergy(),this.saveCoordinates()}catch(a){if(A(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)System.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,"minimize:done"+(a?" EXPLODED":"OK"))}JU.Logger.info("minimize: endMinimization")});d(c$,"saveCoordinates",function(){null==this.coordSaved&&
(this.coordSaved=s(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)){if(null==
this.bsBasis)for(var a=0;a<this.ac;a++){var b=this.minAtoms[a];b.atom.set(b.coord[0],b.coord[1],b.coord[2])}else{for(var c,a=0;a<this.ac;a++)if(!(null!=this.bsFixed&&this.bsFixed.get(a))&&(b=this.minAtoms[a],this.bsBasis.get((c=b.atom).i)))this.p.set(b.coord[0],b.coord[1],b.coord[2]),this.vwr.getModelkit(!1).moveConstrained(c.i,this.p,!0,!0);for(a=0;a<this.ac;a++)b=this.minAtoms[a],b.coord[0]=(c=b.atom).x,b.coord[1]=c.y,b.coord[2]=c.z}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")});r("JM");c$=v(function(){this.data=
null;this.type=0;this.ddata=this.key=null;t(this,arguments)},JM,"MinObject");m(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");r("JM");p(["JM.MinObject"],"JM.MinAngle",null,function(){c$=v(function(){this.sbType=0;this.sbKey=null;this.ka=0;this.theta0=NaN;t(this,arguments)},JM,"MinAngle",JM.MinObject);y(c$,function(a){C(this,JM.MinAngle,[]);this.data=a},"~A")});r("JM");p(["JU.BS","$.Lst"],"JM.MinAtom",null,function(){c$=v(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;t(this,arguments)},JM,"MinAtom");B(c$,function(){this.coord=s(3,0);this.force=s(3,0);this.bonds=new JU.Lst;this.bsVdw=new JU.BS;this.bs14=new JU.BS});m(c$,"toString",function(){return"#"+this.index+" "+this.sType});y(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=q(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")});r("JM");p(["JM.MinObject"],"JM.MinBond",null,function(){c$=v(function(){this.order=this.index=this.rawIndex=0;this.isAmide=this.isAromatic=!1;t(this,arguments)},
JM,"MinBond",JM.MinObject);y(c$,function(a,b,c,e,f,g,h){C(this,JM.MinBond,[]);this.rawIndex=a;this.index=b;this.type=g;this.data=q(-1,[c,e]);this.order=f;this.key=h},"~N,~N,~N,~N,~N,~N,Integer");d(c$,"getOtherAtom",function(a){return this.data[this.data[0]==a?1:0]},"~N")});r("JM");p(["JM.MinObject"],"JM.MinTorsion",null,function(){c$=x(JM,"MinTorsion",JM.MinObject);y(c$,function(a){C(this,JM.MinTorsion,[]);this.data=a},"~A")});r("JM");p(null,"JM.Util",["java.lang.Double","java.util.Random"],function(){c$=
x(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,g,h,d){f.sub2(b,c);g.sub2(b,e);h.cross(f,g);g.add(f);f.sub2(b,a);a=d?JM.Util.vectorAngleRadians(g,f):3.141592653589793;f=JM.Util.vectorAngleRadians(h,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,g,h){JM.Util.sub(b,a,f);JM.Util.sub(c,b,g);g.normalize();f.cross(f,g);JM.Util.sub(e,c,h);h.cross(g,h);a=f.dot(h);f.cross(h,f);return Math.atan2(-g.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 g=b.length();if(JM.Util.isNearZero(g))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),0;b.scale(1/g);g=a.dot(c);g=1<g?0:-1>g?3.141592653589793:Math.acos(g);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 g},"JU.V3d,JU.V3d,JU.V3d");c$.restorativeForceAndOutOfPlaneAngleRadians=d(c$,"restorativeForceAndOutOfPlaneAngleRadians",function(a,b,c,e,f,g,h){a.sub2(a,b);c.sub2(c,b);e.sub2(e,b);var d=a.length(),n=c.length(),u=e.length();if(JM.Util.isNearZero(d)||JM.Util.isNearZero(n)||JM.Util.isNearZero(u))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 l=a.dot(c),j=Math.acos(l);if(JM.Util.isNearZero(j)||JM.Util.isNearZero(Math.abs(j-3.141592653589793)))return a.set(0,
0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),0;j=1/Math.sin(j);f.cross(a,c);g.cross(c,e);h.cross(e,a);var q=f.dot(e)*j,m=Math.asin(q);if(1E-4>Math.cos(m)||JM.Util.isNearZero(m)||JM.Util.isNearZero(Math.abs(m-3.141592653589793)))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),m;e.scaleAdd(-q/j,e,f);e.scale(j/u);b.setT(a);a.scaleAdd(-l,c,a);a.scaleAdd(-q*j,a,g);a.scale(j/d);c.scaleAdd(-l,b,c);c.scaleAdd(-q*j,c,h);c.scale(j/n);b.setT(a);b.add(c);b.add(e);b.scale(-1);return m},"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(),g=b.length(),h=c.length();if(JM.Util.isNearZero(f)||JM.Util.isNearZero(g)||JM.Util.isNearZero(h))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),u=Math.cos(d),d=JM.Util.vectorAngleRadians(b,c),l=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 j=-Math.atan2(c.dot(b),a.dot(e));a.scale(1/f/n/n);e.scale(-1/h/l/l);b.setT(a);b.scale(-f/g*u-1);c.setT(e);c.scale(-h/g*d);b.sub(c);c.setT(a);c.add(b);c.add(e);c.scale(-1);return j},"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)});r("JM.FF");c$=v(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;t(this,arguments)},JM.FF,"AtomType");y(c$,function(a,b,c,e,f,g,h){this.elemNo=a;this.mmType=b;this.hType=c;this.formalCharge=e;this.val=f;this.descr=g;this.smartsCode=h},"~N,~N,~N,~N,~N,~S,~S");r("JM.FF");p(null,"JM.FF.ForceField","java.lang.Float JU.PT JM.Util JU.Logger JV.FileManager $.Viewer".split(" "),function(){c$=v(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.bsFixed=this.minPositions=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null;this.trustRadius=0.3;this.minimizer=null;t(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,c){this.stepMax=a;this.criterion=b/this.toUserUnits(1);this.trustRadius=c;this.currentStep=0;this.clearForces();this.calc.setLoggingEnabled(!0);this.calc.setLoggingEnabled(0==a||JU.Logger.isActiveLevel(6));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",l(-1,[Float.$valueOf(this.toUserUnits(this.e0)),Float.$valueOf(this.toUserUnits(b))]));this.minimizer.report(c,!1);this.calc.appendLogData(c)},"~N,~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 g=JU.PT.sprintf(this.name+" Step %-4d E = %10.6f    dE = %8.6f ","Fi",l(-1,[z(-1,[this.toUserUnits(e),this.toUserUnits(this.dE)]),Integer.$valueOf(this.currentStep)]));this.minimizer.report(g,!1);this.calc.appendLogData(g)}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&&(g=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(g),this.minimizer.report(g,!0),JU.Logger.info(g)),!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",l(-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.75*this.trustRadius,b=this.trustRadius*this.trustRadius,c=this.energyFull(!1,
!0),e=0;10>e;e++){this.saveCoordinates();for(var f=0;f<this.minAtomCount;++f)if(null==this.bsFixed||!this.bsFixed.get(f)){var g=this.minAtoms[f].force,h=this.minAtoms[f].coord,d=g[0]*g[0]+g[1]*g[1]+g[2]*g[2];d>b/a/a&&(d=this.trustRadius/Math.sqrt(d)/a,g[0]*=d,g[1]*=d,g[2]*=d);for(d=0;3>d;++d)if(JM.Util.isFinite(g[d])){var n=g[d]*a;h[d]=n>this.trustRadius?h[d]+this.trustRadius:n<-this.trustRadius?h[d]-this.trustRadius:h[d]+n}}f=this.energyFull(!1,!0);if(JM.Util.isNear3(f,c,0.001))break;f>c?(a*=0.1,
this.restoreCoordinates()):f<c&&(c=f,a*=2.15,1<a&&(a=1))}});d(c$,"saveCoordinates",function(){null==this.coordSaved&&(this.coordSaved=s(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)});r("JM.FF");p(["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$=v(function(){this.typeData=this.line=
this.vRings=this.rawMMFF94Charges=this.rawBondTypes=this.rawAtomTypes=this.ffParams=null;t(this,arguments)},JM.FF,"ForceFieldMMFF",JM.FF.ForceField);B(c$,function(){this.typeData=q(4,0)});d(c$,"getAtomTypeDescriptions",function(){return JM.FF.ForceFieldMMFF.getAtomTypeDescs(this.rawAtomTypes)});d(c$,"getPartialCharges",function(){return this.rawMMFF94Charges});y(c$,function(a,b){C(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");m(c$,"clear",function(){});m(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,g){var d=this.minimizer;this.vRings=JU.AU.createArrayOfArrayList(4);this.rawAtomTypes=JM.FF.ForceFieldMMFF.setAtomTypes(a,b,d.vwr.getSmilesMatcher(),this.vRings,g);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,g=0;;){for(;0>(f=(e=c.readLine()).indexOf(".PAR")););if(1>(g=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,g,b)}c.close()}catch(d){if(A(d,JV.JmolAsyncException))throw new JV.JmolAsyncException(d.getFileName());if(A(d,Exception))System.err.println("Exception "+d.toString()+" in getResource "+a+" line="+e);else throw d;}finally{try{c.close()}catch(k){if(!A(k,Exception))throw k;}}return b},"~B");d(c$,"readParams",function(a,b,c){var e=null,f=0,g=127,d=127,k=127,n=0;switch(b){case 34:k=124;break;case 21:k=125;break;case 546:k=123;n=0;break;case 13:n=6;break;case 1:n=0;
break;case 37:k=126;n=0;break;case 17:k=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:k=this.ival(18,20);case 5:case 21:case 37:d=this.ival(13,15);case 546:case 3:case 34:g=this.ival(8,10);case 1:case 17:f=this.ival(3,5)}switch(b){case 546:e=s(-1,[this.dval(19,25),
this.dval(13,18)]);break;case 3:e=s(-1,[this.dval(14,20),this.dval(25,31)]);break;case 5:case 21:e=s(-1,[this.dval(19,25),this.dval(28,35)]);break;case 34:e=Float.$valueOf(this.fval(10,20));break;case 13:e=s(-1,[this.dval(24,30)]);break;case 1:e=Float.$valueOf(this.fval(5,15));break;case 37:var u=this.dval(19,25),l=this.dval(28,35),e=s(-1,[u,l]),j=JM.MinObject.getKey(n,f,g,d,k);c.put(j,e);e=s(-1,[l,u]);u=f;f=d;d=u;break;case 9:e=s(-1,[this.dval(22,28),this.dval(30,36),this.dval(38,44)]);break;case 17:e=
s(-1,[this.dval(10,15),this.dval(20,25),this.dval(30,35),this.dval(40,45),this.line.charAt(46)])}j=JM.MinObject.getKey(n,f,g,d,k);c.put(j,e);JU.Logger.debugging&&JU.Logger.debug(JM.MinObject.decodeKey(j)+" "+(E(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),g=this.ival(9,11),d=this.fval(12,15)/12,k=this.ival(16,18),n=this.line.substring(19,44).trim(),
l=this.line.substring(45).trim();a.addLast(c=new JM.FF.AtomType(e,f,g,d,k,n,l));JM.FF.ForceFieldMMFF.setFlags(c)}b.close()}catch(q){if(A(q,JV.JmolAsyncException))throw new JV.JmolAsyncException(q.getFileName());if(A(q,Exception))System.err.println("Exception "+q.toString()+" in getResource MMFF94-smarts.txt line="+this.line);else throw q;}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,g){c=z(c.length,0);for(var d=
f.nextSetBit(0);0<=d;d=f.nextSetBit(d+1))c[d]=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,e[d])).formalCharge;for(var k=null,d=b.length;0<=--d;){var k=a[d].atom1,n=a[d].atom2,l=f.get(k.i),q=f.get(n.i);if(l||q){var j=e[k.i],m=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,j)),r=0>j?-j:m.mmType,j=e[n.i],s=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,j)),j=0>j?-j:s.mmType,p=NaN;try{var t=r<j?-1:1,v=JM.MinObject.getKey(b[d],1==t?j:r,1==t?r:j,127,124),y=this.ffParams.get(v),w=NaN,x=JU.Logger.debugging?
k+"/"+n+" mmTypes="+r+"/"+j+" formalCharges="+m.formalCharge+"/"+s.formalCharge+" bci = ":null;if(null==y){var C,B;if(null!=(C=this.ffParams.get(JM.MinObject.getKey(0,r,127,127,127)))&&null!=(B=this.ffParams.get(JM.MinObject.getKey(0,j,127,127,127)))){var G=C.floatValue(),D=B.floatValue(),w=G-D;JU.Logger.debugging&&(x+=G+" - "+D+" = ")}}else w=t*y.floatValue();JU.Logger.debugging&&(x+=w,JU.Logger.debug(x));p=s.fcadj*s.formalCharge-m.fcadj*m.formalCharge+w}catch(E){if(A(E,Exception))p=NaN;else throw E;
}l&&(c[k.i]+=p);q&&(c[n.i]-=p)}}if(g){a=0;for(d=c.length;0<=--d;)c[d]=Math.round(1E3*c[d])/1E3,a+=Math.abs(c[d]);0==a&&null!=k&&(c[k.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 g=new JU.Lst,d=Array(JM.FF.ForceFieldMMFF.atomTypes.size()),k=q(a.length,
0),n=new JU.BS,l=new JU.BS,m=JU.BSUtil.copy(b),j=b.nextSetBit(0);0<=j;j=b.nextSetBit(j+1)){var r=a[j],s=r.bonds;if(null!=s)for(var p=s.length;0<=--p;)s[p].isCovalent()&&m.set(s[p].getOtherAtom(r).i)}for(j=m.nextSetBit(0);0<=j;j=m.nextSetBit(j+1))switch(p=a[j].getElementNumber(),p){case 1:l.set(j);break;default:n.set(p)}p=0;for(j=1;j<JM.FF.ForceFieldMMFF.atomTypes.size();j++)s=JM.FF.ForceFieldMMFF.atomTypes.get(j),n.get(s.elemNo)&&(d[j]=s.smartsCode,p++);JU.Logger.info(p+" SMARTS matches used");try{c.getMMFF94AtomTypes(d,
a,a.length,m,g,e)}catch(t){if(A(t,Exception))JU.Logger.error(t.toString());else throw t;}c=new JU.BS;for(p=0;p<g.size();p++)if(e=g.get(p),null!=e){e.andNot(c);for(j=e.nextSetBit(0);0<=j;j=e.nextSetBit(j+1))k[j]=p;c.or(e)}for(j=l.nextSetBit(0);0<=j;j=l.nextSetBit(j+1))s=a[j].bonds,null!=s&&(p=k[s[0].getOtherAtom(a[j]).i],0!=p&&c.set(j),k[j]=-JM.FF.ForceFieldMMFF.atomTypes.get(p).hType);if(JU.Logger.debugging)for(j=m.nextSetBit(0);0<=j;j=m.nextSetBit(j+1))JU.Logger.debug("atom "+a[j]+"\ttype "+(0>k[j]?
""+-k[j]:JM.FF.ForceFieldMMFF.atomTypes.get(k[j]).mmType+"\t"+JM.FF.ForceFieldMMFF.atomTypes.get(k[j]).smartsCode+"\t"+JM.FF.ForceFieldMMFF.atomTypes.get(k[j]).descr));return!f&&c.cardinality()!=m.cardinality()?null:k},"~A,JU.BS,J.api.SmilesMatcherInterface,~A,~B");d(c$,"setBondTypes",function(a,b,c){for(var e=q(b,0);0<=--b;){var f=a[b].atom1,d=a[b].atom2,h=c.get(f.i),k=c.get(d.i);if(h||k)k=this.rawAtomTypes[f.i],h=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,k)),k=this.rawAtomTypes[d.i],k=JM.FF.ForceFieldMMFF.atomTypes.get(Math.max(0,
k)),e[b]=this.getBondType(a[b],h,k,f.i,d.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=E(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 d=null,h=0;4>h;h++)this.typeData[h]=h<f?this.typeOf(a[h]):127;switch(c){case 21:this.typeData[3]=125;break;case 13:JM.FF.ForceFieldMMFF.sortOop(this.typeData)}d=JM.MinObject.getKey(b,this.typeData[0],this.typeData[1],this.typeData[2],this.typeData[3]);h=this.ffParams.get(d);
switch(c){case 3:return null!=h&&0<h[0]?d:this.applyEmpiricalRules(e,h,3);case 5:if(null!=h&&0!=h[0])return d;break;case 9:if(null==h){if(!this.ffParams.containsKey(d=this.getTorsionKey(b,0,2))&&!this.ffParams.containsKey(d=this.getTorsionKey(b,2,0))&&!this.ffParams.containsKey(d=this.getTorsionKey(b,2,2)))d=this.getTorsionKey(0,2,2);h=this.ffParams.get(d)}return null!=h?d:this.applyEmpiricalRules(e,h,9);case 21:if(null!=h)return d;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!=h)return d}for(var k=!1,n=!1,h=0;3>h&&!n;h++){d=0;for(n=1;d<f;d++,n<<=1)(c&n)==n&&(this.typeData[d]=JM.FF.ForceFieldMMFF.getEquivalentType(this.typeOf(a[d]),h));switch(c){case 3:k=JM.FF.ForceFieldMMFF.fixTypeOrder(this.typeData,0,1);break;case 5:k=JM.FF.ForceFieldMMFF.fixTypeOrder(this.typeData,0,2);break;case 13:JM.FF.ForceFieldMMFF.sortOop(this.typeData)}d=JM.MinObject.getKey(b,this.typeData[0],this.typeData[1],this.typeData[2],this.typeData[3]);
n=this.ffParams.containsKey(d)}if(n){if(k)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&&(d=Integer.$valueOf(d.intValue()^255));h=this.ffParams.get(d);switch(c){case 5:return null!=h&&0!=h[0]?d:this.applyEmpiricalRules(e,h,5)}return d},"~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=s(-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 h=JM.FF.ForceFieldMMFF.getCParam(this.minAtoms[a.data[1]].atom.getElementNumber()),k=JM.FF.ForceFieldMMFF.getZParam(this.minAtoms[a.data[2]].atom.getElementNumber()),n=this.getR0(this.minBonds[a.data[3]]),l=this.getR0(this.minBonds[a.data[4]]);c=n+l;n=(n-l)/(c*c);l=0.017453292519943295*d;l*=l;e=e*b*h*k*Math.exp(-2*n)/(c*l);a.ddata=s(-1,[e,d]);return Integer.$valueOf(-1);case 9:var m=a.data[1],j=a.data[2];c=this.minAtoms[m];f=this.minAtoms[j];if(JM.MinAtom.isLinear(c)||JM.MinAtom.isLinear(f))return null;
d=this.minBonds[a.data[5]];b=c.atom.getElementNumber();var h=f.atom.getElementNumber(),k=JM.FF.ForceFieldMMFF.getUParam(b),n=JM.FF.ForceFieldMMFF.getUParam(h),l=JM.FF.ForceFieldMMFF.getVParam(b),q=JM.FF.ForceFieldMMFF.getVParam(h),p=0,r=0,t=-1,v=-1,w=-1,x=0,y=c.ffAtomType.val,z=f.ffAtomType.val,A=c.ffAtomType.pilp,C=f.ffAtomType.pilp,B=c.ffAtomType.mltb,D=f.ffAtomType.mltb;a:for(;;){if(this.isAromaticBond(m,j)){t=A||C?0.3:0.5;e=7==y+z?3:6;break a}if(2==d.order){e=6;t=2==B&&2==D?1:0.4;break a}c=c.atom.getCovalentBondCount();
f=f.atom.getCovalentBondCount();if(4==c&&4==f){l=JM.FF.ForceFieldMMFF.getVParam(b);q=JM.FF.ForceFieldMMFF.getVParam(h);v=9;break a}if(4!=c&&(y>c||0<B)||4!=f&&(z>f||0<D))return null;y=A&&0<D;z=C&&0<B;if(1==d.order&&(0<B&&0<D||y||z)){if(A&&C)return null;e=6;if(y){t=1==D?0.5:10>=b&&10>=h?0.3:0.15;break a}if(z){t=1==B?0.5:10>=b&&10>=h?0.3:0.15;break a}if((1==B||1==D)&&(6==b||6==h)){t=0.4;break a}t=0.15;break a}switch(b<<8+h){case 2056:w=x=2;break a;case 2064:w=2;x=8;break a;case 4104:w=8;x=2;break a;
case 4112:w=x=8;break a}v=c*f;break a}0<t?p=e*t*Math.sqrt(k*n):0<v?r=Math.sqrt(l*q)/v:0!=w&&(p=-Math.sqrt(w*x));a.ddata=s(-1,[0,p,r]);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),d=JU.Elements.getAllredRochowElectroNeg(a),g=JU.Elements.getAllredRochowElectroNeg(b);return a=c+e-(1==a||1==
b?0.05:0.085)*Math.pow(Math.abs(d-g),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",q(-1,[0,1,34,5,546,3,13,
21,37,9,17]),"sbMap",q(-1,[0,1,3,5,4,6,8,9,11]),"equivalentTypes",q(-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]))});r("JM.FF");p(["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$=v(function(){this.bsAromatic=this.ffParams=null;this.is2D=!1;t(this,arguments)},JM.FF,"ForceFieldUFF",JM.FF.ForceField);y(c$,function(a,b){C(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");m(c$,"clear",function(){this.bsAromatic=null});m(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 d=JM.FF.ForceFieldUFF.atomTypes.get(e),g=d[0];if(null!=g)if(g=this.getSearch(g,b,a),a.get(0))a.clear(0);else if(null==g)break;else for(var h=this.minimizer.bsAtoms.nextSetBit(0),k=0;h<this.minimizer.atoms.length&&
0<=h;h=this.minimizer.bsAtoms.nextSetBit(h+1),k++)g.get(h)&&(this.minAtoms[k].sType=d[1].intern())}},"JU.BS,~N");d(c$,"getSearch",function(a,b,c){var e=null,d=a.length,e=JM.FF.ForceFieldUFF.tokenTypes[0],g=a.charCodeAt(d-2)-48,h=0;10<=g&&(g=0);var k=!1;"#"==a.charAt(1)?h=JU.PT.parseInt(a.substring(2,d-1)):(h=a.substring(1,0<g?d-3:d-1),h.equals(h.toLowerCase())&&(h=h.toUpperCase(),k=!0),h=JU.Elements.elementNumberFromSymbol(h,!1));if(h>b)return null;if(!c.get(h))return c.set(0),null;switch(a.charAt(d-
3)){case "D":e=JM.FF.ForceFieldUFF.tokenTypes[2];e[6].intValue=g;break;case "^":e=JM.FF.ForceFieldUFF.tokenTypes[4+(g-1)];break;case "+":e=JM.FF.ForceFieldUFF.tokenTypes[1];e[5].intValue=g;break;case "-":e=JM.FF.ForceFieldUFF.tokenTypes[1];e[5].intValue=-g;break;case "A":e=JM.FF.ForceFieldUFF.tokenTypes[6]}e[2].intValue=h;b=this.minimizer.vwr.evaluateExpression(e);if(!E(b,JU.BS))return null;k&&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 d=JU.PT.getTokens(e);if(!(13>d.length)&&(JU.Logger.debugging&&JU.Logger.debug(e),e.substring(0,5).equals("param"))){var g=new JM.FF.FFParam;a.put(d[1],g);g.dVal=s(11,0);g.sVal=Array(1);g.sVal[0]=d[1];
g.dVal[0]=JU.PT.parseFloat(d[2]);g.dVal[1]=0.017453292519943295*JU.PT.parseFloat(d[3]);g.dVal[2]=JU.PT.parseFloat(d[4]);g.dVal[3]=JU.PT.parseFloat(d[5]);g.dVal[4]=JU.PT.parseFloat(d[6]);g.dVal[5]=JU.PT.parseFloat(d[7]);g.dVal[6]=JU.PT.parseFloat(d[8]);g.dVal[7]=JU.PT.parseFloat(d[9]);g.dVal[8]=JU.PT.parseFloat(d[10]);g.dVal[9]=JU.PT.parseFloat(d[11]);g.dVal[10]=JU.PT.parseFloat(d[12]);g.iVal=q(1,0);var h=2<d[1].length?d[1].charAt(2):"1";switch(h){case "R":h="2";break;default:h="1";case "1":case "2":case "3":case "4":case "5":case "6":}g.iVal[0]=
h.charCodeAt(0)-48}}c.close()}catch(k){if(A(k,Exception)){System.err.println("Exception "+k.toString()+" in getResource "+b);try{c.close()}catch(l){if(!A(l,Exception))throw l;}return null}throw k;}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),g=l(-1,[d[1],d[2]]);
a.addLast(g)}c.close()}catch(h){if(A(h,JV.JmolAsyncException))throw new JV.JmolAsyncException(h.getFileName());if(A(h,Exception))System.err.println("Exception "+h.toString()+" in getResource "+b);else throw h;}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=l(-1,[l(-1,[JS.T.tokenExpressionBegin,JS.T.n(268435860,1094715402),JS.T.i(0),JS.T.tokenExpressionEnd]),l(-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]),l(-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]),
l(-1,[JS.T.tokenExpressionBegin,JS.T.o(1073741824,"flatring"),JS.T.tokenExpressionEnd]),l(-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]),l(-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]),l(-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])])});r("JM.FF");c$=v(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;t(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");r("JM.FF");p(["JU.AU","$.SB","$.V3d"],"JM.FF.Calculations",["java.lang.Float","JU.Lst","$.PT","JM.Util"],function(){c$=v(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;t(this,arguments)},JM.FF,"Calculations");B(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");y(c$,function(a,b,c,e,d,g,h){this.ff=a;this.minAtoms=b;this.minBonds=c;this.minAngles=e;this.minTorsions=d;this.minPositions=g;this.ac=b.length;this.bondCount=c.length;this.angleCount=e.length;this.torsionCount=d.length;this.setConstraints(h)},"JM.FF.ForceField,~A,~A,~A,~A,~A,JU.Lst");d(c$,"setConstraints",function(a){if(!(null==
a||a.isEmpty())){this.constraintsByType=l(-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 g=this.minAtoms[d].bsVdw,h=g.nextSetBit(0);0<=h;h=g.nextSetBit(h+1))b.setData(a,d,h,0),null!=e&&e.setData(c,d,h,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,g=b.length;0<=--g;){var h=b[g],e=h.minList,h=h.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:h*=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<=h?c+=6.283185307179586:0<c&&-1.5707963267948966>=h&&(h+=6.283185307179586);break;case 1:h*=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,h,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],g=d.minList,h=d.value;switch(d.type){case 2:this.id=g[3];case 1:this.ic=g[2];case 0:this.ib=g[1],this.ia=g[0]}switch(d.type){case 0:this.appendLogData(JU.PT.sprintf("%3d %3d  %-5s %-5s  %12.6f","ssFI",l(-1,[this.minAtoms[this.ia].atom.getAtomName(),
this.minAtoms[this.ib].atom.getAtomName(),z(-1,[h]),q(-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",l(-1,[this.minAtoms[this.ia].atom.getAtomName(),this.minAtoms[this.ib].atom.getAtomName(),this.minAtoms[this.ic].atom.getAtomName(),z(-1,[h]),q(-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",l(-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(),z(-1,[h]),q(-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=q(e.length+2,0);d[0]=c.atom.getAtomNumber();d[1]=null==c.ffAtomType?0:c.ffAtomType.mmType;for(var g="   ",h=0;h<e.length;h++)g+=" %3d",d[h+2]=this.minAtoms[e[h]].atom.getAtomNumber();
b.append(JU.PT.sprintf("%3d %8.3f %8.3f %8.3f %-5s %2d %8.3f %8.3f %8.3f"+g+"\n","sFI",l(-1,[c.sType,z(-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",l(-1,[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,z(-1,[0,b.rab,b.dData[1],b.dData[0],b.delta,c]),q(-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",l(-1,[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,z(-1,[57.29577951308232*b.theta,b.dData[1],b.dData[0],c]),q(-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",l(-1,[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,this.minAtoms[b.id].sType,
z(-1,[b.dData[1],b.dData[0],57.29577951308232*b.theta,c]),q(-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",l(-1,[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,this.minAtoms[b.id].sType,z(-1,[57.29577951308232*b.theta,b.dData[0],c]),
q(-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",l(-1,[this.minAtoms[b.iData[0]].sType,this.minAtoms[b.iData[1]].sType,z(-1,[b.rab,b.dData[0],c]),q(-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",l(-1,[this.minAtoms[b.iData[0]].sType,this.minAtoms[b.iData[1]].sType,z(-1,[b.rab,b.dData[0],b.dData[1],b.dData[2],c]),q(-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",l(-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)});r("JM.FF");p(["JM.FF.Calculations"],"JM.FF.CalculationsMMFF","JU.Lst $.PT JM.MinAtom $.MinObject JM.FF.MMFFAngleCalc $.MMFFDistanceCalc $.MMFFESCalc $.MMFFOOPCalc $.MMFFSBCalc $.MMFFTorsionCalc $.MMFFVDWCalc".split(" "),
function(){c$=v(function(){this.mmff=this.sbCalc=this.esCalc=this.vdwCalc=this.oopCalc=this.torsionCalc=this.angleCalc=this.bondCalc=null;t(this,arguments)},JM.FF,"CalculationsMMFF",JM.FF.Calculations);y(c$,function(a,b,c,e,d,g,h,k){C(this,JM.FF.CalculationsMMFF,[a,c,e,d,g,h,k]);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");m(c$,"getUnits",function(){return"kcal"});m(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});m(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");m(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");m(c$,"getParameterObj",function(a){return null==a.key||null!=a.ddata?a.ddata:this.ffParams.get(a.key)},"JM.MinObject");m(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");m(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",l(-1,[JM.MinObject.decodeKey(b.key),this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,z(-1,[57.29577951308232*b.theta,b.dData[1],b.dData[0],c]),q(-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",l(-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,z(-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)});r("JM.FF");p(["JM.FF.Calculations"],"JM.FF.CalculationsUFF","JU.Lst JM.FF.UFFAngleCalc $.UFFDistanceCalc $.UFFOOPCalc $.UFFTorsionCalc $.UFFVDWCalc".split(" "),function(){c$=v(function(){this.vdwCalc=this.oopCalc=this.torsionCalc=this.angleCalc=this.bondCalc=null;t(this,arguments)},JM.FF,"CalculationsUFF",
JM.FF.Calculations);y(c$,function(a,b,c,e,d,g,h,k){C(this,JM.FF.CalculationsUFF,[a,c,e,d,g,h,k]);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");m(c$,"getUnits",function(){return"kJ"});m(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),g,c=0;c<this.ac;c++)e=this.minAtoms[c],3==e.nBonds&&("C_3"!==e.sType&&JM.FF.CalculationsUFF.isInvertible(g=e.atom.getElementNumber()))&&b.setData(a,c,g,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 g=Math.sqrt(c)-Math.sqrt(e);return a+b+d-a*b*g*g/(c*a+e*b)},"~N,~N,~N,~N,~N");m(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");m(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");m(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)});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.MMFFAngleCalc",null,function(){c$=x(JM.FF,"MMFFAngleCalc",JM.FF.Calculation);d(c$,"setData",function(a,b){var c=
this.calcs.getParameterObj(b);null!=c&&a.addLast(l(-1,[b.data,c,b.key]))},"JU.Lst,JM.MinAngle");m(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)});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.MMFFDistanceCalc",null,function(){c$=v(function(){this.delta2=this.kb=this.r0=0;t(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(l(-1,
[q(-1,[this.ia,this.ib]),c]))},"JU.Lst,JM.MinBond");m(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)});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.MMFFESCalc",null,function(){c$=x(JM.FF,"MMFFESCalc",JM.FF.Calculation);m(c$,"setData",function(a,b,c){0==this.calcs.minAtoms[b].partialCharge||0==this.calcs.minAtoms[c].partialCharge||a.addLast(l(-1,[q(-1,[b,c]),s(-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");
m(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)});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.MMFFOOPCalc",null,function(){c$=v(function(){this.list=null;t(this,arguments)},
JM.FF,"MMFFOOPCalc",JM.FF.Calculation);B(c$,function(){this.list=q(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=s(-1,[e]),a.addLast(l(-1,[q(-1,[c[0],b,c[1],c[2]]),e])),a.addLast(l(-1,[q(-1,[c[1],b,c[2],c[0]]),e])),a.addLast(l(-1,[q(-1,[c[2],b,c[0],c[1]]),e])))}},"JU.Lst,~N");m(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)});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.MMFFSBCalc",null,function(){c$=x(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]]),g=this.calcs.getParameter(this.calcs.minBonds[b.data[4]]);null==c||(null==e||null==d||null==g)||(e=e[1],g=g[1],a.addLast(l(-1,[b.data,s(-1,[c[0],e,d[1]]),b.sbKey])),a.addLast(l(-1,[q(-1,[b.data[2],b.data[1],b.data[0]]),s(-1,[c[1],e,g]),b.sbKey])))}},"JU.Lst,JM.MinAngle");m(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")});r("JM.FF");
p(["JM.FF.Calculation"],"JM.FF.MMFFTorsionCalc",null,function(){c$=x(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(l(-1,[b.data,c,b.key]))}},"JU.Lst,JM.MinTorsion");m(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 d=Math.cos(this.theta),f=d*d;this.energy=
0.5*(a*(1+d)+b*(2-2*f)+c*(1+d*(4*f-3)));if(this.calcs.gradients){var g=Math.sin(this.theta);this.dE=0.5*(-a*g+4*b*g*d+3*c*g*(1-4*f));this.calcs.addForces(this,4)}this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(2,this));return this.energy},"~A")});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.MMFFVDWCalc",null,function(){c$=x(JM.FF,"MMFFVDWCalc",JM.FF.Calculation);m(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.vdwKey),
f=this.calcs.getParameter(this.b.vdwKey);if(!(null==d||null==f)){var g=d[0],h=d[1],k=d[2],n=d[3],d=F(d[4]),m=f[0],p=f[1],j=f[2],r=f[3],f=F(f[4]),k=k*Math.pow(g,0.25),t=j*Math.pow(m,0.25),j=(k-t)/(k+t),k=0.5*(k+t);68!=d&&68!=f&&(k*=1+0.2*(1-Math.exp(-12*j*j)));g=181.16*n*r*g*m/(Math.sqrt(g/h)+Math.sqrt(m/p))*Math.pow(k,-6);133==d+f&&(k*=0.8,g*=0.5);a.addLast(l(-1,[q(-1,[b,c]),s(-1,[k,g])]))}},"JU.Lst,~N,~N,~N");m(c$,"compute",function(a){this.getPointers(a);this.calcs.setPairVariables(this);a=this.dData[0];
var b=this.dData[1],c=this.rab/a,d=1.07/(c+0.07),f=1.12/(Math.pow(c,7)+0.12);this.energy=b*Math.pow(d,7)*(f-2);this.calcs.gradients&&(this.dE=-7*b*Math.pow(d,7)/a*(d/1.07*(f-2)+f*f*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")});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.UFFAngleCalc",["JM.FF.CalculationsUFF"],function(){c$=x(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 d=this.calcs.parB.iVal[0],f=this.calcs.parA.dVal[5],g=this.calcs.parC.dVal[5],h=this.calcs.parB.dVal[1],k=Math.cos(h),n=Math.sin(h),m,p;
switch(d){case 1:case 2:case 4:case 6:n=m=p=0;break;default:p=1/(4*n*n),m=-4*p*k,n=p*(2*k*k+1)}var j=this.a.getBondTo(this.ib),r=j.order;j.isAromatic&&(r=1.5);j.isAmide&&(r=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],r);j=this.c.getBondTo(this.ib);r=j.order;j.isAromatic&&(r=1.5);j.isAmide&&(r=1.41);j=JM.FF.CalculationsUFF.calculateR0(this.calcs.parB.dVal[0],this.calcs.parC.dVal[0],this.calcs.parB.dVal[8],
this.calcs.parC.dVal[8],r);r=Math.sqrt(this.rab*this.rab+j*j-2*this.rab*j*k);f=2696.8016159999997*(f*g/Math.pow(r,5))*(3*this.rab*j*(1-k*k)-r*r*k);a.addLast(l(-1,[q(-1,[this.ia,this.ib,this.ic,d]),s(-1,[f,57.29577951308232*h,n-p,m,2*p,c*f])]))},"JU.Lst,~A");m(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],d=this.dData[3],f=this.dData[4];this.calcs.setAngleVariables(this);if((4==a||6==a)&&(2.35619<this.theta||
0.785398>this.theta))a=1;var g=Math.cos(this.theta),h=Math.sin(this.theta);switch(a){case 0:case 1:this.energy=b*(1+g)*(1+g)/4;break;case 2:this.energy=b*(1+4*g*(1+g))/9;break;case 4:case 6:this.energy=b*g*g;break;default:this.energy=b*(c+d*g+f*g*g)}if(this.calcs.gradients){switch(a){case 0:case 1:this.dE=-0.5*b*h*(1+g);break;case 2:this.dE=-4*h*b*(1-2*g)/9;break;case 4:case 6:this.dE=-b*h*g;break;default:this.dE=-b*(d*h-2*f*g*h)}this.calcs.addForces(this,3)}this.calcs.logging&&this.calcs.appendLogData(this.calcs.getDebugLine(1,
this));return this.energy},"~A")});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.UFFDistanceCalc",["JM.FF.CalculationsUFF"],function(){c$=v(function(){this.kb=this.r0=0;t(this,arguments)},JM.FF,"UFFDistanceCalc",JM.FF.Calculation);m(c$,"setData",function(a,b,c,d){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],d);this.kb=1390.2842991599998*this.calcs.parA.dVal[5]*this.calcs.parB.dVal[5]/(this.r0*this.r0*this.r0);a.addLast(l(-1,[q(-1,[b,c]),s(-1,[this.r0,this.kb,d])]))},"JU.Lst,~N,~N,~N");m(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")});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.UFFOOPCalc",null,function(){c$=x(JM.FF,"UFFOOPCalc",JM.FF.Calculation);m(c$,"setData",function(a,b,c){this.b=this.calcs.minAtoms[b];var d=this.b.getBondedAtomIndexes();this.a=this.calcs.minAtoms[this.ia=d[0]];this.c=this.calcs.minAtoms[this.ic=d[1]];this.d=this.calcs.minAtoms[this.id=d[2]];var f=1,g=-1,h=0,d=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){d+=184.2192;break}break;case 7:case 8:break;default:d=92.1096;f=0.017453292519943295;switch(c){case 15:f*=84.4339;break;case 33:f*=86.9735;break;case 51:f*=87.7047;break;case 83:f*=90}c=Math.cos(f);f=c*c;g=-2*c;h=1}d/=3;a.addLast(l(-1,[q(-1,[this.ia,b,this.ic,this.id]),s(-1,[d,f,g,h,10*d])]));a.addLast(l(-1,[q(-1,[this.ic,b,this.id,this.ia]),s(-1,[d,f,g,h,10*d])]));a.addLast(l(-1,[q(-1,[this.id,b,this.ia,this.ic]),
s(-1,[d,f,g,h,10*d])]))},"JU.Lst,~N,~N,~N");m(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")});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.UFFTorsionCalc",["JM.Util"],function(){c$=x(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 g=this.c.getBondTo(this.ib),h=g.order;g.isAromatic&&(h=1.5);g.isAmide&&(h=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];g=this.calcs.parC.dVal[6];h=0;switch(this.b.atom.getElementNumber()){case 8:h=2;break;case 16:case 34:case 52:case 84:h=6.8}if(0!=h)switch(this.c.atom.getElementNumber()){case 8:f=h;d=g=2;break;case 16:case 34:case 52:case 84:f=h,g=6.8,d=2}f=2.0934*Math.sqrt(f*g);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(h));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(l(-1,[q(-1,[this.ia,this.ib,this.ic,this.id,d]),s(-1,[f,c])]))},"JU.Lst,~A");m(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")});r("JM.FF");p(["JM.FF.Calculation"],"JM.FF.UFFVDWCalc",null,function(){c$=x(JM.FF,"UFFVDWCalc",JM.FF.Calculation);m(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),g=d.dVal[2],h=d.dVal[3];(null==f||null==
f.dVal)&&System.out.println("OHOH");d=f.dVal[2];f=4.1868*Math.sqrt(h*f.dVal[3]);g=Math.sqrt(g*d);a.addLast(l(-1,[q(-1,[b,c]),s(-1,[g,f])]))},"JU.Lst,~N,~N,~N");m(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")});r("JM.FF");c$=v(function(){this.sVal=this.dVal=this.iVal=null;t(this,arguments)},JM.FF,"FFParam");r("JM");p(["J.thread.JmolThread"],"JM.MinimizationThread",["JU.Logger"],function(){c$=v(function(){this.minimizer=null;t(this,arguments)},JM,"MinimizationThread",J.thread.JmolThread);y(c$,function(){C(this,JM.MinimizationThread,[])});m(c$,"setManager",function(a,b){this.minimizer=a;this.setViewer(b,"MinimizationThread");return 0},"~O,JV.Viewer,~O");m(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=System.currentTimeMillis();if(!this.runSleep(33-(this.currentTime-this.lastRepaintTime),1))return;a=1;break;case 1:this.lastRepaintTime=this.currentTime=System.currentTimeMillis();a=this.minimizer.stepMinimization()?0:-2;break;case -2:this.minimizer.endMinimization();
this.vwr.startHoverWatcher(!0);return}},"~N");m(c$,"oops",function(a){this.minimizer.minimizationOn()&&JU.Logger.error(a.toString())},"Exception")});r("JM");c$=v(function(){this.indexes=null;this.type=this.value=0;this.minList=null;this.nAtoms=0;t(this,arguments)},JM,"MMConstraint");B(c$,function(){this.minList=q(4,0)});y(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);
