Clazz.declarePackage("J.api");Clazz.declareInterface(J.api,"MinimizerInterface");Clazz.declarePackage("J.minimize");
Clazz.load(["J.api.MinimizerInterface"],"J.minimize.Minimizer","java.util.Hashtable J.i18n.GT J.minimize.MinAngle $.MinAtom $.MinBond $.MinTorsion J.minimize.forcefield.ForceFieldMMFF $.ForceFieldUFF J.thread.MinimizationThread J.util.ArrayUtil $.BS $.BSUtil $.Escape $.JmolList $.Logger".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.bonds=this.atoms=this.viewer=null;this.rawBondCount=0;this.bsMinFixed=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;Clazz.instantialize(this,arguments)},J.minimize,"Minimizer",null,J.api.MinimizerInterface);Clazz.makeConstructor(c$,function(){});Clazz.overrideMethod(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");Clazz.overrideMethod(c$,"getProperty",function(a){return a.equals("log")?null==this.pFF?"":this.pFF.getLogData():
null},"~S,~N");$_M(c$,"addConstraint",($fz=function(a){if(null!=a){var b=a[0],c=b[0];0==c?this.constraints=null:(null==this.constraints&&(this.constraints=new J.util.JmolList,this.constraintMap=new java.util.Hashtable),b[1]>b[c]&&(J.util.ArrayUtil.swapInt(b,1,c),4==c&&J.util.ArrayUtil.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)))}},$fz.isPrivate=!0,$fz),"~A");$_M(c$,"clear",($fz=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},$fz.isPrivate=!0,$fz));Clazz.overrideMethod(c$,"minimize",function(a,b,c,d,e,f,g){this.isSilent=f||this.viewer.getBooleanProperty("minimizationSilent");this.setEnergyUnits();
2147483647==a&&(f=this.viewer.getParameter("minimizationSteps"),null!=f&&Clazz.instanceOf(f,Integer)&&(a=f.intValue()));this.steps=a;!e&&null!=this.bsFixedDefault&&d.and(this.bsFixedDefault);0>=b&&(f=this.viewer.getParameter("minimizationCriterion"),null!=f&&Clazz.instanceOf(f,Float)&&(b=f.floatValue()));this.crit=Math.max(b,1E-4);if(this.$minimizationOn)return!1;this.getForceField(g);if(null==this.pFF)return J.util.Logger.error(J.i18n.GT._("Could not get class for force field {0}",g)),!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);null!=d&&this.bsAtoms.or(d);this.atomCount=this.bsAtoms.cardinality();b=J.util.BSUtil.areEqual(c,this.bsSelected);this.bsSelected=c;b||this.pFF.clear();if((!b||!J.util.BSUtil.areEqual(d,this.bsFixed))&&!this.setupMinimization())return this.clear(),!1;0<a&&(this.bsTaint=
J.util.BSUtil.copy(this.bsAtoms),J.util.BSUtil.andNot(this.bsTaint,d),this.viewer.setTaintedAtoms(this.bsTaint,2));null!=d&&(this.bsFixed=d);this.setAtomPositions();if(null!=this.constraints)for(c=this.constraints.size();0<=--c;){b=this.constraints.get(c);d=b[0];b=b[1];e=d[0]=Math.abs(d[0]);for(g=1;g<=e;g++){if(0>=a||!this.bsAtoms.get(d[g])){d[0]=-e;break}b[g-1]=this.atomMap[d[g]]}}this.pFF.setConstraints(this);0>=a?this.getEnergyOnly():this.isSilent||!this.viewer.useMinimizationThread()?this.minimizeWithoutThread():
this.setMinimizationOn(!0);return!0},"~N,~N,J.util.BS,J.util.BS,~B,~B,~S");$_M(c$,"setEnergyUnits",($fz=function(){this.units=this.viewer.getEnergyUnits().equalsIgnoreCase("kcal")?"kcal":"kJ"},$fz.isPrivate=!0,$fz));$_M(c$,"setupMinimization",($fz=function(){this.coordSaved=null;this.atomMap=Clazz.newIntArray(this.atoms.length,0);this.minAtoms=Array(this.atomCount);this.elemnoMax=0;for(var a=new J.util.BS,b=this.bsAtoms.nextSetBit(0),c=0;0<=b;b=this.bsAtoms.nextSetBit(b+1),c++){var d=this.atoms[b];
this.atomMap[b]=c;var e=this.atoms[b].getElementNumber();this.elemnoMax=Math.max(this.elemnoMax,e);a.set(e);this.minAtoms[c]=new J.minimize.MinAtom(c,d,[d.x,d.y,d.z],this.atomCount);this.minAtoms[c].sType=d.getAtomName()}J.util.Logger.info(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)},$fz.isPrivate=!0,$fz));$_M(c$,"setModel",($fz=function(a){return!this.pFF.setModel(a,this.elemnoMax)?(J.util.Logger.error(J.i18n.GT._("could not setup force field {0}",this.ff)),this.ff.equals("MMFF")?(this.getForceField("UFF"),this.setModel(a)):!1):!0},$fz.isPrivate=!0,$fz),"J.util.BS");$_M(c$,"setAtomPositions",($fz=function(){for(var a=0;a<this.atomCount;a++)this.minAtoms[a].set();this.bsMinFixed=
null;if(null!=this.bsFixed){this.bsMinFixed=new J.util.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)}},$fz.isPrivate=!0,$fz));$_M(c$,"getBonds",($fz=function(){var a=new J.util.JmolList;this.bondCount=0;for(var b,c,d=0;d<this.rawBondCount;d++){var e=this.bonds[d];if(this.bsAtoms.get(b=e.getAtomIndex1())&&this.bsAtoms.get(c=e.getAtomIndex2())){if(c<b){var f=b;b=c;c=f}e=e.getCovalentOrder();switch(e){case 1:case 2:case 3:break;
case 515:e=5;break;default:e=1}a.addLast(new J.minimize.MinBond(d,this.bondCount++,this.atomMap[b],this.atomMap[c],e,0,null))}}this.minBonds=Array(this.bondCount);for(d=0;d<this.bondCount;d++)e=this.minBonds[d]=a.get(d),b=e.data[0],c=e.data[1],this.minAtoms[b].addBond(e,c),this.minAtoms[c].addBond(e,b);for(d=0;d<this.atomCount;d++)this.minAtoms[d].getBondedAtomIndexes()},$fz.isPrivate=!0,$fz));$_M(c$,"getAngles",function(){for(var a=new J.util.JmolList,b,c,d=0;d<this.bondCount;d++){b=this.minBonds[d];
var e=b.data[0],f=b.data[1];if(1<this.minAtoms[f].nBonds){b=this.minAtoms[f].getBondedAtomIndexes();for(var g=b.length;0<=--g;)if((c=b[g])>e)a.addLast(new J.minimize.MinAngle([e,f,c,d,this.minAtoms[f].getBondIndex(g)])),this.minAtoms[e].bsVdw.clear(c)}if(1<this.minAtoms[e].nBonds){b=this.minAtoms[e].getBondedAtomIndexes();for(g=b.length;0<=--g;)if((c=b[g])<f&&c>e)a.addLast(new J.minimize.MinAngle([c,e,f,this.minAtoms[e].getBondIndex(g),d])),this.minAtoms[c].bsVdw.clear(f)}}this.minAngles=a.toArray(Array(a.size()));
J.util.Logger.info(this.minAngles.length+" angles")});$_M(c$,"getTorsions",function(){for(var a=new J.util.JmolList,b,c=this.minAngles.length;0<=--c;){var d=this.minAngles[c].data,e=d[0],f=d[1],g=d[2],h;if(g>f&&1<this.minAtoms[g].nBonds){h=this.minAtoms[g].getBondedAtomIndexes();for(var k=0;k<h.length;k++)b=h[k],b!=e&&b!=f&&(a.addLast(new J.minimize.MinTorsion([e,f,g,b,d[3],d[4],this.minAtoms[g].getBondIndex(k)])),this.minAtoms[Math.min(e,b)].bs14.set(Math.max(e,b)))}if(e>f&&1!=this.minAtoms[e].nBonds){h=
this.minAtoms[e].getBondedAtomIndexes();for(k=0;k<h.length;k++)b=h[k],b!=g&&b!=f&&(a.addLast(new J.minimize.MinTorsion([g,f,e,b,d[4],d[3],this.minAtoms[e].getBondIndex(k)])),this.minAtoms[Math.min(g,b)].bs14.set(Math.max(g,b)))}}this.minTorsions=a.toArray(Array(a.size()));J.util.Logger.info(this.minTorsions.length+" torsions")});$_M(c$,"getForceField",function(a){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");Clazz.overrideMethod(c$,"minimizationOn",function(){return this.$minimizationOn});$_M(c$,"setMinimizationOn",($fz=function(a){(this.$minimizationOn=a)?null==this.minimizationThread&&(this.minimizationThread=new J.thread.MinimizationThread(this,this.viewer),this.minimizationThread.start()):null!=this.minimizationThread&&
(this.minimizationThread=null)},$fz.isPrivate=!0,$fz),"~B");$_M(c$,"getEnergyOnly",($fz=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())},$fz.isPrivate=!0,$fz));$_M(c$,"reportEnergy",($fz=function(){this.viewer.setFloatProperty("_minimizationEnergy",this.pFF.toUserUnits(this.pFF.getEnergy()))},
$fz.isPrivate=!0,$fz));Clazz.overrideMethod(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(Clazz.exceptionOf(a,Exception))return J.util.Logger.error("minimization error viewer="+this.viewer+" pFF = "+this.pFF),!1;throw a;}return this.$minimizationOn=!0});Clazz.overrideMethod(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});Clazz.overrideMethod(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")});$_M(c$,"saveCoordinates",($fz=function(){null==this.coordSaved&&(this.coordSaved=Clazz.newDoubleArray(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]},$fz.isPrivate=
!0,$fz));$_M(c$,"restoreCoordinates",($fz=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()}},$fz.isPrivate=!0,$fz));$_M(c$,"stopMinimization",function(a){this.$minimizationOn&&(this.setMinimizationOn(!1),a?this.endMinimization():this.restoreCoordinates())},"~B");$_M(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)}});$_M(c$,"minimizeWithoutThread",($fz=function(){if(this.startMinimization()){for(;this.stepMinimization(););this.endMinimization()}},$fz.isPrivate=!0,$fz));$_M(c$,"report",function(a,b){this.isSilent?J.util.Logger.info(a):b?this.viewer.showString(a,!1):this.viewer.scriptEcho(a)},"~S,~B");Clazz.overrideMethod(c$,"calculatePartialCharges",function(a,b,c,d){var e=new J.minimize.forcefield.ForceFieldMMFF(this);e.setArrays(c,d,a,b,!0,!0);
this.viewer.setAtomProperty(d,1087375361,0,0,null,null,e.getAtomTypeDescriptions());this.viewer.setAtomProperty(d,1112541196,0,0,null,e.getPartialCharges(),null)},"~A,~N,~A,J.util.BS")});Clazz.declarePackage("J.minimize");c$=Clazz.decorateAsClass(function(){this.data=null;this.type=0;this.ddata=this.key=null;Clazz.instantialize(this,arguments)},J.minimize,"MinObject");
Clazz.overrideMethod(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=$_M(c$,"getKey",function(a,b,c,d,e){return Integer.$valueOf(((((e<<7)+d<<7)+c<<7)+b<<4)+a)},"~N,~N,~N,~N,~N");
c$.decodeKey=$_M(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,d=b&127,b=b>>7,e=b&127,b=b>>7&127;return a+": "+(10>c?"  ":" ")+c+(10>d?"  ":" ")+d+(10>e?"  ":" ")+e+(10>b?"  ":" ")+b},"Integer");Clazz.declarePackage("J.minimize");
Clazz.load(["J.minimize.MinObject"],"J.minimize.MinAngle",null,function(){c$=Clazz.decorateAsClass(function(){this.sbType=0;this.sbKey=null;this.ka=0;this.theta0=NaN;Clazz.instantialize(this,arguments)},J.minimize,"MinAngle",J.minimize.MinObject);Clazz.makeConstructor(c$,function(a){Clazz.superConstructor(this,J.minimize.MinAngle,[]);this.data=a},"~A")});Clazz.declarePackage("J.minimize");
Clazz.load(["J.util.BS","$.JmolList"],"J.minimize.MinAtom",null,function(){c$=Clazz.decorateAsClass(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;Clazz.instantialize(this,arguments)},J.minimize,"MinAtom");Clazz.prepareFields(c$,function(){this.coord=Clazz.newDoubleArray(3,0);this.force=Clazz.newDoubleArray(3,0);this.bonds=new J.util.JmolList;
this.bsVdw=new J.util.BS;this.bs14=new J.util.BS});Clazz.overrideMethod(c$,"toString",function(){return"#"+this.index+" "+this.sType});Clazz.makeConstructor(c$,function(a,b,c,d){this.index=a;this.atom=b;this.coord=c;this.bsVdw.setBits(a+1,d);this.bsVdw.clear(a);this.hCount=b.getCovalentHydrogenCount()},"~N,J.modelset.Atom,~A,~N");$_M(c$,"set",function(){this.coord[0]=this.atom.x;this.coord[1]=this.atom.y;this.coord[2]=this.atom.z});$_M(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");$_M(c$,"getBondedAtomIndexes",function(){if(null==this.bondedAtoms){this.bondedAtoms=Clazz.newIntArray(this.nBonds,0);for(var a=this.nBonds;0<=--a;)this.bondedAtoms[a]=this.bonds.get(a).getOtherAtom(this.index)}return this.bondedAtoms});$_M(c$,"getIdentity",function(){return this.atom.getInfo()});$_M(c$,"addBond",function(a,b){this.bonds.addLast(a);this.nBonds++;this.bsVdw.clear(b)},"J.minimize.MinBond,~N");
$_M(c$,"getBondIndex",function(a){return this.bonds.get(a).index},"~N");c$.isLinear=$_M(c$,"isLinear",function(a){switch(a.ffType){case 4:case 53:case 61:return!0}return!1},"J.minimize.MinAtom")});Clazz.declarePackage("J.minimize");
Clazz.load(["J.minimize.MinObject"],"J.minimize.MinBond",null,function(){c$=Clazz.decorateAsClass(function(){this.order=this.index=this.rawIndex=0;this.isAmide=this.isAromatic=!1;Clazz.instantialize(this,arguments)},J.minimize,"MinBond",J.minimize.MinObject);Clazz.makeConstructor(c$,function(a,b,c,d,e,f,g){Clazz.superConstructor(this,J.minimize.MinBond,[]);this.rawIndex=a;this.index=b;this.type=f;this.data=[c,d];this.order=e;this.key=g},"~N,~N,~N,~N,~N,~N,Integer");$_M(c$,"getOtherAtom",function(a){return this.data[this.data[0]==
a?1:0]},"~N")});Clazz.declarePackage("J.minimize");Clazz.load(["J.minimize.MinObject"],"J.minimize.MinTorsion",null,function(){c$=Clazz.declareType(J.minimize,"MinTorsion",J.minimize.MinObject);Clazz.makeConstructor(c$,function(a){Clazz.superConstructor(this,J.minimize.MinTorsion,[]);this.data=a},"~A")});Clazz.declarePackage("J.minimize");
Clazz.load(null,"J.minimize.Util",["java.lang.Double","java.util.Random"],function(){c$=Clazz.declareType(J.minimize,"Util");c$.sub=$_M(c$,"sub",function(a,b,c){c.set(a[0]-b[0],a[1]-b[1],a[2]-b[2])},"~A,~A,J.util.Vector3d");c$.putCoord=$_M(c$,"putCoord",function(a,b){b[0]=a.x;b[1]=a.y;b[2]=a.z},"J.util.Vector3d,~A");c$.distance2=$_M(c$,"distance2",function(a,b){var c=a[0]-b[0],d=a[1]-b[1],e=a[2]-b[2];return c*c+d*d+e*e},"~A,~A");c$.distance2V=$_M(c$,"distance2V",function(a,b){var c=a.x-b.x,d=a.y-
b.y,e=a.z-b.z;return c*c+d*d+e*e},"J.util.Vector3d,J.util.Vector3d");c$.getAngleRadiansABC=$_M(c$,"getAngleRadiansABC",function(a,b,c){var d=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(d,0.001)||J.minimize.Util.isNearZero2(b,0.001)?0:Math.acos((d+b-a)/2/Math.sqrt(d*b))},"~A,~A,~A");c$.isApprox=$_M(c$,"isApprox",function(a,b,c){return J.minimize.Util.distance2V(a,b)<=c*c*Math.min(a.lengthSquared(),b.lengthSquared())},
"J.util.Vector3d,J.util.Vector3d,~N");c$.canBeSquared=$_M(c$,"canBeSquared",function(a){return 0==a?!0:1E150>(a=Math.abs(a))&&1E-150<a},"~N");c$.isNegligible=$_M(c$,"isNegligible",function(a,b){return J.minimize.Util.isNegligible3(a,b,1E-11)},"~N,~N");c$.isFinite=$_M(c$,"isFinite",function(a){return!Double.isInfinite(a)&&!Double.isNaN(a)},"~N");c$.isNegligible3=$_M(c$,"isNegligible3",function(a,b,c){return Math.abs(a)<=c*Math.abs(b)},"~N,~N,~N");c$.isNear=$_M(c$,"isNear",function(a,b){return J.minimize.Util.isNear3(a,
b,2E-6)},"~N,~N");c$.isNear3=$_M(c$,"isNear3",function(a,b,c){return Math.abs(a-b)<c},"~N,~N,~N");c$.isNearZero=$_M(c$,"isNearZero",function(a){return J.minimize.Util.isNearZero2(a,2E-6)},"~N");c$.isNearZero2=$_M(c$,"isNearZero2",function(a,b){return Math.abs(a)<b},"~N,~N");c$.canBeNormalized=$_M(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)},"J.util.Vector3d");c$.pointPlaneAngleRadians=
$_M(c$,"pointPlaneAngleRadians",function(a,b,c,d,e,f,g,h){e.sub2(b,c);f.sub2(b,d);g.cross(e,f);f.add(e);e.sub2(b,a);a=h?J.minimize.Util.vectorAngleRadians(f,e):3.141592653589793;e=J.minimize.Util.vectorAngleRadians(g,e);1.5707963267948966<e&&(e=3.141592653589793-e);return 1.5707963267948966+(1.5707963267948966<a?-e:e)},"J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,~B");c$.vectorAngleRadians=$_M(c$,"vectorAngleRadians",($fz=function(a,
b){var c=a.length(),d=b.length();return J.minimize.Util.isNearZero(c)||J.minimize.Util.isNearZero(d)?0:Math.acos(a.dot(b)/(c*d))},$fz.isPrivate=!0,$fz),"J.util.Vector3d,J.util.Vector3d");c$.getTorsionAngleRadians=$_M(c$,"getTorsionAngleRadians",function(a,b,c,d,e,f,g){J.minimize.Util.sub(b,a,e);J.minimize.Util.sub(c,b,f);f.normalize();e.cross(e,f);J.minimize.Util.sub(d,c,g);g.cross(f,g);a=e.dot(g);e.cross(g,e);return Math.atan2(-f.dot(e),a)},"~A,~A,~A,~A,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d");
c$.restorativeForceAndDistance=$_M(c$,"restorativeForceAndDistance",function(a,b,c){c.sub2(a,b);var d=c.length();0.1>d&&(J.minimize.Util.randomizeUnitVector(c),d=0.1);c.normalize();a.setT(c);a.scale(-1);b.setT(c);return d},"J.util.Vector3d,J.util.Vector3d,J.util.Vector3d");c$.randomizeUnitVector=$_M(c$,"randomizeUnitVector",($fz=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()},$fz.isPrivate=
!0,$fz),"J.util.Vector3d");c$.restorativeForceAndAngleRadians=$_M(c$,"restorativeForceAndAngleRadians",function(a,b,c){a.sub(b);c.sub(b);var d=a.length(),e=c.length();if(J.minimize.Util.isNearZero(d)||J.minimize.Util.isNearZero(e))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),0;d=1/d;e=1/e;a.scale(d);c.scale(e);b.cross(a,c);var f=b.length();if(J.minimize.Util.isNearZero(f))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),0;b.scale(1/f);f=a.dot(c);f=1<f?0:-1>f?3.141592653589793:Math.acos(f);a.cross(a,
b);a.normalize();b.cross(c,b);b.normalize();a.scale(-d);b.scale(e);c.setT(b);b.add(a);b.scale(-1);return f},"J.util.Vector3d,J.util.Vector3d,J.util.Vector3d");c$.restorativeForceAndOutOfPlaneAngleRadians=$_M(c$,"restorativeForceAndOutOfPlaneAngleRadians",function(a,b,c,d,e,f,g){a.sub2(a,b);c.sub2(c,b);d.sub2(d,b);var h=a.length(),k=c.length(),l=d.length();if(J.minimize.Util.isNearZero(h)||J.minimize.Util.isNearZero(k)||J.minimize.Util.isNearZero(l))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),d.set(0,
0,0),0;a.normalize();c.normalize();d.normalize();var m=a.dot(c),j=Math.acos(m);if(J.minimize.Util.isNearZero(j)||J.minimize.Util.isNearZero(Math.abs(j-3.141592653589793)))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),d.set(0,0,0),0;j=1/Math.sin(j);e.cross(a,c);f.cross(c,d);g.cross(d,a);var n=e.dot(d)*j,p=Math.asin(n);if(1E-4>Math.cos(p)||J.minimize.Util.isNearZero(p)||J.minimize.Util.isNearZero(Math.abs(p-3.141592653589793)))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),d.set(0,0,0),p;d.scaleAdd(-n/
j,d,e);d.scale(j/l);b.setT(a);a.scaleAdd(-m,c,a);a.scaleAdd(-n*j,a,f);a.scale(j/h);c.scaleAdd(-m,b,c);c.scaleAdd(-n*j,c,g);c.scale(j/k);b.setT(a);b.add(c);b.add(d);b.scale(-1);return p},"J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d");c$.restorativeForceAndTorsionAngleRadians=$_M(c$,"restorativeForceAndTorsionAngleRadians",function(a,b,c,d){a.sub2(b,a);b.sub2(c,b);c.sub2(d,c);var e=a.length(),f=b.length(),g=c.length();if(J.minimize.Util.isNearZero(e)||
J.minimize.Util.isNearZero(f)||J.minimize.Util.isNearZero(g))return a.set(0,0,0),b.set(0,0,0),c.set(0,0,0),d.set(0,0,0),0;var h=J.minimize.Util.vectorAngleRadians(a,b),k=Math.sin(h),l=Math.cos(h),h=J.minimize.Util.vectorAngleRadians(b,c),m=Math.sin(h),h=Math.cos(h);a.normalize();b.normalize();c.normalize();a.cross(a,b);d.cross(b,c);c.cross(a,d);var j=-Math.atan2(c.dot(b),a.dot(d));a.scale(1/e/k/k);d.scale(-1/g/m/m);b.setT(a);b.scale(-e/f*l-1);c.setT(d);c.scale(-g/f*h);b.sub(c);c.setT(a);c.add(b);
c.add(d);c.scale(-1);return j},"J.util.Vector3d,J.util.Vector3d,J.util.Vector3d,J.util.Vector3d");Clazz.defineStatics(c$,"RAD_TO_DEG",57.29577951308232,"DEG_TO_RAD",0.017453292519943295,"max_squarable_double",1E150,"min_squarable_double",1E-150)});Clazz.declarePackage("J.minimize.forcefield");
c$=Clazz.decorateAsClass(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;Clazz.instantialize(this,arguments)},J.minimize.forcefield,"AtomType");Clazz.makeConstructor(c$,function(a,b,c,d,e,f,g){this.elemNo=a;this.mmType=b;this.hType=c;this.formalCharge=d;this.val=e;this.descr=f;this.smartsCode=g},"~N,~N,~N,~N,~N,~S,~S");Clazz.declarePackage("J.minimize.forcefield");
Clazz.load(null,"J.minimize.forcefield.ForceField","java.lang.Float $.NullPointerException J.minimize.Util J.util.Logger $.TextFormat J.viewer.Viewer".split(" "),function(){c$=Clazz.decorateAsClass(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.base=this.minimizer=this.bsFixed=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null;Clazz.instantialize(this,arguments)},J.minimize.forcefield,
"ForceField");$_M(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});$_M(c$,"setConstraints",function(a){this.bsFixed=a.bsMinFixed;this.calc.setConstraints(a.constraints);this.coordSaved=null},"J.minimize.Minimizer");$_M(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.TextFormat.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");$_M(c$,"clearForces",($fz=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},$fz.isPrivate=
!0,$fz));$_M(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 d=0;d<this.minAtomCount;d++)(null==this.bsFixed||!this.bsFixed.get(d))&&this.setForcesUsingNumericalDerivative(this.minAtoms[d],1);this.linearSearch();this.calc.setSilent(!1);this.calc.loggingEnabled&&this.calc.appendLogData(this.calc.getAtomList("S T E P    "+this.currentStep));d=this.energyFull(!1,!1);this.dE=d-this.e0;var e=J.minimize.Util.isNear3(d,
this.e0,this.criterion);if(e||0==this.currentStep%10||this.stepMax<=this.currentStep){var f=J.util.TextFormat.sprintf(this.name+" Step %-4d E = %10.6f    dE = %8.6f ","Fi",[[d,this.dE,this.criterion],Integer.$valueOf(this.currentStep)]);this.minimizer.report(f,!1);this.calc.appendLogData(f)}this.e0=d;if(e||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")),e&&(f=J.util.TextFormat.formatStringF("\n    "+this.name+
" STEEPEST DESCENT HAS CONVERGED: E = %8.5f "+this.minimizer.units+" after "+this.currentStep+" steps","f",this.toUserUnits(d)),this.calc.appendLogData(f),this.minimizer.report(f,!0),J.util.Logger.info(f)),!1;b&&2<=this.getNormalizedDE()&&(this.calc.setPreliminary(b=!1),this.e0=this.energyFull(!1,!1))}return!0},"~N");$_M(c$,"getEnergies",($fz=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},$fz.isPrivate=!0,$fz),"~N,~B");$_M(c$,"setForcesUsingNumericalDerivative",($fz=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)},$fz.isPrivate=!0,$fz),"J.minimize.MinAtom,~N");$_M(c$,"getDE",($fz=function(a,b,c,d){a.coord[c]+=d;b=this.getEnergies(b,!1);a.coord[c]-=d;return(b-this.e0)/
d},$fz.isPrivate=!0,$fz),"J.minimize.MinAtom,~N,~N,~N");$_M(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.TextFormat.sprintf("\nTOTAL %s ENERGY = %8.3f %s/mol\n","sfs",[this.name,Float.$valueOf(this.toUserUnits(c)),this.minimizer.units]));return c},"~B,~B");$_M(c$,"energyStretchBend",function(a){return this.calc.energyStretchBend(a)},
"~B");$_M(c$,"energyBond",function(a){return this.calc.energyBond(a)},"~B");$_M(c$,"energyAngle",function(a){return this.calc.energyAngle(a)},"~B");$_M(c$,"energyTorsion",function(a){return this.calc.energyTorsion(a)},"~B");$_M(c$,"energyOOP",function(a){return this.calc.energyOOP(a)},"~B");$_M(c$,"energyVDW",function(a){return this.calc.energyVDW(a)},"~B");$_M(c$,"energyES",function(a){return this.calc.energyES(a)},"~B");$_M(c$,"linearSearch",($fz=function(){for(var a=0.23,b=this.energyFull(!1,!0),
c=0;10>c;c++){this.saveCoordinates();for(var d=0;d<this.minAtomCount;++d)if(null==this.bsFixed||!this.bsFixed.get(d)){var e=this.minAtoms[d].force,f=this.minAtoms[d].coord,g=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];g>0.09/a/a&&(g=0.3/Math.sqrt(g)/a,e[0]*=g,e[1]*=g,e[2]*=g);for(g=0;3>g;++g)if(J.minimize.Util.isFinite(e[g])){var h=e[g]*a;f[g]=0.3<h?f[g]+0.3:-0.3>h?f[g]-0.3:f[g]+h}}d=this.energyFull(!1,!0);if(J.minimize.Util.isNear3(d,b,0.001))break;d>b?(a*=0.1,this.restoreCoordinates()):d<b&&(b=d,a*=2.15,1<a&&
(a=1))}},$fz.isPrivate=!0,$fz));$_M(c$,"saveCoordinates",($fz=function(){null==this.coordSaved&&(this.coordSaved=Clazz.newDoubleArray(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]},$fz.isPrivate=!0,$fz));$_M(c$,"restoreCoordinates",($fz=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]},$fz.isPrivate=!0,$fz));$_M(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});$_M(c$,"getCurrentStep",function(){return this.currentStep});$_M(c$,"getEnergy",function(){return this.e0});$_M(c$,"getAtomList",function(a){return this.calc.getAtomList(a)},"~S");$_M(c$,"getEnergyDiff",function(){return this.dE});
$_M(c$,"getLogData",function(){return this.calc.getLogData()});$_M(c$,"getNormalizedDE",function(){return Math.abs(this.dE/this.criterion)});$_M(c$,"toUserUnits",function(a){return this.toUnits(a,this.calc.getUnits())},"~N");$_M(c$,"toUnits",($fz=function(a,b){return b.equalsIgnoreCase(this.minimizer.units)?a:a*(this.minimizer.units.equals("kJ")?4.1868:0.23884589662749595)},$fz.isPrivate=!0,$fz),"~N,~S");$_M(c$,"log",function(a){this.calc.appendLogData(a)},"~S");$_M(c$,"getBufferedReader",function(a){var b=
null;if(null==(b=this.getResourceUrl(a)))throw System.err.println("Couldn't find file: "+a),new NullPointerException;return this.getResource(b)},"~S");$_M(c$,"getResourceUrl",($fz=function(a){a="data/"+a;null==this.base&&(this.base=this.minimizer.viewer.viewerOptions.get("codeBase"));a=this.base+"J/minimize/forcefield/"+a;return new java.net.URL(null,a,null)},$fz.isPrivate=!0,$fz),"~S");$_M(c$,"getResource",function(a){return this.minimizer.viewer.getBufferedReaderOrErrorMessageFromName(a.toString(),
[null,null],!1)},"java.net.URL");Clazz.defineStatics(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)});Clazz.declarePackage("J.minimize.forcefield");
Clazz.load(["J.minimize.forcefield.ForceField"],"J.minimize.forcefield.ForceFieldMMFF","java.lang.Boolean $.Float java.util.Hashtable J.minimize.MinAtom $.MinObject J.minimize.forcefield.AtomType $.CalculationsMMFF J.util.ArrayUtil $.BS $.BSUtil $.Elements $.Escape $.JmolList $.Logger $.Parser".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.useEmpiricalRules=!0;this.typeData=this.vRings=this.rawMMFF94Charges=this.rawBondTypes=this.rawAtomTypes=null;Clazz.instantialize(this,arguments)},
J.minimize.forcefield,"ForceFieldMMFF",J.minimize.forcefield.ForceField);Clazz.prepareFields(c$,function(){this.typeData=Clazz.newIntArray(4,0)});$_M(c$,"getAtomTypeDescriptions",function(){return J.minimize.forcefield.ForceFieldMMFF.getAtomTypeDescs(this.rawAtomTypes)});$_M(c$,"getPartialCharges",function(){return this.rawMMFF94Charges});Clazz.makeConstructor(c$,function(a){Clazz.superConstructor(this,J.minimize.forcefield.ForceFieldMMFF,[]);this.minimizer=a;this.name="MMFF";this.getChargeParameters()},
"J.minimize.Minimizer");Clazz.overrideMethod(c$,"clear",function(){});Clazz.overrideMethod(c$,"setModel",function(){this.getMinimizationParameters();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.minimizer.constraints);this.calc.setLoggingEnabled(!0);
return this.calc.setupCalculations()},"J.util.BS,~N");$_M(c$,"setArrays",function(a,b,c,d,e,f){var g=this.minimizer;this.vRings=J.util.ArrayUtil.createArrayOfArrayList(4);this.rawAtomTypes=J.minimize.forcefield.ForceFieldMMFF.setAtomTypes(a,b,g.viewer.getSmilesMatcher(),this.vRings,f);if(null==this.rawAtomTypes)return!1;this.rawBondTypes=this.setBondTypes(c,d,b);this.rawMMFF94Charges=J.minimize.forcefield.ForceFieldMMFF.calculatePartialCharges(c,this.rawBondTypes,a,this.rawAtomTypes,b,e);return!0},
"~A,J.util.BS,~A,~N,~B,~B");$_M(c$,"getChargeParameters",($fz=function(){if(null==J.minimize.forcefield.ForceFieldMMFF.ffParams){this.getAtomTypes("MMFF94-smarts.txt");var a=new java.util.Hashtable;this.getMmffParameters("mmffpbci.par.txt",a,1);this.getMmffParameters("mmffchg.par.txt",a,34);$t$=J.minimize.forcefield.ForceFieldMMFF.ffParams=a;J.minimize.forcefield.ForceFieldMMFF.prototype.ffParams=J.minimize.forcefield.ForceFieldMMFF.ffParams;$t$}},$fz.isPrivate=!0,$fz));$_M(c$,"getMinimizationParameters",
($fz=function(){J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(Integer.$valueOf(-1))||(this.getMmffParameters("mmffang.par.txt",J.minimize.forcefield.ForceFieldMMFF.ffParams,5),this.getMmffParameters("mmffbndk.par.txt",J.minimize.forcefield.ForceFieldMMFF.ffParams,546),this.getMmffParameters("mmffbond.par.txt",J.minimize.forcefield.ForceFieldMMFF.ffParams,3),this.getMmffParameters("mmffoop.par.txt",J.minimize.forcefield.ForceFieldMMFF.ffParams,13),this.getMmffParameters("mmffstbn.par.txt",
J.minimize.forcefield.ForceFieldMMFF.ffParams,21),this.getMmffParameters("mmffdfsb.par.txt",J.minimize.forcefield.ForceFieldMMFF.ffParams,37),this.getMmffParameters("mmfftor.par.txt",J.minimize.forcefield.ForceFieldMMFF.ffParams,9),this.getMmffParameters("mmffvdw.par.txt",J.minimize.forcefield.ForceFieldMMFF.ffParams,17),J.minimize.forcefield.ForceFieldMMFF.ffParams.put(Integer.$valueOf(-1),Boolean.TRUE))},$fz.isPrivate=!0,$fz));$_M(c$,"getMmffParameters",($fz=function(a,b,c){var d=null,e=null;J.util.Logger.debugging&&
J.util.Logger.info("reading data from "+a);try{for(var f=this.getBufferedReader(a);null!=(d=f.readLine())&&5>d.length||!d.startsWith("*"););var g=0,h=127,k=127,l=127,m=0;switch(c){case 34:l=124;break;case 21:l=125;break;case 546:l=123;m=0;break;case 13:m=6;break;case 1:m=0;break;case 37:l=126;m=0;break;case 17:l=122,m=0}for(;null!=(d=f.readLine());)if(!(5>d.length||d.startsWith("*"))){switch(c){case 17:if(" "!=d.charAt(5))continue;break;case 34:if("4"==d.charAt(0))continue;case 5:case 3:case 21:case 9:m=
d.charCodeAt(0)-48}switch(c){case 13:case 9:l=J.util.Parser.parseInt(d.substring(18,20).trim());case 5:case 21:case 37:k=J.util.Parser.parseInt(d.substring(13,15).trim());case 546:case 3:case 34:h=J.util.Parser.parseInt(d.substring(8,10).trim());case 1:case 17:g=J.util.Parser.parseInt(d.substring(3,5).trim())}switch(c){case 546:e=[J.util.Parser.dVal(d.substring(19,25).trim()),J.util.Parser.dVal(d.substring(13,18).trim())];break;case 3:e=[J.util.Parser.dVal(d.substring(14,20).trim()),J.util.Parser.dVal(d.substring(25,
31).trim())];break;case 5:case 21:e=[J.util.Parser.dVal(d.substring(19,25).trim()),J.util.Parser.dVal(d.substring(28,35).trim())];break;case 34:e=Float.$valueOf(J.util.Parser.fVal(d.substring(10,20).trim()));break;case 13:e=[J.util.Parser.dVal(d.substring(24,30).trim())];break;case 1:e=Float.$valueOf(J.util.Parser.fVal(d.substring(5,15).trim()));break;case 37:var j=J.util.Parser.dVal(d.substring(19,25).trim()),n=J.util.Parser.dVal(d.substring(28,35).trim()),e=[j,n],p=J.minimize.MinObject.getKey(m,
g,h,k,l);b.put(p,e);var e=[n,j],q=g,g=k,k=q;break;case 9:e=[J.util.Parser.dVal(d.substring(22,28).trim()),J.util.Parser.dVal(d.substring(30,36).trim()),J.util.Parser.dVal(d.substring(38,44).trim())];break;case 17:e=[J.util.Parser.dVal(d.substring(10,15).trim()),J.util.Parser.dVal(d.substring(20,25).trim()),J.util.Parser.dVal(d.substring(30,35).trim()),J.util.Parser.dVal(d.substring(40,45).trim()),d.charAt(46)]}p=J.minimize.MinObject.getKey(m,g,h,k,l);b.put(p,e);J.util.Logger.debugging&&J.util.Logger.info(J.minimize.MinObject.decodeKey(p)+
" "+(Clazz.instanceOf(e,Float)?e:J.util.Escape.eAD(e)))}f.close()}catch(r){if(Clazz.exceptionOf(r,Exception))System.err.println("Exception "+r.toString()+" in getResource "+a+" line="+d);else throw r;}},$fz.isPrivate=!0,$fz),"~S,java.util.Map,~N");$_M(c$,"getAtomTypes",($fz=function(a){var b=new J.util.JmolList,c=null;try{var d=this.getBufferedReader(a),e;for(b.addLast(new J.minimize.forcefield.AtomType(0,0,0,0,1,"H or NOT FOUND",""));null!=(c=d.readLine());)if(!(0==c.length||c.startsWith("#"))){var f=
J.util.Parser.parseInt(c.substring(3,5).trim()),g=J.util.Parser.parseInt(c.substring(6,8).trim()),h=J.util.Parser.parseInt(c.substring(9,11).trim()),k=J.util.Parser.fVal(c.substring(12,15).trim())/12,l=J.util.Parser.parseInt(c.substring(16,18).trim()),m=c.substring(19,44).trim(),j=c.substring(45).trim();b.addLast(e=new J.minimize.forcefield.AtomType(f,g,h,k,l,m,j));J.minimize.forcefield.ForceFieldMMFF.setFlags(e)}d.close()}catch(n){if(Clazz.exceptionOf(n,Exception))System.err.println("Exception "+
n.toString()+" in getResource "+a+" line="+c);else throw n;}J.util.Logger.info(b.size()-1+" SMARTS-based atom types read");$t$=J.minimize.forcefield.ForceFieldMMFF.atomTypes=b;J.minimize.forcefield.ForceFieldMMFF.prototype.atomTypes=J.minimize.forcefield.ForceFieldMMFF.atomTypes;$t$},$fz.isPrivate=!0,$fz),"~S");c$.setFlags=$_M(c$,"setFlags",($fz=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}},$fz.isPrivate=!0,$fz),"J.minimize.forcefield.AtomType");c$.calculatePartialCharges=$_M(c$,"calculatePartialCharges",function(a,b,c,d,e,f){c=Clazz.newFloatArray(c.length,0);for(var g=e.nextSetBit(0);0<=g;g=e.nextSetBit(g+1))c[g]=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,d[g])).formalCharge;for(var h=null,g=b.length;0<=--g;){var h=a[g].getAtom1(),k=a[g].getAtom2(),l=e.get(h.index),m=e.get(k.index);if(l||m){var j=d[h.index],n=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,
j)),p=0>j?-j:n.mmType,j=d[k.index],q=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,j)),j=0>j?-j:q.mmType,r;try{var v=p<j?-1:1,w=J.minimize.MinObject.getKey(b[g],1==v?j:p,1==v?p:j,127,124),x=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(w),t,s=J.util.Logger.debugging?h+"/"+k+" mmTypes="+p+"/"+j+" formalCharges="+n.formalCharge+"/"+q.formalCharge+" bci = ":null;if(null==x){var y=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(J.minimize.MinObject.getKey(0,p,127,127,127)).floatValue(),
z=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(J.minimize.MinObject.getKey(0,j,127,127,127)).floatValue();t=y-z;J.util.Logger.debugging&&(s+=y+" - "+z+" = ")}else t=v*x.floatValue();J.util.Logger.debugging&&(s+=t,J.util.Logger.debug(s));r=q.fcadj*q.formalCharge-n.fcadj*n.formalCharge+t}catch(u){if(Clazz.exceptionOf(u,Exception))r=NaN;else throw u;}l&&(c[h.index]+=r);m&&(c[k.index]-=r)}}if(f){a=0;for(g=c.length;0<=--g;)c[g]=Math.round(1E3*c[g])/1E3,a+=Math.abs(c[g]);0==a&&null!=h&&(c[h.index]=
-0)}return c},"~A,~A,~A,~A,J.util.BS,~B");c$.isBondType1=$_M(c$,"isBondType1",($fz=function(a,b){return a.sbmb&&b.sbmb||a.arom&&b.arom},$fz.isPrivate=!0,$fz),"J.minimize.forcefield.AtomType,J.minimize.forcefield.AtomType");$_M(c$,"getBondType",($fz=function(a,b,c,d,e){return J.minimize.forcefield.ForceFieldMMFF.isBondType1(b,c)&&1==a.getCovalentOrder()&&!this.isAromaticBond(d,e)?1:0},$fz.isPrivate=!0,$fz),"J.modelset.Bond,J.minimize.forcefield.AtomType,J.minimize.forcefield.AtomType,~N,~N");$_M(c$,
"isAromaticBond",($fz=function(a,b){if(null!=this.vRings[3])for(var c=this.vRings[3].size();0<=--c;){var d=this.vRings[3].get(c);if(d.get(a)&&d.get(b))return!0}return!1},$fz.isPrivate=!0,$fz),"~N,~N");c$.getAtomTypeDescs=$_M(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=$_M(c$,"setAtomTypes",($fz=function(a,b,c,d,e){for(var f=new J.util.JmolList,
g=Array(J.minimize.forcefield.ForceFieldMMFF.atomTypes.size()),h=Clazz.newIntArray(a.length,0),k=new J.util.BS,l=new J.util.BS,m=J.util.BSUtil.copy(b),j=b.nextSetBit(0);0<=j;j=b.nextSetBit(j+1)){var n=a[j],p=n.getBonds();if(null!=p)for(var q=p.length;0<=--q;)p[q].isCovalent()&&m.set(p[q].getOtherAtom(n).index)}for(j=m.nextSetBit(0);0<=j;j=m.nextSetBit(j+1))switch(q=a[j].getElementNumber(),q){case 1:l.set(j);break;default:k.set(q)}q=0;for(j=1;j<J.minimize.forcefield.ForceFieldMMFF.atomTypes.size();j++)p=
J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(j),k.get(p.elemNo)&&(g[j]=p.smartsCode,q++);J.util.Logger.info(q+" SMARTS matches used");c.getSubstructureSets(g,a,a.length,20,m,f,d);c=new J.util.BS;for(q=0;q<f.size();q++)if(d=f.get(q),null!=d){d.andNot(c);for(j=d.nextSetBit(0);0<=j;j=d.nextSetBit(j+1))h[j]=q;c.or(d)}for(j=l.nextSetBit(0);0<=j;j=l.nextSetBit(j+1))p=a[j].getBonds(),null!=p&&(q=h[p[0].getOtherAtom(a[j]).index],0!=q&&c.set(j),h[j]=-J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(q).hType);
if(J.util.Logger.debugging)for(j=m.nextSetBit(0);0<=j;j=m.nextSetBit(j+1))J.util.Logger.info("atom "+a[j]+"\ttype "+(0>h[j]?""+-h[j]:J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(h[j]).mmType+"\t"+J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(h[j]).smartsCode+"\t"+J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(h[j]).descr));return!e&&c.cardinality()!=m.cardinality()?null:h},$fz.isPrivate=!0,$fz),"~A,J.util.BS,J.api.SmilesMatcherInterface,~A,~B");$_M(c$,"setBondTypes",($fz=function(a,
b,c){for(var d=Clazz.newIntArray(b,0);0<=--b;){var e=a[b].getAtom1(),f=a[b].getAtom2(),g=c.get(e.index),h=c.get(f.index);if(g||h)h=this.rawAtomTypes[e.index],g=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,h)),h=this.rawAtomTypes[f.index],h=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,h)),d[b]=this.getBondType(a[b],g,h,e.index,f.index)}return d},$fz.isPrivate=!0,$fz),"~A,~N,J.util.BS");$_M(c$,"fixTypes",($fz=function(){for(var a=this.minAtomCount;0<=--a;){var b=this.minAtoms[a],
c=b.atom.index,d=this.rawAtomTypes[c];b.ffAtomType=J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(Math.max(0,d));d=0>d?-d:J.minimize.forcefield.ForceFieldMMFF.atomTypes.get(d).mmType;b.ffType=d;b.vdwKey=J.minimize.MinObject.getKey(0,d,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)},$fz.isPrivate=!0,$fz));$_M(c$,"setAngleType",($fz=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},
$fz.isPrivate=!0,$fz),"J.minimize.MinAngle");$_M(c$,"setTorsionType",($fz=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},$fz.isPrivate=!0,$fz),"J.minimize.MinTorsion");$_M(c$,"typeOf",($fz=function(a){return this.minAtoms[a].ffType},$fz.isPrivate=!0,$fz),"~N");$_M(c$,"checkRings",($fz=
function(a,b,c){if(null!=a)for(var d=a.size();0<=--d;){var e=a.get(d);if(e.get(this.minAtoms[b[0]].atom.index)&&e.get(this.minAtoms[b[1]].atom.index)&&(3>c||e.get(this.minAtoms[b[2]].atom.index))&&(4>c||e.get(this.minAtoms[b[3]].atom.index)))return!0}return!1},$fz.isPrivate=!0,$fz),"J.util.JmolList,~A,~N");$_M(c$,"getKey",($fz=function(a,b,c){var d=Clazz.instanceOf(a,J.minimize.MinObject)?a:null;a=null==d?a:d.data;var e=4;switch(c){case 3:this.fixOrder(a,0,1);e=2;break;case 5:-1==this.fixOrder(a,
0,2)&&J.minimize.forcefield.ForceFieldMMFF.swap(a,3,4);b=this.setAngleType(d);e=3;break;case 21:e=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(d)}for(var f=null,g=0;4>g;g++)this.typeData[g]=g<e?this.typeOf(a[g]):127;switch(c){case 21:this.typeData[3]=125;break;case 13:J.minimize.forcefield.ForceFieldMMFF.sortOop(this.typeData)}f=
J.minimize.MinObject.getKey(b,this.typeData[0],this.typeData[1],this.typeData[2],this.typeData[3]);g=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(f);switch(c){case 3:return!this.useEmpiricalRules?f:null!=g&&0<g[0]?f:this.applyEmpiricalRules(d,g,3);case 5:if(null!=g&&0!=g[0])return f;break;case 9:if(null==g){if(!J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(f=this.getTorsionKey(b,0,2))&&!J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(f=this.getTorsionKey(b,2,0))&&!J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(f=
this.getTorsionKey(b,2,2)))f=this.getTorsionKey(0,2,2);g=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(f)}return!this.useEmpiricalRules?f:null!=g?f:this.applyEmpiricalRules(d,g,9);case 21:if(null!=g)return f;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!=g)return f}if(!this.useEmpiricalRules&&null!=g)return f;for(var h=!1,k=!1,g=0;3>g&&!k;g++){f=0;for(k=1;f<e;f++,k<<=1)(c&k)==k&&(this.typeData[f]=J.minimize.forcefield.ForceFieldMMFF.getEquivalentType(this.typeOf(a[f]),
g));switch(c){case 3:h=J.minimize.forcefield.ForceFieldMMFF.fixTypeOrder(this.typeData,0,1);break;case 5:h=J.minimize.forcefield.ForceFieldMMFF.fixTypeOrder(this.typeData,0,2);break;case 13:J.minimize.forcefield.ForceFieldMMFF.sortOop(this.typeData)}f=J.minimize.MinObject.getKey(b,this.typeData[0],this.typeData[1],this.typeData[2],this.typeData[3]);k=J.minimize.forcefield.ForceFieldMMFF.ffParams.containsKey(f)}if(k){if(h)switch(c){case 5:J.minimize.forcefield.ForceFieldMMFF.swap(a,0,2),J.minimize.forcefield.ForceFieldMMFF.swap(a,
3,4),this.setAngleType(d)}}else 0!=b&&5==c&&(f=Integer.$valueOf(f.intValue()^255));if(!this.useEmpiricalRules)return f;g=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(f);switch(c){case 5:return null!=g&&0!=g[0]?f:this.applyEmpiricalRules(d,g,5)}return f},$fz.isPrivate=!0,$fz),"~O,~N,~N");$_M(c$,"getTorsionKey",($fz=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))},$fz.isPrivate=!0,$fz),"~N,~N,~N");$_M(c$,"applyEmpiricalRules",($fz=function(a,b,c){var d=0,e;switch(c){case 3:d=this.minAtoms[a.data[0]];c=this.minAtoms[a.data[1]];var f=d.atom.getElementNumber();b=c.atom.getElementNumber();f=J.minimize.MinObject.getKey(0,Math.min(f,b),Math.max(f,b),127,123);b=J.minimize.forcefield.ForceFieldMMFF.ffParams.get(f);if(null==b)return null;f=b[0];b=b[1];d=J.minimize.forcefield.ForceFieldMMFF.getRuleBondLength(d,c,a.order,this.isAromaticBond(a.data[0],a.data[1]));
if(0==d)return null;c=b/d;c*=c;a.ddata=[f*c*c*c,d];return Integer.$valueOf(-1);case 5:if(null==b||0==(f=b[1]))switch(c=this.minAtoms[a.data[1]],d=c.atom,b=d.getElementNumber(),a.type){case 3:case 5:case 6:f=60;break;case 4:case 7:case 8:f=90;break;default:switch(f=120,d.getCovalentBondCount()){case 2:J.minimize.MinAtom.isLinear(c)?f=180:8==b?f=105:10<b&&(f=95);break;case 3:0==c.ffAtomType.mltb&&3==c.ffAtomType.val&&(f=7==b?107:92);break;case 4:f=109.45}}d=1.75;switch(a.type){case 3:case 5:case 6:d*=
0.05;break;case 4:case 7:case 8:d*=0.85}b=J.minimize.forcefield.ForceFieldMMFF.getZParam(this.minAtoms[a.data[0]].atom.getElementNumber());var g=J.minimize.forcefield.ForceFieldMMFF.getCParam(this.minAtoms[a.data[1]].atom.getElementNumber()),h=J.minimize.forcefield.ForceFieldMMFF.getZParam(this.minAtoms[a.data[2]].atom.getElementNumber()),k=J.minimize.forcefield.ForceFieldMMFF.getR0(this.minBonds[a.data[3]]),l=J.minimize.forcefield.ForceFieldMMFF.getR0(this.minBonds[a.data[4]]);c=k+l;k=(k-l)/(c*c);
l=0.017453292519943295*f;l*=l;d=d*b*g*h*Math.exp(-2*k)/(c*l);a.ddata=[d,f];return Integer.$valueOf(-1);case 9:var m=a.data[1],j=a.data[2];c=this.minAtoms[m];e=this.minAtoms[j];if(J.minimize.MinAtom.isLinear(c)||J.minimize.MinAtom.isLinear(e))return null;f=this.minBonds[a.data[5]];b=c.atom.getElementNumber();var g=e.atom.getElementNumber(),h=J.minimize.forcefield.ForceFieldMMFF.getUParam(b),k=J.minimize.forcefield.ForceFieldMMFF.getUParam(g),l=J.minimize.forcefield.ForceFieldMMFF.getVParam(b),n=J.minimize.forcefield.ForceFieldMMFF.getVParam(g),
p=0,q=0,r=-1,v=-1,w=-1,x=0,t=c.ffAtomType.val,s=e.ffAtomType.val,y=c.ffAtomType.pilp,z=e.ffAtomType.pilp,u=c.ffAtomType.mltb,A=e.ffAtomType.mltb;a:for(;;){if(this.isAromaticBond(m,j)){r=y||z?0.3:0.5;d=7==t+s?3:6;break a}if(2==f.order){d=6;r=2==u&&2==A?1:0.4;break a}c=c.atom.getCovalentBondCount();e=e.atom.getCovalentBondCount();if(4==c&&4==e){l=J.minimize.forcefield.ForceFieldMMFF.getVParam(b);n=J.minimize.forcefield.ForceFieldMMFF.getVParam(g);v=9;break a}if(4!=c&&(t>c||0<u)||4!=e&&(s>e||0<A))return null;
t=y&&0<A;s=z&&0<u;if(1==f.order&&(0<u&&0<A||t||s)){if(y&&z)return null;d=6;if(t){r=1==A?0.5:10>=b&&10>=g?0.3:0.15;break a}if(s){r=1==u?0.5:10>=b&&10>=g?0.3:0.15;break a}if((1==u||1==A)&&(6==b||6==g)){r=0.4;break a}r=0.15;break a}switch(b<<8+g){case 2056:w=x=2;break a;case 2064:w=2;x=8;break a;case 4104:w=8;x=2;break a;case 4112:w=x=8;break a}v=c*e;break a}0<r?p=d*r*Math.sqrt(h*k):0<v?q=Math.sqrt(l*n)/v:0!=w&&(p=-Math.sqrt(w*x));a.ddata=[0,p,q];return Integer.$valueOf(-1);default:return null}},$fz.isPrivate=
!0,$fz),"J.minimize.MinObject,~A,~N");c$.getR0=$_M(c$,"getR0",($fz=function(a){return(null==a.ddata?J.minimize.forcefield.ForceFieldMMFF.ffParams.get(a.key):a.ddata)[1]},$fz.isPrivate=!0,$fz),"J.minimize.MinBond");$_M(c$,"getRowFor",($fz=function(a){a=this.minAtoms[a].atom.getElementNumber();return 3>a?0:11>a?1:19>a?2:37>a?3:4},$fz.isPrivate=!0,$fz),"~N");$_M(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=$_M(c$,"sortOop",($fz=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)},$fz.isPrivate=!0,$fz),"~A");c$.fixTypeOrder=$_M(c$,"fixTypeOrder",($fz=function(a,b,c){return a[b]>a[c]?(J.minimize.forcefield.ForceFieldMMFF.swap(a,b,c),!0):!1},$fz.isPrivate=!0,$fz),"~A,~N,~N");$_M(c$,"fixOrder",($fz=function(a,b,c){var d=this.typeOf(a[c])-this.typeOf(a[b]);0>d&&J.minimize.forcefield.ForceFieldMMFF.swap(a,
b,c);return 0>d?-1:0<d?1:0},$fz.isPrivate=!0,$fz),"~A,~N,~N");c$.swap=$_M(c$,"swap",($fz=function(a,b,c){var d=a[b];a[b]=a[c];a[c]=d},$fz.isPrivate=!0,$fz),"~A,~N,~N");c$.getEquivalentType=$_M(c$,"getEquivalentType",($fz=function(a,b){return 0==a?0:70==a||82<a?a:2==b?0:J.minimize.forcefield.ForceFieldMMFF.equivalentTypes[(a-1<<1)+b]},$fz.isPrivate=!0,$fz),"~N,~N");c$.getZParam=$_M(c$,"getZParam",($fz=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},$fz.isPrivate=!0,$fz),"~N");c$.getCParam=$_M(c$,"getCParam",($fz=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},$fz.isPrivate=!0,$fz),"~N");c$.getUParam=$_M(c$,"getUParam",($fz=function(a){switch(a){case 6:case 7:case 8:return 2;
case 14:case 15:case 16:return 1.25}return 0},$fz.isPrivate=!0,$fz),"~N");c$.getVParam=$_M(c$,"getVParam",($fz=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},$fz.isPrivate=!0,$fz),"~N");c$.getCovalentRadius=$_M(c$,"getCovalentRadius",($fz=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)}},$fz.isPrivate=!0,$fz),"~N");c$.getRuleBondLength=$_M(c$,"getRuleBondLength",($fz=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 d=J.minimize.forcefield.ForceFieldMMFF.getCovalentRadius(b),e=J.util.Elements.getAllredRochowElectroNeg(a),f=J.util.Elements.getAllredRochowElectroNeg(b);return a=c+d-(1==a||1==b?0.05:0.085)*Math.pow(Math.abs(e-f),1.4)},$fz.isPrivate=!0,$fz),"J.minimize.MinAtom,J.minimize.MinAtom,~N,~B");Clazz.defineStatics(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,"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],"r0reductions",[0.08,0.03,0.1,0.17,0.075,0.04])});Clazz.declarePackage("J.minimize.forcefield");
Clazz.load(["J.minimize.forcefield.ForceField","J.script.T"],"J.minimize.forcefield.ForceFieldUFF","java.util.Hashtable J.minimize.forcefield.CalculationsUFF $.FFParam J.util.Elements $.JmolList $.Logger $.Parser".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.bsAromatic=null;Clazz.instantialize(this,arguments)},J.minimize.forcefield,"ForceFieldUFF",J.minimize.forcefield.ForceField);Clazz.makeConstructor(c$,function(a){Clazz.superConstructor(this,J.minimize.forcefield.ForceFieldUFF,
[]);this.minimizer=a;this.name="UFF"},"J.minimize.Minimizer");Clazz.overrideMethod(c$,"clear",function(){this.bsAromatic=null});Clazz.overrideMethod(c$,"setModel",function(a,b){this.setModelFields();J.util.Logger.info("minimize: setting atom types...");if(null==J.minimize.forcefield.ForceFieldUFF.atomTypes&&null==($t$=J.minimize.forcefield.ForceFieldUFF.atomTypes=this.getAtomTypes(),J.minimize.forcefield.ForceFieldUFF.prototype.atomTypes=J.minimize.forcefield.ForceFieldUFF.atomTypes,$t$)||null==J.minimize.forcefield.ForceFieldUFF.ffParams&&
null==($t$=J.minimize.forcefield.ForceFieldUFF.ffParams=this.getFFParameters(),J.minimize.forcefield.ForceFieldUFF.prototype.ffParams=J.minimize.forcefield.ForceFieldUFF.ffParams,$t$))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.minimizer.constraints);return this.calc.setupCalculations()},"J.util.BS,~N");$_M(c$,"setAtomTypes",($fz=function(a,b){var c=
J.minimize.forcefield.ForceFieldUFF.atomTypes.size();a.clear(0);for(var d=0;d<c;d++){var e=J.minimize.forcefield.ForceFieldUFF.atomTypes.get(d),f=e[0];if(null!=f)if(f=this.getSearch(f,b,a),a.get(0))a.clear(0);else if(null==f)break;else for(var g=this.minimizer.bsAtoms.nextSetBit(0),h=0;g<this.minimizer.atoms.length&&0<=g;g=this.minimizer.bsAtoms.nextSetBit(g+1),h++)f.get(g)&&(this.minAtoms[h].sType=e[1].intern())}},$fz.isPrivate=!0,$fz),"J.util.BS,~N");$_M(c$,"getSearch",($fz=function(a,b,c){var d=
null,e=a.length,d=J.minimize.forcefield.ForceFieldUFF.tokenTypes[0],f=a.charCodeAt(e-2)-48,g=0;10<=f&&(f=0);var h=!1;"#"==a.charAt(1)?g=J.util.Parser.parseInt(a.substring(2,e-1)):(g=a.substring(1,0<f?e-3:e-1),g.equals(g.toLowerCase())&&(g=g.toUpperCase(),h=!0),g=J.util.Elements.elementNumberFromSymbol(g,!1));if(g>b)return null;if(!c.get(g))return c.set(0),null;switch(a.charAt(e-3)){case "D":d=J.minimize.forcefield.ForceFieldUFF.tokenTypes[2];d[6].intValue=f;break;case "^":d=J.minimize.forcefield.ForceFieldUFF.tokenTypes[4+
(f-1)];break;case "+":d=J.minimize.forcefield.ForceFieldUFF.tokenTypes[1];d[5].intValue=f;break;case "-":d=J.minimize.forcefield.ForceFieldUFF.tokenTypes[1];d[5].intValue=-f;break;case "A":d=J.minimize.forcefield.ForceFieldUFF.tokenTypes[6]}d[2].intValue=g;b=this.minimizer.viewer.evaluateExpression(d);if(!Clazz.instanceOf(b,J.util.BS))return null;h&&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},$fz.isPrivate=!0,$fz),"~S,~N,J.util.BS");$_M(c$,"getFFParameters",($fz=function(){var a,b=new java.util.Hashtable,c=null;try{for(var c=this.getBufferedReader("UFF.txt"),d;null!=(d=c.readLine());){var e=J.util.Parser.getTokens(d);if(!(13>e.length)&&(J.util.Logger.debugging&&J.util.Logger.info(d),d.substring(0,5).equals("param"))){a=new J.minimize.forcefield.FFParam;b.put(e[1],a);
a.dVal=Clazz.newDoubleArray(11,0);a.sVal=Array(1);a.sVal[0]=e[1];a.dVal[0]=J.util.Parser.parseFloatStr(e[2]);a.dVal[1]=0.017453292519943295*J.util.Parser.parseFloatStr(e[3]);a.dVal[2]=J.util.Parser.parseFloatStr(e[4]);a.dVal[3]=J.util.Parser.parseFloatStr(e[5]);a.dVal[4]=J.util.Parser.parseFloatStr(e[6]);a.dVal[5]=J.util.Parser.parseFloatStr(e[7]);a.dVal[6]=J.util.Parser.parseFloatStr(e[8]);a.dVal[7]=J.util.Parser.parseFloatStr(e[9]);a.dVal[8]=J.util.Parser.parseFloatStr(e[10]);a.dVal[9]=J.util.Parser.parseFloatStr(e[11]);
a.dVal[10]=J.util.Parser.parseFloatStr(e[12]);a.iVal=Clazz.newIntArray(1,0);var f=2<e[1].length?e[1].charAt(2):"1";switch(f){case "R":f="2";break;default:f="1";case "1":case "2":case "3":case "4":case "5":case "6":}a.iVal[0]=f.charCodeAt(0)-48}}c.close()}catch(g){if(Clazz.exceptionOf(g,Exception)){System.err.println("Exception "+g.toString()+" in getResource UFF.txt");try{c.close()}catch(h){if(!Clazz.exceptionOf(h,Exception))throw h;}return null}throw g;}J.util.Logger.info(b.size()+" atom types read from UFF.txt");
return b},$fz.isPrivate=!0,$fz));$_M(c$,"getAtomTypes",($fz=function(){var a=new J.util.JmolList;try{for(var b=this.getBufferedReader("UFF.txt"),c;null!=(c=b.readLine());)if(4<c.length&&c.substring(0,4).equals("atom")){var d=J.util.Parser.getTokens(c);a.addLast([d[1],d[2]])}b.close()}catch(e){if(Clazz.exceptionOf(e,Exception))System.err.println("Exception "+e.toString()+" in getResource UFF.txt");else throw e;}J.util.Logger.info(a.size()+" UFF parameters read");return 0<a.size()?a:null},$fz.isPrivate=
!0,$fz));Clazz.defineStatics(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,1095763976),J.script.T.i(0),J.script.T.tokenExpressionEnd],[J.script.T.tokenExpressionBegin,J.script.T.n(269484436,1095763976),J.script.T.i(0),J.script.T.tokenAnd,
J.script.T.n(269484436,1632634889),J.script.T.i(0),J.script.T.tokenExpressionEnd],[J.script.T.tokenExpressionBegin,J.script.T.n(269484436,1095763976),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,1095763976),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,1095763976),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,1095763976),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]]});Clazz.declarePackage("J.minimize.forcefield");c$=Clazz.decorateAsClass(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;Clazz.instantialize(this,arguments)},J.minimize.forcefield,"Calculation");$_M(c$,"getEnergy",function(){return this.energy});
$_M(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");Clazz.declarePackage("J.minimize.forcefield");
Clazz.load(["J.minimize.forcefield.Calculation","J.util.ArrayUtil","$.SB","$.Vector3d"],"J.minimize.forcefield.Calculations",["java.lang.Float","J.minimize.Util","J.util.TextFormat"],function(){c$=Clazz.decorateAsClass(function(){this.calculations=this.ff=null;this.torsionCount=this.angleCount=this.bondCount=this.atomCount=0;this.constraints=this.minTorsions=this.minAngles=this.minBonds=this.minAtoms=null;this.silent=this.gradients=this.isPreliminary=!1;this.logData=null;this.loggingEnabled=this.logging=
!1;Clazz.isClassDefined("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;Clazz.instantialize(this,arguments)},J.minimize.forcefield,"Calculations");Clazz.prepareFields(c$,function(){this.calculations=J.util.ArrayUtil.createArrayOfArrayList(7);this.logData=new J.util.SB;this.da=new J.util.Vector3d;this.db=new J.util.Vector3d;this.dc=new J.util.Vector3d;
this.dd=new J.util.Vector3d;this.v1=new J.util.Vector3d;this.v2=new J.util.Vector3d;this.v3=new J.util.Vector3d});$_M(c$,"setConstraints",function(a){this.constraints=a},"J.util.JmolList");Clazz.makeConstructor(c$,function(a,b,c,d,e,f){this.ff=a;this.minAtoms=b;this.minBonds=c;this.minAngles=d;this.minTorsions=e;this.atomCount=b.length;this.bondCount=c.length;this.angleCount=d.length;this.torsionCount=e.length;this.constraints=f},"J.minimize.forcefield.ForceField,~A,~A,~A,~A,J.util.JmolList");$_M(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},"J.util.Vector3d,~N,~N");$_M(c$,"setSilent",function(a){this.silent=a},"~B");$_M(c$,"getLogData",function(){return this.logData.toString()});$_M(c$,"appendLogData",function(a){this.logData.append(a).append("\n")},"~S");$_M(c$,"setLoggingEnabled",function(a){if(this.loggingEnabled=a)this.logData=new J.util.SB},"~B");$_M(c$,"setPreliminary",function(a){this.isPreliminary=a},
"~B");$_M(c$,"pairSearch",function(a,b,c,d){for(var e=0;e<this.atomCount-1;e++)for(var f=this.minAtoms[e].bsVdw,g=f.nextSetBit(0);0<=g;g=f.nextSetBit(g+1))b.setData(a,e,g),null!=d&&d.setData(c,e,g)},"J.util.JmolList,J.minimize.forcefield.Calculations.PairCalc,J.util.JmolList,J.minimize.forcefield.Calculations.PairCalc");$_M(c$,"calc",($fz=function(a,b){this.logging=this.loggingEnabled&&!this.silent;this.gradients=b;var c=this.calculations[a],d,e=0;if(null==c||0==(d=c.size()))return 0;this.logging&&
this.appendLogData(this.getDebugHeader(a));for(c=0;c<d;c++)e+=this.compute(a,this.calculations[a].get(c));this.logging&&this.appendLogData(this.getDebugFooter(a,e));null!=this.constraints&&3>=a&&(e+=this.constraintEnergy(a));return e},$fz.isPrivate=!0,$fz),"~N,~B");$_M(c$,"energyStrBnd",function(){return 0},"~B");$_M(c$,"energyBond",function(a){return this.calc(0,a)},"~B");$_M(c$,"energyAngle",function(a){return this.calc(1,a)},"~B");$_M(c$,"energyTorsion",function(a){return this.calc(3,a)},"~B");
$_M(c$,"energyStretchBend",function(a){return this.calc(2,a)},"~B");$_M(c$,"energyOOP",function(a){return this.calc(4,a)},"~B");$_M(c$,"energyVDW",function(a){return this.calc(5,a)},"~B");$_M(c$,"energyES",function(a){return this.calc(6,a)},"~B");$_M(c$,"constraintEnergy",($fz=function(a){for(var b=0,c=0,d=0,e=this.constraints.size();0<=--e;){var f=this.constraints.get(e);if(f[0][0]==a+2){c=f[1];f=f[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:f*=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<=f?b+=6.283185307179586:0<b&&-1.5707963267948966>=f&&(f+=6.283185307179586);break;case 1:f*=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))}d+=this.constrainQuadratic(b,f,c,a)}}return d},$fz.isPrivate=!0,$fz),"~N");$_M(c$,"constrainQuadratic",($fz=function(a,b,c,d){if(!J.minimize.Util.isFinite(a))return 0;a-=b;if(this.gradients)switch(b=2*c*a,d){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},$fz.isPrivate=!0,$fz),"~N,~N,~N,~N");$_M(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],d=b[1],b=b[2].doubleValue(),c=c[0]-2;switch(c){case 3:this.id=d[3];case 1:this.ic=d[2];case 0:this.ib=d[1],this.ia=d[0]}switch(c){case 0:this.appendLogData(J.util.TextFormat.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.TextFormat.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.TextFormat.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")}});$_M(c$,"getAtomList",function(a){var b=new J.util.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],d=c.getBondedAtomIndexes(),e=Clazz.newIntArray(d.length+1,0);e[0]=c.atom.getAtomNumber();for(var f="   ",g=0;g<d.length;g++)f+=" %3d",e[g+1]=this.minAtoms[d[g]].atom.getAtomNumber();b.append(J.util.TextFormat.sprintf("%3d %8.3f %8.3f %8.3f  %-5s %8.3f %8.3f %8.3f"+f+"\n","sFI",[c.sType,[c.coord[0],c.coord[1],c.coord[2],c.force[0],c.force[1],c.force[2]],e]))}b.append("-----------------------------------------------------------------------------------------------\n\n\n");
return b.toString()},"~S");$_M(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");$_M(c$,"getDebugLine",function(a,b){var c=this.ff.toUserUnits(b.energy);switch(a){case 0:return J.util.TextFormat.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.TextFormat.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.TextFormat.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.TextFormat.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.TextFormat.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.TextFormat.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");$_M(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.TextFormat.sprintf("\n     TOTAL %s ENERGY = %8.3f %s/mol\n",
"sfs",[c,Float.$valueOf(this.ff.toUserUnits(b)),this.ff.minimizer.units])},"~N,~N");$_M(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");$_M(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");$_M(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");$_M(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");$_M(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");$_M(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(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.Calculations,"PairCalc",J.minimize.forcefield.Calculation);c$=Clazz.p0p()};Clazz.defineStatics(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)});Clazz.declarePackage("J.minimize.forcefield");
Clazz.load(["J.minimize.forcefield.Calculation","$.Calculations"],"J.minimize.forcefield.CalculationsMMFF",["J.minimize.MinAtom","$.MinObject","J.util.JmolList","$.TextFormat"],function(){c$=Clazz.decorateAsClass(function(){this.mmff=this.sbCalc=this.esCalc=this.vdwCalc=this.oopCalc=this.torsionCalc=this.angleCalc=this.bondCalc=this.ffParams=null;Clazz.isClassDefined("J.minimize.forcefield.CalculationsMMFF.DistanceCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$DistanceCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsMMFF.AngleCalc")||
J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$AngleCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsMMFF.SBCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$SBCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsMMFF.TorsionCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$TorsionCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsMMFF.OOPCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$OOPCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsMMFF.VDWCalc")||
J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$VDWCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsMMFF.ESCalc")||J.minimize.forcefield.CalculationsMMFF.$CalculationsMMFF$ESCalc$();Clazz.instantialize(this,arguments)},J.minimize.forcefield,"CalculationsMMFF",J.minimize.forcefield.Calculations);Clazz.makeConstructor(c$,function(a,b,c,d,e,f,g){Clazz.superConstructor(this,J.minimize.forcefield.CalculationsMMFF,[a,c,d,e,f,g]);this.mmff=a;this.ffParams=b;this.bondCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.DistanceCalc,
this,null);this.angleCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.AngleCalc,this,null);this.sbCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.SBCalc,this,null);this.torsionCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.TorsionCalc,this,null);this.oopCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.OOPCalc,this,null);this.vdwCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.VDWCalc,this,null);this.esCalc=
Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.ESCalc,this,null)},"J.minimize.forcefield.ForceField,java.util.Map,~A,~A,~A,~A,J.util.JmolList");Clazz.overrideMethod(c$,"getUnits",function(){return"kcal"});Clazz.overrideMethod(c$,"setupCalculations",function(){var a,b=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.DistanceCalc,this,null);a=this.calculations[0]=new J.util.JmolList;for(var c=0;c<this.bondCount;c++)b.setData(a,this.minBonds[c]);a=this.calculations[1]=new J.util.JmolList;
b=Clazz.innerTypeInstance(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 J.util.JmolList;b=Clazz.innerTypeInstance(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 J.util.JmolList;b=Clazz.innerTypeInstance(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 J.util.JmolList;b=Clazz.innerTypeInstance(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 J.util.JmolList,Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.VDWCalc,this,null),this.calculations[6]=new J.util.JmolList,Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsMMFF.ESCalc,
this,null));return!0});$_M(c$,"isLinear",function(a){return J.minimize.MinAtom.isLinear(this.minAtoms[a])},"~N");c$.isInvertible=$_M(c$,"isInvertible",($fz=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}},$fz.isPrivate=!0,$fz),"J.minimize.MinAtom");Clazz.overrideMethod(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");$_M(c$,"getParameterObj",function(a){return null==a.key||null!=a.ddata?a.ddata:this.ffParams.get(a.key)},"J.minimize.MinObject");$_M(c$,"getParameter",function(a){return this.ffParams.get(a)},"Integer");Clazz.overrideMethod(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");$_M(c$,"getDebugLine",function(a,b){var c=this.ff.toUserUnits(b.energy);switch(a){case 1:case 2:return J.util.TextFormat.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.TextFormat.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 Clazz.superCall(this,J.minimize.forcefield.CalculationsMMFF,"getDebugLine",[a,b])}},"~N,J.minimize.forcefield.Calculation");c$.$CalculationsMMFF$DistanceCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);this.delta2=this.kb=this.r0=0;Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"DistanceCalc",
J.minimize.forcefield.Calculation);$_M(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])},"J.util.JmolList,J.minimize.MinBond");Clazz.overrideMethod(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");Clazz.defineStatics(c$,"FSTRETCH",71.96625,"CS",-2,"CS2",2.3333333333333335);c$=Clazz.p0p()};c$.$CalculationsMMFF$AngleCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"AngleCalc",J.minimize.forcefield.Calculation);$_M(c$,"setData",function(a,b){var c=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(b);null!=c&&a.addLast([b.data,c,b.key])},"J.util.JmolList,J.minimize.MinAngle");
Clazz.overrideMethod(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");Clazz.defineStatics(c$,"CB",-0.006981317007977318);c$=Clazz.p0p()};c$.$CalculationsMMFF$SBCalc$=function(){Clazz.pu$h();
c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"SBCalc",J.minimize.forcefield.Calculation);$_M(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),d=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(b),e=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(this.b$["J.minimize.forcefield.CalculationsMMFF"].minBonds[b.data[3]]),
f=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameterObj(this.b$["J.minimize.forcefield.CalculationsMMFF"].minBonds[b.data[4]]);null==c||(null==d||null==e||null==f)||(d=d[1],f=f[1],a.addLast([b.data,[c[0],d,e[1]]]),a.addLast([[b.data[2],b.data[1],b.data[0]],[c[1],d,f]]))}},"J.util.JmolList,J.minimize.MinAngle");Clazz.overrideMethod(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$=Clazz.p0p()};c$.$CalculationsMMFF$TorsionCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"TorsionCalc",J.minimize.forcefield.Calculation);$_M(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])}},"J.util.JmolList,J.minimize.MinTorsion");Clazz.overrideMethod(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 d=Math.cos(this.theta),e=d*d;this.energy=0.5*(a*(1+d)+b*(2-2*e)+c*(1+d*(4*e-3)));if(this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients){var f=
Math.sin(this.theta);this.dE=0.5*(-a*f+4*b*f*d+3*c*f*(1-4*e));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$=Clazz.p0p()};c$.$CalculationsMMFF$OOPCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);this.list=
null;Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"OOPCalc",J.minimize.forcefield.Calculation);Clazz.prepareFields(c$,function(){this.list=Clazz.newIntArray(4,0)});$_M(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 d=this.b$["J.minimize.forcefield.CalculationsMMFF"].mmff.getOutOfPlaneParameter(this.list);
0!=d&&(d=[d],a.addLast([[c[0],b,c[1],c[2]],d]),a.addLast([[c[1],b,c[2],c[0]],d]),a.addLast([[c[2],b,c[0],c[1]],d]))}},"J.util.JmolList,~N");Clazz.overrideMethod(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");Clazz.defineStatics(c$,"FOOPD",2.5120761569715815,"FOOP",71.96568080495746);c$=Clazz.p0p()};c$.$CalculationsMMFF$VDWCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsMMFF,
"VDWCalc",J.minimize.forcefield.Calculations.PairCalc,null,Clazz.innerTypeInstance(J.minimize.forcefield.Calculations.PairCalc,this,null,Clazz.inheritArgs));Clazz.overrideMethod(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 d=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameter(this.a.vdwKey),e=this.b$["J.minimize.forcefield.CalculationsMMFF"].getParameter(this.b.vdwKey);
if(!(null==d||null==e)){var f=d[0],g=d[1],h=d[2],k=d[3],d=Clazz.doubleToInt(d[4]),l=e[0],m=e[1],j=e[2],n=e[3],e=Clazz.doubleToInt(e[4]),h=h*Math.pow(f,0.25),p=j*Math.pow(l,0.25),j=(h-p)/(h+p),h=0.5*(h+p);68!=d&&68!=e&&(h*=1+0.2*(1-Math.exp(-12*j*j)));f=181.16*k*n*f*l/(Math.sqrt(f/g)+Math.sqrt(l/m))*Math.pow(h,-6);133==d+e&&(h*=0.8,f*=0.5);a.addLast([[b,c],[h,f]])}},"J.util.JmolList,~N,~N");Clazz.overrideMethod(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,d=1.07/(c+0.07),e=1.12/(Math.pow(c,7)+0.12);this.energy=b*Math.pow(d,7)*(e-2);this.b$["J.minimize.forcefield.CalculationsMMFF"].gradients&&(this.dE=-7*b*Math.pow(d,7)/a*(d/1.07*(e-2)+e*e*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$=Clazz.p0p()};c$.$CalculationsMMFF$ESCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsMMFF,"ESCalc",J.minimize.forcefield.Calculations.PairCalc,null,Clazz.innerTypeInstance(J.minimize.forcefield.Calculations.PairCalc,this,null,Clazz.inheritArgs));Clazz.overrideMethod(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]])},"J.util.JmolList,~N,~N");Clazz.overrideMethod(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");Clazz.defineStatics(c$,"BUFF",0.05);c$=Clazz.p0p()};Clazz.defineStatics(c$,
"FPAR",143.9325,"DA_D","D","DA_DA",133)});Clazz.declarePackage("J.minimize.forcefield");
Clazz.load(["J.minimize.forcefield.Calculation","$.Calculations"],"J.minimize.forcefield.CalculationsUFF",["J.minimize.Util","J.util.JmolList"],function(){c$=Clazz.decorateAsClass(function(){this.vdwCalc=this.oopCalc=this.torsionCalc=this.angleCalc=this.bondCalc=this.parC=this.parB=this.parA=this.ffParams=null;Clazz.isClassDefined("J.minimize.forcefield.CalculationsUFF.DistanceCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$DistanceCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsUFF.AngleCalc")||
J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$AngleCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsUFF.TorsionCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$TorsionCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsUFF.OOPCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$OOPCalc$();Clazz.isClassDefined("J.minimize.forcefield.CalculationsUFF.VDWCalc")||J.minimize.forcefield.CalculationsUFF.$CalculationsUFF$VDWCalc$();Clazz.instantialize(this,
arguments)},J.minimize.forcefield,"CalculationsUFF",J.minimize.forcefield.Calculations);Clazz.makeConstructor(c$,function(a,b,c,d,e,f,g){Clazz.superConstructor(this,J.minimize.forcefield.CalculationsUFF,[a,c,d,e,f,g]);this.ffParams=b;this.bondCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsUFF.DistanceCalc,this,null);this.angleCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsUFF.AngleCalc,this,null);this.torsionCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsUFF.TorsionCalc,
this,null);this.oopCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsUFF.OOPCalc,this,null);this.vdwCalc=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsUFF.VDWCalc,this,null)},"J.minimize.forcefield.ForceField,java.util.Map,~A,~A,~A,~A,J.util.JmolList");Clazz.overrideMethod(c$,"getUnits",function(){return"kJ"});Clazz.overrideMethod(c$,"setupCalculations",function(){var a,b=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsUFF.DistanceCalc,this,null);a=this.calculations[0]=
new J.util.JmolList;for(var c=0;c<this.bondCount;c++){var d=this.minBonds[c],e=d.order;d.isAromatic&&(e=1.5);d.isAmide&&(e=1.41);b.setData(a,d.data[0],d.data[1],e)}a=this.calculations[1]=new J.util.JmolList;b=Clazz.innerTypeInstance(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 J.util.JmolList;b=Clazz.innerTypeInstance(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 J.util.JmolList;for(var b=Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsUFF.OOPCalc,this,null),f,c=0;c<this.atomCount;c++)d=this.minAtoms[c],3==d.nBonds&&J.minimize.forcefield.CalculationsUFF.isInvertible(f=d.atom.getElementNumber())&&b.setData(a,c,f);this.pairSearch(this.calculations[5]=new J.util.JmolList,Clazz.innerTypeInstance(J.minimize.forcefield.CalculationsUFF.VDWCalc,this,null),null,null);return!0});c$.isInvertible=
$_M(c$,"isInvertible",($fz=function(a){switch(a){case 6:case 7:case 8:case 15:case 33:case 51:case 83:return!0;default:return!1}},$fz.isPrivate=!0,$fz),"~N");c$.calculateR0=$_M(c$,"calculateR0",function(a,b,c,d,e){e=-0.1332*(a+b)*Math.log(e);var f=Math.sqrt(c)-Math.sqrt(d);return a+b+e-a*b*f*f/(c*a+d*b)},"~N,~N,~N,~N,~N");Clazz.overrideMethod(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");$_M(c$,"getParameter",function(a){return this.ffParams.get(a)},"~O");Clazz.overrideMethod(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(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,
arguments);this.kb=this.r0=0;Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsUFF,"DistanceCalc",J.minimize.forcefield.Calculation);$_M(c$,"setData",function(a,b,c,d){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],d);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,d]])},"J.util.JmolList,~N,~N,~N");Clazz.overrideMethod(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$=Clazz.p0p()};c$.$CalculationsUFF$AngleCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsUFF,"AngleCalc",J.minimize.forcefield.Calculation);$_M(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 d=this.b$["J.minimize.forcefield.CalculationsUFF"].parB.iVal[0],e=this.b$["J.minimize.forcefield.CalculationsUFF"].parA.dVal[5],f=this.b$["J.minimize.forcefield.CalculationsUFF"].parC.dVal[5],g=this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[1],h=Math.cos(g),k=Math.sin(g),l,m;switch(d){case 1:case 2:case 4:case 6:k=l=m=0;break;default:m=1/(4*k*k),l=-4*m*h,k=m*(2*h*h+1)}var j=this.a.getBondTo(this.ib),n=j.order;
j.isAromatic&&(n=1.5);j.isAmide&&(n=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],n);j=this.c.getBondTo(this.ib);n=j.order;j.isAromatic&&(n=1.5);j.isAmide&&(n=1.41);j=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],n);n=Math.sqrt(this.rab*this.rab+j*j-2*this.rab*j*h);e=2696.8016159999997*(e*f/Math.pow(n,5))*(3*this.rab*j*(1-h*h)-n*n*h);a.addLast([[this.ia,this.ib,this.ic,d],[e,57.29577951308232*g,k-m,l,2*m,c*e]])},"J.util.JmolList,~A");Clazz.overrideMethod(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],d=this.dData[3],e=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 f=Math.cos(this.theta),g=Math.sin(this.theta);switch(a){case 0:case 1:this.energy=b*(1+f)*(1+f)/4;break;case 2:this.energy=b*(1+4*f*(1+f))/9;break;case 4:case 6:this.energy=b*f*f;break;default:this.energy=b*(c+d*f+e*f*f)}if(this.b$["J.minimize.forcefield.CalculationsUFF"].gradients){switch(a){case 0:case 1:this.dE=
-0.5*b*g*(1+f);break;case 2:this.dE=-4*g*b*(1-2*f)/9;break;case 4:case 6:this.dE=-b*g*f;break;default:this.dE=-b*(d*g-2*e*f*g)}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$=Clazz.p0p()};c$.$CalculationsUFF$TorsionCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,
arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsUFF,"TorsionCalc",J.minimize.forcefield.Calculation);$_M(c$,"setData",function(a,b){var c=-1,d=0,e=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 f=
this.c.getBondTo(this.ib),g=f.order;f.isAromatic&&(g=1.5);f.isAmide&&(g=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:d=3;e=this.b$["J.minimize.forcefield.CalculationsUFF"].parB.dVal[6];
f=this.b$["J.minimize.forcefield.CalculationsUFF"].parC.dVal[6];g=0;switch(this.b.atom.getElementNumber()){case 8:g=2;break;case 16:case 34:case 52:case 84:g=6.8}if(0!=g)switch(this.c.atom.getElementNumber()){case 8:e=g;d=f=2;break;case 16:case 34:case 52:case 84:e=g,f=6.8,d=2}e=2.0934*Math.sqrt(e*f);break;case 4:c=1;d=2;e=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(g));break;case 6:c=
1;d=6;e=3==this.b$["J.minimize.forcefield.CalculationsUFF"].parC.iVal[0];switch((e?this.c:this.b).atom.getElementNumber()){case 8:case 16:case 34:case 52:case 84:switch((e?this.b:this.c).atom.getElementNumber()){case 8:case 16:case 34:case 52:case 84:break;default:d=2,c=-1}}e=2.0934}J.minimize.Util.isNearZero(e)||a.addLast([[this.ia,this.ib,this.ic,this.id,d],[e,c]])},"J.util.JmolList,~A");Clazz.overrideMethod(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$=Clazz.p0p()};c$.$CalculationsUFF$OOPCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsUFF,"OOPCalc",J.minimize.forcefield.Calculation);$_M(c$,"setData",function(a,b,c){this.b=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[b];var d=this.b.getBondedAtomIndexes();this.a=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ia=d[0]];this.c=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.ic=
d[1]];this.d=this.b$["J.minimize.forcefield.CalculationsUFF"].minAtoms[this.id=d[2]];var e=1,f=-1,g=0,d=25.1208;switch(c){case 6:if("C_2"===this.b.sType&&1<this.b.hCount||"C_2+"===this.b.sType||"O_2"===this.a.sType||"O_2"===this.c.sType||"O_2"===this.d.sType){d+=184.2192;break}break;case 7:case 8:break;default:d=92.1096;e=0.017453292519943295;switch(c){case 15:e*=84.4339;break;case 33:e*=86.9735;break;case 51:e*=87.7047;break;case 83:e*=90}c=Math.cos(e);e=c*c;f=-2*c;g=1}d/=3;a.addLast([[this.ia,b,
this.ic,this.id],[d,e,f,g,10*d]]);a.addLast([[this.ic,b,this.id,this.ia],[d,e,f,g,10*d]]);a.addLast([[this.id,b,this.ia,this.ic],[d,e,f,g,10*d]])},"J.util.JmolList,~N,~N");Clazz.overrideMethod(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 e=Math.cos(this.theta);this.energy=a*(b+
c*e+d*e*e);this.b$["J.minimize.forcefield.CalculationsUFF"].gradients&&(this.dE=a*(c*Math.sin(this.theta)+2*d*Math.sin(this.theta)*e),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$=Clazz.p0p()};c$.$CalculationsUFF$VDWCalc$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,
arguments);Clazz.instantialize(this,arguments)},J.minimize.forcefield.CalculationsUFF,"VDWCalc",J.minimize.forcefield.Calculations.PairCalc,null,Clazz.innerTypeInstance(J.minimize.forcefield.Calculations.PairCalc,this,null,Clazz.inheritArgs));Clazz.overrideMethod(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),
e=this.b$["J.minimize.forcefield.CalculationsUFF"].getParameter(this.b.sType),f=d.dVal[2],g=e.dVal[2],d=4.1868*Math.sqrt(d.dVal[3]*e.dVal[3]),f=Math.sqrt(f*g);a.addLast([[b,c],[f,d]])},"J.util.JmolList,~N,~N");Clazz.overrideMethod(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$=Clazz.p0p()};Clazz.defineStatics(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)});Clazz.declarePackage("J.minimize.forcefield");c$=Clazz.decorateAsClass(function(){this.sVal=this.dVal=this.iVal=null;Clazz.instantialize(this,arguments)},J.minimize.forcefield,"FFParam");Clazz.declarePackage("J.thread");
Clazz.load(["J.thread.JmolThread"],"J.thread.MinimizationThread",["J.util.Logger"],function(){c$=Clazz.decorateAsClass(function(){this.minimizer=null;Clazz.instantialize(this,arguments)},J.thread,"MinimizationThread",J.thread.JmolThread);Clazz.makeConstructor(c$,function(a,b){Clazz.superConstructor(this,J.thread.MinimizationThread);this.setViewer(b,"MinimizationThread");this.minimizer=a},"J.api.MinimizerInterface,J.viewer.Viewer");Clazz.overrideMethod(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");Clazz.overrideMethod(c$,"oops",function(a){this.minimizer.minimizationOn()&&J.util.Logger.error(a.toString())},"Exception")});
