(function(P,Q,R,S,T,U,V,W,X,Y,Z,$,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,d,ka,la,ma,na,oa,pa,qa,ra,sa,j,ta,ua,va,wa,K,s,G,x,n,m,xa,y,ya,B,C,z,N,M,I,A,za,O,p,v,Aa,l,u,w,Ba,Ca,Da,Ea,Fa,Ga,Ha,Ia,H,Ja,Ka,La,Ma,Na,Oa,Pa,Qa,Ra,Sa,Ta,Ua,Va,Wa,Xa,Ya,Za,$a,ab,bb,L){s("J.api");O(J.api,"MinimizerInterface");s("J.minimize");x(["J.api.MinimizerInterface"],"J.minimize.Minimizer","java.lang.Float java.util.Hashtable JU.AU $.BS $.List J.i18n.GT J.minimize.MinAngle $.MinAtom $.MinBond $.MinTorsion $.MinimizationThread J.minimize.forcefield.ForceFieldMMFF $.ForceFieldUFF J.util.BSUtil $.Escape $.Logger".split(" "),
function(){c$=m(function(){this.bonds=this.atoms=this.viewer=null;this.rawBondCount=0;this.bsMinFixed=this.minPositions=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null;this.bondCount=this.atomCount=0;this.partialCharges=this.atomMap=null;this.steps=50;this.crit=0.001;this.units="kJ/mol";this.pFF=null;this.ff="UFF";this.constraints=this.bsFixed=this.bsFixedDefault=this.bsAtoms=this.bsSelected=this.bsTaint=null;this.isSilent=!1;this.constraintMap=null;this.elemnoMax=0;this.$minimizationOn=
!1;this.coordSaved=this.minimizationThread=null;n(this,arguments)},J.minimize,"Minimizer",null,J.api.MinimizerInterface);y(c$,function(){});j(c$,"setProperty",function(a,b){a.equals("ff")?this.ff.equals(b)||(this.setProperty("clear",null),this.ff=b):a.equals("cancel")?this.stopMinimization(!1):a.equals("clear")?null!=this.minAtoms&&(this.stopMinimization(!1),this.clear()):a.equals("constraint")?this.addConstraint(b):a.equals("fixed")?this.bsFixedDefault=b:a.equals("stop")?this.stopMinimization(!0):
a.equals("viewer")&&(this.viewer=b)},"~S,~O");j(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];0==c?this.constraints=null:(null==this.constraints&&(this.constraints=new JU.List,this.constraintMap=new java.util.Hashtable),b[1]>b[c]&&(JU.AU.swapInt(b,1,c),4==c&&JU.AU.swapInt(b,2,3)),b=J.util.Escape.eAI(b),c=this.constraintMap.get(b),null!=c?c[2]=a[2]:(this.constraintMap.put(b,a),
this.constraints.addLast(a)))}},"~A");d(c$,"clear",function(){this.setMinimizationOn(!1);this.bondCount=this.atomCount=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});j(c$,"minimize",function(a,b,c,e,f,g,h){this.isSilent=g||this.viewer.getBooleanProperty("minimizationSilent");
this.setEnergyUnits();2147483647==a&&(g=this.viewer.getParameter("minimizationSteps"),null!=g&&G(g,Integer)&&(a=g.intValue()));this.steps=a;!f&&null!=this.bsFixedDefault&&e.and(this.bsFixedDefault);0>=b&&(g=this.viewer.getParameter("minimizationCriterion"),null!=g&&G(g,Float)&&(b=g.floatValue()));this.crit=Math.max(b,1E-4);if(this.$minimizationOn)return!1;f=this.pFF;this.getForceField(h);if(null==this.pFF)return J.util.Logger.error(J.i18n.GT.o(J.i18n.GT._("Could not get class for force field {0}"),
h)),!1;J.util.Logger.info("minimize: initializing "+this.pFF.name+" (steps = "+a+" criterion = "+b+") ...");if(0==c.cardinality())return J.util.Logger.error(J.i18n.GT._("No atoms selected -- nothing to do!")),!1;this.atoms=this.viewer.getModelSet().atoms;this.bsAtoms=J.util.BSUtil.copy(c);for(b=this.bsAtoms.nextSetBit(0);0<=b;b=this.bsAtoms.nextSetBit(b+1))0==this.atoms[b].getElementNumber()&&this.bsAtoms.clear(b);null!=e&&this.bsAtoms.or(e);this.atomCount=this.bsAtoms.cardinality();b=J.util.BSUtil.areEqual(c,
this.bsSelected);this.bsSelected=c;null!=f&&this.pFF!==f&&(b=!1);b||this.pFF.clear();if((!b||!J.util.BSUtil.areEqual(e,this.bsFixed))&&!this.setupMinimization())return this.clear(),!1;0<a&&(this.bsTaint=J.util.BSUtil.copy(this.bsAtoms),J.util.BSUtil.andNot(this.bsTaint,e),this.viewer.setTaintedAtoms(this.bsTaint,2));null!=e&&(this.bsFixed=e);this.setAtomPositions();if(null!=this.constraints)for(b=this.constraints.size();0<=--b;){e=this.constraints.get(b);c=e[0];e=e[1];h=c[0]=Math.abs(c[0]);for(f=
1;f<=h;f++){if(0>=a||!this.bsAtoms.get(c[f])){c[0]=-h;break}e[f-1]=this.atomMap[c[f]]}}this.pFF.setConstraints(this);0>=a?this.getEnergyOnly():this.isSilent||!this.viewer.useMinimizationThread()?this.minimizeWithoutThread():this.setMinimizationOn(!0);return!0},"~N,~N,JU.BS,JU.BS,~B,~B,~S");d(c$,"setEnergyUnits",function(){this.units=this.viewer.getEnergyUnits().equalsIgnoreCase("kcal")?"kcal":"kJ"});d(c$,"setupMinimization",function(){this.coordSaved=null;this.atomMap=C(this.atoms.length,0);this.minAtoms=
Array(this.atomCount);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 J.minimize.MinAtom(c,e,[e.x,e.y,e.z],this.atomCount);this.minAtoms[c].sType=e.getAtomName()}J.util.Logger.info(J.i18n.GT.i(J.i18n.GT._("{0} atoms will be minimized."),this.atomCount));J.util.Logger.info("minimize: getting bonds...");
this.bonds=this.viewer.modelSet.bonds;this.rawBondCount=this.viewer.modelSet.bondCount;this.getBonds();J.util.Logger.info("minimize: getting angles...");this.getAngles();J.util.Logger.info("minimize: getting torsions...");this.getTorsions();return this.setModel(a)});d(c$,"setModel",function(a){return!this.pFF.setModel(a,this.elemnoMax)?(J.util.Logger.error(J.i18n.GT.o(J.i18n.GT._("could not setup force field {0}"),this.ff)),this.ff.equals("MMFF")?(this.getForceField("UFF"),this.setModel(a)):!1):!0},
"JU.BS");d(c$,"setAtomPositions",function(){for(var a=0;a<this.atomCount;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.List;this.bondCount=0;for(var b,c,e=0;e<this.rawBondCount;e++){var f=this.bonds[e];if(this.bsAtoms.get(b=f.getAtomIndex1())&&this.bsAtoms.get(c=f.getAtomIndex2())){if(c<
b){var g=b;b=c;c=g}f=f.getCovalentOrder();switch(f){case 1:case 2:case 3:break;case 515:f=5;break;default:f=1}a.addLast(new J.minimize.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.atomCount;e++)this.minAtoms[e].getBondedAtomIndexes()});d(c$,"getAngles",function(){for(var a=new JU.List,
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 J.minimize.MinAngle([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 J.minimize.MinAngle([c,f,g,this.minAtoms[f].getBondIndex(h),e])),this.minAtoms[c].bsVdw.clear(g)}}this.minAngles=
a.toArray(Array(a.size()));J.util.Logger.info(this.minAngles.length+" angles")});d(c$,"getTorsions",function(){for(var a=new JU.List,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 r=0;r<d.length;r++)b=d[r],b!=f&&b!=g&&(a.addLast(new J.minimize.MinTorsion([f,g,h,b,e[3],e[4],this.minAtoms[h].getBondIndex(r)])),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(r=0;r<d.length;r++)b=d[r],b!=h&&b!=g&&(a.addLast(new J.minimize.MinTorsion([h,g,f,b,e[4],e[3],this.minAtoms[f].getBondIndex(r)])),this.minAtoms[Math.min(h,b)].bs14.set(Math.max(h,b)))}}this.minTorsions=a.toArray(Array(a.size()));J.util.Logger.info(this.minTorsions.length+" torsions")});d(c$,"getForceField",function(a){a.startsWith("MMFF")&&(a="MMFF");if(null==this.pFF||!a.equals(this.ff))a.equals("UFF")?this.pFF=new J.minimize.forcefield.ForceFieldUFF(this):
a.equals("MMFF")?this.pFF=new J.minimize.forcefield.ForceFieldMMFF(this):(this.pFF=new J.minimize.forcefield.ForceFieldUFF(this),a="UFF"),this.ff=a,this.viewer.setStringProperty("_minimizationForceField",a);return this.pFF},"~S");j(c$,"minimizationOn",function(){return this.$minimizationOn});d(c$,"setMinimizationOn",function(a){(this.$minimizationOn=a)?null==this.minimizationThread&&(this.minimizationThread=new J.minimize.MinimizationThread,this.minimizationThread.setManager(this,this.viewer,null),
this.minimizationThread.start()):null!=this.minimizationThread&&(this.minimizationThread=null)},"~B");d(c$,"getEnergyOnly",function(){null==this.pFF||null==this.viewer||(this.pFF.steepestDescentInitialize(this.steps,this.crit),this.viewer.setFloatProperty("_minimizationEnergyDiff",0),this.reportEnergy(),this.viewer.setStringProperty("_minimizationStatus","calculate"),this.viewer.notifyMinimizationStatus())});d(c$,"reportEnergy",function(){this.viewer.setFloatProperty("_minimizationEnergy",this.pFF.toUserUnits(this.pFF.getEnergy()))});
j(c$,"startMinimization",function(){try{J.util.Logger.info("minimizer: startMinimization"),this.viewer.setIntProperty("_minimizationStep",0),this.viewer.setStringProperty("_minimizationStatus","starting"),this.viewer.setFloatProperty("_minimizationEnergy",0),this.viewer.setFloatProperty("_minimizationEnergyDiff",0),this.viewer.notifyMinimizationStatus(),this.viewer.saveCoordinates("minimize",this.bsTaint),this.pFF.steepestDescentInitialize(this.steps,this.crit),this.reportEnergy(),this.saveCoordinates()}catch(a){if(B(a,
Exception))return J.util.Logger.error("minimization error viewer="+this.viewer+" pFF = "+this.pFF),!1;throw a;}return this.$minimizationOn=!0});j(c$,"stepMinimization",function(){if(!this.$minimizationOn)return!1;var a=!this.isSilent&&this.viewer.getBooleanProperty("minimizationRefresh");this.viewer.setStringProperty("_minimizationStatus","running");var b=this.pFF.steepestDescentTakeNSteps(1),c=this.pFF.getCurrentStep();this.viewer.setIntProperty("_minimizationStep",c);this.reportEnergy();this.viewer.setFloatProperty("_minimizationEnergyDiff",
this.pFF.toUserUnits(this.pFF.getEnergyDiff()));this.viewer.notifyMinimizationStatus();a&&(this.updateAtomXYZ(),this.viewer.refresh(3,"minimization step "+c));return b});j(c$,"endMinimization",function(){this.updateAtomXYZ();this.setMinimizationOn(!1);var a=this.pFF.detectExplosion();a&&this.restoreCoordinates();this.viewer.setIntProperty("_minimizationStep",this.pFF.getCurrentStep());this.reportEnergy();this.viewer.setStringProperty("_minimizationStatus",a?"failed":"done");this.viewer.notifyMinimizationStatus();
this.viewer.refresh(3,"Minimizer:done"+(a?" EXPLODED":"OK"));J.util.Logger.info("minimizer: endMinimization")});d(c$,"saveCoordinates",function(){null==this.coordSaved&&(this.coordSaved=H(this.atomCount,3,0));for(var a=0;a<this.atomCount;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.atomCount;a++)for(var b=0;3>b;b++)this.minAtoms[a].coord[b]=this.coordSaved[a][b];this.updateAtomXYZ()}});d(c$,
"stopMinimization",function(a){this.$minimizationOn&&(this.setMinimizationOn(!1),a?this.endMinimization():this.restoreCoordinates())},"~B");d(c$,"updateAtomXYZ",function(){if(!(0>=this.steps)){for(var a=0;a<this.atomCount;a++){var b=this.minAtoms[a],c=b.atom;c.x=b.coord[0];c.y=b.coord[1];c.z=b.coord[2]}this.viewer.refreshMeasures(!1)}});d(c$,"minimizeWithoutThread",function(){if(this.startMinimization()){for(;this.stepMinimization(););this.endMinimization()}});d(c$,"report",function(a,b){this.isSilent?
J.util.Logger.info(a):b?this.viewer.showString(a,!1):this.viewer.scriptEcho(a)},"~S,~B");j(c$,"calculatePartialCharges",function(a,b,c,e){var f=new J.minimize.forcefield.ForceFieldMMFF(this);f.setArrays(c,e,a,b,!0,!0);this.viewer.setAtomProperty(e,1087375361,0,0,null,null,f.getAtomTypeDescriptions());this.viewer.setAtomProperty(e,1112541196,0,0,null,f.getPartialCharges(),null)},"~A,~N,~A,JU.BS")});s("J.minimize");c$=m(function(){this.data=null;this.type=0;this.ddata=this.key=null;n(this,arguments)},
J.minimize,"MinObject");j(c$,"toString",function(){return this.type+" "+this.data[0]+","+this.data[1]+(2<this.data.length?","+this.data[2]+","+this.data[3]:"")+" "+J.minimize.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 a+": "+(10>c?"  ":
" ")+c+(10>e?"  ":" ")+e+(10>f?"  ":" ")+f+(10>b?"  ":" ")+b},"Integer");s("J.minimize");x(["J.minimize.MinObject"],"J.minimize.MinAngle",null,function(){c$=m(function(){this.sbType=0;this.sbKey=null;this.ka=0;this.theta0=NaN;n(this,arguments)},J.minimize,"MinAngle",J.minimize.MinObject);y(c$,function(a){A(this,J.minimize.MinAngle,[]);this.data=a},"~A")});s("J.minimize");x(["JU.BS","$.List"],"J.minimize.MinAtom",null,function(){c$=m(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;n(this,arguments)},J.minimize,"MinAtom");I(c$,function(){this.coord=H(3,0);this.force=H(3,0);this.bonds=new JU.List;this.bsVdw=new JU.BS;this.bs14=new JU.BS});j(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,J.modelset.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=C(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)},"J.minimize.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},"J.minimize.MinAtom")});s("J.minimize");x(["J.minimize.MinObject"],"J.minimize.MinBond",null,function(){c$=m(function(){this.order=this.index=this.rawIndex=0;this.isAmide=
this.isAromatic=!1;n(this,arguments)},J.minimize,"MinBond",J.minimize.MinObject);y(c$,function(a,b,c,e,f,g,h){A(this,J.minimize.MinBond,[]);this.rawIndex=a;this.index=b;this.type=g;this.data=[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")});s("J.minimize");x(["J.minimize.MinObject"],"J.minimize.MinTorsion",null,function(){c$=M(J.minimize,"MinTorsion",J.minimize.MinObject);y(c$,function(a){A(this,J.minimize.MinTorsion,
[]);this.data=a},"~A")});s("J.minimize");x(null,"J.minimize.Util",["java.lang.Double","java.util.Random"],function(){c$=M(J.minimize,"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=J.minimize.Util.distance2(a,b);b=J.minimize.Util.distance2(b,c);a=J.minimize.Util.distance2(a,c);return J.minimize.Util.isNearZero2(e,0.001)||J.minimize.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 J.minimize.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 J.minimize.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 J.minimize.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 J.minimize.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:J.minimize.Util.canBeSquared(a.x)&&J.minimize.Util.canBeSquared(a.y)&&J.minimize.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?J.minimize.Util.vectorAngleRadians(g,f):3.141592653589793;f=J.minimize.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 J.minimize.Util.isNearZero(c)||J.minimize.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){J.minimize.Util.sub(b,a,f);J.minimize.Util.sub(c,b,g);g.normalize();f.cross(f,g);J.minimize.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&&(J.minimize.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(J.minimize.Util.isNearZero(e)||J.minimize.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(J.minimize.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(),r=c.length(),j=e.length();if(J.minimize.Util.isNearZero(d)||J.minimize.Util.isNearZero(r)||J.minimize.Util.isNearZero(j))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),0;a.normalize();c.normalize();e.normalize();var t=a.dot(c),k=Math.acos(t);if(J.minimize.Util.isNearZero(k)||J.minimize.Util.isNearZero(Math.abs(k-3.141592653589793)))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),0;k=1/Math.sin(k);f.cross(a,c);g.cross(c,e);h.cross(e,
a);var E=f.dot(e)*k,D=Math.asin(E);if(1E-4>Math.cos(D)||J.minimize.Util.isNearZero(D)||J.minimize.Util.isNearZero(Math.abs(D-3.141592653589793)))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),e.set(0,0,0),D;e.scaleAdd(-E/k,e,f);e.scale(k/j);b.setT(a);a.scaleAdd(-t,c,a);a.scaleAdd(-E*k,a,g);a.scale(k/d);c.scaleAdd(-t,b,c);c.scaleAdd(-E*k,c,h);c.scale(k/r);b.setT(a);b.add(c);b.add(e);b.scale(-1);return D},"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(J.minimize.Util.isNearZero(f)||J.minimize.Util.isNearZero(g)||J.minimize.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=J.minimize.Util.vectorAngleRadians(a,b),r=Math.sin(d),j=Math.cos(d),d=J.minimize.Util.vectorAngleRadians(b,c),t=Math.sin(d),d=Math.cos(d);a.normalize();b.normalize();c.normalize();a.cross(a,b);e.cross(b,
c);c.cross(a,e);var k=-Math.atan2(c.dot(b),a.dot(e));a.scale(1/f/r/r);e.scale(-1/h/t/t);b.setT(a);b.scale(-f/g*j-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 k},"JU.V3d,JU.V3d,JU.V3d,JU.V3d");z(c$,"RAD_TO_DEG",57.29577951308232,"DEG_TO_RAD",0.017453292519943295,"max_squarable_double",1E150,"min_squarable_double",1E-150)});s("J.minimize.forcefield");c$=m(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;n(this,arguments)},J.minimize.forcefield,"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");s("J.minimize.forcefield");x(null,"J.minimize.forcefield.ForceField","java.lang.Float J.io.JmolBinary J.minimize.Util J.util.Logger $.Txt J.viewer.Viewer".split(" "),function(){c$=m(function(){this.calc=this.name=null;this.stepMax=this.currentStep=
this.dE=this.e0=this.criterion=0;this.coordSaved=null;this.minBondCount=this.minAtomCount=0;this.minimizer=this.bsFixed=this.minPositions=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null;n(this,arguments)},J.minimize.forcefield,"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},"J.minimize.Minimizer");d(c$,"steepestDescentInitialize",function(a,b){this.stepMax=a;this.criterion=b/this.toUserUnits(1);this.currentStep=0;this.clearForces();this.calc.setLoggingEnabled(!0);this.calc.setLoggingEnabled(0==a||J.util.Logger.isActiveLevel(6));var c=this.name+" "+this.calc.getDebugHeader(-1)+"Jmol Minimization Version "+
J.viewer.Viewer.getJmolVersion()+"\n";this.calc.appendLogData(c);J.util.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=J.util.Txt.sprintf(" Initial "+this.name+" E = %10.3f "+this.minimizer.units+" criterion = %8.6f max steps = "+a,"ff",[Float.$valueOf(this.toUserUnits(this.e0)),Float.$valueOf(this.toUserUnits(b))]);this.minimizer.report(c,
!1);this.calc.appendLogData(c)},"~N,~N");d(c$,"clearForces",function(){for(var a=0;a<this.minAtomCount;a++)this.minAtoms[a].force[0]=this.minAtoms[a].force[1]=this.minAtoms[a].force[2]=0});d(c$,"steepestDescentTakeNSteps",function(a){if(0==this.stepMax)return!1;for(var b=!0,c=1;c<=a;c++){this.currentStep++;this.calc.setSilent(!0);for(var e=0;e<this.minAtomCount;e++)(null==this.bsFixed||!this.bsFixed.get(e))&&this.setForcesUsingNumericalDerivative(this.minAtoms[e],1);this.linearSearch();this.calc.setSilent(!1);
this.calc.loggingEnabled&&this.calc.appendLogData(this.calc.getAtomList("S T E P    "+this.currentStep));e=this.energyFull(!1,!1);this.dE=e-this.e0;var f=J.minimize.Util.isNear3(e,this.e0,this.criterion);if(f||0==this.currentStep%10||this.stepMax<=this.currentStep){var g=J.util.Txt.sprintf(this.name+" Step %-4d E = %10.6f    dE = %8.6f ","Fi",[[e,this.dE,this.criterion],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=J.util.Txt.formatStringF("\n    "+this.name+" STEEPEST DESCENT HAS CONVERGED: E = %8.5f "+this.minimizer.units+" after "+this.currentStep+" steps","f",this.toUserUnits(e)),this.calc.appendLogData(g),this.minimizer.report(g,!0),J.util.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)},"J.minimize.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},"J.minimize.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(J.util.Txt.sprintf("\nTOTAL %s ENERGY = %8.3f %s/mol\n","sfs",[this.name,Float.$valueOf(this.toUserUnits(c)),this.minimizer.units]));return c},"~B,~B");
d(c$,"energyStretchBend",function(a){return this.calc.energyStretchBend(a)},"~B");d(c$,"energyBond",function(a){return this.calc.energyBond(a)},"~B");d(c$,"energyAngle",function(a){return this.calc.energyAngle(a)},"~B");d(c$,"energyTorsion",function(a){return this.calc.energyTorsion(a)},"~B");d(c$,"energyOOP",function(a){return this.calc.energyOOP(a)},"~B");d(c$,"energyVDW",function(a){return this.calc.energyVDW(a)},"~B");d(c$,"energyES",function(a){return this.calc.energyES(a)},"~B");d(c$,"linearSearch",
function(){for(var a=0.23,b=this.energyFull(!1,!0),c=0;10>c;c++){this.saveCoordinates();for(var e=0;e<this.minAtomCount;++e)if(null==this.bsFixed||!this.bsFixed.get(e)){var f=this.minAtoms[e].force,g=this.minAtoms[e].coord,h=f[0]*f[0]+f[1]*f[1]+f[2]*f[2];h>0.09/a/a&&(h=0.3/Math.sqrt(h)/a,f[0]*=h,f[1]*=h,f[2]*=h);for(h=0;3>h;++h)if(J.minimize.Util.isFinite(f[h])){var d=f[h]*a;g[h]=0.3<d?g[h]+0.3:-0.3>d?g[h]-0.3:g[h]+d}}e=this.energyFull(!1,!0);if(J.minimize.Util.isNear3(e,b,0.001))break;e>b?(a*=0.1,
this.restoreCoordinates()):e<b&&(b=e,a*=2.15,1<a&&(a=1))}});d(c$,"saveCoordinates",function(){null==this.coordSaved&&(this.coordSaved=H(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(!J.minimize.Util.isFinite(b.coord[c]))return!0;for(a=0;a<this.minBondCount;a++)if(b=this.minBonds[a],900<J.minimize.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 J.io.JmolBinary.getBufferedReaderForResource(this.minimizer.viewer,this,"J/minimize/forcefield/",
"data/"+a)},"~S");z(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,"R56",3)});s("J.minimize.forcefield");x(["J.minimize.forcefield.ForceField"],"J.minimize.forcefield.ForceFieldMMFF","java.lang.Float java.util.Hashtable JU.AU $.BS $.List $.PT J.minimize.MinAtom $.MinObject J.minimize.forcefield.AtomType $.CalculationsMMFF J.util.BSUtil $.Elements $.Escape $.Logger".split(" "),
function(){c$=m(function(){this.useEmpiricalRules=!0;this.typeData=this.line=this.vRings=this.rawMMFF94Charges=this.rawBondTypes=this.rawAtomTypes=null;n(this,arguments)},J.minimize.forcefield,"ForceFieldMMFF",J.minimize.forcefield.ForceField);I(c$,function(){this.typeData=C(4,0)});d(c$,"getAtomTypeDescriptions",function(){return J.minimize.forcefield.ForceFieldMMFF.getAtomTypeDescs(this.rawAtomTypes)});d(c$,"getPartialCharges",function(){return this.rawMMFF94Charges});y(c$,function(a){A(this,J.minimize.forcefield.ForceFieldMMFF,
[]);this.minimizer=a;this.name="MMFF";this.getParameters()},"J.minimize.Minimizer");j(c$,"clear",function(){});j(c$,"setModel",function(){var a=this.minimizer;if(!this.setArrays(a.atoms,a.bsAtoms,a.bonds,a.rawBondCount,!1,!1))return!1;this.setModelFields();this.fixTypes();this.calc=new J.minimize.forcefield.CalculationsMMFF(this,J.minimize.forcefield.ForceFieldMMFF.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 h=this.minimizer;this.vRings=JU.AU.createArrayOfArrayList(4);this.rawAtomTypes=J.minimize.forcefield.ForceFieldMMFF.setAtomTypes(a,b,h.viewer.getSmilesMatcher(),this.vRings,g);if(null==this.rawAtomTypes)return!1;this.rawBondTypes=this.setBondTypes(c,e,b);this.rawMMFF94Charges=J.minimize.forcefield.ForceFieldMMFF.calculatePartialCharges(c,this.rawBondTypes,a,this.rawAtomTypes,b,f);return!0},"~A,JU.BS,~A,~N,~B,~B");
d(c$,"getParameters",function(){if(null==J.minimize.forcefield.ForceFieldMMFF.ffParams){this.getAtomTypes();var a=new java.util.Hashtable;J.util.Logger.debugging&&J.util.Logger.debug("reading data from mmff94.par.txt");var b=null,c=null;try{for(var b=this.getBufferedReader("mmff94.par.txt"),e=0,f=0;;){for(;0>(e=(c=b.readLine()).indexOf(".PAR")););if(1>(f=J.minimize.forcefield.ForceFieldMMFF.types[K("END.BCI.CHG.ANG.NDK.OND.OOP.TBN.FSB.TOR.VDW.".indexOf(c.substring(e-3,e+1))/4)]))break;this.readParams(b,
f,a)}b.close()}catch(g){if(B(g,Exception))System.err.println("Exception "+g.toString()+" in getResource mmff94.par.txt line="+c);else throw g;}finally{try{b.close()}catch(h){if(!B(h,java.io.IOException))throw h;}}J.minimize.forcefield.ForceFieldMMFF.ffParams=a}});d(c$,"readParams",function(a,b,c){var e=null,f=0,g=127,h=127,d=127,r=0;switch(b){case 34:d=124;break;case 21:d=125;break;case 546:d=123;r=0;break;case 13:r=6;break;case 1:r=0;break;case 37:d=126;r=0;break;case 17:d=122,r=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:r=this.line.charCodeAt(0)-48}switch(b){case 13:case 9:d=this.ival(18,20);case 5:case 21:case 37:h=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=[this.dval(19,25),this.dval(13,18)];break;case 3:e=[this.dval(14,20),this.dval(25,31)];break;case 5:case 21:e=
[this.dval(19,25),this.dval(28,35)];break;case 34:e=Float.$valueOf(this.fval(10,20));break;case 13:e=[this.dval(24,30)];break;case 1:e=Float.$valueOf(this.fval(5,15));break;case 37:var j=this.dval(19,25),t=this.dval(28,35),e=[j,t],k=J.minimize.MinObject.getKey(r,f,g,h,d);c.put(k,e);e=[t,j];j=f;f=h;h=j;break;case 9:e=[this.dval(22,28),this.dval(30,36),this.dval(38,44)];break;case 17:e=[this.dval(10,15),this.dval(20,25),this.dval(30,35),this.dval(40,45),this.line.charAt(46)]}k=J.minimize.MinObject.getKey(r,
f,g,h,d);c.put(k,e);J.util.Logger.debugging&&J.util.Logger.debug(J.minimize.MinObject.decodeKey(k)+" "+(G(e,Float)?e:J.util.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 JU.PT.fVal(this.line.substring(a,b).trim())},"~N,~N");d(c$,"dval",function(a,b){return JU.PT.dVal(this.line.substring(a,b).trim())},"~N,~N");d(c$,
"getAtomTypes",function(){var a=new JU.List;try{var b=this.getBufferedReader("MMFF94-smarts.txt"),c;for(a.addLast(new J.minimize.forcefield.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,q=this.ival(16,18),r=this.line.substring(19,44).trim(),j=this.line.substring(45).trim();a.addLast(c=new J.minimize.forcefield.AtomType(e,f,g,d,q,r,j));J.minimize.forcefield.ForceFieldMMFF.setFlags(c)}b.close()}catch(t){if(B(t,
Exception))System.err.println("Exception "+t.toString()+" in getResource MMFF94-smarts.txt line="+this.line);else throw t;}J.util.Logger.info(a.size()-1+" SMARTS-based atom types read");J.minimize.forcefield.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}},"J.minimize.forcefield.AtomType");c$.calculatePartialCharges=d(c$,"calculatePartialCharges",function(a,b,c,e,f,g){c=N(c.length,0);for(var d=f.nextSetBit(0);0<=d;d=f.nextSetBit(d+1))c[d]=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,e[d])).formalCharge;for(var q=null,d=b.length;0<=--d;){var q=a[d].getAtom1(),r=a[d].getAtom2(),j=f.get(q.index),t=f.get(r.index);if(j||t){var k=e[q.index],E=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,
k)),D=0>k?-k:E.mmType,k=e[r.index],n=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,k)),k=0>k?-k:n.mmType,m;try{var l=D<k?-1:1,s=J.minimize.MinObject.getKey(b[d],1==l?k:D,1==l?D:k,127,124),x=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(s),p,v=J.util.Logger.debugging?q+"/"+r+" mmTypes="+D+"/"+k+" formalCharges="+E.formalCharge+"/"+n.formalCharge+" bci = ":null;if(null==x){var u=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(J.minimize.MinObject.getKey(0,D,127,127,127)).floatValue(),
w=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(J.minimize.MinObject.getKey(0,k,127,127,127)).floatValue();p=u-w;J.util.Logger.debugging&&(v+=u+" - "+w+" = ")}else p=l*x.floatValue();J.util.Logger.debugging&&(v+=p,J.util.Logger.debug(v));m=n.fcadj*n.formalCharge-E.fcadj*E.formalCharge+p}catch(y){if(B(y,Exception))m=NaN;else throw y;}j&&(c[q.index]+=m);t&&(c[r.index]-=m)}}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!=q&&(c[q.index]=-0)}return c},"~A,~A,~A,~A,JU.BS,~B");
c$.isBondType1=d(c$,"isBondType1",function(a,b){return a.sbmb&&b.sbmb||a.arom&&b.arom},"J.minimize.forcefield.AtomType,J.minimize.forcefield.AtomType");d(c$,"getBondType",function(a,b,c,e,f){return J.minimize.forcefield.ForceFieldMMFF.isBondType1(b,c)&&1==a.getCovalentOrder()&&!this.isAromaticBond(e,f)?1:0},"J.modelset.Bond,J.minimize.forcefield.AtomType,J.minimize.forcefield.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]:J.minimize.forcefield.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.List,d=Array(J.minimize.forcefield.ForceFieldMMFF.atomTypes.size()),q=C(a.length,0),r=new JU.BS,j=new JU.BS,t=J.util.BSUtil.copy(b),k=b.nextSetBit(0);0<=
k;k=b.nextSetBit(k+1)){var n=a[k],m=n.getBonds();if(null!=m)for(var l=m.length;0<=--l;)m[l].isCovalent()&&t.set(m[l].getOtherAtom(n).index)}for(k=t.nextSetBit(0);0<=k;k=t.nextSetBit(k+1))switch(l=a[k].getElementNumber(),l){case 1:j.set(k);break;default:r.set(l)}l=0;for(k=1;k<J.minimize.forcefield.ForceFieldMMFF.atomTypes.size();k++)m=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(k),r.get(m.elemNo)&&(d[k]=m.smartsCode,l++);J.util.Logger.info(l+" SMARTS matches used");c.getSubstructureSets(d,a,
a.length,20,t,g,e);c=new JU.BS;for(l=0;l<g.size();l++)if(e=g.get(l),null!=e){e.andNot(c);for(k=e.nextSetBit(0);0<=k;k=e.nextSetBit(k+1))q[k]=l;c.or(e)}for(k=j.nextSetBit(0);0<=k;k=j.nextSetBit(k+1))m=a[k].getBonds(),null!=m&&(l=q[m[0].getOtherAtom(a[k]).index],0!=l&&c.set(k),q[k]=-J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(l).hType);if(J.util.Logger.debugging)for(k=t.nextSetBit(0);0<=k;k=t.nextSetBit(k+1))J.util.Logger.debug("atom "+a[k]+"\ttype "+(0>q[k]?""+-q[k]:J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(q[k]).mmType+
"\t"+J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(q[k]).smartsCode+"\t"+J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(q[k]).descr));return!f&&c.cardinality()!=t.cardinality()?null:q},"~A,JU.BS,J.api.SmilesMatcherInterface,~A,~B");d(c$,"setBondTypes",function(a,b,c){for(var e=C(b,0);0<=--b;){var f=a[b].getAtom1(),g=a[b].getAtom2(),d=c.get(f.index),q=c.get(g.index);if(d||q)q=this.rawAtomTypes[f.index],d=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,q)),q=this.rawAtomTypes[g.index],
q=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,q)),e[b]=this.getBondType(a[b],d,q,f.index,g.index)}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.index,e=this.rawAtomTypes[c];b.ffAtomType=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,e));e=0>e?-e:J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(e).mmType;b.ffType=e;b.vdwKey=J.minimize.MinObject.getKey(0,e,127,127,122);b.partialCharge=this.rawMMFF94Charges[c]}for(a=
this.minBonds.length;0<=--a;)b=this.minBonds[a],b.type=this.rawBondTypes[b.rawIndex],b.key=this.getKey(b,b.type,3);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)});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=J.minimize.forcefield.ForceFieldMMFF.sbMap[a.type];switch(a.type){case 1:case 5:case 7:a.sbType+=this.minBonds[a.data[4]].type}return a.type},"J.minimize.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},"J.minimize.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.index)&&f.get(this.minAtoms[b[1]].atom.index)&&(3>c||f.get(this.minAtoms[b[2]].atom.index))&&(4>c||f.get(this.minAtoms[b[3]].atom.index)))return!0}return!1},"JU.List,~A,~N");d(c$,"getKey",function(a,b,c){var e=G(a,J.minimize.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)&&J.minimize.forcefield.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:J.minimize.forcefield.ForceFieldMMFF.swap(a,0,3);J.minimize.forcefield.ForceFieldMMFF.swap(a,4,6);break;case 0:-1==this.fixOrder(a,0,3)&&J.minimize.forcefield.ForceFieldMMFF.swap(a,4,6)}b=this.setTorsionType(e)}for(var g=null,d=0;4>d;d++)this.typeData[d]=d<f?this.typeOf(a[d]):127;switch(c){case 21:this.typeData[3]=125;break;
case 13:J.minimize.forcefield.ForceFieldMMFF.sortOop(this.typeData)}g=J.minimize.MinObject.getKey(b,this.typeData[0],this.typeData[1],this.typeData[2],this.typeData[3]);d=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(g);switch(c){case 3:return!this.useEmpiricalRules?g:null!=d&&0<d[0]?g:this.applyEmpiricalRules(e,d,3);case 5:if(null!=d&&0!=d[0])return g;break;case 9:if(null==d){if(!J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(g=this.getTorsionKey(b,0,2))&&!J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(g=
this.getTorsionKey(b,2,0))&&!J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(g=this.getTorsionKey(b,2,2)))g=this.getTorsionKey(0,2,2);d=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(g)}return!this.useEmpiricalRules?g:null!=d?g:this.applyEmpiricalRules(e,d,9);case 21:if(null!=d)return g;b=this.getRowFor(a[0]);c=this.getRowFor(a[1]);a=this.getRowFor(a[2]);return J.minimize.MinObject.getKey(0,b,c,a,126);case 13:if(null!=d)return g}if(!this.useEmpiricalRules&&null!=d)return g;for(var q=
!1,j=!1,d=0;3>d&&!j;d++){g=0;for(j=1;g<f;g++,j<<=1)(c&j)==j&&(this.typeData[g]=J.minimize.forcefield.ForceFieldMMFF.getEquivalentType(this.typeOf(a[g]),d));switch(c){case 3:q=J.minimize.forcefield.ForceFieldMMFF.fixTypeOrder(this.typeData,0,1);break;case 5:q=J.minimize.forcefield.ForceFieldMMFF.fixTypeOrder(this.typeData,0,2);break;case 13:J.minimize.forcefield.ForceFieldMMFF.sortOop(this.typeData)}g=J.minimize.MinObject.getKey(b,this.typeData[0],this.typeData[1],this.typeData[2],this.typeData[3]);
j=J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(g)}if(j){if(q)switch(c){case 5:J.minimize.forcefield.ForceFieldMMFF.swap(a,0,2),J.minimize.forcefield.ForceFieldMMFF.swap(a,3,4),this.setAngleType(e)}}else 0!=b&&5==c&&(g=Integer.$valueOf(g.intValue()^255));if(!this.useEmpiricalRules)return g;d=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(g);switch(c){case 5:return null!=d&&0!=d[0]?g:this.applyEmpiricalRules(e,d,5)}return g},"~O,~N,~N");d(c$,"getTorsionKey",function(a,b,c){return J.minimize.MinObject.getKey(a,
J.minimize.forcefield.ForceFieldMMFF.getEquivalentType(this.typeData[0],b),this.typeData[1],this.typeData[2],J.minimize.forcefield.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=J.minimize.MinObject.getKey(0,Math.min(d,b),Math.max(d,b),127,123);b=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(d);
if(null==b)return null;d=b[0];b=b[1];e=J.minimize.forcefield.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=[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:J.minimize.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=J.minimize.forcefield.ForceFieldMMFF.getZParam(this.minAtoms[a.data[0]].atom.getElementNumber());var h=J.minimize.forcefield.ForceFieldMMFF.getCParam(this.minAtoms[a.data[1]].atom.getElementNumber()),q=J.minimize.forcefield.ForceFieldMMFF.getZParam(this.minAtoms[a.data[2]].atom.getElementNumber()),j=J.minimize.forcefield.ForceFieldMMFF.getR0(this.minBonds[a.data[3]]),
l=J.minimize.forcefield.ForceFieldMMFF.getR0(this.minBonds[a.data[4]]);c=j+l;j=(j-l)/(c*c);l=0.017453292519943295*d;l*=l;e=e*b*h*q*Math.exp(-2*j)/(c*l);a.ddata=[e,d];return Integer.$valueOf(-1);case 9:var m=a.data[1],k=a.data[2];c=this.minAtoms[m];f=this.minAtoms[k];if(J.minimize.MinAtom.isLinear(c)||J.minimize.MinAtom.isLinear(f))return null;d=this.minBonds[a.data[5]];b=c.atom.getElementNumber();var h=f.atom.getElementNumber(),q=J.minimize.forcefield.ForceFieldMMFF.getUParam(b),j=J.minimize.forcefield.ForceFieldMMFF.getUParam(h),
l=J.minimize.forcefield.ForceFieldMMFF.getVParam(b),n=J.minimize.forcefield.ForceFieldMMFF.getVParam(h),s=0,v=0,p=-1,x=-1,u=-1,w=0,y=c.ffAtomType.val,z=f.ffAtomType.val,B=c.ffAtomType.pilp,C=f.ffAtomType.pilp,A=c.ffAtomType.mltb,F=f.ffAtomType.mltb;a:for(;;){if(this.isAromaticBond(m,k)){p=B||C?0.3:0.5;e=7==y+z?3:6;break a}if(2==d.order){e=6;p=2==A&&2==F?1:0.4;break a}c=c.atom.getCovalentBondCount();f=f.atom.getCovalentBondCount();if(4==c&&4==f){l=J.minimize.forcefield.ForceFieldMMFF.getVParam(b);
n=J.minimize.forcefield.ForceFieldMMFF.getVParam(h);x=9;break a}if(4!=c&&(y>c||0<A)||4!=f&&(z>f||0<F))return null;y=B&&0<F;z=C&&0<A;if(1==d.order&&(0<A&&0<F||y||z)){if(B&&C)return null;e=6;if(y){p=1==F?0.5:10>=b&&10>=h?0.3:0.15;break a}if(z){p=1==A?0.5:10>=b&&10>=h?0.3:0.15;break a}if((1==A||1==F)&&(6==b||6==h)){p=0.4;break a}p=0.15;break a}switch(b<<8+h){case 2056:u=w=2;break a;case 2064:u=2;w=8;break a;case 4104:u=8;w=2;break a;case 4112:u=w=8;break a}x=c*f;break a}0<p?s=e*p*Math.sqrt(q*j):0<x?
v=Math.sqrt(l*n)/x:0!=u&&(s=-Math.sqrt(u*w));a.ddata=[0,s,v];return Integer.$valueOf(-1);default:return null}},"J.minimize.MinObject,~A,~N");c$.getR0=d(c$,"getR0",function(a){return(null==a.ddata?J.minimize.forcefield.ForceFieldMMFF.ffParams.get(a.key):a.ddata)[1]},"J.minimize.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=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(this.getKey(a,
6,13));return null==a?0:a[0]},"~A");c$.sortOop=d(c$,"sortOop",function(a){J.minimize.forcefield.ForceFieldMMFF.fixTypeOrder(a,0,2);J.minimize.forcefield.ForceFieldMMFF.fixTypeOrder(a,0,3);J.minimize.forcefield.ForceFieldMMFF.fixTypeOrder(a,2,3)},"~A");c$.fixTypeOrder=d(c$,"fixTypeOrder",function(a,b,c){return a[b]>a[c]?(J.minimize.forcefield.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&&J.minimize.forcefield.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:J.minimize.forcefield.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 J.util.Elements.getBondingRadiusFloat(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=J.minimize.forcefield.ForceFieldMMFF.getCovalentRadius(a);var e=J.minimize.forcefield.ForceFieldMMFF.getCovalentRadius(b),
f=J.util.Elements.getAllredRochowElectroNeg(a),d=J.util.Elements.getAllredRochowElectroNeg(b);return a=c+e-(1==a||1==b?0.05:0.085)*Math.pow(Math.abs(f-d),1.4)},"J.minimize.MinAtom,J.minimize.MinAtom,~N,~B");z(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,"ffParams",null,"names","END.BCI.CHG.ANG.NDK.OND.OOP.TBN.FSB.TOR.VDW.","types",[0,1,34,5,546,3,13,21,37,9,17],"sbMap",[0,1,3,5,4,6,8,9,11],"equivalentTypes",[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])});s("J.minimize.forcefield");x(["J.minimize.forcefield.ForceField","J.script.T"],"J.minimize.forcefield.ForceFieldUFF","java.util.Hashtable JU.BS $.List $.PT J.minimize.forcefield.CalculationsUFF $.FFParam J.util.Elements $.Logger".split(" "),function(){c$=m(function(){this.bsAromatic=null;n(this,arguments)},J.minimize.forcefield,"ForceFieldUFF",J.minimize.forcefield.ForceField);y(c$,function(a){A(this,J.minimize.forcefield.ForceFieldUFF,[]);this.minimizer=
a;this.name="UFF"},"J.minimize.Minimizer");j(c$,"clear",function(){this.bsAromatic=null});j(c$,"setModel",function(a,b){this.setModelFields();J.util.Logger.info("minimize: setting atom types...");if(null==J.minimize.forcefield.ForceFieldUFF.atomTypes&&null==(J.minimize.forcefield.ForceFieldUFF.atomTypes=this.getAtomTypes())||null==J.minimize.forcefield.ForceFieldUFF.ffParams&&null==(J.minimize.forcefield.ForceFieldUFF.ffParams=this.getFFParameters()))return!1;this.setAtomTypes(a,b);this.calc=new J.minimize.forcefield.CalculationsUFF(this,
J.minimize.forcefield.ForceFieldUFF.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=J.minimize.forcefield.ForceFieldUFF.atomTypes.size();a.clear(0);for(var e=0;e<c;e++){var f=J.minimize.forcefield.ForceFieldUFF.atomTypes.get(e),d=f[0];if(null!=d)if(d=this.getSearch(d,b,a),a.get(0))a.clear(0);else if(null==d)break;else for(var h=this.minimizer.bsAtoms.nextSetBit(0),
j=0;h<this.minimizer.atoms.length&&0<=h;h=this.minimizer.bsAtoms.nextSetBit(h+1),j++)d.get(h)&&(this.minAtoms[j].sType=f[1].intern())}},"JU.BS,~N");d(c$,"getSearch",function(a,b,c){var e=null,f=a.length,e=J.minimize.forcefield.ForceFieldUFF.tokenTypes[0],d=a.charCodeAt(f-2)-48,h=0;10<=d&&(d=0);var j=!1;"#"==a.charAt(1)?h=JU.PT.parseInt(a.substring(2,f-1)):(h=a.substring(1,0<d?f-3:f-1),h.equals(h.toLowerCase())&&(h=h.toUpperCase(),j=!0),h=J.util.Elements.elementNumberFromSymbol(h,!1));if(h>b)return null;
if(!c.get(h))return c.set(0),null;switch(a.charAt(f-3)){case "D":e=J.minimize.forcefield.ForceFieldUFF.tokenTypes[2];e[6].intValue=d;break;case "^":e=J.minimize.forcefield.ForceFieldUFF.tokenTypes[4+(d-1)];break;case "+":e=J.minimize.forcefield.ForceFieldUFF.tokenTypes[1];e[5].intValue=d;break;case "-":e=J.minimize.forcefield.ForceFieldUFF.tokenTypes[1];e[5].intValue=-d;break;case "A":e=J.minimize.forcefield.ForceFieldUFF.tokenTypes[6]}e[2].intValue=h;b=this.minimizer.viewer.evaluateExpression(e);
if(!G(b,JU.BS))return null;j&&0<b.cardinality()&&(null==this.bsAromatic&&(this.bsAromatic=this.minimizer.viewer.evaluateExpression(J.minimize.forcefield.ForceFieldUFF.tokenTypes[3])),b.and(this.bsAromatic));J.util.Logger.debugging&&0<b.cardinality()&&J.util.Logger.debug(a+" minimize atoms="+b);return b},"~S,~N,JU.BS");d(c$,"getFFParameters",function(){var a,b=new java.util.Hashtable,c=null;try{for(var c=this.getBufferedReader("UFF.txt"),e;null!=(e=c.readLine());){var f=JU.PT.getTokens(e);if(!(13>
f.length)&&(J.util.Logger.debugging&&J.util.Logger.debug(e),e.substring(0,5).equals("param"))){a=new J.minimize.forcefield.FFParam;b.put(f[1],a);a.dVal=H(11,0);a.sVal=Array(1);a.sVal[0]=f[1];a.dVal[0]=JU.PT.parseFloat(f[2]);a.dVal[1]=0.017453292519943295*JU.PT.parseFloat(f[3]);a.dVal[2]=JU.PT.parseFloat(f[4]);a.dVal[3]=JU.PT.parseFloat(f[5]);a.dVal[4]=JU.PT.parseFloat(f[6]);a.dVal[5]=JU.PT.parseFloat(f[7]);a.dVal[6]=JU.PT.parseFloat(f[8]);a.dVal[7]=JU.PT.parseFloat(f[9]);a.dVal[8]=JU.PT.parseFloat(f[10]);
a.dVal[9]=JU.PT.parseFloat(f[11]);a.dVal[10]=JU.PT.parseFloat(f[12]);a.iVal=C(1,0);var d=2<f[1].length?f[1].charAt(2):"1";switch(d){case "R":d="2";break;default:d="1";case "1":case "2":case "3":case "4":case "5":case "6":}a.iVal[0]=d.charCodeAt(0)-48}}c.close()}catch(h){if(B(h,Exception)){System.err.println("Exception "+h.toString()+" in getResource UFF.txt");try{c.close()}catch(j){if(!B(j,Exception))throw j;}return null}throw h;}J.util.Logger.info(b.size()+" atom types read from UFF.txt");return b});
d(c$,"getAtomTypes",function(){var a=new JU.List;try{for(var b=this.getBufferedReader("UFF.txt"),c;null!=(c=b.readLine());)if(4<c.length&&c.substring(0,4).equals("atom")){var e=JU.PT.getTokens(c);a.addLast([e[1],e[2]])}b.close()}catch(f){if(B(f,Exception))System.err.println("Exception "+f.toString()+" in getResource UFF.txt");else throw f;}J.util.Logger.info(a.size()+" UFF parameters read");return 0<a.size()?a:null});z(c$,"atomTypes",null,"ffParams",null,"TOKEN_ELEMENT_ONLY",0,"TOKEN_ELEMENT_CHARGED",
1,"TOKEN_ELEMENT_CONNECTED",2,"TOKEN_AROMATIC",3,"TOKEN_ELEMENT_SP",4,"TOKEN_ELEMENT_ALLYLIC",6,"PT_ELEMENT",2,"PT_CHARGE",5,"PT_CONNECT",6);c$.tokenTypes=c$.prototype.tokenTypes=[[J.script.T.tokenExpressionBegin,J.script.T.n(269484436,1095763978),J.script.T.i(0),J.script.T.tokenExpressionEnd],[J.script.T.tokenExpressionBegin,J.script.T.n(269484436,1095763978),J.script.T.i(0),J.script.T.tokenAnd,J.script.T.n(269484436,1632634891),J.script.T.i(0),J.script.T.tokenExpressionEnd],[J.script.T.tokenExpressionBegin,
J.script.T.n(269484436,1095763978),J.script.T.i(0),J.script.T.tokenAnd,J.script.T.tokenConnected,J.script.T.tokenLeftParen,J.script.T.i(0),J.script.T.tokenRightParen,J.script.T.tokenExpressionEnd],[J.script.T.tokenExpressionBegin,J.script.T.o(1073741824,"flatring"),J.script.T.tokenExpressionEnd],[J.script.T.tokenExpressionBegin,J.script.T.n(269484436,1095763978),J.script.T.i(0),J.script.T.tokenAnd,J.script.T.tokenLeftParen,J.script.T.tokenConnected,J.script.T.tokenLeftParen,J.script.T.i(1),J.script.T.tokenComma,
J.script.T.o(4,"triple"),J.script.T.tokenRightParen,J.script.T.tokenOr,J.script.T.tokenConnected,J.script.T.tokenLeftParen,J.script.T.i(2),J.script.T.tokenComma,J.script.T.o(4,"double"),J.script.T.tokenRightParen,J.script.T.tokenRightParen,J.script.T.tokenExpressionEnd],[J.script.T.tokenExpressionBegin,J.script.T.n(269484436,1095763978),J.script.T.i(0),J.script.T.tokenAnd,J.script.T.o(135266310,"connected"),J.script.T.tokenLeftParen,J.script.T.i(1),J.script.T.tokenComma,J.script.T.o(4,"double"),J.script.T.tokenRightParen,
J.script.T.tokenExpressionEnd],[J.script.T.tokenExpressionBegin,J.script.T.n(269484436,1095763978),J.script.T.i(0),J.script.T.tokenAnd,J.script.T.tokenConnected,J.script.T.tokenLeftParen,J.script.T.i(3),J.script.T.tokenRightParen,J.script.T.tokenAnd,J.script.T.tokenConnected,J.script.T.tokenLeftParen,J.script.T.tokenConnected,J.script.T.tokenLeftParen,J.script.T.o(4,"double"),J.script.T.tokenRightParen,J.script.T.tokenRightParen,J.script.T.tokenExpressionEnd]]});s("J.minimize.forcefield");c$=m(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;n(this,arguments)},J.minimize.forcefield,"Calculation");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");s("J.minimize.forcefield");
x(["J.minimize.forcefield.Calculation","JU.AU","$.SB","$.V3d"],"J.minimize.forcefield.Calculations",["java.lang.Float","J.minimize.Util","J.util.Txt"],function(){c$=m(function(){this.calculations=this.ff=null;this.torsionCount=this.angleCount=this.bondCount=this.atomCount=0;this.constraints=this.minPositions=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null;this.silent=this.gradients=this.isPreliminary=!1;this.logData=null;this.loggingEnabled=this.logging=!1;u("J.minimize.forcefield.Calculations.PairCalc")||
J.minimize.forcefield.Calculations.$Calculations$PairCalc$();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;n(this,arguments)},J.minimize.forcefield,"Calculations");I(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$,"setConstraints",function(a){this.constraints=a},"JU.List");
y(c$,function(a,b,c,e,f,d,h){this.ff=a;this.minAtoms=b;this.minBonds=c;this.minAngles=e;this.minTorsions=f;this.minPositions=d;this.atomCount=b.length;this.bondCount=c.length;this.angleCount=e.length;this.torsionCount=f.length;this.constraints=h},"J.minimize.forcefield.ForceField,~A,~A,~A,~A,~A,JU.List");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 f=0;f<this.atomCount-1;f++)for(var d=this.minAtoms[f].bsVdw,h=d.nextSetBit(0);0<=h;h=d.nextSetBit(h+1))b.setData(a,f,h),null!=e&&e.setData(c,f,h)},"JU.List,J.minimize.forcefield.Calculations.PairCalc,JU.List,J.minimize.forcefield.Calculations.PairCalc");
d(c$,"calc",function(a,b){this.logging=this.loggingEnabled&&!this.silent;this.gradients=b;var c=this.calculations[a],e,d=0;if(null==c||0==(e=c.size()))return 0;this.logging&&this.appendLogData(this.getDebugHeader(a));for(c=0;c<e;c++)d+=this.compute(a,this.calculations[a].get(c));this.logging&&this.appendLogData(this.getDebugFooter(a,d));null!=this.constraints&&3>=a&&(d+=this.constraintEnergy(a));return d},"~N,~B");d(c$,"energyStrBnd",function(){return 0},"~B");d(c$,"energyBond",function(a){return this.calc(0,
a)},"~B");d(c$,"energyAngle",function(a){return this.calc(1,a)},"~B");d(c$,"energyTorsion",function(a){return this.calc(3,a)},"~B");d(c$,"energyStretchBend",function(a){return this.calc(2,a)},"~B");d(c$,"energyOOP",function(a){return this.calc(4,a)},"~B");d(c$,"energyVDW",function(a){return this.calc(5,a)},"~B");d(c$,"energyES",function(a){return this.calc(6,a)},"~B");d(c$,"constraintEnergy",function(a){for(var b=0,c=0,e=0,d=this.constraints.size();0<=--d;){var g=this.constraints.get(d);if(g[0][0]==
a+2){c=g[1];g=g[2].doubleValue();switch(a){case 3:this.id=c[3],this.gradients&&this.dd.setA(this.minAtoms[this.id].coord);case 1:this.ic=c[2],this.gradients&&this.dc.setA(this.minAtoms[this.ic].coord);case 0:this.ib=c[1],this.ia=c[0],this.gradients&&(this.db.setA(this.minAtoms[this.ib].coord),this.da.setA(this.minAtoms[this.ia].coord))}c=1E4;switch(a){case 3:g*=0.017453292519943295;b=this.gradients?J.minimize.Util.restorativeForceAndTorsionAngleRadians(this.da,this.db,this.dc,this.dd):J.minimize.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>b&&1.5707963267948966<=g?b+=6.283185307179586:0<b&&-1.5707963267948966>=g&&(g+=6.283185307179586);break;case 1:g*=0.017453292519943295;b=this.gradients?J.minimize.Util.restorativeForceAndAngleRadians(this.da,this.db,this.dc):J.minimize.Util.getAngleRadiansABC(this.minAtoms[this.ia].coord,this.minAtoms[this.ib].coord,this.minAtoms[this.ic].coord);break;case 0:b=this.gradients?J.minimize.Util.restorativeForceAndDistance(this.da,
this.db,this.dc):Math.sqrt(J.minimize.Util.distance2(this.minAtoms[this.ia].coord,this.minAtoms[this.ib].coord))}e+=this.constrainQuadratic(b,g,c,a)}}return e},"~N");d(c$,"constrainQuadratic",function(a,b,c,e){if(!J.minimize.Util.isFinite(a))return 0;a-=b;if(this.gradients)switch(b=2*c*a,e){case 3: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.constraints||0==this.constraints.size())){this.appendLogData("C O N S T R A I N T S\n---------------------");for(var a=this.constraints.size();0<=--a;){var b=this.constraints.get(a),c=b[0],e=b[1],b=b[2].doubleValue(),c=c[0]-2;switch(c){case 3:this.id=e[3];case 1:this.ic=e[2];case 0:this.ib=e[1],this.ia=e[0]}switch(c){case 0:this.appendLogData(J.util.Txt.sprintf("%3d %3d  %-5s %-5s  %12.6f","ssFI",[this.minAtoms[this.ia].atom.getAtomName(),this.minAtoms[this.ib].atom.getAtomName(),[b],[this.minAtoms[this.ia].atom.getAtomNumber(),
this.minAtoms[this.ib].atom.getAtomNumber()]]));break;case 1:this.appendLogData(J.util.Txt.sprintf("%3d %3d %3d  %-5s %-5s %-5s  %12.6f","sssFI",[this.minAtoms[this.ia].atom.getAtomName(),this.minAtoms[this.ib].atom.getAtomName(),this.minAtoms[this.ic].atom.getAtomName(),[b],[this.minAtoms[this.ia].atom.getAtomNumber(),this.minAtoms[this.ib].atom.getAtomNumber(),this.minAtoms[this.ic].atom.getAtomNumber()]]));break;case 3:this.appendLogData(J.util.Txt.sprintf("%3d %3d %3d %3d  %-5s %-5s %-5s %-5s  %3d %8.3f     %8.3f     %8.3f     %8.3f",
"ssssFI",[this.minAtoms[this.ia].atom.getAtomName(),this.minAtoms[this.ib].atom.getAtomName(),this.minAtoms[this.ic].atom.getAtomName(),this.minAtoms[this.id].atom.getAtomName(),[b],[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.atomCount;a++){var c=this.minAtoms[a],e=c.getBondedAtomIndexes(),d=C(e.length+1,0);d[0]=c.atom.getAtomNumber();for(var g="   ",h=0;h<e.length;h++)g+=" %3d",d[h+1]=this.minAtoms[e[h]].atom.getAtomNumber();b.append(J.util.Txt.sprintf("%3d %8.3f %8.3f %8.3f  %-5s %8.3f %8.3f %8.3f"+g+"\n","sFI",[c.sType,[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 2: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 3: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,J.minimize.forcefield.Calculation");d(c$,"getDebugLineC",function(a,b){var c=this.ff.toUserUnits(b.energy);switch(a){case 0:return J.util.Txt.sprintf("%3d %3d  %-5s %-5s  %4.2f%8.3f   %8.3f     %8.3f   %8.3f   %8.3f","ssFI",[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,[0,b.rab,b.dData[1],b.dData[0],b.delta,c],[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber()]]);case 1:case 2:return J.util.Txt.sprintf("%3d %3d %3d  %-5s %-5s %-5s  %8.3f  %8.3f     %8.3f   %8.3f",
"sssFI",[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,[57.29577951308232*b.theta,b.dData[1],b.dData[0],c],[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber(),this.minAtoms[b.ic].atom.getAtomNumber()]]);case 3:return J.util.Txt.sprintf("%3d %3d %3d %3d  %-5s %-5s %-5s %-5s  %3d %8.3f     %8.3f     %8.3f     %8.3f","ssssFI",[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,this.minAtoms[b.id].sType,[b.dData[1],
b.dData[0],57.29577951308232*b.theta,c],[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 J.util.Txt.sprintf("%3d %3d %3d %3d  %-5s %-5s %-5s %-5s  %8.3f   %8.3f     %8.3f","ssssFI",[this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,this.minAtoms[b.id].sType,[57.29577951308232*b.theta,b.dData[0],c],[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 J.util.Txt.sprintf("%3d %3d  %-5s %-5s %6.3f  %8.3f  %8.3f","ssFI",[this.minAtoms[b.iData[0]].sType,this.minAtoms[b.iData[1]].sType,[b.rab,b.dData[0],c],[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber()]]);case 6:return J.util.Txt.sprintf("%3d %3d  %-5s %-5s %6.3f  %8.3f  %8.3f  %8.3f  %8.3f","ssFI",[this.minAtoms[b.iData[0]].sType,
this.minAtoms[b.iData[1]].sType,[b.rab,b.dData[0],b.dData[1],b.dData[2],c],[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber()]])}return""},"~N,J.minimize.forcefield.Calculation");d(c$,"getDebugFooter",function(a,b){var c="";switch(a){case 0:c="BOND STRETCHING";break;case 1:c="ANGLE BENDING";break;case 3:c="TORSIONAL";break;case 4:c="OUT-OF-PLANE BENDING";break;case 2:c="STRETCH BENDING";break;case 5:c="VAN DER WAALS";break;case 6:c="ELECTROSTATIC ENERGY"}return J.util.Txt.sprintf("\n     TOTAL %s ENERGY = %8.3f %s/mol\n",
"sfs",[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=J.minimize.Util.restorativeForceAndDistance(this.da,this.db,this.dc)):a.rab=Math.sqrt(J.minimize.Util.distance2(this.minAtoms[a.ia].coord,this.minAtoms[a.ib].coord));J.minimize.Util.isNearZero2(a.rab,0.001)&&(a.rab=0.001)},"J.minimize.forcefield.Calculation");d(c$,"setAngleVariables",function(a){this.gradients?(this.setCoords(a,3),a.theta=
J.minimize.Util.restorativeForceAndAngleRadians(this.da,this.db,this.dc)):a.theta=J.minimize.Util.getAngleRadiansABC(this.minAtoms[a.ia].coord,this.minAtoms[a.ib].coord,this.minAtoms[a.ic].coord);J.minimize.Util.isFinite(a.theta)||(a.theta=0)},"J.minimize.forcefield.Calculation");d(c$,"setOopVariables",function(a,b){this.setCoords(a,4);a.theta=this.gradients?J.minimize.Util.restorativeForceAndOutOfPlaneAngleRadians(this.da,this.db,this.dc,this.dd,this.v1,this.v2,this.v3):J.minimize.Util.pointPlaneAngleRadians(this.da,
this.db,this.dc,this.dd,this.v1,this.v2,this.v3,b);J.minimize.Util.isFinite(a.theta)||(a.theta=0)},"J.minimize.forcefield.Calculation,~B");d(c$,"setTorsionVariables",function(a){this.gradients?(this.setCoords(a,4),a.theta=J.minimize.Util.restorativeForceAndTorsionAngleRadians(this.da,this.db,this.dc,this.dd),J.minimize.Util.isFinite(a.theta)||(a.theta=1.7453292519943296E-5)):a.theta=J.minimize.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)},"J.minimize.forcefield.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)}},"J.minimize.forcefield.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)}},"J.minimize.forcefield.Calculation,~N");c$.$Calculations$PairCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.Calculations,"PairCalc",J.minimize.forcefield.Calculation);c$=p()};z(c$,"RAD_TO_DEG",57.29577951308232,"DEG_TO_RAD",0.017453292519943295,"KCAL_TO_KJ",4.1868,"CALC_DISTANCE",0,"CALC_ANGLE",1,"CALC_STRETCH_BEND",2,"CALC_TORSION",3,"CALC_OOP",4,"CALC_VDW",5,"CALC_ES",6,"CALC_MAX",7,"PI_OVER_2",
1.5707963267948966,"TWO_PI",6.283185307179586)});s("J.minimize.forcefield");x(["J.minimize.forcefield.Calculation","$.Calculations"],"J.minimize.forcefield.CalculationsMMFF",["JU.List","J.minimize.MinAtom","$.MinObject","J.util.Txt"],function(){c$=m(function(){this.mmff=this.sbCalc=this.esCalc=this.vdwCalc=this.oopCalc=this.torsionCalc=this.angleCalc=this.bondCalc=this.ffParams=null;u("J.minimize.forcefield.CalculationsMMFF.DistanceCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$DistanceCalc$();
u("J.minimize.forcefield.CalculationsMMFF.AngleCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$AngleCalc$();u("J.minimize.forcefield.CalculationsMMFF.SBCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$SBCalc$();u("J.minimize.forcefield.CalculationsMMFF.TorsionCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$TorsionCalc$();u("J.minimize.forcefield.CalculationsMMFF.OOPCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$OOPCalc$();u("J.minimize.forcefield.CalculationsMMFF.VDWCalc")||
J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$VDWCalc$();u("J.minimize.forcefield.CalculationsMMFF.ESCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$ESCalc$();n(this,arguments)},J.minimize.forcefield,"CalculationsMMFF",J.minimize.forcefield.Calculations);y(c$,function(a,b,c,e,d,g,h,j){A(this,J.minimize.forcefield.CalculationsMMFF,[a,c,e,d,g,h,j]);this.mmff=a;this.ffParams=b;this.bondCalc=l(J.minimize.forcefield.CalculationsMMFF.DistanceCalc,this,null);this.angleCalc=l(J.minimize.forcefield.CalculationsMMFF.AngleCalc,
this,null);this.sbCalc=l(J.minimize.forcefield.CalculationsMMFF.SBCalc,this,null);this.torsionCalc=l(J.minimize.forcefield.CalculationsMMFF.TorsionCalc,this,null);this.oopCalc=l(J.minimize.forcefield.CalculationsMMFF.OOPCalc,this,null);this.vdwCalc=l(J.minimize.forcefield.CalculationsMMFF.VDWCalc,this,null);this.esCalc=l(J.minimize.forcefield.CalculationsMMFF.ESCalc,this,null)},"J.minimize.forcefield.ForceField,java.util.Map,~A,~A,~A,~A,~A,JU.List");j(c$,"getUnits",function(){return"kcal"});j(c$,
"setupCalculations",function(){var a,b=l(J.minimize.forcefield.CalculationsMMFF.DistanceCalc,this,null);a=this.calculations[0]=new JU.List;for(var c=0;c<this.bondCount;c++)b.setData(a,this.minBonds[c]);a=this.calculations[1]=new JU.List;b=l(J.minimize.forcefield.CalculationsMMFF.AngleCalc,this,null);for(c=0;c<this.angleCount;c++)b.setData(a,this.minAngles[c]);a=this.calculations[2]=new JU.List;b=l(J.minimize.forcefield.CalculationsMMFF.SBCalc,this,null);for(c=0;c<this.angleCount;c++)b.setData(a,this.minAngles[c]);
a=this.calculations[3]=new JU.List;b=l(J.minimize.forcefield.CalculationsMMFF.TorsionCalc,this,null);for(c=0;c<this.torsionCount;c++)b.setData(a,this.minTorsions[c]);a=this.calculations[4]=new JU.List;b=l(J.minimize.forcefield.CalculationsMMFF.OOPCalc,this,null);for(c=0;c<this.atomCount;c++)J.minimize.forcefield.CalculationsMMFF.isInvertible(this.minAtoms[c])&&b.setData(a,c);this.pairSearch(this.calculations[5]=new JU.List,l(J.minimize.forcefield.CalculationsMMFF.VDWCalc,this,null),this.calculations[6]=
new JU.List,l(J.minimize.forcefield.CalculationsMMFF.ESCalc,this,null));return!0});d(c$,"isLinear",function(a){return J.minimize.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}},"J.minimize.MinAtom");j(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.sbCalc.compute(b);case 3: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");d(c$,"getParameterObj",function(a){return null==a.key||null!=a.ddata?a.ddata:this.ffParams.get(a.key)},"J.minimize.MinObject");d(c$,"getParameter",function(a){return this.ffParams.get(a)},"Integer");j(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 3: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");j(c$,"getDebugLine",function(a,b){var c=this.ff.toUserUnits(b.energy);switch(a){case 1:case 2:return J.util.Txt.sprintf("%15s  %-5s %-5s %-5s  %8.3f  %8.3f     %8.3f   %8.3f",
"ssssFI",[J.minimize.MinObject.decodeKey(b.key),this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,[57.29577951308232*b.theta,b.dData[1],b.dData[0],c],[this.minAtoms[b.ia].atom.getAtomNumber(),this.minAtoms[b.ib].atom.getAtomNumber(),this.minAtoms[b.ic].atom.getAtomNumber()]]);case 3:return J.util.Txt.sprintf("%15s  %-5s %-5s %-5s %-5s  %8.3f %8.3f %8.3f %8.3f %8.3f","sssssF",[J.minimize.MinObject.decodeKey(b.key),this.minAtoms[b.ia].sType,this.minAtoms[b.ib].sType,this.minAtoms[b.ic].sType,
this.minAtoms[b.id].sType,[57.29577951308232*b.theta,b.dData[0],b.dData[1],b.dData[2],c]]);default:return this.getDebugLineC(a,b)}},"~N,J.minimize.forcefield.Calculation");c$.$CalculationsMMFF$DistanceCalc$=function(){v();c$=m(function(){w(this,arguments);this.delta2=this.kb=this.r0=0;n(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"DistanceCalc",J.minimize.forcefield.Calculation);d(c$,"setData",function(a,b){this.ia=b.data[0];this.ib=b.data[1];var c=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(b);
null!=c&&a.addLast([[this.ia,this.ib],c])},"JU.List,J.minimize.MinBond");j(c$,"compute",function(a){this.getPointers(a);this.kb=this.dData[0];this.r0=this.dData[1];this.b$["J.minimize.forcefield.CalculationsMMFF"].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.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&(this.dE=71.96625*this.kb*this.delta*(2+-6*this.delta+
9.333333333333334*this.delta2),this.b$["J.minimize.forcefield.CalculationsMMFF"].addForces(this,2));this.b$["J.minimize.forcefield.CalculationsMMFF"].logging&&this.b$["J.minimize.forcefield.CalculationsMMFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsMMFF"].getDebugLine(0,this));return this.energy},"~A");z(c$,"FSTRETCH",71.96625,"CS",-2,"CS2",2.3333333333333335);c$=p()};c$.$CalculationsMMFF$AngleCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsMMFF,
"AngleCalc",J.minimize.forcefield.Calculation);d(c$,"setData",function(a,b){var c=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(b);null!=c&&a.addLast([b.data,c,b.key])},"JU.List,J.minimize.MinAngle");j(c$,"compute",function(a){this.key=a[2];this.getPointers(a);a=this.dData[0];var b=this.dData[1];this.b$["J.minimize.forcefield.CalculationsMMFF"].setAngleVariables(this);var c=57.29577951308232*this.theta-b;180==b?(this.energy=143.9325*a*(1+Math.cos(this.theta)),this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&
(this.dE=-143.9325*a*Math.sin(this.theta))):(this.energy=0.021922*a*Math.pow(c,2)*(1+-0.006981317007977318*c),this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&(this.dE=0.021922*a*c*(2+-0.020943951023931956*c)));this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&this.b$["J.minimize.forcefield.CalculationsMMFF"].addForces(this,3);this.b$["J.minimize.forcefield.CalculationsMMFF"].logging&&this.b$["J.minimize.forcefield.CalculationsMMFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsMMFF"].getDebugLine(1,
this));return this.energy},"~A");z(c$,"CB",-0.006981317007977318);c$=p()};c$.$CalculationsMMFF$SBCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"SBCalc",J.minimize.forcefield.Calculation);d(c$,"setData",function(a,b){if(!this.b$["J.minimize.forcefield.CalculationsMMFF"].isLinear(b.data[1])){var c=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameter(b.sbKey),e=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(b),
d=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(this.b$["J.minimize.forcefield.CalculationsMMFF"].minBonds[b.data[3]]),g=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(this.b$["J.minimize.forcefield.CalculationsMMFF"].minBonds[b.data[4]]);null==c||(null==e||null==d||null==g)||(e=e[1],g=g[1],a.addLast([b.data,[c[0],e,d[1]]]),a.addLast([[b.data[2],b.data[1],b.data[0]],[c[1],e,g]]))}},"JU.List,J.minimize.MinAngle");j(c$,"compute",function(a){this.getPointers(a);
a=2.5121*this.dData[0];var b=this.dData[1],c=this.dData[2];this.b$["J.minimize.forcefield.CalculationsMMFF"].setPairVariables(this);this.b$["J.minimize.forcefield.CalculationsMMFF"].setAngleVariables(this);c=this.rab-c;this.delta=57.29577951308232*this.theta-b;this.energy=a*c*this.delta;this.b$["J.minimize.forcefield.CalculationsMMFF"].logging&&this.b$["J.minimize.forcefield.CalculationsMMFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsMMFF"].getDebugLine(2,this));this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&
(this.dE=a*c,this.b$["J.minimize.forcefield.CalculationsMMFF"].addForces(this,3),this.b$["J.minimize.forcefield.CalculationsMMFF"].setPairVariables(this),this.dE=a*this.delta,this.b$["J.minimize.forcefield.CalculationsMMFF"].addForces(this,2));return this.energy},"~A");c$=p()};c$.$CalculationsMMFF$TorsionCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"TorsionCalc",J.minimize.forcefield.Calculation);d(c$,"setData",function(a,b){if(!this.b$["J.minimize.forcefield.CalculationsMMFF"].isLinear(b.data[1])&&
!this.b$["J.minimize.forcefield.CalculationsMMFF"].isLinear(b.data[2])){var c=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(b);null!=c&&a.addLast([b.data,c,b.key])}},"JU.List,J.minimize.MinTorsion");j(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.b$["J.minimize.forcefield.CalculationsMMFF"].setTorsionVariables(this);var e=Math.cos(this.theta),d=e*e;this.energy=0.5*(a*(1+e)+b*(2-2*d)+c*(1+e*(4*d-3)));if(this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients){var g=
Math.sin(this.theta);this.dE=0.5*(-a*g+4*b*g*e+3*c*g*(1-4*d));this.b$["J.minimize.forcefield.CalculationsMMFF"].addForces(this,4)}this.b$["J.minimize.forcefield.CalculationsMMFF"].logging&&this.b$["J.minimize.forcefield.CalculationsMMFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsMMFF"].getDebugLine(3,this));return this.energy},"~A");c$=p()};c$.$CalculationsMMFF$OOPCalc$=function(){v();c$=m(function(){w(this,arguments);this.list=null;n(this,arguments)},J.minimize.forcefield.CalculationsMMFF,
"OOPCalc",J.minimize.forcefield.Calculation);I(c$,function(){this.list=C(4,0)});d(c$,"setData",function(a,b){if(3==this.b$["J.minimize.forcefield.CalculationsMMFF"].minAtoms[b].nBonds){var c=this.b$["J.minimize.forcefield.CalculationsMMFF"].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.b$["J.minimize.forcefield.CalculationsMMFF"].mmff.getOutOfPlaneParameter(this.list);0!=e&&(e=[e],a.addLast([[c[0],b,c[1],c[2]],e]),a.addLast([[c[1],
b,c[2],c[0]],e]),a.addLast([[c[2],b,c[0],c[1]],e]))}},"JU.List,~N");j(c$,"compute",function(a){this.getPointers(a);this.b$["J.minimize.forcefield.CalculationsMMFF"].setOopVariables(this,!1);a=this.dData[0];this.energy=71.96568080495746*a*this.theta*this.theta;this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&(this.dE=2.5120761569715815*a*this.theta,this.b$["J.minimize.forcefield.CalculationsMMFF"].addForces(this,4));this.b$["J.minimize.forcefield.CalculationsMMFF"].logging&&this.b$["J.minimize.forcefield.CalculationsMMFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsMMFF"].getDebugLine(4,
this));return this.energy},"~A");z(c$,"FOOPD",2.5120761569715815,"FOOP",71.96568080495746);c$=p()};c$.$CalculationsMMFF$VDWCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"VDWCalc",J.minimize.forcefield.Calculations.PairCalc,null,l(J.minimize.forcefield.Calculations.PairCalc,this,null,L));j(c$,"setData",function(a,b,c){this.a=this.b$["J.minimize.forcefield.CalculationsMMFF"].minAtoms[b];this.b=this.b$["J.minimize.forcefield.CalculationsMMFF"].minAtoms[c];
var e=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameter(this.a.vdwKey),d=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameter(this.b.vdwKey);if(!(null==e||null==d)){var g=e[0],h=e[1],j=e[2],l=e[3],e=K(e[4]),m=d[0],n=d[1],k=d[2],p=d[3],d=K(d[4]),j=j*Math.pow(g,0.25),s=k*Math.pow(m,0.25),k=(j-s)/(j+s),j=0.5*(j+s);68!=e&&68!=d&&(j*=1+0.2*(1-Math.exp(-12*k*k)));g=181.16*l*p*g*m/(Math.sqrt(g/h)+Math.sqrt(m/n))*Math.pow(j,-6);133==e+d&&(j*=0.8,g*=0.5);a.addLast([[b,c],[j,g]])}},"JU.List,~N,~N");
j(c$,"compute",function(a){this.getPointers(a);this.b$["J.minimize.forcefield.CalculationsMMFF"].setPairVariables(this);a=this.dData[0];var b=this.dData[1],c=this.rab/a,e=1.07/(c+0.07),d=1.12/(Math.pow(c,7)+0.12);this.energy=b*Math.pow(e,7)*(d-2);this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&(this.dE=-7*b*Math.pow(e,7)/a*(e/1.07*(d-2)+d*d*Math.pow(c,6)),this.b$["J.minimize.forcefield.CalculationsMMFF"].addForces(this,2));this.b$["J.minimize.forcefield.CalculationsMMFF"].logging&&0.1<
Math.abs(this.energy)&&this.b$["J.minimize.forcefield.CalculationsMMFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsMMFF"].getDebugLine(5,this));return this.energy},"~A");c$=p()};c$.$CalculationsMMFF$ESCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"ESCalc",J.minimize.forcefield.Calculations.PairCalc,null,l(J.minimize.forcefield.Calculations.PairCalc,this,null,L));j(c$,"setData",function(a,b,c){0==this.b$["J.minimize.forcefield.CalculationsMMFF"].minAtoms[b].partialCharge||
0==this.b$["J.minimize.forcefield.CalculationsMMFF"].minAtoms[c].partialCharge||a.addLast([[b,c],[this.b$["J.minimize.forcefield.CalculationsMMFF"].minAtoms[b].partialCharge,this.b$["J.minimize.forcefield.CalculationsMMFF"].minAtoms[c].partialCharge,this.b$["J.minimize.forcefield.CalculationsMMFF"].minAtoms[b].bs14.get(c)?249.0537:332.0716]])},"JU.List,~N,~N");j(c$,"compute",function(a){this.getPointers(a);a=this.dData[0]*this.dData[1]*this.dData[2];this.b$["J.minimize.forcefield.CalculationsMMFF"].setPairVariables(this);
var b=this.rab+0.05;this.energy=a/b;this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&(this.dE=-this.energy/b,this.b$["J.minimize.forcefield.CalculationsMMFF"].addForces(this,2));this.b$["J.minimize.forcefield.CalculationsMMFF"].logging&&20<Math.abs(this.energy)&&this.b$["J.minimize.forcefield.CalculationsMMFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsMMFF"].getDebugLine(6,this));return this.energy},"~A");z(c$,"BUFF",0.05);c$=p()};z(c$,"FPAR",143.9325,"DA_D","D","DA_DA",
133)});s("J.minimize.forcefield");x(["J.minimize.forcefield.Calculation","$.Calculations"],"J.minimize.forcefield.CalculationsUFF",["JU.List","J.minimize.Util"],function(){c$=m(function(){this.vdwCalc=this.oopCalc=this.torsionCalc=this.angleCalc=this.bondCalc=this.parC=this.parB=this.parA=this.ffParams=null;u("J.minimize.forcefield.CalculationsUFF.DistanceCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$DistanceCalc$();u("J.minimize.forcefield.CalculationsUFF.AngleCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$AngleCalc$();
u("J.minimize.forcefield.CalculationsUFF.TorsionCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$TorsionCalc$();u("J.minimize.forcefield.CalculationsUFF.OOPCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$OOPCalc$();u("J.minimize.forcefield.CalculationsUFF.VDWCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$VDWCalc$();n(this,arguments)},J.minimize.forcefield,"CalculationsUFF",J.minimize.forcefield.Calculations);y(c$,function(a,b,c,e,d,g,h,j){A(this,J.minimize.forcefield.CalculationsUFF,
[a,c,e,d,g,h,j]);this.ffParams=b;this.bondCalc=l(J.minimize.forcefield.CalculationsUFF.DistanceCalc,this,null);this.angleCalc=l(J.minimize.forcefield.CalculationsUFF.AngleCalc,this,null);this.torsionCalc=l(J.minimize.forcefield.CalculationsUFF.TorsionCalc,this,null);this.oopCalc=l(J.minimize.forcefield.CalculationsUFF.OOPCalc,this,null);this.vdwCalc=l(J.minimize.forcefield.CalculationsUFF.VDWCalc,this,null)},"J.minimize.forcefield.ForceField,java.util.Map,~A,~A,~A,~A,~A,JU.List");j(c$,"getUnits",
function(){return"kJ"});j(c$,"setupCalculations",function(){var a,b=l(J.minimize.forcefield.CalculationsUFF.DistanceCalc,this,null);a=this.calculations[0]=new JU.List;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.List;b=l(J.minimize.forcefield.CalculationsUFF.AngleCalc,this,null);for(c=this.minAngles.length;0<=--c;)b.setData(a,this.minAngles[c].data);a=this.calculations[3]=
new JU.List;b=l(J.minimize.forcefield.CalculationsUFF.TorsionCalc,this,null);for(c=this.minTorsions.length;0<=--c;)b.setData(a,this.minTorsions[c].data);a=this.calculations[4]=new JU.List;for(var b=l(J.minimize.forcefield.CalculationsUFF.OOPCalc,this,null),g,c=0;c<this.atomCount;c++)e=this.minAtoms[c],3==e.nBonds&&J.minimize.forcefield.CalculationsUFF.isInvertible(g=e.atom.getElementNumber())&&b.setData(a,c,g);this.pairSearch(this.calculations[5]=new JU.List,l(J.minimize.forcefield.CalculationsUFF.VDWCalc,
this,null),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");j(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.torsionCalc.compute(b);
case 4:return this.oopCalc.compute(b);case 5:return this.vdwCalc.compute(b)}return 0},"~N,~A");d(c$,"getParameter",function(a){return this.ffParams.get(a)},"~O");j(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");c$.$CalculationsUFF$DistanceCalc$=function(){v();c$=m(function(){w(this,arguments);this.kb=this.r0=0;n(this,arguments)},J.minimize.forcefield.CalculationsUFF,
"DistanceCalc",J.minimize.forcefield.Calculation);d(c$,"setData",function(a,b,c,e){this.b$["J.minimize.forcefield.CalculationsUFF"].parA=this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[b].sType);this.b$["J.minimize.forcefield.CalculationsUFF"].parB=this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[c].sType);this.r0=J.minimize.forcefield.CalculationsUFF.calculateR0(this.b$["J.minimize.forcefield.CalculationsUFF"].parA.dVal[0],
this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[0],this.b$["J.minimize.forcefield.CalculationsUFF"].parA.dVal[8],this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[8],e);this.kb=1390.2842991599998*this.b$["J.minimize.forcefield.CalculationsUFF"].parA.dVal[5]*this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[5]/(this.r0*this.r0*this.r0);a.addLast([[b,c],[this.r0,this.kb,e]])},"JU.List,~N,~N,~N");j(c$,"compute",function(a){this.getPointers(a);this.r0=this.dData[0];this.kb=
this.dData[1];this.b$["J.minimize.forcefield.CalculationsUFF"].setPairVariables(this);this.delta=this.rab-this.r0;this.energy=this.kb*this.delta*this.delta;this.b$["J.minimize.forcefield.CalculationsUFF"].gradients&&(this.dE=2*this.kb*this.delta,this.b$["J.minimize.forcefield.CalculationsUFF"].addForces(this,2));this.b$["J.minimize.forcefield.CalculationsUFF"].logging&&this.b$["J.minimize.forcefield.CalculationsUFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsUFF"].getDebugLine(0,this));
return this.energy},"~A");c$=p()};c$.$CalculationsUFF$AngleCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsUFF,"AngleCalc",J.minimize.forcefield.Calculation);d(c$,"setData",function(a,b){this.a=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ia=b[0]];this.b=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ib=b[1]];this.c=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ic=b[2]];var c="H_"===this.a.sType&&
"H_"===this.c.sType?10:1;this.b$["J.minimize.forcefield.CalculationsUFF"].parA=this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.a.sType);this.b$["J.minimize.forcefield.CalculationsUFF"].parB=this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.b.sType);this.b$["J.minimize.forcefield.CalculationsUFF"].parC=this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.c.sType);var e=this.b$["J.minimize.forcefield.CalculationsUFF"].parB.iVal[0],d=this.b$["J.minimize.forcefield.CalculationsUFF"].parA.dVal[5],
g=this.b$["J.minimize.forcefield.CalculationsUFF"].parC.dVal[5],h=this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[1],j=Math.cos(h),l=Math.sin(h),m,n;switch(e){case 1:case 2:case 4:case 6:l=m=n=0;break;default:n=1/(4*l*l),m=-4*n*j,l=n*(2*j*j+1)}var k=this.a.getBondTo(this.ib),p=k.order;k.isAromatic&&(p=1.5);k.isAmide&&(p=1.41);this.rab=J.minimize.forcefield.CalculationsUFF.calculateR0(this.b$["J.minimize.forcefield.CalculationsUFF"].parA.dVal[0],this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[0],
this.b$["J.minimize.forcefield.CalculationsUFF"].parA.dVal[8],this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[8],p);k=this.c.getBondTo(this.ib);p=k.order;k.isAromatic&&(p=1.5);k.isAmide&&(p=1.41);k=J.minimize.forcefield.CalculationsUFF.calculateR0(this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[0],this.b$["J.minimize.forcefield.CalculationsUFF"].parC.dVal[0],this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[8],this.b$["J.minimize.forcefield.CalculationsUFF"].parC.dVal[8],
p);p=Math.sqrt(this.rab*this.rab+k*k-2*this.rab*k*j);d=2696.8016159999997*(d*g/Math.pow(p,5))*(3*this.rab*k*(1-j*j)-p*p*j);a.addLast([[this.ia,this.ib,this.ic,e],[d,57.29577951308232*h,l-n,m,2*n,c*d]])},"JU.List,~A");j(c$,"compute",function(a){this.getPointers(a);a=this.iData[3];var b=this.b$["J.minimize.forcefield.CalculationsUFF"].isPreliminary?this.dData[5]:this.dData[0],c=this.dData[2],e=this.dData[3],d=this.dData[4];this.b$["J.minimize.forcefield.CalculationsUFF"].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+e*g+d*g*g)}if(this.b$["J.minimize.forcefield.CalculationsUFF"].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*(e*h-2*d*g*h)}this.b$["J.minimize.forcefield.CalculationsUFF"].addForces(this,
3)}this.b$["J.minimize.forcefield.CalculationsUFF"].logging&&this.b$["J.minimize.forcefield.CalculationsUFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsUFF"].getDebugLine(1,this));return this.energy},"~A");c$=p()};c$.$CalculationsUFF$TorsionCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsUFF,"TorsionCalc",J.minimize.forcefield.Calculation);d(c$,"setData",function(a,b){var c=-1,e=0,d=0;this.a=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ia=
b[0]];this.b=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ib=b[1]];this.c=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ic=b[2]];this.d=this.b$["J.minimize.forcefield.CalculationsUFF"].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.b$["J.minimize.forcefield.CalculationsUFF"].parB=this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.b.sType);this.b$["J.minimize.forcefield.CalculationsUFF"].parC=
this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.c.sType);switch(this.b$["J.minimize.forcefield.CalculationsUFF"].parB.iVal[0]*this.b$["J.minimize.forcefield.CalculationsUFF"].parC.iVal[0]){case 9:e=3;d=this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[6];g=this.b$["J.minimize.forcefield.CalculationsUFF"].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:d=
h;e=g=2;break;case 16:case 34:case 52:case 84:d=h,g=6.8,e=2}d=2.0934*Math.sqrt(d*g);break;case 4:c=1;e=2;d=2.0934*5*Math.sqrt(this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[7]*this.b$["J.minimize.forcefield.CalculationsUFF"].parC.dVal[7])*(1+4.18*Math.log(h));break;case 6:c=1;e=6;d=3==this.b$["J.minimize.forcefield.CalculationsUFF"].parC.iVal[0];switch((d?this.c:this.b).atom.getElementNumber()){case 8:case 16:case 34:case 52:case 84:switch((d?this.b:this.c).atom.getElementNumber()){case 8:case 16:case 34:case 52:case 84:break;
default:e=2,c=-1}}d=2.0934}J.minimize.Util.isNearZero(d)||a.addLast([[this.ia,this.ib,this.ic,this.id,e],[d,c]])},"JU.List,~A");j(c$,"compute",function(a){this.getPointers(a);a=this.iData[4];var b=this.dData[0],c=this.dData[1];this.b$["J.minimize.forcefield.CalculationsUFF"].setTorsionVariables(this);this.energy=b*(1-c*Math.cos(this.theta*a));this.b$["J.minimize.forcefield.CalculationsUFF"].gradients&&(this.dE=b*a*c*Math.sin(a*this.theta),this.b$["J.minimize.forcefield.CalculationsUFF"].addForces(this,
4));this.b$["J.minimize.forcefield.CalculationsUFF"].logging&&this.b$["J.minimize.forcefield.CalculationsUFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsUFF"].getDebugLine(3,this));return this.energy},"~A");c$=p()};c$.$CalculationsUFF$OOPCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsUFF,"OOPCalc",J.minimize.forcefield.Calculation);d(c$,"setData",function(a,b,c){this.b=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[b];
var e=this.b.getBondedAtomIndexes();this.a=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ia=e[0]];this.c=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ic=e[1]];this.d=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.id=e[2]];var d=1,g=-1,h=0,e=25.1208;switch(c){case 6:if("C_2"===this.b.sType&&1<this.b.hCount||"C_2+"===this.b.sType||"O_2"===this.a.sType||"O_2"===this.c.sType||"O_2"===this.d.sType){e+=184.2192;break}break;case 7:case 8:break;default:e=
92.1096;d=0.017453292519943295;switch(c){case 15:d*=84.4339;break;case 33:d*=86.9735;break;case 51:d*=87.7047;break;case 83:d*=90}c=Math.cos(d);d=c*c;g=-2*c;h=1}e/=3;a.addLast([[this.ia,b,this.ic,this.id],[e,d,g,h,10*e]]);a.addLast([[this.ic,b,this.id,this.ia],[e,d,g,h,10*e]]);a.addLast([[this.id,b,this.ia,this.ic],[e,d,g,h,10*e]])},"JU.List,~N,~N");j(c$,"compute",function(a){this.getPointers(a);a=this.b$["J.minimize.forcefield.CalculationsUFF"].isPreliminary?this.dData[4]:this.dData[0];var b=this.dData[1],
c=this.dData[2],d=this.dData[3];this.b$["J.minimize.forcefield.CalculationsUFF"].setOopVariables(this,!0);var f=Math.cos(this.theta);this.energy=a*(b+c*f+d*f*f);this.b$["J.minimize.forcefield.CalculationsUFF"].gradients&&(this.dE=a*(c*Math.sin(this.theta)+2*d*Math.sin(this.theta)*f),this.b$["J.minimize.forcefield.CalculationsUFF"].addForces(this,4));this.b$["J.minimize.forcefield.CalculationsUFF"].logging&&this.b$["J.minimize.forcefield.CalculationsUFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsUFF"].getDebugLine(4,
this));return this.energy},"~A");c$=p()};c$.$CalculationsUFF$VDWCalc$=function(){v();c$=m(function(){w(this,arguments);n(this,arguments)},J.minimize.forcefield.CalculationsUFF,"VDWCalc",J.minimize.forcefield.Calculations.PairCalc,null,l(J.minimize.forcefield.Calculations.PairCalc,this,null,L));j(c$,"setData",function(a,b,c){this.a=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[b];this.b=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[c];var d=this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.a.sType),
f=this.b$["J.minimize.forcefield.CalculationsUFF"].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([[b,c],[g,f]])},"JU.List,~N,~N");j(c$,"compute",function(a){this.getPointers(a);a=this.dData[0];var b=this.dData[1];this.b$["J.minimize.forcefield.CalculationsUFF"].setPairVariables(this);var c=a/this.rab,d=c*c*c,d=d*d;this.energy=b*d*(d-2);this.b$["J.minimize.forcefield.CalculationsUFF"].gradients&&
(this.dE=12*b*(1-d)*d*c/a,this.b$["J.minimize.forcefield.CalculationsUFF"].addForces(this,2));this.b$["J.minimize.forcefield.CalculationsUFF"].logging&&this.b$["J.minimize.forcefield.CalculationsUFF"].appendLogData(this.b$["J.minimize.forcefield.CalculationsUFF"].getDebugLine(5,this));return this.energy},"~A");c$=p()};z(c$,"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,"KCAL332",1390.2842991599998,"KCAL644",2696.8016159999997,
"KCAL6",25.1208,"KCAL22",92.1096,"KCAL44",184.2192)});s("J.minimize.forcefield");c$=m(function(){this.sVal=this.dVal=this.iVal=null;n(this,arguments)},J.minimize.forcefield,"FFParam");s("J.minimize");x(["J.thread.JmolThread"],"J.minimize.MinimizationThread",["J.util.Logger"],function(){c$=m(function(){this.minimizer=null;n(this,arguments)},J.minimize,"MinimizationThread",J.thread.JmolThread);y(c$,function(){A(this,J.minimize.MinimizationThread,[])});j(c$,"setManager",function(a,b){this.minimizer=
a;this.setViewer(b,"MinimizationThread");return 0},"~O,J.viewer.Viewer,~O");j(c$,"run1",function(a){for(;;)switch(a){case -1:this.lastRepaintTime=this.startTime;if(!this.minimizer.startMinimization())return;this.viewer.startHoverWatcher(!1);a=0;break;case 0:if(!this.minimizer.minimizationOn()||this.checkInterrupted()){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.viewer.startHoverWatcher(!0);return}},"~N");j(c$,"oops",function(a){this.minimizer.minimizationOn()&&J.util.Logger.error(a.toString())},"Exception")})})(Clazz,Clazz.newArray,Clazz.newBooleanArray,Clazz.newByteArray,Clazz.newCharArray,Clazz.newDoubleArray,Clazz.newFloatArray,Clazz.newIntArray,Clazz.newLongArray,Clazz.newShortArray,Clazz.prepareCallback,Clazz.decorateAsClass,Clazz.isClassDefined,
Clazz.defineEnumConstant,Clazz.cloneFinals,Clazz.inheritArgs,Clazz.pu$h,Clazz.declareInterface,Clazz.declarePackage,Clazz.makeConstructor,Clazz.overrideConstructor,Clazz.load,Clazz.defineMethod,Clazz.innerTypeInstance,Clazz.instanceOf,Clazz.p0p,Clazz.makeFunction,Clazz.superConstructor,Clazz.defineStatics,Clazz.registerSerializableFields,Clazz.declareType,Clazz.superCall,Clazz.overrideMethod,Clazz.declareAnonymous,Clazz.checkPrivateMethod,Clazz.prepareFields,Clazz.instantialize,Clazz.doubleToInt,
Clazz.declarePackage,Clazz.instanceOf,Clazz.load,Clazz.instantialize,Clazz.decorateAsClass,Clazz.floatToInt,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.supportsNativeObject,Clazz.extendedObjectMethods,Clazz.callingStackTraces,Clazz.clone,Clazz.doubleToShort,Clazz.innerFunctions,Clazz.getInheritedLevel,Clazz.getParamsType,Clazz.isAF,Clazz.isAI,Clazz.isAS,Clazz.isASS,Clazz.isAP,Clazz.isAFloat,Clazz.isAII,Clazz.isAFF,Clazz.isAFFF,Clazz.tryToSearchAndExecute,Clazz.getStackTrace,Clazz.inheritArgs);
