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