initial commit
This commit is contained in:
448
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/JSmol.min.js
vendored
Normal file
448
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/JSmol.min.js
vendored
Normal file
@@ -0,0 +1,448 @@
|
||||
(function(a,m){"object"===typeof module&&"object"===typeof module.exports?module.exports=a.document?m(a,!0):function(a){if(!a.document)throw Error("jQuery requires a window with a document");return m(a)}:m(a)})("undefined"!==typeof window?window:this,function(a,m){function l(f){var v=f.length,a=g.type(f);return"function"===a||g.isWindow(f)?!1:1===f.nodeType&&v?!0:"array"===a||0===v||"number"===typeof v&&0<v&&v-1 in f}function h(f,v,a){if(g.isFunction(v))return g.grep(f,function(f,g){return!!v.call(f,
|
||||
g,f)!==a});if(v.nodeType)return g.grep(f,function(f){return f===v!==a});if("string"===typeof v){if(Vc.test(v))return g.filter(v,f,a);v=g.filter(v,f)}return g.grep(f,function(f){return 0<=g.inArray(f,v)!==a})}function e(f,v){do f=f[v];while(f&&1!==f.nodeType);return f}function j(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",t,!1),a.removeEventListener("load",t,!1)):(y.detachEvent("onreadystatechange",t),a.detachEvent("onload",t))}function t(){if(y.addEventListener||"load"===event.type||
|
||||
"complete"===y.readyState)j(),g.ready()}function s(f,v,a){if(void 0===a&&1===f.nodeType)if(a="data-"+v.replace(Wc,"-$1").toLowerCase(),a=f.getAttribute(a),"string"===typeof a){try{a="true"===a?!0:"false"===a?!1:"null"===a?null:+a+""===a?+a:Xc.test(a)?g.parseJSON(a):a}catch(I){}g.data(f,v,a)}else a=void 0;return a}function u(f){for(var a in f)if(!("data"===a&&g.isEmptyObject(f[a]))&&"toJSON"!==a)return!1;return!0}function b(f,a,p,I){if(g.acceptData(f)){var b=g.expando,c=f.nodeType,d=c?g.cache:f,n=
|
||||
c?f[b]:f[b]&&b;if(n&&d[n]&&(I||d[n].data)||!(void 0===p&&"string"===typeof a)){n||(n=c?f[b]=k.pop()||g.guid++:b);d[n]||(d[n]=c?{}:{toJSON:g.noop});if("object"===typeof a||"function"===typeof a)I?d[n]=g.extend(d[n],a):d[n].data=g.extend(d[n].data,a);f=d[n];I||(f.data||(f.data={}),f=f.data);void 0!==p&&(f[g.camelCase(a)]=p);"string"===typeof a?(p=f[a],null==p&&(p=f[g.camelCase(a)])):p=f;return p}}}function c(f,a,p){if(g.acceptData(f)){var I,b,c=f.nodeType,k=c?g.cache:f,d=c?f[g.expando]:g.expando;if(k[d]){if(a&&
|
||||
(I=p?k[d]:k[d].data)){g.isArray(a)?a=a.concat(g.map(a,g.camelCase)):a in I?a=[a]:(a=g.camelCase(a),a=a in I?[a]:a.split(" "));for(b=a.length;b--;)delete I[a[b]];if(p?!u(I):!g.isEmptyObject(I))return}if(!p&&(delete k[d].data,!u(k[d])))return;c?g.cleanData([f],!0):w.deleteExpando||k!=k.window?delete k[d]:k[d]=null}}}function d(){return!0}function q(){return!1}function K(){try{return y.activeElement}catch(f){}}function B(f){var a=mc.split("|");f=f.createDocumentFragment();if(f.createElement)for(;a.length;)f.createElement(a.pop());
|
||||
return f}function E(f,a){var p,I,b=0,c=typeof f.getElementsByTagName!==la?f.getElementsByTagName(a||"*"):typeof f.querySelectorAll!==la?f.querySelectorAll(a||"*"):void 0;if(!c){c=[];for(p=f.childNodes||f;null!=(I=p[b]);b++)!a||g.nodeName(I,a)?c.push(I):g.merge(c,E(I,a))}return void 0===a||a&&g.nodeName(f,a)?g.merge([f],c):c}function rb(f){Mb.test(f.type)&&(f.defaultChecked=f.checked)}function Ya(f,a){return g.nodeName(f,"table")&&g.nodeName(11!==a.nodeType?a:a.firstChild,"tr")?f.getElementsByTagName("tbody")[0]||
|
||||
f.appendChild(f.ownerDocument.createElement("tbody")):f}function Ea(f){f.type=(null!==g.find.attr(f,"type"))+"/"+f.type;return f}function U(f){var a=Yc.exec(f.type);a?f.type=a[1]:f.removeAttribute("type");return f}function Q(f,a){for(var p,I=0;null!=(p=f[I]);I++)g._data(p,"globalEval",!a||g._data(a[I],"globalEval"))}function Fa(f,a){if(1===a.nodeType&&g.hasData(f)){var p,I,b;I=g._data(f);var c=g._data(a,I),k=I.events;if(k)for(p in delete c.handle,c.events={},k){I=0;for(b=k[p].length;I<b;I++)g.event.add(a,
|
||||
p,k[p][I])}c.data&&(c.data=g.extend({},c.data))}}function Pa(f,v){var p=g(v.createElement(f)).appendTo(v.body),I=a.getDefaultComputedStyle?a.getDefaultComputedStyle(p[0]).display:g.css(p[0],"display");p.detach();return I}function db(f){var a=y,p=nc[f];if(!p){p=Pa(f,a);if("none"===p||!p)eb=(eb||g("<iframe frameborder='0' width='0' height='0'/>")).appendTo(a.documentElement),a=(eb[0].contentWindow||eb[0].contentDocument).document,a.write(),a.close(),p=Pa(f,a),eb.detach();nc[f]=p}return p}function fb(f,
|
||||
a){return{get:function(){var p=f();if(null!=p)if(p)delete this.get;else return(this.get=a).apply(this,arguments)}}}function gb(f,a){if(a in f)return a;for(var p=a.charAt(0).toUpperCase()+a.slice(1),I=a,b=oc.length;b--;)if(a=oc[b]+p,a in f)return a;return I}function va(f,a){for(var p,b,c,k=[],d=0,n=f.length;d<n;d++)if(b=f[d],b.style)if(k[d]=g._data(b,"olddisplay"),p=b.style.display,a)!k[d]&&"none"===p&&(b.style.display=""),""===b.style.display&&hb(b)&&(k[d]=g._data(b,"olddisplay",db(b.nodeName)));
|
||||
else if(!k[d]&&(c=hb(b),p&&"none"!==p||!c))g._data(b,"olddisplay",c?p:g.css(b,"display"));for(d=0;d<n;d++)if(b=f[d],b.style&&(!a||"none"===b.style.display||""===b.style.display))b.style.display=a?k[d]||"":"none";return f}function ma(f,a,p){return(f=Zc.exec(a))?Math.max(0,f[1]-(p||0))+(f[2]||"px"):a}function x(f,a,p,b,c){a=p===(b?"border":"content")?4:"width"===a?1:0;for(var k=0;4>a;a+=2)"margin"===p&&(k+=g.css(f,p+Qa[a],!0,c)),b?("content"===p&&(k-=g.css(f,"padding"+Qa[a],!0,c)),"margin"!==p&&(k-=
|
||||
g.css(f,"border"+Qa[a]+"Width",!0,c))):(k+=g.css(f,"padding"+Qa[a],!0,c),"padding"!==p&&(k+=g.css(f,"border"+Qa[a]+"Width",!0,c)));return k}function aa(f,a,p){var b=!0,c="width"===a?f.offsetWidth:f.offsetHeight,k=Ra(f),d=w.boxSizing()&&"border-box"===g.css(f,"boxSizing",!1,k);if(0>=c||null==c){c=Sa(f,a,k);if(0>c||null==c)c=f.style[a];if(sb.test(c))return c;b=d&&(w.boxSizingReliable()||c===f.style[a]);c=parseFloat(c)||0}return c+x(f,a,p||(d?"border":"content"),b,k)+"px"}function L(f,a,p,b,g){return new L.prototype.init(f,
|
||||
a,p,b,g)}function ga(){setTimeout(function(){Za=void 0});return Za=g.now()}function O(f,a){var p,b={height:f},g=0;for(a=a?1:0;4>g;g+=2-a)p=Qa[g],b["margin"+p]=b["padding"+p]=f;a&&(b.opacity=b.width=f);return b}function wa(f,a,p){for(var b,g=(ib[a]||[]).concat(ib["*"]),c=0,k=g.length;c<k;c++)if(b=g[c].call(p,a,f))return b}function jb(f,a,p){var b,c,k=0,d=tb.length,n=g.Deferred().always(function(){delete e.elem}),e=function(){if(c)return!1;for(var a=Za||ga(),a=Math.max(0,r.startTime+r.duration-a),v=
|
||||
1-(a/r.duration||0),p=0,b=r.tweens.length;p<b;p++)r.tweens[p].run(v);n.notifyWith(f,[r,v,a]);if(1>v&&b)return a;n.resolveWith(f,[r]);return!1},r=n.promise({elem:f,props:g.extend({},a),opts:g.extend(!0,{specialEasing:{}},p),originalProperties:a,originalOptions:p,startTime:Za||ga(),duration:p.duration,tweens:[],createTween:function(a,v){var p=g.Tween(f,r.opts,a,v,r.opts.specialEasing[a]||r.opts.easing);r.tweens.push(p);return p},stop:function(a){var v=0,p=a?r.tweens.length:0;if(c)return this;for(c=
|
||||
!0;v<p;v++)r.tweens[v].run(1);a?n.resolveWith(f,[r,a]):n.rejectWith(f,[r,a]);return this}});a=r.props;p=r.opts.specialEasing;var q,h,l,j;for(b in a)if(q=g.camelCase(b),h=p[q],l=a[b],g.isArray(l)&&(h=l[1],l=a[b]=l[0]),b!==q&&(a[q]=l,delete a[b]),(j=g.cssHooks[q])&&"expand"in j)for(b in l=j.expand(l),delete a[q],l)b in a||(a[b]=l[b],p[b]=h);else p[q]=h;for(;k<d;k++)if(b=tb[k].call(r,f,a,r.opts))return b;g.map(a,wa,r);g.isFunction(r.opts.start)&&r.opts.start.call(f,r);g.fx.timer(g.extend(e,{elem:f,anim:r,
|
||||
queue:r.opts.queue}));return r.progress(r.opts.progress).done(r.opts.done,r.opts.complete).fail(r.opts.fail).always(r.opts.always)}function kb(f){return function(a,p){"string"!==typeof a&&(p=a,a="*");var b,c=0,k=a.toLowerCase().match(xa)||[];if(g.isFunction(p))for(;b=k[c++];)"+"===b.charAt(0)?(b=b.slice(1)||"*",(f[b]=f[b]||[]).unshift(p)):(f[b]=f[b]||[]).push(p)}}function ub(f,a,p,b){function c(n){var e;k[n]=!0;g.each(f[n]||[],function(f,g){var n=g(a,p,b);if("string"===typeof n&&!d&&!k[n])return a.dataTypes.unshift(n),
|
||||
c(n),!1;if(d)return!(e=n)});return e}var k={},d=f===Nb;return c(a.dataTypes[0])||!k["*"]&&c("*")}function ya(f,a){var p,b,c=g.ajaxSettings.flatOptions||{};for(b in a)void 0!==a[b]&&((c[b]?f:p||(p={}))[b]=a[b]);p&&g.extend(!0,f,p);return f}function na(f,a,p,b){var c;if(g.isArray(a))g.each(a,function(a,v){p||ad.test(f)?b(f,v):na(f+"["+("object"===typeof v?a:"")+"]",v,p,b)});else if(!p&&"object"===g.type(a))for(c in a)na(f+"["+c+"]",a[c],p,b);else b(f,a)}function C(f){try{return f?new a.ActiveXObject("Microsoft.XMLHTTP"):
|
||||
new a.XMLHttpRequest}catch(v){}}function ba(){try{return new a.XMLHttpRequest}catch(f){}}function V(f){return g.isWindow(f)?f:9===f.nodeType?f.defaultView||f.parentWindow:!1}var k=[],n=k.slice,r=k.concat,z=k.push,F=k.indexOf,P={},bd=P.toString,za=P.hasOwnProperty,Ob="".trim,w={},g=function(f,a){return new g.fn.init(f,a)},cd=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,dd=/^-ms-/,ed=/-([\da-z])/gi,fd=function(f,a){return a.toUpperCase()};g.fn=g.prototype={jquery:"1.11.0",constructor:g,selector:"",length:0,
|
||||
toArray:function(){return n.call(this)},get:function(f){return null!=f?0>f?this[f+this.length]:this[f]:n.call(this)},pushStack:function(f){f=g.merge(this.constructor(),f);f.prevObject=this;f.context=this.context;return f},each:function(f,a){return g.each(this,f,a)},map:function(f){return this.pushStack(g.map(this,function(a,p){return f.call(a,p,a)}))},slice:function(){return this.pushStack(n.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(f){var a=
|
||||
this.length;f=+f+(0>f?a:0);return this.pushStack(0<=f&&f<a?[this[f]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:z,sort:k.sort,splice:k.splice};g.extend=g.fn.extend=function(){var f,a,p,b,c,k=arguments[0]||{},d=1,n=arguments.length,e=!1;"boolean"===typeof k&&(e=k,k=arguments[d]||{},d++);"object"!==typeof k&&!g.isFunction(k)&&(k={});d===n&&(k=this,d--);for(;d<n;d++)if(null!=(c=arguments[d]))for(b in c)f=k[b],p=c[b],k!==p&&(e&&p&&(g.isPlainObject(p)||(a=g.isArray(p)))?(a?
|
||||
(a=!1,f=f&&g.isArray(f)?f:[]):f=f&&g.isPlainObject(f)?f:{},k[b]=g.extend(e,f,p)):void 0!==p&&(k[b]=p));return k};g.extend({expando:"jQuery"+("1.11.0"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(f){throw Error(f);},noop:function(){},isFunction:function(f){return"function"===g.type(f)},isArray:Array.isArray||function(f){return"array"===g.type(f)},isWindow:function(f){return null!=f&&f==f.window},isNumeric:function(f){return 0<=f-parseFloat(f)},isEmptyObject:function(f){for(var a in f)return!1;
|
||||
return!0},isPlainObject:function(f){var a;if(!f||"object"!==g.type(f)||f.nodeType||g.isWindow(f))return!1;try{if(f.constructor&&!za.call(f,"constructor")&&!za.call(f.constructor.prototype,"isPrototypeOf"))return!1}catch(p){return!1}if(w.ownLast)for(a in f)return za.call(f,a);for(a in f);return void 0===a||za.call(f,a)},type:function(f){return null==f?f+"":"object"===typeof f||"function"===typeof f?P[bd.call(f)]||"object":typeof f},globalEval:function(f){f&&g.trim(f)&&(a.execScript||function(f){a.eval.call(a,
|
||||
f)})(f)},camelCase:function(f){return f.replace(dd,"ms-").replace(ed,fd)},nodeName:function(f,a){return f.nodeName&&f.nodeName.toLowerCase()===a.toLowerCase()},each:function(f,a,p){var b,g=0,c=f.length;b=l(f);if(p)if(b)for(;g<c&&!(b=a.apply(f[g],p),!1===b);g++);else for(g in f){if(b=a.apply(f[g],p),!1===b)break}else if(b)for(;g<c&&!(b=a.call(f[g],g,f[g]),!1===b);g++);else for(g in f)if(b=a.call(f[g],g,f[g]),!1===b)break;return f},trim:Ob&&!Ob.call("\ufeff\u00a0")?function(f){return null==f?"":Ob.call(f)}:
|
||||
function(f){return null==f?"":(f+"").replace(cd,"")},makeArray:function(f,a){var p=a||[];null!=f&&(l(Object(f))?g.merge(p,"string"===typeof f?[f]:f):z.call(p,f));return p},inArray:function(f,a,p){var b;if(a){if(F)return F.call(a,f,p);b=a.length;for(p=p?0>p?Math.max(0,b+p):p:0;p<b;p++)if(p in a&&a[p]===f)return p}return-1},merge:function(f,a){for(var p=+a.length,b=0,g=f.length;b<p;)f[g++]=a[b++];if(p!==p)for(;void 0!==a[b];)f[g++]=a[b++];f.length=g;return f},grep:function(f,a,p){for(var b=[],g=0,c=
|
||||
f.length,k=!p;g<c;g++)p=!a(f[g],g),p!==k&&b.push(f[g]);return b},map:function(f,a,p){var b,g=0,c=f.length,k=[];if(l(f))for(;g<c;g++)b=a(f[g],g,p),null!=b&&k.push(b);else for(g in f)b=a(f[g],g,p),null!=b&&k.push(b);return r.apply([],k)},guid:1,proxy:function(f,a){var p,b;"string"===typeof a&&(b=f[a],a=f,f=b);if(g.isFunction(f))return p=n.call(arguments,2),b=function(){return f.apply(a||this,p.concat(n.call(arguments)))},b.guid=f.guid=f.guid||g.guid++,b},now:function(){return+new Date},support:w});
|
||||
g.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(f,a){P["[object "+a+"]"]=a.toLowerCase()});var Pb=a,D=function(f,a,p,b){var g,c,k,d,n;(a?a.ownerDocument||a:W)!==R&&oa(a);a=a||R;p=p||[];if(!f||"string"!==typeof f)return p;if(1!==(d=a.nodeType)&&9!==d)return[];if(X&&!b){if(g=gd.exec(f))if(k=g[1])if(9===d)if((c=a.getElementById(k))&&c.parentNode){if(c.id===k)return p.push(c),p}else return p;else{if(a.ownerDocument&&(c=a.ownerDocument.getElementById(k))&&sa(a,
|
||||
c)&&c.id===k)return p.push(c),p}else{if(g[2])return Ga.apply(p,a.getElementsByTagName(f)),p;if((k=g[3])&&H.getElementsByClassName&&a.getElementsByClassName)return Ga.apply(p,a.getElementsByClassName(k)),p}if(H.qsa&&(!S||!S.test(f))){c=g=M;k=a;n=9===d&&f;if(1===d&&"object"!==a.nodeName.toLowerCase()){d=ta(f);(g=a.getAttribute("id"))?c=g.replace(hd,"\\$&"):a.setAttribute("id",c);c="[id='"+c+"'] ";for(k=d.length;k--;)d[k]=c+vb(d[k]);k=Qb.test(f)&&ha(a.parentNode)||a;n=d.join(",")}if(n)try{return Ga.apply(p,
|
||||
k.querySelectorAll(n)),p}catch(e){}finally{g||a.removeAttribute("id")}}}var r;a:{f=f.replace(wb,"$1");c=ta(f);if(!b&&1===c.length){g=c[0]=c[0].slice(0);if(2<g.length&&"ID"===(r=g[0]).type&&H.getById&&9===a.nodeType&&X&&G.relative[g[1].type]){a=(G.find.ID(r.matches[0].replace(Ha,Ia),a)||[])[0];if(!a){r=p;break a}f=f.slice(g.shift().value.length)}for(d=xb.needsContext.test(f)?0:g.length;d--;){r=g[d];if(G.relative[k=r.type])break;if(k=G.find[k])if(b=k(r.matches[0].replace(Ha,Ia),Qb.test(g[0].type)&&
|
||||
ha(a.parentNode)||a)){g.splice(d,1);f=b.length&&vb(g);if(!f){Ga.apply(p,b);r=p;break a}break}}}$a(f,c)(b,a,!X,p,Qb.test(f)&&ha(a.parentNode)||a);r=p}return r},Rb=function(){function f(p,b){a.push(p+" ")>G.cacheLength&&delete f[a.shift()];return f[p+" "]=b}var a=[];return f},pa=function(f){f[M]=!0;return f},qa=function(f){var a=R.createElement("div");try{return!!f(a)}catch(p){return!1}finally{a.parentNode&&a.parentNode.removeChild(a)}},Sb=function(f,a){for(var p=f.split("|"),b=f.length;b--;)G.attrHandle[p[b]]=
|
||||
a},pc=function(f,a){var p=a&&f,b=p&&1===f.nodeType&&1===a.nodeType&&(~a.sourceIndex||ia)-(~f.sourceIndex||ia);if(b)return b;if(p)for(;p=p.nextSibling;)if(p===a)return-1;return f?1:-1},id=function(f){return function(a){return"input"===a.nodeName.toLowerCase()&&a.type===f}},jd=function(f){return function(a){var p=a.nodeName.toLowerCase();return("input"===p||"button"===p)&&a.type===f}},ua=function(f){return pa(function(a){a=+a;return pa(function(p,b){for(var g,c=f([],p.length,a),k=c.length;k--;)if(p[g=
|
||||
c[k]])p[g]=!(b[g]=p[g])})})},ha=function(f){return f&&typeof f.getElementsByTagName!==T&&f},qc=function(){},ta=function(f,a){var p,b,g,c,k,d,n;if(k=Ja[f+" "])return a?0:k.slice(0);k=f;d=[];for(n=G.preFilter;k;){if(!p||(b=kd.exec(k)))b&&(k=k.slice(b[0].length)||k),d.push(g=[]);p=!1;if(b=ld.exec(k))p=b.shift(),g.push({value:p,type:b[0].replace(wb," ")}),k=k.slice(p.length);for(c in G.filter)if((b=xb[c].exec(k))&&(!n[c]||(b=n[c](b))))p=b.shift(),g.push({value:p,type:c,matches:b}),k=k.slice(p.length);
|
||||
if(!p)break}return a?k.length:k?D.error(f):Ja(f,d).slice(0)},vb=function(f){for(var a=0,p=f.length,b="";a<p;a++)b+=f[a].value;return b},Tb=function(f,a,p){var b=a.dir,g=p&&"parentNode"===b,c=md++;return a.first?function(a,p,v){for(;a=a[b];)if(1===a.nodeType||g)return f(a,p,v)}:function(a,p,v){var k,d,n=[ca,c];if(v)for(;a=a[b];){if((1===a.nodeType||g)&&f(a,p,v))return!0}else for(;a=a[b];)if(1===a.nodeType||g){d=a[M]||(a[M]={});if((k=d[b])&&k[0]===ca&&k[1]===c)return n[2]=k[2];d[b]=n;if(n[2]=f(a,p,
|
||||
v))return!0}}},Ub=function(f){return 1<f.length?function(a,p,b){for(var g=f.length;g--;)if(!f[g](a,p,b))return!1;return!0}:f[0]},Ta=function(f,a,p,b,g){for(var c,k=[],d=0,n=f.length,e=null!=a;d<n;d++)if(c=f[d])if(!p||p(c,b,g))k.push(c),e&&a.push(d);return k},Vb=function(f,a,p,b,g,c){b&&!b[M]&&(b=Vb(b));g&&!g[M]&&(g=Vb(g,c));return pa(function(c,k,d,n){var e,r,fa=[],q=[],l=k.length,h;if(!(h=c)){h=a||"*";for(var j=d.nodeType?[d]:d,A=[],z=0,T=j.length;z<T;z++)D(h,j[z],A);h=A}h=f&&(c||!a)?Ta(h,fa,f,d,
|
||||
n):h;j=p?g||(c?f:l||b)?[]:k:h;p&&p(h,j,d,n);if(b){e=Ta(j,q);b(e,[],d,n);for(d=e.length;d--;)if(r=e[d])j[q[d]]=!(h[q[d]]=r)}if(c){if(g||f){if(g){e=[];for(d=j.length;d--;)if(r=j[d])e.push(h[d]=r);g(null,j=[],e,n)}for(d=j.length;d--;)if((r=j[d])&&-1<(e=g?Ua.call(c,r):fa[d]))c[e]=!(k[e]=r)}}else j=Ta(j===k?j.splice(l,j.length):j),g?g(null,k,j,n):Ga.apply(k,j)})},Wb=function(f){var a,p,b,g=f.length,c=G.relative[f[0].type];p=c||G.relative[" "];for(var k=c?1:0,d=Tb(function(f){return f===a},p,!0),n=Tb(function(f){return-1<
|
||||
Ua.call(a,f)},p,!0),e=[function(f,p,b){return!c&&(b||p!==Aa)||((a=p).nodeType?d(f,p,b):n(f,p,b))}];k<g;k++)if(p=G.relative[f[k].type])e=[Tb(Ub(e),p)];else{p=G.filter[f[k].type].apply(null,f[k].matches);if(p[M]){for(b=++k;b<g&&!G.relative[f[b].type];b++);return Vb(1<k&&Ub(e),1<k&&vb(f.slice(0,k-1).concat({value:" "===f[k-2].type?"*":""})).replace(wb,"$1"),p,k<b&&Wb(f.slice(k,b)),b<g&&Wb(f=f.slice(b)),b<g&&vb(f))}e.push(p)}return Ub(e)},Ba,H,G,Ka,rc,$a,Aa,ra,Ca,oa,R,ja,X,S,da,La,sa,M="sizzle"+-new Date,
|
||||
W=Pb.document,ca=0,md=0,sc=Rb(),Ja=Rb(),Da=Rb(),A=function(f,a){f===a&&(Ca=!0);return 0},T="undefined",ia=-2147483648,ea={}.hasOwnProperty,N=[],Y=N.pop,nd=N.push,Ga=N.push,tc=N.slice,Ua=N.indexOf||function(f){for(var a=0,p=this.length;a<p;a++)if(this[a]===f)return a;return-1},uc="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w","w#"),vc="\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)[\\x20\\t\\r\\n\\f]*(?:([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+uc+")|)|)[\\x20\\t\\r\\n\\f]*\\]",
|
||||
Xb=":((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+vc.replace(3,8)+")*)|.*)\\)|)",wb=RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$","g"),kd=/^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/,ld=/^[\x20\t\r\n\f]*([>+~]|[\x20\t\r\n\f])[\x20\t\r\n\f]*/,od=RegExp("=[\\x20\\t\\r\\n\\f]*([^\\]'\"]*?)[\\x20\\t\\r\\n\\f]*\\]","g"),pd=RegExp(Xb),qd=RegExp("^"+uc+"$"),xb={ID:/^#((?:\\.|[\w-]|[^\x00-\xa0])+)/,CLASS:/^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/,
|
||||
TAG:RegExp("^("+"(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w","w*")+")"),ATTR:RegExp("^"+vc),PSEUDO:RegExp("^"+Xb),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),bool:RegExp("^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$","i"),needsContext:RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)",
|
||||
"i")},rd=/^(?:input|select|textarea|button)$/i,sd=/^h\d$/i,lb=/^[^{]+\{\s*\[native \w/,gd=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Qb=/[+~]/,hd=/'|\\/g,Ha=RegExp("\\\\([\\da-f]{1,6}[\\x20\\t\\r\\n\\f]?|([\\x20\\t\\r\\n\\f])|.)","ig"),Ia=function(f,a,p){f="0x"+a-65536;return f!==f||p?a:0>f?String.fromCharCode(f+65536):String.fromCharCode(f>>10|55296,f&1023|56320)};try{Ga.apply(N=tc.call(W.childNodes),W.childNodes),N[W.childNodes.length].nodeType}catch(Zd){Ga={apply:N.length?function(f,a){nd.apply(f,tc.call(a))}:
|
||||
function(f,a){for(var p=f.length,b=0;f[p++]=a[b++];);f.length=p-1}}}H=D.support={};rc=D.isXML=function(f){return(f=f&&(f.ownerDocument||f).documentElement)?"HTML"!==f.nodeName:!1};oa=D.setDocument=function(f){var a=f?f.ownerDocument||f:W;f=a.defaultView;if(a===R||9!==a.nodeType||!a.documentElement)return R;R=a;ja=a.documentElement;X=!rc(a);f&&f!==f.top&&(f.addEventListener?f.addEventListener("unload",function(){oa()},!1):f.attachEvent&&f.attachEvent("onunload",function(){oa()}));H.attributes=qa(function(f){f.className=
|
||||
"i";return!f.getAttribute("className")});H.getElementsByTagName=qa(function(f){f.appendChild(a.createComment(""));return!f.getElementsByTagName("*").length});H.getElementsByClassName=lb.test(a.getElementsByClassName)&&qa(function(f){f.innerHTML="<div class='a'></div><div class='a i'></div>";f.firstChild.className="i";return 2===f.getElementsByClassName("i").length});H.getById=qa(function(f){ja.appendChild(f).id=M;return!a.getElementsByName||!a.getElementsByName(M).length});H.getById?(G.find.ID=function(f,
|
||||
a){if(typeof a.getElementById!==T&&X){var b=a.getElementById(f);return b&&b.parentNode?[b]:[]}},G.filter.ID=function(f){var a=f.replace(Ha,Ia);return function(f){return f.getAttribute("id")===a}}):(delete G.find.ID,G.filter.ID=function(f){var a=f.replace(Ha,Ia);return function(f){return(f=typeof f.getAttributeNode!==T&&f.getAttributeNode("id"))&&f.value===a}});G.find.TAG=H.getElementsByTagName?function(f,a){if(typeof a.getElementsByTagName!==T)return a.getElementsByTagName(f)}:function(f,a){var b,
|
||||
v=[],g=0,c=a.getElementsByTagName(f);if("*"===f){for(;b=c[g++];)1===b.nodeType&&v.push(b);return v}return c};G.find.CLASS=H.getElementsByClassName&&function(f,a){if(typeof a.getElementsByClassName!==T&&X)return a.getElementsByClassName(f)};da=[];S=[];if(H.qsa=lb.test(a.querySelectorAll))qa(function(f){f.innerHTML="<select t=''><option selected=''></option></select>";f.querySelectorAll("[t^='']").length&&S.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:''|\"\")");f.querySelectorAll("[selected]").length||S.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)");
|
||||
f.querySelectorAll(":checked").length||S.push(":checked")}),qa(function(f){var b=a.createElement("input");b.setAttribute("type","hidden");f.appendChild(b).setAttribute("name","D");f.querySelectorAll("[name=d]").length&&S.push("name[\\x20\\t\\r\\n\\f]*[*^$|!~]?=");f.querySelectorAll(":enabled").length||S.push(":enabled",":disabled");f.querySelectorAll("*,:x");S.push(",.*:")});(H.matchesSelector=lb.test(La=ja.webkitMatchesSelector||ja.mozMatchesSelector||ja.oMatchesSelector||ja.msMatchesSelector))&&
|
||||
qa(function(f){H.disconnectedMatch=La.call(f,"div");La.call(f,"[s!='']:x");da.push("!=",Xb)});S=S.length&&RegExp(S.join("|"));da=da.length&&RegExp(da.join("|"));sa=(f=lb.test(ja.compareDocumentPosition))||lb.test(ja.contains)?function(f,a){var b=9===f.nodeType?f.documentElement:f,v=a&&a.parentNode;return f===v||!(!v||!(1===v.nodeType&&(b.contains?b.contains(v):f.compareDocumentPosition&&f.compareDocumentPosition(v)&16)))}:function(f,a){if(a)for(;a=a.parentNode;)if(a===f)return!0;return!1};A=f?function(f,
|
||||
b){if(f===b)return Ca=!0,0;var g=!f.compareDocumentPosition-!b.compareDocumentPosition;if(g)return g;g=(f.ownerDocument||f)===(b.ownerDocument||b)?f.compareDocumentPosition(b):1;return g&1||!H.sortDetached&&b.compareDocumentPosition(f)===g?f===a||f.ownerDocument===W&&sa(W,f)?-1:b===a||b.ownerDocument===W&&sa(W,b)?1:ra?Ua.call(ra,f)-Ua.call(ra,b):0:g&4?-1:1}:function(f,b){if(f===b)return Ca=!0,0;var g,c=0;g=f.parentNode;var k=b.parentNode,d=[f],n=[b];if(!g||!k)return f===a?-1:b===a?1:g?-1:k?1:ra?Ua.call(ra,
|
||||
f)-Ua.call(ra,b):0;if(g===k)return pc(f,b);for(g=f;g=g.parentNode;)d.unshift(g);for(g=b;g=g.parentNode;)n.unshift(g);for(;d[c]===n[c];)c++;return c?pc(d[c],n[c]):d[c]===W?-1:n[c]===W?1:0};return a};D.matches=function(f,a){return D(f,null,null,a)};D.matchesSelector=function(f,a){(f.ownerDocument||f)!==R&&oa(f);a=a.replace(od,"='$1']");if(H.matchesSelector&&X&&(!da||!da.test(a))&&(!S||!S.test(a)))try{var b=La.call(f,a);if(b||H.disconnectedMatch||f.document&&11!==f.document.nodeType)return b}catch(g){}return 0<
|
||||
D(a,R,null,[f]).length};D.contains=function(f,a){(f.ownerDocument||f)!==R&&oa(f);return sa(f,a)};D.attr=function(f,a){(f.ownerDocument||f)!==R&&oa(f);var b=G.attrHandle[a.toLowerCase()],b=b&&ea.call(G.attrHandle,a.toLowerCase())?b(f,a,!X):void 0;return void 0!==b?b:H.attributes||!X?f.getAttribute(a):(b=f.getAttributeNode(a))&&b.specified?b.value:null};D.error=function(f){throw Error("Syntax error, unrecognized expression: "+f);};D.uniqueSort=function(f){var a,b=[],g=0,c=0;Ca=!H.detectDuplicates;ra=
|
||||
!H.sortStable&&f.slice(0);f.sort(A);if(Ca){for(;a=f[c++];)a===f[c]&&(g=b.push(c));for(;g--;)f.splice(b[g],1)}ra=null;return f};Ka=D.getText=function(f){var a,b="",g=0;if(a=f.nodeType)if(1===a||9===a||11===a){if("string"===typeof f.textContent)return f.textContent;for(f=f.firstChild;f;f=f.nextSibling)b+=Ka(f)}else{if(3===a||4===a)return f.nodeValue}else for(;a=f[g++];)b+=Ka(a);return b};G=D.selectors={cacheLength:50,createPseudo:pa,match:xb,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0},
|
||||
" ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(f){f[1]=f[1].replace(Ha,Ia);f[3]=(f[4]||f[5]||"").replace(Ha,Ia);"~="===f[2]&&(f[3]=" "+f[3]+" ");return f.slice(0,4)},CHILD:function(f){f[1]=f[1].toLowerCase();"nth"===f[1].slice(0,3)?(f[3]||D.error(f[0]),f[4]=+(f[4]?f[5]+(f[6]||1):2*("even"===f[3]||"odd"===f[3])),f[5]=+(f[7]+f[8]||"odd"===f[3])):f[3]&&D.error(f[0]);return f},PSEUDO:function(f){var a,b=!f[5]&&f[2];if(xb.CHILD.test(f[0]))return null;
|
||||
if(f[3]&&void 0!==f[4])f[2]=f[4];else if(b&&pd.test(b)&&(a=ta(b,!0))&&(a=b.indexOf(")",b.length-a)-b.length))f[0]=f[0].slice(0,a),f[2]=b.slice(0,a);return f.slice(0,3)}},filter:{TAG:function(f){var a=f.replace(Ha,Ia).toLowerCase();return"*"===f?function(){return!0}:function(f){return f.nodeName&&f.nodeName.toLowerCase()===a}},CLASS:function(f){var a=sc[f+" "];return a||(a=RegExp("(^|[\\x20\\t\\r\\n\\f])"+f+"([\\x20\\t\\r\\n\\f]|$)"))&&sc(f,function(f){return a.test("string"===typeof f.className&&
|
||||
f.className||typeof f.getAttribute!==T&&f.getAttribute("class")||"")})},ATTR:function(f,a,b){return function(g){g=D.attr(g,f);if(null==g)return"!="===a;if(!a)return!0;g+="";return"="===a?g===b:"!="===a?g!==b:"^="===a?b&&0===g.indexOf(b):"*="===a?b&&-1<g.indexOf(b):"$="===a?b&&g.slice(-b.length)===b:"~="===a?-1<(" "+g+" ").indexOf(b):"|="===a?g===b||g.slice(0,b.length+1)===b+"-":!1}},CHILD:function(f,a,b,g,c){var k="nth"!==f.slice(0,3),d="last"!==f.slice(-4),n="of-type"===a;return 1===g&&0===c?function(f){return!!f.parentNode}:
|
||||
function(a,b,p){var v,e,r,j,h;b=k!==d?"nextSibling":"previousSibling";var q=a.parentNode,l=n&&a.nodeName.toLowerCase();p=!p&&!n;if(q){if(k){for(;b;){for(e=a;e=e[b];)if(n?e.nodeName.toLowerCase()===l:1===e.nodeType)return!1;h=b="only"===f&&!h&&"nextSibling"}return!0}h=[d?q.firstChild:q.lastChild];if(d&&p){p=q[M]||(q[M]={});v=p[f]||[];j=v[0]===ca&&v[1];r=v[0]===ca&&v[2];for(e=j&&q.childNodes[j];e=++j&&e&&e[b]||(r=j=0)||h.pop();)if(1===e.nodeType&&++r&&e===a){p[f]=[ca,j,r];break}}else if(p&&(v=(a[M]||
|
||||
(a[M]={}))[f])&&v[0]===ca)r=v[1];else for(;e=++j&&e&&e[b]||(r=j=0)||h.pop();)if((n?e.nodeName.toLowerCase()===l:1===e.nodeType)&&++r)if(p&&((e[M]||(e[M]={}))[f]=[ca,r]),e===a)break;r-=c;return r===g||0===r%g&&0<=r/g}}},PSEUDO:function(f,a){var b,g=G.pseudos[f]||G.setFilters[f.toLowerCase()]||D.error("unsupported pseudo: "+f);return g[M]?g(a):1<g.length?(b=[f,f,"",a],G.setFilters.hasOwnProperty(f.toLowerCase())?pa(function(f,b){for(var p,c=g(f,a),k=c.length;k--;)p=Ua.call(f,c[k]),f[p]=!(b[p]=c[k])}):
|
||||
function(f){return g(f,0,b)}):g}},pseudos:{not:pa(function(f){var a=[],b=[],g=$a(f.replace(wb,"$1"));return g[M]?pa(function(f,a,b,p){p=g(f,null,p,[]);for(var v=f.length;v--;)if(b=p[v])f[v]=!(a[v]=b)}):function(f,c,k){a[0]=f;g(a,null,k,b);return!b.pop()}}),has:pa(function(f){return function(a){return 0<D(f,a).length}}),contains:pa(function(f){return function(a){return-1<(a.textContent||a.innerText||Ka(a)).indexOf(f)}}),lang:pa(function(f){qd.test(f||"")||D.error("unsupported lang: "+f);f=f.replace(Ha,
|
||||
Ia).toLowerCase();return function(a){var b;do if(b=X?a.lang:a.getAttribute("xml:lang")||a.getAttribute("lang"))return b=b.toLowerCase(),b===f||0===b.indexOf(f+"-");while((a=a.parentNode)&&1===a.nodeType);return!1}}),target:function(f){var a=Pb.location&&Pb.location.hash;return a&&a.slice(1)===f.id},root:function(f){return f===ja},focus:function(f){return f===R.activeElement&&(!R.hasFocus||R.hasFocus())&&!(!f.type&&!f.href&&!~f.tabIndex)},enabled:function(f){return!1===f.disabled},disabled:function(f){return!0===
|
||||
f.disabled},checked:function(f){var a=f.nodeName.toLowerCase();return"input"===a&&!!f.checked||"option"===a&&!!f.selected},selected:function(f){f.parentNode&&f.parentNode.selectedIndex;return!0===f.selected},empty:function(f){for(f=f.firstChild;f;f=f.nextSibling)if(6>f.nodeType)return!1;return!0},parent:function(f){return!G.pseudos.empty(f)},header:function(f){return sd.test(f.nodeName)},input:function(f){return rd.test(f.nodeName)},button:function(f){var a=f.nodeName.toLowerCase();return"input"===
|
||||
a&&"button"===f.type||"button"===a},text:function(f){var a;return"input"===f.nodeName.toLowerCase()&&"text"===f.type&&(null==(a=f.getAttribute("type"))||"text"===a.toLowerCase())},first:ua(function(){return[0]}),last:ua(function(f,a){return[a-1]}),eq:ua(function(f,a,b){return[0>b?b+a:b]}),even:ua(function(f,a){for(var b=0;b<a;b+=2)f.push(b);return f}),odd:ua(function(f,a){for(var b=1;b<a;b+=2)f.push(b);return f}),lt:ua(function(f,a,b){for(a=0>b?b+a:b;0<=--a;)f.push(a);return f}),gt:ua(function(f,
|
||||
a,b){for(b=0>b?b+a:b;++b<a;)f.push(b);return f})}};G.pseudos.nth=G.pseudos.eq;for(Ba in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})G.pseudos[Ba]=id(Ba);for(Ba in{submit:!0,reset:!0})G.pseudos[Ba]=jd(Ba);qc.prototype=G.filters=G.pseudos;G.setFilters=new qc;$a=D.compile=function(f,a){var b,g=[],c=[],k=Da[f+" "];if(!k){a||(a=ta(f));for(b=a.length;b--;)k=Wb(a[b]),k[M]?g.push(k):c.push(k);var d=0<g.length,n=0<c.length;b=function(f,a,b,p,v){var k,e,r,j=0,fa="0",h=f&&[],q=[],l=Aa,A=f||n&&G.find.TAG("*",
|
||||
v),z=ca+=null==l?1:Math.random()||0.1,T=A.length;for(v&&(Aa=a!==R&&a);fa!==T&&null!=(k=A[fa]);fa++){if(n&&k){for(e=0;r=c[e++];)if(r(k,a,b)){p.push(k);break}v&&(ca=z)}d&&((k=!r&&k)&&j--,f&&h.push(k))}j+=fa;if(d&&fa!==j){for(e=0;r=g[e++];)r(h,q,a,b);if(f){if(0<j)for(;fa--;)!h[fa]&&!q[fa]&&(q[fa]=Y.call(p));q=Ta(q)}Ga.apply(p,q);v&&(!f&&0<q.length&&1<j+g.length)&&D.uniqueSort(p)}v&&(ca=z,Aa=l);return h};b=d?pa(b):b;k=Da(f,b)}return k};H.sortStable=M.split("").sort(A).join("")===M;H.detectDuplicates=
|
||||
!!Ca;oa();H.sortDetached=qa(function(f){return f.compareDocumentPosition(R.createElement("div"))&1});qa(function(f){f.innerHTML="<a href='#'></a>";return"#"===f.firstChild.getAttribute("href")})||Sb("type|href|height|width",function(f,a,b){if(!b)return f.getAttribute(a,"type"===a.toLowerCase()?1:2)});(!H.attributes||!qa(function(f){f.innerHTML="<input/>";f.firstChild.setAttribute("value","");return""===f.firstChild.getAttribute("value")}))&&Sb("value",function(f,a,b){if(!b&&"input"===f.nodeName.toLowerCase())return f.defaultValue});
|
||||
qa(function(f){return null==f.getAttribute("disabled")})||Sb("checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",function(f,a,b){var g;if(!b)return!0===f[a]?a.toLowerCase():(g=f.getAttributeNode(a))&&g.specified?g.value:null});g.find=D;g.expr=D.selectors;g.expr[":"]=g.expr.pseudos;g.unique=D.uniqueSort;g.text=D.getText;g.isXMLDoc=D.isXML;g.contains=D.contains;var wc=g.expr.match.needsContext,xc=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Vc=
|
||||
/^.[^:#\[\.,]*$/;g.filter=function(f,a,b){var c=a[0];b&&(f=":not("+f+")");return 1===a.length&&1===c.nodeType?g.find.matchesSelector(c,f)?[c]:[]:g.find.matches(f,g.grep(a,function(f){return 1===f.nodeType}))};g.fn.extend({find:function(f){var a,b=[],c=this,k=c.length;if("string"!==typeof f)return this.pushStack(g(f).filter(function(){for(a=0;a<k;a++)if(g.contains(c[a],this))return!0}));for(a=0;a<k;a++)g.find(f,c[a],b);b=this.pushStack(1<k?g.unique(b):b);b.selector=this.selector?this.selector+" "+
|
||||
f:f;return b},filter:function(f){return this.pushStack(h(this,f||[],!1))},not:function(f){return this.pushStack(h(this,f||[],!0))},is:function(f){return!!h(this,"string"===typeof f&&wc.test(f)?g(f):f||[],!1).length}});var mb,y=a.document,td=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/;(g.fn.init=function(f,a){var b,c;if(!f)return this;if("string"===typeof f){if((b="<"===f.charAt(0)&&">"===f.charAt(f.length-1)&&3<=f.length?[null,f,null]:td.exec(f))&&(b[1]||!a)){if(b[1]){if(a=a instanceof g?a[0]:a,g.merge(this,
|
||||
g.parseHTML(b[1],a&&a.nodeType?a.ownerDocument||a:y,!0)),xc.test(b[1])&&g.isPlainObject(a))for(b in a)if(g.isFunction(this[b]))this[b](a[b]);else this.attr(b,a[b])}else{if((c=y.getElementById(b[2]))&&c.parentNode){if(c.id!==b[2])return mb.find(f);this.length=1;this[0]=c}this.context=y;this.selector=f}return this}return!a||a.jquery?(a||mb).find(f):this.constructor(a).find(f)}if(f.nodeType)return this.context=this[0]=f,this.length=1,this;if(g.isFunction(f))return"undefined"!==typeof mb.ready?mb.ready(f):
|
||||
f(g);void 0!==f.selector&&(this.selector=f.selector,this.context=f.context);return g.makeArray(f,this)}).prototype=g.fn;mb=g(y);var ud=/^(?:parents|prev(?:Until|All))/,vd={children:!0,contents:!0,next:!0,prev:!0};g.extend({dir:function(f,a,b){var c=[];for(f=f[a];f&&9!==f.nodeType&&(void 0===b||1!==f.nodeType||!g(f).is(b));)1===f.nodeType&&c.push(f),f=f[a];return c},sibling:function(f,a){for(var b=[];f;f=f.nextSibling)1===f.nodeType&&f!==a&&b.push(f);return b}});g.fn.extend({has:function(f){var a,
|
||||
b=g(f,this),c=b.length;return this.filter(function(){for(a=0;a<c;a++)if(g.contains(this,b[a]))return!0})},closest:function(f,a){for(var b,c=0,k=this.length,d=[],n=wc.test(f)||"string"!==typeof f?g(f,a||this.context):0;c<k;c++)for(b=this[c];b&&b!==a;b=b.parentNode)if(11>b.nodeType&&(n?-1<n.index(b):1===b.nodeType&&g.find.matchesSelector(b,f))){d.push(b);break}return this.pushStack(1<d.length?g.unique(d):d)},index:function(f){return!f?this[0]&&this[0].parentNode?this.first().prevAll().length:-1:"string"===
|
||||
typeof f?g.inArray(this[0],g(f)):g.inArray(f.jquery?f[0]:f,this)},add:function(f,a){return this.pushStack(g.unique(g.merge(this.get(),g(f,a))))},addBack:function(f){return this.add(null==f?this.prevObject:this.prevObject.filter(f))}});g.each({parent:function(f){return(f=f.parentNode)&&11!==f.nodeType?f:null},parents:function(f){return g.dir(f,"parentNode")},parentsUntil:function(f,a,b){return g.dir(f,"parentNode",b)},next:function(f){return e(f,"nextSibling")},prev:function(f){return e(f,"previousSibling")},
|
||||
nextAll:function(f){return g.dir(f,"nextSibling")},prevAll:function(f){return g.dir(f,"previousSibling")},nextUntil:function(f,a,b){return g.dir(f,"nextSibling",b)},prevUntil:function(f,a,b){return g.dir(f,"previousSibling",b)},siblings:function(f){return g.sibling((f.parentNode||{}).firstChild,f)},children:function(f){return g.sibling(f.firstChild)},contents:function(f){return g.nodeName(f,"iframe")?f.contentDocument||f.contentWindow.document:g.merge([],f.childNodes)}},function(f,a){g.fn[f]=function(b,
|
||||
c){var k=g.map(this,a,b);"Until"!==f.slice(-5)&&(c=b);c&&"string"===typeof c&&(k=g.filter(c,k));1<this.length&&(vd[f]||(k=g.unique(k)),ud.test(f)&&(k=k.reverse()));return this.pushStack(k)}});var xa=/\S+/g,yc={};g.Callbacks=function(f){var a;if("string"===typeof f){if(!(a=yc[f])){a=f;var b=yc[a]={};g.each(a.match(xa)||[],function(f,a){b[a]=!0});a=b}}else a=g.extend({},f);f=a;var c,k,d,n,e,r,j=[],h=!f.once&&[],q=function(a){k=f.memory&&a;d=!0;e=r||0;r=0;n=j.length;for(c=!0;j&&e<n;e++)if(!1===j[e].apply(a[0],
|
||||
a[1])&&f.stopOnFalse){k=!1;break}c=!1;j&&(h?h.length&&q(h.shift()):k?j=[]:l.disable())},l={add:function(){if(j){var a=j.length;(function $c(a){g.each(a,function(a,b){var p=g.type(b);"function"===p?(!f.unique||!l.has(b))&&j.push(b):b&&(b.length&&"string"!==p)&&$c(b)})})(arguments);c?n=j.length:k&&(r=a,q(k))}return this},remove:function(){j&&g.each(arguments,function(f,a){for(var b;-1<(b=g.inArray(a,j,b));)j.splice(b,1),c&&(b<=n&&n--,b<=e&&e--)});return this},has:function(f){return f?-1<g.inArray(f,
|
||||
j):!(!j||!j.length)},empty:function(){j=[];n=0;return this},disable:function(){j=h=k=void 0;return this},disabled:function(){return!j},lock:function(){h=void 0;k||l.disable();return this},locked:function(){return!h},fireWith:function(f,a){if(j&&(!d||h))a=a||[],a=[f,a.slice?a.slice():a],c?h.push(a):q(a);return this},fire:function(){l.fireWith(this,arguments);return this},fired:function(){return!!d}};return l};g.extend({Deferred:function(f){var a=[["resolve","done",g.Callbacks("once memory"),"resolved"],
|
||||
["reject","fail",g.Callbacks("once memory"),"rejected"],["notify","progress",g.Callbacks("memory")]],b="pending",c={state:function(){return b},always:function(){k.done(arguments).fail(arguments);return this},then:function(){var f=arguments;return g.Deferred(function(b){g.each(a,function(a,p){var v=g.isFunction(f[a])&&f[a];k[p[1]](function(){var f=v&&v.apply(this,arguments);if(f&&g.isFunction(f.promise))f.promise().done(b.resolve).fail(b.reject).progress(b.notify);else b[p[0]+"With"](this===c?b.promise():
|
||||
this,v?[f]:arguments)})});f=null}).promise()},promise:function(f){return null!=f?g.extend(f,c):c}},k={};c.pipe=c.then;g.each(a,function(f,g){var d=g[2],n=g[3];c[g[1]]=d.add;n&&d.add(function(){b=n},a[f^1][2].disable,a[2][2].lock);k[g[0]]=function(){k[g[0]+"With"](this===k?c:this,arguments);return this};k[g[0]+"With"]=d.fireWith});c.promise(k);f&&f.call(k,k);return k},when:function(f){var a=0,b=n.call(arguments),c=b.length,k=1!==c||f&&g.isFunction(f.promise)?c:0,d=1===k?f:g.Deferred(),e=function(f,
|
||||
a,b){return function(g){a[f]=this;b[f]=1<arguments.length?n.call(arguments):g;b===r?d.notifyWith(a,b):--k||d.resolveWith(a,b)}},r,j,h;if(1<c){r=Array(c);j=Array(c);for(h=Array(c);a<c;a++)b[a]&&g.isFunction(b[a].promise)?b[a].promise().done(e(a,h,b)).fail(d.reject).progress(e(a,j,r)):--k}k||d.resolveWith(h,b);return d.promise()}});var yb;g.fn.ready=function(f){g.ready.promise().done(f);return this};g.extend({isReady:!1,readyWait:1,holdReady:function(f){f?g.readyWait++:g.ready(!0)},ready:function(f){if(!(!0===
|
||||
f?--g.readyWait:g.isReady)){if(!y.body)return setTimeout(g.ready);g.isReady=!0;!0!==f&&0<--g.readyWait||(yb.resolveWith(y,[g]),g.fn.trigger&&g(y).trigger("ready").off("ready"))}}});g.ready.promise=function(f){if(!yb)if(yb=g.Deferred(),"complete"===y.readyState)setTimeout(g.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",t,!1),a.addEventListener("load",t,!1);else{y.attachEvent("onreadystatechange",t);a.attachEvent("onload",t);var b=!1;try{b=null==a.frameElement&&y.documentElement}catch(c){}b&&
|
||||
b.doScroll&&function Uc(){if(!g.isReady){try{b.doScroll("left")}catch(f){return setTimeout(Uc,50)}j();g.ready()}}()}return yb.promise(f)};var la="undefined",zc;for(zc in g(w))break;w.ownLast="0"!==zc;w.inlineBlockNeedsLayout=!1;g(function(){var f,a,b=y.getElementsByTagName("body")[0];if(b){f=y.createElement("div");f.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";a=y.createElement("div");b.appendChild(f).appendChild(a);if(typeof a.style.zoom!==la&&(a.style.cssText=
|
||||
"border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1",w.inlineBlockNeedsLayout=3===a.offsetWidth))b.style.zoom=1;b.removeChild(f)}});var wd=y.createElement("div");if(null==w.deleteExpando){w.deleteExpando=!0;try{delete wd.test}catch($d){w.deleteExpando=!1}}g.acceptData=function(f){var a=g.noData[(f.nodeName+" ").toLowerCase()],b=+f.nodeType||1;return 1!==b&&9!==b?!1:!a||!0!==a&&f.getAttribute("classid")===a};var Xc=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Wc=/([A-Z])/g;g.extend({cache:{},noData:{"applet ":!0,
|
||||
"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(f){f=f.nodeType?g.cache[f[g.expando]]:f[g.expando];return!!f&&!u(f)},data:function(f,a,g){return b(f,a,g)},removeData:function(f,a){return c(f,a)},_data:function(f,a,g){return b(f,a,g,!0)},_removeData:function(f,a){return c(f,a,!0)}});g.fn.extend({data:function(f,a){var b,c,k,d=this[0],n=d&&d.attributes;if(void 0===f){if(this.length&&(k=g.data(d),1===d.nodeType&&!g._data(d,"parsedAttrs"))){for(b=n.length;b--;)c=n[b].name,
|
||||
0===c.indexOf("data-")&&(c=g.camelCase(c.slice(5)),s(d,c,k[c]));g._data(d,"parsedAttrs",!0)}return k}return"object"===typeof f?this.each(function(){g.data(this,f)}):1<arguments.length?this.each(function(){g.data(this,f,a)}):d?s(d,f,g.data(d,f)):void 0},removeData:function(f){return this.each(function(){g.removeData(this,f)})}});g.extend({queue:function(f,a,b){var c;if(f)return a=(a||"fx")+"queue",c=g._data(f,a),b&&(!c||g.isArray(b)?c=g._data(f,a,g.makeArray(b)):c.push(b)),c||[]},dequeue:function(f,
|
||||
a){a=a||"fx";var b=g.queue(f,a),c=b.length,k=b.shift(),d=g._queueHooks(f,a),n=function(){g.dequeue(f,a)};"inprogress"===k&&(k=b.shift(),c--);k&&("fx"===a&&b.unshift("inprogress"),delete d.stop,k.call(f,n,d));!c&&d&&d.empty.fire()},_queueHooks:function(f,a){var b=a+"queueHooks";return g._data(f,b)||g._data(f,b,{empty:g.Callbacks("once memory").add(function(){g._removeData(f,a+"queue");g._removeData(f,b)})})}});g.fn.extend({queue:function(f,a){var b=2;"string"!==typeof f&&(a=f,f="fx",b--);return arguments.length<
|
||||
b?g.queue(this[0],f):void 0===a?this:this.each(function(){var b=g.queue(this,f,a);g._queueHooks(this,f);"fx"===f&&"inprogress"!==b[0]&&g.dequeue(this,f)})},dequeue:function(f){return this.each(function(){g.dequeue(this,f)})},clearQueue:function(f){return this.queue(f||"fx",[])},promise:function(f,a){var b,c=1,k=g.Deferred(),d=this,n=this.length,e=function(){--c||k.resolveWith(d,[d])};"string"!==typeof f&&(a=f,f=void 0);for(f=f||"fx";n--;)if((b=g._data(d[n],f+"queueHooks"))&&b.empty)c++,b.empty.add(e);
|
||||
e();return k.promise(a)}});var zb=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Qa=["Top","Right","Bottom","Left"],hb=function(a,b){a=b||a;return"none"===g.css(a,"display")||!g.contains(a.ownerDocument,a)},Va=g.access=function(a,b,c,k,d,n,e){var r=0,j=a.length,h=null==c;if("object"===g.type(c))for(r in d=!0,c)g.access(a,b,r,c[r],!0,n,e);else if(void 0!==k&&(d=!0,g.isFunction(k)||(e=!0),h&&(e?(b.call(a,k),b=null):(h=b,b=function(a,f,b){return h.call(g(a),b)})),b))for(;r<j;r++)b(a[r],c,e?k:k.call(a[r],
|
||||
r,b(a[r],c)));return d?a:h?b.call(a):j?b(a[0],c):n},Mb=/^(?:checkbox|radio)$/i,Yb=y.createDocumentFragment(),Z=y.createElement("div"),nb=y.createElement("input");Z.setAttribute("className","t");Z.innerHTML=" <link/><table></table><a href='/a'>a</a>";w.leadingWhitespace=3===Z.firstChild.nodeType;w.tbody=!Z.getElementsByTagName("tbody").length;w.htmlSerialize=!!Z.getElementsByTagName("link").length;w.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML;nb.type="checkbox";nb.checked=
|
||||
!0;Yb.appendChild(nb);w.appendChecked=nb.checked;Z.innerHTML="<textarea>x</textarea>";w.noCloneChecked=!!Z.cloneNode(!0).lastChild.defaultValue;Yb.appendChild(Z);Z.innerHTML="<input type='radio' checked='checked' name='t'/>";w.checkClone=Z.cloneNode(!0).cloneNode(!0).lastChild.checked;w.noCloneEvent=!0;Z.attachEvent&&(Z.attachEvent("onclick",function(){w.noCloneEvent=!1}),Z.cloneNode(!0).click());if(null==w.deleteExpando){w.deleteExpando=!0;try{delete Z.test}catch(ae){w.deleteExpando=!1}}var Yb=Z=
|
||||
nb=null,Ab,Bb,Ac=y.createElement("div");for(Ab in{submit:!0,change:!0,focusin:!0})if(Bb="on"+Ab,!(w[Ab+"Bubbles"]=Bb in a))Ac.setAttribute(Bb,"t"),w[Ab+"Bubbles"]=!1===Ac.attributes[Bb].expando;var Zb=/^(?:input|select|textarea)$/i,xd=/^key/,yd=/^(?:mouse|contextmenu)|click/,Bc=/^(?:focusinfocus|focusoutblur)$/,Cc=/^([^.]*)(?:\.(.+)|)$/;g.event={global:{},add:function(a,b,c,k,d){var n,e,r,j,h,q,l,A,z;if(r=g._data(a)){c.handler&&(j=c,c=j.handler,d=j.selector);c.guid||(c.guid=g.guid++);if(!(e=r.events))e=
|
||||
r.events={};if(!(h=r.handle))h=r.handle=function(a){return typeof g!==la&&(!a||g.event.triggered!==a.type)?g.event.dispatch.apply(h.elem,arguments):void 0},h.elem=a;b=(b||"").match(xa)||[""];for(r=b.length;r--;)if(n=Cc.exec(b[r])||[],A=q=n[1],z=(n[2]||"").split(".").sort(),A){n=g.event.special[A]||{};A=(d?n.delegateType:n.bindType)||A;n=g.event.special[A]||{};q=g.extend({type:A,origType:q,data:k,handler:c,guid:c.guid,selector:d,needsContext:d&&g.expr.match.needsContext.test(d),namespace:z.join(".")},
|
||||
j);if(!(l=e[A]))if(l=e[A]=[],l.delegateCount=0,!n.setup||!1===n.setup.call(a,k,z,h))a.addEventListener?a.addEventListener(A,h,!1):a.attachEvent&&a.attachEvent("on"+A,h);n.add&&(n.add.call(a,q),q.handler.guid||(q.handler.guid=c.guid));d?l.splice(l.delegateCount++,0,q):l.push(q);g.event.global[A]=!0}a=null}},remove:function(a,b,c,k,d){var n,e,r,j,h,q,l,A,z,T,t,m=g.hasData(a)&&g._data(a);if(m&&(q=m.events)){b=(b||"").match(xa)||[""];for(h=b.length;h--;)if(r=Cc.exec(b[h])||[],z=t=r[1],T=(r[2]||"").split(".").sort(),
|
||||
z){l=g.event.special[z]||{};z=(k?l.delegateType:l.bindType)||z;A=q[z]||[];r=r[2]&&RegExp("(^|\\.)"+T.join("\\.(?:.*\\.|)")+"(\\.|$)");for(j=n=A.length;n--;)if(e=A[n],(d||t===e.origType)&&(!c||c.guid===e.guid)&&(!r||r.test(e.namespace))&&(!k||k===e.selector||"**"===k&&e.selector))A.splice(n,1),e.selector&&A.delegateCount--,l.remove&&l.remove.call(a,e);j&&!A.length&&((!l.teardown||!1===l.teardown.call(a,T,m.handle))&&g.removeEvent(a,z,m.handle),delete q[z])}else for(z in q)g.event.remove(a,z+b[h],c,
|
||||
k,!0);g.isEmptyObject(q)&&(delete m.handle,g._removeData(a,"events"))}},trigger:function(f,b,c,k){var d,n,e,r,j,h,q=[c||y],l=za.call(f,"type")?f.type:f;j=za.call(f,"namespace")?f.namespace.split("."):[];e=d=c=c||y;if(!(3===c.nodeType||8===c.nodeType)&&!Bc.test(l+g.event.triggered))if(0<=l.indexOf(".")&&(j=l.split("."),l=j.shift(),j.sort()),n=0>l.indexOf(":")&&"on"+l,f=f[g.expando]?f:new g.Event(l,"object"===typeof f&&f),f.isTrigger=k?2:3,f.namespace=j.join("."),f.namespace_re=f.namespace?RegExp("(^|\\.)"+
|
||||
j.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,f.result=void 0,f.target||(f.target=c),b=null==b?[f]:g.makeArray(b,[f]),j=g.event.special[l]||{},k||!(j.trigger&&!1===j.trigger.apply(c,b))){if(!k&&!j.noBubble&&!g.isWindow(c)){r=j.delegateType||l;Bc.test(r+l)||(e=e.parentNode);for(;e;e=e.parentNode)q.push(e),d=e;if(d===(c.ownerDocument||y))q.push(d.defaultView||d.parentWindow||a)}for(h=0;(e=q[h++])&&!f.isPropagationStopped();)if(f.type=1<h?r:j.bindType||l,(d=(g._data(e,"events")||{})[f.type]&&g._data(e,"handle"))&&
|
||||
d.apply(e,b),(d=n&&e[n])&&d.apply&&g.acceptData(e))f.result=d.apply(e,b),!1===f.result&&f.preventDefault();f.type=l;if(!k&&!f.isDefaultPrevented()&&(!j._default||!1===j._default.apply(q.pop(),b))&&g.acceptData(c)&&n&&c[l]&&!g.isWindow(c)){(d=c[n])&&(c[n]=null);g.event.triggered=l;try{c[l]()}catch(A){}g.event.triggered=void 0;d&&(c[n]=d)}return f.result}},dispatch:function(a){a=g.event.fix(a);var b,c,k,d,e=[],r=n.call(arguments);b=(g._data(this,"events")||{})[a.type]||[];var j=g.event.special[a.type]||
|
||||
{};r[0]=a;a.delegateTarget=this;if(!(j.preDispatch&&!1===j.preDispatch.call(this,a))){e=g.event.handlers.call(this,a,b);for(b=0;(k=e[b++])&&!a.isPropagationStopped();){a.currentTarget=k.elem;for(d=0;(c=k.handlers[d++])&&!a.isImmediatePropagationStopped();)if(!a.namespace_re||a.namespace_re.test(c.namespace))if(a.handleObj=c,a.data=c.data,c=((g.event.special[c.origType]||{}).handle||c.handler).apply(k.elem,r),void 0!==c&&!1===(a.result=c))a.preventDefault(),a.stopPropagation()}j.postDispatch&&j.postDispatch.call(this,
|
||||
a);return a.result}},handlers:function(a,b){var c,k,d,n,e=[],r=b.delegateCount,j=a.target;if(r&&j.nodeType&&(!a.button||"click"!==a.type))for(;j!=this;j=j.parentNode||this)if(1===j.nodeType&&(!0!==j.disabled||"click"!==a.type)){d=[];for(n=0;n<r;n++)k=b[n],c=k.selector+" ",void 0===d[c]&&(d[c]=k.needsContext?0<=g(c,this).index(j):g.find(c,this,null,[j]).length),d[c]&&d.push(k);d.length&&e.push({elem:j,handlers:d})}r<b.length&&e.push({elem:this,handlers:b.slice(r)});return e},fix:function(a){if(a[g.expando])return a;
|
||||
var b,c,k;b=a.type;var d=a,n=this.fixHooks[b];n||(this.fixHooks[b]=n=yd.test(b)?this.mouseHooks:xd.test(b)?this.keyHooks:{});k=n.props?this.props.concat(n.props):this.props;a=new g.Event(d);for(b=k.length;b--;)c=k[b],a[c]=d[c];a.target||(a.target=d.srcElement||y);3===a.target.nodeType&&(a.target=a.target.parentNode);a.metaKey=!!a.metaKey;return n.filter?n.filter(a,d):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
|
||||
fixHooks:{},keyHooks:{props:["char","charCode","key","keyCode"],filter:function(a,b){null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var g,c,k=b.button,d=b.fromElement;null==a.pageX&&null!=b.clientX&&(g=a.target.ownerDocument||y,c=g.documentElement,g=g.body,a.pageX=b.clientX+(c&&c.scrollLeft||g&&g.scrollLeft||0)-(c&&c.clientLeft||
|
||||
g&&g.clientLeft||0),a.pageY=b.clientY+(c&&c.scrollTop||g&&g.scrollTop||0)-(c&&c.clientTop||g&&g.clientTop||0));!a.relatedTarget&&d&&(a.relatedTarget=d===a.target?b.toElement:d);!a.which&&void 0!==k&&(a.which=k&1?1:k&2?3:k&4?2:0);return a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==K()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){if(this===K()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if(g.nodeName(this,
|
||||
"input")&&"checkbox"===this.type&&this.click)return this.click(),!1},_default:function(a){return g.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,k){a=g.extend(new g.Event,c,{type:a,isSimulated:!0,originalEvent:{}});k?g.event.trigger(a,null,b):g.event.dispatch.call(b,a);a.isDefaultPrevented()&&c.preventDefault()}};g.removeEvent=y.removeEventListener?function(a,b,g){a.removeEventListener&&a.removeEventListener(b,
|
||||
g,!1)}:function(a,b,g){b="on"+b;a.detachEvent&&(typeof a[b]===la&&(a[b]=null),a.detachEvent(b,g))};g.Event=function(a,b){if(!(this instanceof g.Event))return new g.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&(!1===a.returnValue||a.getPreventDefault&&a.getPreventDefault())?d:q):this.type=a;b&&g.extend(this,b);this.timeStamp=a&&a.timeStamp||g.now();this[g.expando]=!0};g.Event.prototype={isDefaultPrevented:q,isPropagationStopped:q,
|
||||
isImmediatePropagationStopped:q,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=d;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=d;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=d;this.stopPropagation()}};g.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){g.event.special[a]={delegateType:b,
|
||||
bindType:b,handle:function(a){var f,c=a.relatedTarget,k=a.handleObj;if(!c||c!==this&&!g.contains(this,c))a.type=k.origType,f=k.handler.apply(this,arguments),a.type=b;return f}}});w.submitBubbles||(g.event.special.submit={setup:function(){if(g.nodeName(this,"form"))return!1;g.event.add(this,"click._submit keypress._submit",function(a){a=a.target;if((a=g.nodeName(a,"input")||g.nodeName(a,"button")?a.form:void 0)&&!g._data(a,"submitBubbles"))g.event.add(a,"submit._submit",function(a){a._submit_bubble=
|
||||
!0}),g._data(a,"submitBubbles",!0)})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&g.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(g.nodeName(this,"form"))return!1;g.event.remove(this,"._submit")}});w.changeBubbles||(g.event.special.change={setup:function(){if(Zb.test(this.nodeName)){if("checkbox"===this.type||"radio"===this.type)g.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&
|
||||
(this._just_changed=!0)}),g.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1);g.event.simulate("change",this,a,!0)});return!1}g.event.add(this,"beforeactivate._change",function(a){a=a.target;Zb.test(a.nodeName)&&!g._data(a,"changeBubbles")&&(g.event.add(a,"change._change",function(a){this.parentNode&&(!a.isSimulated&&!a.isTrigger)&&g.event.simulate("change",this.parentNode,a,!0)}),g._data(a,"changeBubbles",!0))})},handle:function(a){var b=a.target;
|
||||
if(this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type)return a.handleObj.handler.apply(this,arguments)},teardown:function(){g.event.remove(this,"._change");return!Zb.test(this.nodeName)}});w.focusinBubbles||g.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){g.event.simulate(b,a.target,g.event.fix(a),!0)};g.event.special[b]={setup:function(){var k=this.ownerDocument||this,d=g._data(k,b);d||k.addEventListener(a,c,!0);g._data(k,b,(d||0)+1)},teardown:function(){var k=
|
||||
this.ownerDocument||this,d=g._data(k,b)-1;d?g._data(k,b,d):(k.removeEventListener(a,c,!0),g._removeData(k,b))}}});g.fn.extend({on:function(a,b,c,k,d){var n,e;if("object"===typeof a){"string"!==typeof b&&(c=c||b,b=void 0);for(n in a)this.on(n,b,c,a[n],d);return this}null==c&&null==k?(k=b,c=b=void 0):null==k&&("string"===typeof b?(k=c,c=void 0):(k=c,c=b,b=void 0));if(!1===k)k=q;else if(!k)return this;1===d&&(e=k,k=function(a){g().off(a);return e.apply(this,arguments)},k.guid=e.guid||(e.guid=g.guid++));
|
||||
return this.each(function(){g.event.add(this,a,k,c,b)})},one:function(a,b,g,c){return this.on(a,b,g,c,1)},off:function(a,b,c){var k;if(a&&a.preventDefault&&a.handleObj)return k=a.handleObj,g(a.delegateTarget).off(k.namespace?k.origType+"."+k.namespace:k.origType,k.selector,k.handler),this;if("object"===typeof a){for(k in a)this.off(k,b,a[k]);return this}if(!1===b||"function"===typeof b)c=b,b=void 0;!1===c&&(c=q);return this.each(function(){g.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){g.event.trigger(a,
|
||||
b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return g.event.trigger(a,b,c,!0)}});var mc="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",zd=/ jQuery\d+="(?:null|\d+)"/g,Dc=RegExp("<(?:"+mc+")[\\s/>]","i"),$b=/^\s+/,Ec=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Fc=/<([\w:]+)/,Gc=/<tbody/i,Ad=/<|&#?\w+;/,Bd=/<(?:script|style|link)/i,Cd=/checked\s*(?:[^=]|=\s*.checked.)/i,
|
||||
Hc=/^$|\/(?:java|ecma)script/i,Yc=/^true\/(.*)/,Dd=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ka={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:w.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},ac=
|
||||
B(y).appendChild(y.createElement("div"));ka.optgroup=ka.option;ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead;ka.th=ka.td;g.extend({clone:function(a,b,c){var k,d,n,e,r,j=g.contains(a.ownerDocument,a);w.html5Clone||g.isXMLDoc(a)||!Dc.test("<"+a.nodeName+">")?n=a.cloneNode(!0):(ac.innerHTML=a.outerHTML,ac.removeChild(n=ac.firstChild));if((!w.noCloneEvent||!w.noCloneChecked)&&(1===a.nodeType||11===a.nodeType)&&!g.isXMLDoc(a)){k=E(n);r=E(a);for(e=0;null!=(d=r[e]);++e)if(k[e]){var h=k[e],l=void 0,q=
|
||||
void 0,A=void 0;if(1===h.nodeType){l=h.nodeName.toLowerCase();if(!w.noCloneEvent&&h[g.expando]){A=g._data(h);for(q in A.events)g.removeEvent(h,q,A.handle);h.removeAttribute(g.expando)}if("script"===l&&h.text!==d.text)Ea(h).text=d.text,U(h);else if("object"===l)h.parentNode&&(h.outerHTML=d.outerHTML),w.html5Clone&&(d.innerHTML&&!g.trim(h.innerHTML))&&(h.innerHTML=d.innerHTML);else if("input"===l&&Mb.test(d.type))h.defaultChecked=h.checked=d.checked,h.value!==d.value&&(h.value=d.value);else if("option"===
|
||||
l)h.defaultSelected=h.selected=d.defaultSelected;else if("input"===l||"textarea"===l)h.defaultValue=d.defaultValue}}}if(b)if(c){r=r||E(a);k=k||E(n);for(e=0;null!=(d=r[e]);e++)Fa(d,k[e])}else Fa(a,n);k=E(n,"script");0<k.length&&Q(k,!j&&E(a,"script"));return n},buildFragment:function(a,b,c,k){for(var d,n,e,r,j,h,l=a.length,q=B(b),A=[],z=0;z<l;z++)if((n=a[z])||0===n)if("object"===g.type(n))g.merge(A,n.nodeType?[n]:n);else if(Ad.test(n)){e=e||q.appendChild(b.createElement("div"));r=(Fc.exec(n)||["",""])[1].toLowerCase();
|
||||
h=ka[r]||ka._default;e.innerHTML=h[1]+n.replace(Ec,"<$1></$2>")+h[2];for(d=h[0];d--;)e=e.lastChild;!w.leadingWhitespace&&$b.test(n)&&A.push(b.createTextNode($b.exec(n)[0]));if(!w.tbody)for(d=(n="table"===r&&!Gc.test(n)?e.firstChild:"<table>"===h[1]&&!Gc.test(n)?e:0)&&n.childNodes.length;d--;)g.nodeName(j=n.childNodes[d],"tbody")&&!j.childNodes.length&&n.removeChild(j);g.merge(A,e.childNodes);for(e.textContent="";e.firstChild;)e.removeChild(e.firstChild);e=q.lastChild}else A.push(b.createTextNode(n));
|
||||
e&&q.removeChild(e);w.appendChecked||g.grep(E(A,"input"),rb);for(z=0;n=A[z++];)if(!(k&&-1!==g.inArray(n,k))&&(a=g.contains(n.ownerDocument,n),e=E(q.appendChild(n),"script"),a&&Q(e),c))for(d=0;n=e[d++];)Hc.test(n.type||"")&&c.push(n);return q},cleanData:function(a,b){for(var c,d,n,e,r=0,j=g.expando,h=g.cache,l=w.deleteExpando,q=g.event.special;null!=(c=a[r]);r++)if(b||g.acceptData(c))if(e=(n=c[j])&&h[n]){if(e.events)for(d in e.events)q[d]?g.event.remove(c,d):g.removeEvent(c,d,e.handle);h[n]&&(delete h[n],
|
||||
l?delete c[j]:typeof c.removeAttribute!==la?c.removeAttribute(j):c[j]=null,k.push(n))}}});g.fn.extend({text:function(a){return Va(this,function(a){return void 0===a?g.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&Ya(this,a).appendChild(a)})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||
|
||||
11===this.nodeType||9===this.nodeType){var b=Ya(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,k=a?g.filter(a,this):this,d=0;null!=(c=k[d]);d++)!b&&1===c.nodeType&&g.cleanData(E(c)),c.parentNode&&(b&&g.contains(c.ownerDocument,
|
||||
c)&&Q(E(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){for(1===a.nodeType&&g.cleanData(E(a,!1));a.firstChild;)a.removeChild(a.firstChild);a.options&&g.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){a=null==a?!1:a;b=null==b?a:b;return this.map(function(){return g.clone(this,a,b)})},html:function(a){return Va(this,function(a){var f=this[0]||{},b=0,c=this.length;if(void 0===a)return 1===f.nodeType?f.innerHTML.replace(zd,
|
||||
""):void 0;if("string"===typeof a&&!Bd.test(a)&&(w.htmlSerialize||!Dc.test(a))&&(w.leadingWhitespace||!$b.test(a))&&!ka[(Fc.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ec,"<$1></$2>");try{for(;b<c;b++)f=this[b]||{},1===f.nodeType&&(g.cleanData(E(f,!1)),f.innerHTML=a);f=0}catch(k){}}f&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];this.domManip(arguments,function(b){a=this.parentNode;g.cleanData(E(this));a&&a.replaceChild(b,this)});return a&&(a.length||
|
||||
a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=r.apply([],a);var c,k,d,n,e=0,j=this.length,h=this,l=j-1,q=a[0],A=g.isFunction(q);if(A||1<j&&"string"===typeof q&&!w.checkClone&&Cd.test(q))return this.each(function(c){var g=h.eq(c);A&&(a[0]=q.call(this,c,g.html()));g.domManip(a,b)});if(j&&(n=g.buildFragment(a,this[0].ownerDocument,!1,this),c=n.firstChild,1===n.childNodes.length&&(n=c),c)){d=g.map(E(n,"script"),Ea);for(k=d.length;e<j;e++)c=n,e!==
|
||||
l&&(c=g.clone(c,!0,!0),k&&g.merge(d,E(c,"script"))),b.call(this[e],c,e);if(k){n=d[d.length-1].ownerDocument;g.map(d,U);for(e=0;e<k;e++)if(c=d[e],Hc.test(c.type||"")&&!g._data(c,"globalEval")&&g.contains(n,c))c.src?g._evalUrl&&g._evalUrl(c.src):g.globalEval((c.text||c.textContent||c.innerHTML||"").replace(Dd,""))}n=c=null}return this}});g.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){g.fn[a]=function(a){for(var f=0,c=[],
|
||||
k=g(a),d=k.length-1;f<=d;f++)a=f===d?this:this.clone(!0),g(k[f])[b](a),z.apply(c,a.get());return this.pushStack(c)}});var eb,nc={},ob,Cb,ab=y.createElement("div");ab.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";ob=ab.getElementsByTagName("a")[0];ob.style.cssText="float:left;opacity:.5";w.opacity=/^0.5/.test(ob.style.opacity);w.cssFloat=!!ob.style.cssFloat;ab.style.backgroundClip="content-box";ab.cloneNode(!0).style.backgroundClip="";w.clearCloneStyle="content-box"===
|
||||
ab.style.backgroundClip;ob=ab=null;w.shrinkWrapBlocks=function(){var a,b,c;if(null==Cb){a=y.getElementsByTagName("body")[0];if(!a)return;b=y.createElement("div");c=y.createElement("div");a.appendChild(b).appendChild(c);Cb=!1;typeof c.style.zoom!==la&&(c.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0;width:1px;padding:1px;zoom:1",c.innerHTML="<div></div>",c.firstChild.style.width="5px",Cb=3!==c.offsetWidth);
|
||||
a.removeChild(b)}return Cb};var Ic=/^margin/,sb=RegExp("^("+zb+")(?!px)[a-z%]+$","i"),Ra,Sa,Ed=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ra=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Sa=function(a,b,c){var k,d,n=a.style;d=(c=c||Ra(a))?c.getPropertyValue(b)||c[b]:void 0;c&&(""===d&&!g.contains(a.ownerDocument,a)&&(d=g.style(a,b)),sb.test(d)&&Ic.test(b)&&(a=n.width,b=n.minWidth,k=n.maxWidth,n.minWidth=n.maxWidth=n.width=d,d=c.width,n.width=a,n.minWidth=b,n.maxWidth=
|
||||
k));return void 0===d?d:d+""}):y.documentElement.currentStyle&&(Ra=function(a){return a.currentStyle},Sa=function(a,b,c){var g,k,d,n=a.style;d=(c=c||Ra(a))?c[b]:void 0;null==d&&(n&&n[b])&&(d=n[b]);if(sb.test(d)&&!Ed.test(b)){c=n.left;if(k=(g=a.runtimeStyle)&&g.left)g.left=a.currentStyle.left;n.left="fontSize"===b?"1em":d;d=n.pixelLeft+"px";n.left=c;k&&(g.left=k)}return void 0===d?d:d+""||"auto"});var dc=function(){var f,b,c=y.getElementsByTagName("body")[0];c&&(f=y.createElement("div"),b=y.createElement("div"),
|
||||
f.style.cssText=bc,c.appendChild(f).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%",g.swap(c,null!=c.style.zoom?{zoom:1}:{},function(){cc=4===b.offsetWidth}),Db=!0,Eb=!1,Fb=!0,a.getComputedStyle&&(Eb="1%"!==(a.getComputedStyle(b,null)||{}).top,Db="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width),c.removeChild(f),b=c=null)},pb,Gb,cc,Db,Eb,Fb,
|
||||
bb=y.createElement("div"),bc="border:0;width:0;height:0;position:absolute;top:0;left:-9999px";bb.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";pb=bb.getElementsByTagName("a")[0];pb.style.cssText="float:left;opacity:.5";w.opacity=/^0.5/.test(pb.style.opacity);w.cssFloat=!!pb.style.cssFloat;bb.style.backgroundClip="content-box";bb.cloneNode(!0).style.backgroundClip="";w.clearCloneStyle="content-box"===bb.style.backgroundClip;pb=bb=null;g.extend(w,{reliableHiddenOffsets:function(){if(null!=
|
||||
Gb)return Gb;var a,b,c;b=y.createElement("div");var g=y.getElementsByTagName("body")[0];if(g)return b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=y.createElement("div"),a.style.cssText=bc,g.appendChild(a).appendChild(b),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",b=b.getElementsByTagName("td"),b[0].style.cssText="padding:0;margin:0;border:0;display:none",c=0===b[0].offsetHeight,b[0].style.display="",b[1].style.display=
|
||||
"none",Gb=c&&0===b[0].offsetHeight,g.removeChild(a),Gb},boxSizing:function(){null==cc&&dc();return cc},boxSizingReliable:function(){null==Db&&dc();return Db},pixelPosition:function(){null==Eb&&dc();return Eb},reliableMarginRight:function(){var f,b,c,g;if(null==Fb&&a.getComputedStyle){f=y.getElementsByTagName("body")[0];if(!f)return;b=y.createElement("div");c=y.createElement("div");b.style.cssText=bc;f.appendChild(b).appendChild(c);g=c.appendChild(y.createElement("div"));g.style.cssText=c.style.cssText=
|
||||
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0";g.style.marginRight=g.style.width="0";c.style.width="1px";Fb=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight);f.removeChild(b)}return Fb}});g.swap=function(a,b,c,g){var k,d={};for(k in b)d[k]=a.style[k],a.style[k]=b[k];c=c.apply(a,g||[]);for(k in b)a.style[k]=d[k];return c};var ec=/alpha\([^)]*\)/i,Fd=/opacity\s*=\s*([^)]*)/,Gd=/^(none|table(?!-c[ea]).+)/,Zc=RegExp("^("+
|
||||
zb+")(.*)$","i"),Hd=RegExp("^([+-])=("+zb+")","i"),Id={position:"absolute",visibility:"hidden",display:"block"},Jc={letterSpacing:0,fontWeight:400},oc=["Webkit","O","Moz","ms"];g.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Sa(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":w.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,k){if(a&&!(3===a.nodeType||
|
||||
8===a.nodeType||!a.style)){var d,n,e,r=g.camelCase(b),j=a.style;b=g.cssProps[r]||(g.cssProps[r]=gb(j,r));e=g.cssHooks[b]||g.cssHooks[r];if(void 0!==c){n=typeof c;if("string"===n&&(d=Hd.exec(c)))c=(d[1]+1)*d[2]+parseFloat(g.css(a,b)),n="number";if(!(null==c||c!==c))if("number"===n&&!g.cssNumber[r]&&(c+="px"),!w.clearCloneStyle&&(""===c&&0===b.indexOf("background"))&&(j[b]="inherit"),!e||!("set"in e)||void 0!==(c=e.set(a,c,k)))try{j[b]="",j[b]=c}catch(h){}}else return e&&"get"in e&&void 0!==(d=e.get(a,
|
||||
!1,k))?d:j[b]}},css:function(a,b,c,k){var d,n;n=g.camelCase(b);b=g.cssProps[n]||(g.cssProps[n]=gb(a.style,n));(n=g.cssHooks[b]||g.cssHooks[n])&&"get"in n&&(d=n.get(a,!0,c));void 0===d&&(d=Sa(a,b,k));"normal"===d&&b in Jc&&(d=Jc[b]);return""===c||c?(a=parseFloat(d),!0===c||g.isNumeric(a)?a||0:d):d}});g.each(["height","width"],function(a,b){g.cssHooks[b]={get:function(a,f,c){if(f)return 0===a.offsetWidth&&Gd.test(g.css(a,"display"))?g.swap(a,Id,function(){return aa(a,b,c)}):aa(a,b,c)},set:function(a,
|
||||
f,c){var k=c&&Ra(a);return ma(a,f,c?x(a,b,c,w.boxSizing()&&"border-box"===g.css(a,"boxSizing",!1,k),k):0)}}});w.opacity||(g.cssHooks.opacity={get:function(a,b){return Fd.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?0.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,k=a.currentStyle,d=g.isNumeric(b)?"alpha(opacity="+100*b+")":"",n=k&&k.filter||c.filter||"";c.zoom=1;if((1<=b||""===b)&&""===g.trim(n.replace(ec,""))&&c.removeAttribute)if(c.removeAttribute("filter"),
|
||||
""===b||k&&!k.filter)return;c.filter=ec.test(n)?n.replace(ec,d):n+" "+d}});g.cssHooks.marginRight=fb(w.reliableMarginRight,function(a,b){if(b)return g.swap(a,{display:"inline-block"},Sa,[a,"marginRight"])});g.each({margin:"",padding:"",border:"Width"},function(a,b){g.cssHooks[a+b]={expand:function(c){var g=0,k={};for(c="string"===typeof c?c.split(" "):[c];4>g;g++)k[a+Qa[g]+b]=c[g]||c[g-2]||c[0];return k}};Ic.test(a)||(g.cssHooks[a+b].set=ma)});g.fn.extend({css:function(a,b){return Va(this,function(a,
|
||||
f,b){var c,k={},d=0;if(g.isArray(f)){b=Ra(a);for(c=f.length;d<c;d++)k[f[d]]=g.css(a,f[d],!1,b);return k}return void 0!==b?g.style(a,f,b):g.css(a,f)},a,b,1<arguments.length)},show:function(){return va(this,!0)},hide:function(){return va(this)},toggle:function(a){return"boolean"===typeof a?a?this.show():this.hide():this.each(function(){hb(this)?g(this).show():g(this).hide()})}});g.Tween=L;L.prototype={constructor:L,init:function(a,b,c,k,d,n){this.elem=a;this.prop=c;this.easing=d||"swing";this.options=
|
||||
b;this.start=this.now=this.cur();this.end=k;this.unit=n||(g.cssNumber[c]?"":"px")},cur:function(){var a=L.propHooks[this.prop];return a&&a.get?a.get(this):L.propHooks._default.get(this)},run:function(a){var b,c=L.propHooks[this.prop];this.pos=this.options.duration?b=g.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):b=a;this.now=(this.end-this.start)*b+this.start;this.options.step&&this.options.step.call(this.elem,this.now,this);c&&c.set?c.set(this):L.propHooks._default.set(this);
|
||||
return this}};L.prototype.init.prototype=L.prototype;L.propHooks={_default:{get:function(a){if(null!=a.elem[a.prop]&&(!a.elem.style||null==a.elem.style[a.prop]))return a.elem[a.prop];a=g.css(a.elem,a.prop,"");return!a||"auto"===a?0:a},set:function(a){if(g.fx.step[a.prop])g.fx.step[a.prop](a);else a.elem.style&&(null!=a.elem.style[g.cssProps[a.prop]]||g.cssHooks[a.prop])?g.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}};L.propHooks.scrollTop=L.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&
|
||||
a.elem.parentNode&&(a.elem[a.prop]=a.now)}};g.easing={linear:function(a){return a},swing:function(a){return 0.5-Math.cos(a*Math.PI)/2}};g.fx=L.prototype.init;g.fx.step={};var Za,Hb,Jd=/^(?:toggle|show|hide)$/,Kc=RegExp("^(?:([+-])=|)("+zb+")([a-z%]*)$","i"),Kd=/queueHooks$/,tb=[function(a,b,c){var k,d,n,e,r,j,h=this,q={},l=a.style,A=a.nodeType&&hb(a),z=g._data(a,"fxshow");c.queue||(e=g._queueHooks(a,"fx"),null==e.unqueued&&(e.unqueued=0,r=e.empty.fire,e.empty.fire=function(){e.unqueued||r()}),e.unqueued++,
|
||||
h.always(function(){h.always(function(){e.unqueued--;g.queue(a,"fx").length||e.empty.fire()})}));if(1===a.nodeType&&("height"in b||"width"in b))c.overflow=[l.overflow,l.overflowX,l.overflowY],d=g.css(a,"display"),j=db(a.nodeName),"none"===d&&(d=j),"inline"===d&&"none"===g.css(a,"float")&&(!w.inlineBlockNeedsLayout||"inline"===j?l.display="inline-block":l.zoom=1);c.overflow&&(l.overflow="hidden",w.shrinkWrapBlocks()||h.always(function(){l.overflow=c.overflow[0];l.overflowX=c.overflow[1];l.overflowY=
|
||||
c.overflow[2]}));for(k in b)if(d=b[k],Jd.exec(d)){delete b[k];n=n||"toggle"===d;if(d===(A?"hide":"show"))if("show"===d&&z&&void 0!==z[k])A=!0;else continue;q[k]=z&&z[k]||g.style(a,k)}if(!g.isEmptyObject(q))for(k in z?"hidden"in z&&(A=z.hidden):z=g._data(a,"fxshow",{}),n&&(z.hidden=!A),A?g(a).show():h.done(function(){g(a).hide()}),h.done(function(){var b;g._removeData(a,"fxshow");for(b in q)g.style(a,b,q[b])}),q)b=wa(A?z[k]:0,k,h),k in z||(z[k]=b.start,A&&(b.end=b.start,b.start="width"===k||"height"===
|
||||
k?1:0))}],ib={"*":[function(a,b){var c=this.createTween(a,b),k=c.cur(),d=Kc.exec(b),n=d&&d[3]||(g.cssNumber[a]?"":"px"),e=(g.cssNumber[a]||"px"!==n&&+k)&&Kc.exec(g.css(c.elem,a)),r=1,j=20;if(e&&e[3]!==n){n=n||e[3];d=d||[];e=+k||1;do r=r||".5",e/=r,g.style(c.elem,a,e+n);while(r!==(r=c.cur()/k)&&1!==r&&--j)}d&&(e=c.start=+e||+k||0,c.unit=n,c.end=d[1]?e+(d[1]+1)*d[2]:+d[2]);return c}]};g.Animation=g.extend(jb,{tweener:function(a,b){g.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,k=0,d=a.length;k<
|
||||
d;k++)c=a[k],ib[c]=ib[c]||[],ib[c].unshift(b)},prefilter:function(a,b){b?tb.unshift(a):tb.push(a)}});g.speed=function(a,b,c){var k=a&&"object"===typeof a?g.extend({},a):{complete:c||!c&&b||g.isFunction(a)&&a,duration:a,easing:c&&b||b&&!g.isFunction(b)&&b};k.duration=g.fx.off?0:"number"===typeof k.duration?k.duration:k.duration in g.fx.speeds?g.fx.speeds[k.duration]:g.fx.speeds._default;if(null==k.queue||!0===k.queue)k.queue="fx";k.old=k.complete;k.complete=function(){g.isFunction(k.old)&&k.old.call(this);
|
||||
k.queue&&g.dequeue(this,k.queue)};return k};g.fn.extend({fadeTo:function(a,b,c,k){return this.filter(hb).css("opacity",0).show().end().animate({opacity:b},a,c,k)},animate:function(a,b,c,k){var d=g.isEmptyObject(a),n=g.speed(b,c,k);b=function(){var b=jb(this,g.extend({},a),n);(d||g._data(this,"finish"))&&b.stop(!0)};b.finish=b;return d||!1===n.queue?this.each(b):this.queue(n.queue,b)},stop:function(a,b,c){var k=function(a){var b=a.stop;delete a.stop;b(c)};"string"!==typeof a&&(c=b,b=a,a=void 0);b&&
|
||||
!1!==a&&this.queue(a||"fx",[]);return this.each(function(){var b=!0,d=null!=a&&a+"queueHooks",n=g.timers,e=g._data(this);if(d)e[d]&&e[d].stop&&k(e[d]);else for(d in e)e[d]&&(e[d].stop&&Kd.test(d))&&k(e[d]);for(d=n.length;d--;)if(n[d].elem===this&&(null==a||n[d].queue===a))n[d].anim.stop(c),b=!1,n.splice(d,1);(b||!c)&&g.dequeue(this,a)})},finish:function(a){!1!==a&&(a=a||"fx");return this.each(function(){var b,c=g._data(this),k=c[a+"queue"];b=c[a+"queueHooks"];var d=g.timers,n=k?k.length:0;c.finish=
|
||||
!0;g.queue(this,a,[]);b&&b.stop&&b.stop.call(this,!0);for(b=d.length;b--;)d[b].elem===this&&d[b].queue===a&&(d[b].anim.stop(!0),d.splice(b,1));for(b=0;b<n;b++)k[b]&&k[b].finish&&k[b].finish.call(this);delete c.finish})}});g.each(["toggle","show","hide"],function(a,b){var c=g.fn[b];g.fn[b]=function(a,f,k){return null==a||"boolean"===typeof a?c.apply(this,arguments):this.animate(O(b,!0),a,f,k)}});g.each({slideDown:O("show"),slideUp:O("hide"),slideToggle:O("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},
|
||||
fadeToggle:{opacity:"toggle"}},function(a,b){g.fn[a]=function(a,f,c){return this.animate(b,a,f,c)}});g.timers=[];g.fx.tick=function(){var a,b=g.timers,c=0;for(Za=g.now();c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||g.fx.stop();Za=void 0};g.fx.timer=function(a){g.timers.push(a);a()?g.fx.start():g.timers.pop()};g.fx.interval=13;g.fx.start=function(){Hb||(Hb=setInterval(g.fx.tick,g.fx.interval))};g.fx.stop=function(){clearInterval(Hb);Hb=null};g.fx.speeds={slow:600,fast:200,_default:400};
|
||||
g.fn.delay=function(a,b){a=g.fx?g.fx.speeds[a]||a:a;return this.queue(b||"fx",function(b,c){var k=setTimeout(b,a);c.stop=function(){clearTimeout(k)}})};var Ib,Ma,fc,gc,qb=y.createElement("div");qb.setAttribute("className","t");qb.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";Ib=qb.getElementsByTagName("a")[0];fc=y.createElement("select");gc=fc.appendChild(y.createElement("option"));Ma=qb.getElementsByTagName("input")[0];Ib.style.cssText="top:1px";w.getSetAttribute=
|
||||
"t"!==qb.className;w.style=/top/.test(Ib.getAttribute("style"));w.hrefNormalized="/a"===Ib.getAttribute("href");w.checkOn=!!Ma.value;w.optSelected=gc.selected;w.enctype=!!y.createElement("form").enctype;fc.disabled=!0;w.optDisabled=!gc.disabled;Ma=y.createElement("input");Ma.setAttribute("value","");w.input=""===Ma.getAttribute("value");Ma.value="t";Ma.setAttribute("type","radio");w.radioValue="t"===Ma.value;var Ld=/\r/g;g.fn.extend({val:function(a){var b,c,k,d=this[0];if(arguments.length)return k=
|
||||
g.isFunction(a),this.each(function(c){if(1===this.nodeType&&(c=k?a.call(this,c,g(this).val()):a,null==c?c="":"number"===typeof c?c+="":g.isArray(c)&&(c=g.map(c,function(a){return null==a?"":a+""})),b=g.valHooks[this.type]||g.valHooks[this.nodeName.toLowerCase()],!b||!("set"in b)||void 0===b.set(this,c,"value")))this.value=c});if(d){if((b=g.valHooks[d.type]||g.valHooks[d.nodeName.toLowerCase()])&&"get"in b&&void 0!==(c=b.get(d,"value")))return c;c=d.value;return"string"===typeof c?c.replace(Ld,""):
|
||||
null==c?"":c}}});g.extend({valHooks:{option:{get:function(a){var b=g.find.attr(a,"value");return null!=b?b:g.text(a)}},select:{get:function(a){for(var b,c=a.options,k=a.selectedIndex,d=(a="select-one"===a.type||0>k)?null:[],n=a?k+1:c.length,e=0>k?n:a?k:0;e<n;e++)if(b=c[e],(b.selected||e===k)&&(w.optDisabled?!b.disabled:null===b.getAttribute("disabled"))&&(!b.parentNode.disabled||!g.nodeName(b.parentNode,"optgroup"))){b=g(b).val();if(a)return b;d.push(b)}return d},set:function(a,b){for(var c,k,d=a.options,
|
||||
n=g.makeArray(b),e=d.length;e--;)if(k=d[e],0<=g.inArray(g.valHooks.option.get(k),n))try{k.selected=c=!0}catch(r){k.scrollHeight}else k.selected=!1;c||(a.selectedIndex=-1);return d}}}});g.each(["radio","checkbox"],function(){g.valHooks[this]={set:function(a,b){if(g.isArray(b))return a.checked=0<=g.inArray(g(a).val(),b)}};w.checkOn||(g.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var cb,Lc,Na=g.expr.attrHandle,hc=/^(?:checked|selected)$/i,Wa=w.getSetAttribute,
|
||||
Jb=w.input;g.fn.extend({attr:function(a,b){return Va(this,g.attr,a,b,1<arguments.length)},removeAttr:function(a){return this.each(function(){g.removeAttr(this,a)})}});g.extend({attr:function(a,b,c){var k,d,n=a.nodeType;if(a&&!(3===n||8===n||2===n)){if(typeof a.getAttribute===la)return g.prop(a,b,c);if(1!==n||!g.isXMLDoc(a))b=b.toLowerCase(),k=g.attrHooks[b]||(g.expr.match.bool.test(b)?Lc:cb);if(void 0!==c)if(null===c)g.removeAttr(a,b);else{if(k&&"set"in k&&void 0!==(d=k.set(a,c,b)))return d;a.setAttribute(b,
|
||||
c+"");return c}else{if(k&&"get"in k&&null!==(d=k.get(a,b)))return d;d=g.find.attr(a,b);return null==d?void 0:d}}},removeAttr:function(a,b){var c,k,d=0,n=b&&b.match(xa);if(n&&1===a.nodeType)for(;c=n[d++];)k=g.propFix[c]||c,g.expr.match.bool.test(c)?Jb&&Wa||!hc.test(c)?a[k]=!1:a[g.camelCase("default-"+c)]=a[k]=!1:g.attr(a,c,""),a.removeAttribute(Wa?c:k)},attrHooks:{type:{set:function(a,b){if(!w.radioValue&&"radio"===b&&g.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b);c&&(a.value=c);return b}}}}});
|
||||
Lc={set:function(a,b,c){!1===b?g.removeAttr(a,c):Jb&&Wa||!hc.test(c)?a.setAttribute(!Wa&&g.propFix[c]||c,c):a[g.camelCase("default-"+c)]=a[c]=!0;return c}};g.each(g.expr.match.bool.source.match(/\w+/g),function(a,b){var c=Na[b]||g.find.attr;Na[b]=Jb&&Wa||!hc.test(b)?function(a,b,f){var k,g;f||(g=Na[b],Na[b]=k,k=null!=c(a,b,f)?b.toLowerCase():null,Na[b]=g);return k}:function(a,b,f){if(!f)return a[g.camelCase("default-"+b)]?b.toLowerCase():null}});if(!Jb||!Wa)g.attrHooks.value={set:function(a,b,c){if(g.nodeName(a,
|
||||
"input"))a.defaultValue=b;else return cb&&cb.set(a,b,c)}};Wa||(cb={set:function(a,b,c){var k=a.getAttributeNode(c);k||a.setAttributeNode(k=a.ownerDocument.createAttribute(c));k.value=b+="";if("value"===c||b===a.getAttribute(c))return b}},Na.id=Na.name=Na.coords=function(a,b,c){var k;if(!c)return(k=a.getAttributeNode(b))&&""!==k.value?k.value:null},g.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);if(c&&c.specified)return c.value},set:cb.set},g.attrHooks.contenteditable={set:function(a,
|
||||
b,c){cb.set(a,""===b?!1:b,c)}},g.each(["width","height"],function(a,b){g.attrHooks[b]={set:function(a,f){if(""===f)return a.setAttribute(b,"auto"),f}}}));w.style||(g.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var Md=/^(?:input|select|textarea|button|object)$/i,Nd=/^(?:a|area)$/i;g.fn.extend({prop:function(a,b){return Va(this,g.prop,a,b,1<arguments.length)},removeProp:function(a){a=g.propFix[a]||a;return this.each(function(){try{this[a]=
|
||||
void 0,delete this[a]}catch(b){}})}});g.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var k,d,n;n=a.nodeType;if(a&&!(3===n||8===n||2===n)){if(n=1!==n||!g.isXMLDoc(a))b=g.propFix[b]||b,d=g.propHooks[b];return void 0!==c?d&&"set"in d&&void 0!==(k=d.set(a,c,b))?k:a[b]=c:d&&"get"in d&&null!==(k=d.get(a,b))?k:a[b]}},propHooks:{tabIndex:{get:function(a){var b=g.find.attr(a,"tabindex");return b?parseInt(b,10):Md.test(a.nodeName)||Nd.test(a.nodeName)&&a.href?0:-1}}}});w.hrefNormalized||
|
||||
g.each(["href","src"],function(a,b){g.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}});w.optSelected||(g.propHooks.selected={get:function(a){if(a=a.parentNode)a.selectedIndex,a.parentNode&&a.parentNode.selectedIndex;return null}});g.each("tabIndex readOnly maxLength cellSpacing cellPadding rowSpan colSpan useMap frameBorder contentEditable".split(" "),function(){g.propFix[this.toLowerCase()]=this});w.enctype||(g.propFix.enctype="encoding");var ic=/[\t\r\n\f]/g;g.fn.extend({addClass:function(a){var b,
|
||||
c,k,d,n,e=0,r=this.length;b="string"===typeof a&&a;if(g.isFunction(a))return this.each(function(b){g(this).addClass(a.call(this,b,this.className))});if(b)for(b=(a||"").match(xa)||[];e<r;e++)if(c=this[e],k=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ic," "):" ")){for(n=0;d=b[n++];)0>k.indexOf(" "+d+" ")&&(k+=d+" ");k=g.trim(k);c.className!==k&&(c.className=k)}return this},removeClass:function(a){var b,c,k,d,n,e=0,r=this.length;b=0===arguments.length||"string"===typeof a&&a;if(g.isFunction(a))return this.each(function(b){g(this).removeClass(a.call(this,
|
||||
b,this.className))});if(b)for(b=(a||"").match(xa)||[];e<r;e++)if(c=this[e],k=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ic," "):"")){for(n=0;d=b[n++];)for(;0<=k.indexOf(" "+d+" ");)k=k.replace(" "+d+" "," ");k=a?g.trim(k):"";c.className!==k&&(c.className=k)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"===typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):g.isFunction(a)?this.each(function(c){g(this).toggleClass(a.call(this,c,this.className,b),b)}):
|
||||
this.each(function(){if("string"===c)for(var b,k=0,d=g(this),n=a.match(xa)||[];b=n[k++];)d.hasClass(b)?d.removeClass(b):d.addClass(b);else if(c===la||"boolean"===c)this.className&&g._data(this,"__className__",this.className),this.className=this.className||!1===a?"":g._data(this,"__className__")||""})},hasClass:function(a){a=" "+a+" ";for(var b=0,c=this.length;b<c;b++)if(1===this[b].nodeType&&0<=(" "+this[b].className+" ").replace(ic," ").indexOf(a))return!0;return!1}});g.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),
|
||||
function(a,b){g.fn[b]=function(a,f){return 0<arguments.length?this.on(b,null,a,f):this.trigger(b)}});g.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,k){return this.on(b,a,c,k)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var jc=g.now(),kc=/\?/,Od=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;
|
||||
g.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,k=null,d=g.trim(b+"");return d&&!g.trim(d.replace(Od,function(a,b,f,g){c&&b&&(k=0);if(0===k)return a;c=f||b;k+=!g-!f;return""}))?Function("return "+d)():g.error("Invalid JSON: "+b)};g.parseXML=function(b){var c,k;if(!b||"string"!==typeof b)return null;try{a.DOMParser?(k=new DOMParser,c=k.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(d){c=void 0}(!c||!c.documentElement||
|
||||
c.getElementsByTagName("parsererror").length)&&g.error("Invalid XML: "+b);return c};var Xa,Oa,Pd=/#.*$/,Mc=/([?&])_=[^&]*/,Qd=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,Rd=/^(?:GET|HEAD)$/,Sd=/^\/\//,Nc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Oc={},Nb={},Pc="*/".concat("*");try{Oa=location.href}catch(be){Oa=y.createElement("a"),Oa.href="",Oa=Oa.href}Xa=Nc.exec(Oa.toLowerCase())||[];g.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Oa,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Xa[1]),
|
||||
global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":g.parseJSON,"text xml":g.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?ya(ya(a,
|
||||
g.ajaxSettings),b):ya(g.ajaxSettings,a)},ajaxPrefilter:kb(Oc),ajaxTransport:kb(Nb),ajax:function(a,b){function c(a,b,f,k){var d,l,p,K;K=b;if(2!==ea){ea=2;r&&clearTimeout(r);h=void 0;e=k||"";s.readyState=0<a?4:0;k=200<=a&&300>a||304===a;if(f){p=q;for(var v=s,N,ia,F,B,E=p.contents,P=p.dataTypes;"*"===P[0];)P.shift(),void 0===ia&&(ia=p.mimeType||v.getResponseHeader("Content-Type"));if(ia)for(B in E)if(E[B]&&E[B].test(ia)){P.unshift(B);break}if(P[0]in f)F=P[0];else{for(B in f){if(!P[0]||p.converters[B+
|
||||
" "+P[0]]){F=B;break}N||(N=B)}F=F||N}F?(F!==P[0]&&P.unshift(F),p=f[F]):p=void 0}a:{f=q;N=p;ia=s;F=k;var w,Y,u,v={},E=f.dataTypes.slice();if(E[1])for(Y in f.converters)v[Y.toLowerCase()]=f.converters[Y];for(B=E.shift();B;)if(f.responseFields[B]&&(ia[f.responseFields[B]]=N),!u&&(F&&f.dataFilter)&&(N=f.dataFilter(N,f.dataType)),u=B,B=E.shift())if("*"===B)B=u;else if("*"!==u&&u!==B){Y=v[u+" "+B]||v["* "+B];if(!Y)for(w in v)if(p=w.split(" "),p[1]===B&&(Y=v[u+" "+p[0]]||v["* "+p[0]])){!0===Y?Y=v[w]:!0!==
|
||||
v[w]&&(B=p[0],E.unshift(p[1]));break}if(!0!==Y)if(Y&&f["throws"])N=Y(N);else try{N=Y(N)}catch(I){p={state:"parsererror",error:Y?I:"No conversion from "+u+" to "+B};break a}}p={state:"success",data:N}}if(k)q.ifModified&&((K=s.getResponseHeader("Last-Modified"))&&(g.lastModified[n]=K),(K=s.getResponseHeader("etag"))&&(g.etag[n]=K)),204===a||"HEAD"===q.type?K="nocontent":304===a?K="notmodified":(K=p.state,d=p.data,l=p.error,k=!l);else if(l=K,a||!K)K="error",0>a&&(a=0);s.status=a;s.statusText=(b||K)+
|
||||
"";k?T.resolveWith(A,[d,K,s]):T.rejectWith(A,[s,K,l]);s.statusCode(m);m=void 0;j&&z.trigger(k?"ajaxSuccess":"ajaxError",[s,q,k?d:l]);t.fireWith(A,[s,K]);j&&(z.trigger("ajaxComplete",[s,q]),--g.active||g.event.trigger("ajaxStop"))}}"object"===typeof a&&(b=a,a=void 0);b=b||{};var k,d,n,e,r,j,h,l,q=g.ajaxSetup({},b),A=q.context||q,z=q.context&&(A.nodeType||A.jquery)?g(A):g.event,T=g.Deferred(),t=g.Callbacks("once memory"),m=q.statusCode||{},K={},N={},ea=0,ia="canceled",s={readyState:0,getResponseHeader:function(a){var b;
|
||||
if(2===ea){if(!l)for(l={};b=Qd.exec(e);)l[b[1].toLowerCase()]=b[2];b=l[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===ea?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();ea||(a=N[c]=N[c]||a,K[a]=b);return this},overrideMimeType:function(a){ea||(q.mimeType=a);return this},statusCode:function(a){var b;if(a)if(2>ea)for(b in a)m[b]=[m[b],a[b]];else s.always(a[s.status]);return this},abort:function(a){a=a||ia;h&&h.abort(a);c(0,a);return this}};T.promise(s).complete=
|
||||
t.add;s.success=s.done;s.error=s.fail;q.url=((a||q.url||Oa)+"").replace(Pd,"").replace(Sd,Xa[1]+"//");q.type=b.method||b.type||q.method||q.type;q.dataTypes=g.trim(q.dataType||"*").toLowerCase().match(xa)||[""];null==q.crossDomain&&(k=Nc.exec(q.url.toLowerCase()),q.crossDomain=!(!k||!(k[1]!==Xa[1]||k[2]!==Xa[2]||(k[3]||("http:"===k[1]?"80":"443"))!==(Xa[3]||("http:"===Xa[1]?"80":"443")))));q.data&&(q.processData&&"string"!==typeof q.data)&&(q.data=g.param(q.data,q.traditional));ub(Oc,q,b,s);if(2===
|
||||
ea)return s;(j=q.global)&&0===g.active++&&g.event.trigger("ajaxStart");q.type=q.type.toUpperCase();q.hasContent=!Rd.test(q.type);n=q.url;q.hasContent||(q.data&&(n=q.url+=(kc.test(n)?"&":"?")+q.data,delete q.data),!1===q.cache&&(q.url=Mc.test(n)?n.replace(Mc,"$1_="+jc++):n+(kc.test(n)?"&":"?")+"_="+jc++));q.ifModified&&(g.lastModified[n]&&s.setRequestHeader("If-Modified-Since",g.lastModified[n]),g.etag[n]&&s.setRequestHeader("If-None-Match",g.etag[n]));(q.data&&q.hasContent&&!1!==q.contentType||b.contentType)&&
|
||||
s.setRequestHeader("Content-Type",q.contentType);s.setRequestHeader("Accept",q.dataTypes[0]&&q.accepts[q.dataTypes[0]]?q.accepts[q.dataTypes[0]]+("*"!==q.dataTypes[0]?", "+Pc+"; q=0.01":""):q.accepts["*"]);for(d in q.headers)s.setRequestHeader(d,q.headers[d]);if(q.beforeSend&&(!1===q.beforeSend.call(A,s,q)||2===ea))return s.abort();ia="abort";for(d in{success:1,error:1,complete:1})s[d](q[d]);if(h=ub(Nb,q,b,s)){s.readyState=1;j&&z.trigger("ajaxSend",[s,q]);q.async&&0<q.timeout&&(r=setTimeout(function(){s.abort("timeout")},
|
||||
q.timeout));try{ea=1,h.send(K,c)}catch(F){if(2>ea)c(-1,F);else throw F;}}else c(-1,"No Transport");return s},getJSON:function(a,b,c){return g.get(a,b,c,"json")},getScript:function(a,b){return g.get(a,void 0,b,"script")}});g.each(["get","post"],function(a,b){g[b]=function(a,c,f,k){g.isFunction(c)&&(k=k||f,f=c,c=void 0);return g.ajax({url:a,type:b,dataType:k,data:c,success:f})}});g.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){g.fn[b]=function(a){return this.on(b,
|
||||
a)}});g._evalUrl=function(a){return g.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})};g.fn.extend({wrapAll:function(a){if(g.isFunction(a))return this.each(function(b){g(this).wrapAll(a.call(this,b))});if(this[0]){var b=g(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return g.isFunction(a)?
|
||||
this.each(function(b){g(this).wrapInner(a.call(this,b))}):this.each(function(){var b=g(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=g.isFunction(a);return this.each(function(c){g(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){g.nodeName(this,"body")||g(this).replaceWith(this.childNodes)}).end()}});g.expr.filters.hidden=function(a){return 0>=a.offsetWidth&&0>=a.offsetHeight||!w.reliableHiddenOffsets()&&"none"===(a.style&&
|
||||
a.style.display||g.css(a,"display"))};g.expr.filters.visible=function(a){return!g.expr.filters.hidden(a)};var Td=/%20/g,ad=/\[\]$/,Qc=/\r?\n/g,Ud=/^(?:submit|button|image|reset|file)$/i,Vd=/^(?:input|select|textarea|keygen)/i;g.param=function(a,b){var c,k=[],d=function(a,b){b=g.isFunction(b)?b():null==b?"":b;k[k.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};void 0===b&&(b=g.ajaxSettings&&g.ajaxSettings.traditional);if(g.isArray(a)||a.jquery&&!g.isPlainObject(a))g.each(a,function(){d(this.name,
|
||||
this.value)});else for(c in a)na(c,a[c],b,d);return k.join("&").replace(Td,"+")};g.fn.extend({serialize:function(){return g.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=g.prop(this,"elements");return a?g.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!g(this).is(":disabled")&&Vd.test(this.nodeName)&&!Ud.test(a)&&(this.checked||!Mb.test(a))}).map(function(a,b){var c=g(this).val();return null==c?null:g.isArray(c)?g.map(c,function(a){return{name:b.name,
|
||||
value:a.replace(Qc,"\r\n")}}):{name:b.name,value:c.replace(Qc,"\r\n")}}).get()}});g.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){var b;if(!(b=!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&ba()))a:{try{b=new a.ActiveXObject("Microsoft.XMLHTTP");break a}catch(c){}b=void 0}return b}:ba;g.ajaxSettings.xhr=void 0===a.ActiveXObject?C:function(){return(this.url==y.location||0==this.url.indexOf("http")||!this.isLocal)&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&
|
||||
C()||C(1)};var Wd=0,Kb={},Lb=g.ajaxSettings.xhr();if(a.ActiveXObject)g(a).on("unload",function(){for(var a in Kb)Kb[a](void 0,!0)});w.cors=!!Lb&&"withCredentials"in Lb;(Lb=w.ajax=!!Lb)&&g.ajaxTransport(function(a){if(!a.crossDomain||w.cors){var b;return{send:function(c,k){var d,n=a.xhr(),e=++Wd;console.log("xhr.open async="+a.async+" url="+a.url);n.open(a.type,a.url,a.async,a.username,a.password);if(a.xhrFields)for(d in a.xhrFields)n[d]=a.xhrFields[d];a.mimeType&&n.overrideMimeType&&n.overrideMimeType(a.mimeType);
|
||||
!a.crossDomain&&!c["X-Requested-With"]&&(c["X-Requested-With"]="XMLHttpRequest");for(d in c)void 0!==c[d]&&n.setRequestHeader(d,c[d]+"");n.send(a.hasContent&&a.data||null);b=function(c,d){var r,q,j;if(b&&(d||4===n.readyState))if(delete Kb[e],b=void 0,n.onreadystatechange=g.noop,d)4!==n.readyState&&n.abort();else{j={};r=n.status;"string"===typeof n.responseText&&(j.text=n.responseText);try{q=n.statusText}catch(h){q=""}!r&&a.isLocal&&!a.crossDomain?r=j.text?200:404:1223===r&&(r=204)}j&&k(r,q,j,n.getAllResponseHeaders())};
|
||||
a.async?4===n.readyState?setTimeout(b):n.onreadystatechange=Kb[e]=b:b()},abort:function(){b&&b(void 0,!0)}}}});g.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){g.globalEval(a);return a}}});g.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1);a.crossDomain&&(a.type="GET",a.global=!1)});g.ajaxTransport("script",function(a){if(a.crossDomain){var b,
|
||||
c=y.head||g("head")[0]||y.documentElement;return{send:function(k,g){b=y.createElement("script");b.async=!0;a.scriptCharset&&(b.charset=a.scriptCharset);b.src=a.url;b.onload=b.onreadystatechange=function(a,c){if(c||!b.readyState||/loaded|complete/.test(b.readyState))b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||g(200,"success")};c.insertBefore(b,c.firstChild)},abort:function(){if(b)b.onload(void 0,!0)}}}});var Rc=[],lc=/(=)\?(?=&|$)|\?\?/;g.ajaxSetup({jsonp:"callback",
|
||||
jsonpCallback:function(){var a=Rc.pop()||g.expando+"_"+jc++;this[a]=!0;return a}});g.ajaxPrefilter("json jsonp",function(b,c,k){var d,n,e,r=!1!==b.jsonp&&(lc.test(b.url)?"url":"string"===typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&lc.test(b.data)&&"data");if(r||"jsonp"===b.dataTypes[0])return d=b.jsonpCallback=g.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,r?b[r]=b[r].replace(lc,"$1"+d):!1!==b.jsonp&&(b.url+=(kc.test(b.url)?"&":"?")+b.jsonp+"="+
|
||||
d),b.converters["script json"]=function(){e||g.error(d+" was not called");return e[0]},b.dataTypes[0]="json",n=a[d],a[d]=function(){e=arguments},k.always(function(){a[d]=n;b[d]&&(b.jsonpCallback=c.jsonpCallback,Rc.push(d));e&&g.isFunction(n)&&n(e[0]);e=n=void 0}),"script"});g.parseHTML=function(a,b,c){if(!a||"string"!==typeof a)return null;"boolean"===typeof b&&(c=b,b=!1);b=b||y;var k=xc.exec(a);c=!c&&[];if(k)return[b.createElement(k[1])];k=g.buildFragment([a],b,c);c&&c.length&&g(c).remove();return g.merge([],
|
||||
k.childNodes)};var Sc=g.fn.load;g.fn.load=function(a,b,c){if("string"!==typeof a&&Sc)return Sc.apply(this,arguments);var k,d,n,e=this,r=a.indexOf(" ");0<=r&&(k=a.slice(r,a.length),a=a.slice(0,r));g.isFunction(b)?(c=b,b=void 0):b&&"object"===typeof b&&(n="POST");0<e.length&&g.ajax({url:a,type:n,dataType:"html",data:b}).done(function(a){d=arguments;e.html(k?g("<div>").append(g.parseHTML(a)).find(k):a)}).complete(c&&function(a,b){e.each(c,d||[a.responseText,b,a])});return this};g.expr.filters.animated=
|
||||
function(a){return g.grep(g.timers,function(b){return a===b.elem}).length};var Tc=a.document.documentElement;g.offset={setOffset:function(a,b,c){var k,d,n,e=g.css(a,"position"),r=g(a),q={};"static"===e&&(a.style.position="relative");n=r.offset();d=g.css(a,"top");k=g.css(a,"left");("absolute"===e||"fixed"===e)&&-1<g.inArray("auto",[d,k])?(k=r.position(),d=k.top,k=k.left):(d=parseFloat(d)||0,k=parseFloat(k)||0);g.isFunction(b)&&(b=b.call(a,c,n));null!=b.top&&(q.top=b.top-n.top+d);null!=b.left&&(q.left=
|
||||
b.left-n.left+k);"using"in b?b.using.call(a,q):r.css(q)}};g.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){g.offset.setOffset(this,a,b)});var b,c,k={top:0,left:0},d=(c=this[0])&&c.ownerDocument;if(d){b=d.documentElement;if(!g.contains(b,c))return k;typeof c.getBoundingClientRect!==la&&(k=c.getBoundingClientRect());c=V(d);return{top:k.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:k.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}}},position:function(){if(this[0]){var a,
|
||||
b,c={top:0,left:0},k=this[0];"fixed"===g.css(k,"position")?b=k.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),g.nodeName(a[0],"html")||(c=a.offset()),c.top+=g.css(a[0],"borderTopWidth",!0),c.left+=g.css(a[0],"borderLeftWidth",!0));return{top:b.top-c.top-g.css(k,"marginTop",!0),left:b.left-c.left-g.css(k,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||Tc;a&&!g.nodeName(a,"html")&&"static"===g.css(a,"position");)a=a.offsetParent;return a||
|
||||
Tc})}});g.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);g.fn[a]=function(k){return Va(this,function(a,k,f){var d=V(a);if(void 0===f)return d?b in d?d[b]:d.document.documentElement[k]:a[k];d?d.scrollTo(!c?f:g(d).scrollLeft(),c?f:g(d).scrollTop()):a[k]=f},a,k,arguments.length,null)}});g.each(["top","left"],function(a,b){g.cssHooks[b]=fb(w.pixelPosition,function(a,c){if(c)return c=Sa(a,b),sb.test(c)?g(a).position()[b]+"px":c})});g.each({Height:"height",Width:"width"},
|
||||
function(a,b){g.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,k){g.fn[k]=function(k,d){var n=arguments.length&&(c||"boolean"!==typeof k),e=c||(!0===k||!0===d?"margin":"border");return Va(this,function(b,c,k){return g.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(c=b.documentElement,Math.max(b.body["scroll"+a],c["scroll"+a],b.body["offset"+a],c["offset"+a],c["client"+a])):void 0===k?g.css(b,c,e):g.style(b,c,k,e)},b,n?k:void 0,n,null)}})});g.fn.size=function(){return this.length};
|
||||
g.fn.andSelf=g.fn.addBack;"function"===typeof define&&define.amd&&define("jquery",[],function(){return g});var Xd=a.jQuery,Yd=a.$;g.noConflict=function(b){a.$===g&&(a.$=Yd);b&&a.jQuery===g&&(a.jQuery=Xd);return g};typeof m===la&&(a.jQuery=a.$=g);return g});
|
||||
(function(a){function m(a){try{return a?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest}catch(h){}}a.ajaxSettings.xhr=void 0===window.ActiveXObject?m:function(){return(this.url==document.location||0==this.url.indexOf("http")||!this.isLocal)&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&m()||m(1)};a.ajaxTransport("+script",function(a){var h,e=document.head||jQuery("head")[0]||document.documentElement;return{send:function(j,t){h=document.createElement("script");a.scriptCharset&&
|
||||
(h.charset=a.scriptCharset);h.src=a.url;h.onload=h.onreadystatechange=function(a,e){if(e||!h.readyState||/loaded|complete/.test(h.readyState))h.onload=h.onreadystatechange=null,h.parentNode&&h.parentNode.removeChild(h),h=null,e||t(200,"success")};e.insertBefore(h,e.firstChild)},abort:function(){if(h)h.onload(void 0,!0)}}});a.extend(a.support,{iecors:!!window.XDomainRequest});a.support.iecors?a.ajaxTransport(function(a){return{send:function(h,e){var j=new window.XDomainRequest;j.onload=function(){e(200,
|
||||
"OK",{text:j.responseText},{"Content-Type":j.contentType})};a.xhrFields&&(j.onerror=a.xhrFields.error,j.ontimeout=a.xhrFields.timeout);j.open(a.type,a.url);j.send(a.hasContent&&a.data||null)},abort:function(){xdr.abort()}}}):(a.ajaxSetup({accepts:{binary:"text/plain; charset=x-user-defined"},responseFields:{binary:"response"}}),a.ajaxTransport("binary",function(a){var h;return{send:function(e,j){var t=a.xhr();console.log("xhr.open binary async="+a.async+" url="+a.url);t.open(a.type,a.url,a.async);
|
||||
var m=!1;try{t.hasOwnProperty("responseType")&&(t.responseType="arraybuffer",m=!0)}catch(u){}try{!m&&t.overrideMimeType&&t.overrideMimeType("text/plain; charset=x-user-defined")}catch(b){}!a.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(var c in e)t.setRequestHeader(c,e[c])}catch(d){}t.send(a.hasContent&&a.data||null);h=function(){var b=t.status,c="",d=t.getAllResponseHeaders(),e={};try{if(h&&4===t.readyState){h=void 0;try{e.text="string"===typeof t.responseText?
|
||||
t.responseText:null}catch(m){}try{e.binary=t.response}catch(s){}try{c=t.statusText}catch(u){c=""}!b&&a.isLocal&&!a.crossDomain?b=e.text?200:404:1223===b&&(b=204);j(b,c,e,d)}}catch(U){alert(U),j(-1,U)}};a.async?4===t.readyState?setTimeout(h):t.onreadystatechange=h:h()},abort:function(){}}}))})(jQuery);
|
||||
(function(a,m,l,h){function e(e,l){function s(b){a(u).each(function(){self.Jmol&&(0<=l.indexOf("mouseup")||0<=l.indexOf("touchend"))&&Jmol._setMouseOwner(null);var d=a(this);this!==b.target&&!d.has(b.target).length&&d.triggerHandler(l,[b.target,b])})}l=l||e+h;var u=a(),b=e+"."+l+"-special-event";a.event.special[l]={setup:function(){u=u.add(this);1===u.length&&a(m).bind(b,s)},teardown:function(){self.Jmol&&Jmol._setMouseOwner(null);u=u.not(this);0===u.length&&a(m).unbind(b)},add:function(a){var b=
|
||||
a.handler;a.handler=function(a,c){a.target=c;b.apply(this,arguments)}}}}a.map(l.split(" "),function(a){e(a)});e("focusin","focus"+h);e("focusout","blur"+h)})(jQuery,document,"click mousemove mouseup touchmove touchend","outjsmol");"undefined"==typeof jQuery&&alert("Note -- JSmoljQuery is required for JSmol, but it's not defined.");self.Jmol||(Jmol={});
|
||||
Jmol._version||(Jmol=function(a){var m=function(a){return{rear:a++,header:a++,main:a++,image:a++,front:a++,fileOpener:a++,coverImage:a++,dialog:a++,menu:a+9E4,console:a+91E3,consoleImage:a+91001,monitorZIndex:a+99999}},m={_version:"$Date: 2018-01-28 23:38:52 -0600 (Sun, 28 Jan 2018) $",_alertNoBinary:!0,_allowedJmolSize:[25,2048,300],_appletCssClass:"",_appletCssText:"",_fileCache:null,_jarFile:null,_j2sPath:null,_use:null,_j2sLoadMonitorOpacity:90,_applets:{},_asynchronous:!0,_ajaxQueue:[],_persistentMenu:!1,
|
||||
_getZOrders:m,_z:m(Jmol.z||9E3),_debugCode:!0,_debugCore:!1,db:{_databasePrefixes:"$=:",_fileLoadScript:";if (_loadScript = '' && defaultLoadScript == '' && _filetype == 'Pdb') { select protein or nucleic;cartoons Only;color structure; select * };",_nciLoadScript:";n = ({molecule=1}.length < {molecule=2}.length ? 2 : 1); select molecule=n;display selected;center selected;",_pubChemLoadScript:"",_DirectDatabaseCalls:{"cactus.nci.nih.gov":null,".x3dna.org":null,"rruff.geo.arizona.edu":null,".rcsb.org":null,
|
||||
"ftp.wwpdb.org":null,"pdbe.org":null,"materialsproject.org":null,".ebi.ac.uk":null,"pubchem.ncbi.nlm.nih.gov":null,"www.nmrdb.org/tools/jmol/predict.php":null,$:"https://cactus.nci.nih.gov/chemical/structure/%FILENCI/file?format=sdf&get3d=True",$$:"https://cactus.nci.nih.gov/chemical/structure/%FILENCI/file?format=sdf","=":"https://files.rcsb.org/download/%FILE.pdb","*":"https://www.ebi.ac.uk/pdbe/entry-files/download/%FILE.cif","==":"https://files.rcsb.org/ligands/download/%FILE.cif",":":"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d"},
|
||||
_restQueryUrl:"http://www.rcsb.org/pdb/rest/search",_restQueryXml:"<orgPdbQuery><queryType>org.pdb.query.simple.AdvancedKeywordQuery</queryType><description>Text Search</description><keywords>QUERY</keywords></orgPdbQuery>",_restReportUrl:"http://www.pdb.org/pdb/rest/customReport?pdbids=IDLIST&customReportColumns=structureId,structureTitle"},_debugAlert:!1,_document:a,_isXHTML:!1,_lastAppletID:null,_mousePageX:null,_mouseOwner:null,_serverUrl:"https://your.server.here/jsmol.php",_syncId:(""+Math.random()).substring(3),
|
||||
_touching:!1,_XhtmlElement:null,_XhtmlAppendChild:!1};a=a.location.href.toLowerCase();m._debugCore=0<=a.indexOf("j2sdebugcore");m._httpProto=0==a.indexOf("https")?"https://":"http://";m._isFile=0==a.indexOf("file:");m._isFile&&$.ajaxSetup({mimeType:"text/plain"});m._ajaxTestSite=m._httpProto+"google.com";a=m._isFile||0==a.indexOf("http://localhost")||0==a.indexOf("http://127.");m._tracker=!a&&"https://chemapps.stolaf.edu/jmol/JmolTracker.php?id=UA-45940799-1";m._isChrome=0<=navigator.userAgent.toLowerCase().indexOf("chrome");
|
||||
m._isSafari=!m._isChrome&&0<=navigator.userAgent.toLowerCase().indexOf("safari");m._isMsie=void 0!==window.ActiveXObject;m._isEdge=0<=navigator.userAgent.indexOf("Edge/");m._useDataURI=!m._isSafari&&!m._isMsie&&!m._isEdge;window.requestAnimationFrame||(window.requestAnimationFrame=window.setTimeout);for(var l in Jmol)m[l]=Jmol[l];return m}(document,Jmol));
|
||||
(function(a,m){a.__$=m;m(document).ready(function(){a._document=null});a.$=function(a,c){null==a&&alert(c+arguments.callee.caller.toString());return m(c?"#"+a._id+"_"+c:a)};a._$=function(a){return"string"==typeof a?m("#"+a):a};a.$ajax=function(b){a._ajaxCall=b.url;b.cache="NO"!=b.cache;b.url=a._fixProtocol(b.url);return m.ajax(b)};a._fixProtocol=function(b){0<=b.indexOf("get3d=True")&&(b=b.replace(/get3d\=True/,"get3d=true"));return 0==b.indexOf("http://www.rcsb.org/pdb/files/")&&0>b.indexOf("/ligand/")?
|
||||
"http://files.rcsb.org/view/"+b.substring(30).replace(/\.gz/,""):0==b.indexOf("http://")&&("https://"==a._httpProto||0<b.indexOf(".gov/")||0==b.indexOf("http://www.materialsproject"))?"https"+b.substring(4):b};a._getNCIInfo=function(b,c){return a._getFileData("https://cactus.nci.nih.gov/chemical/structure/"+b+"/"+("name"==c?"names":c))};a.$appEvent=function(b,c,d,e){b=a.$(b,c);b.off(d)&&e&&b.on(d,e)};a.$resize=function(a){return m(window).resize(a)};a.$after=function(a,c){return m(a).after(c)};a.$append=
|
||||
function(a,c){return m(a).append(c)};a.$bind=function(a,c,d){return d?m(a).bind(c,d):m(a).unbind(c)};a.$closest=function(a,c){return m(a).closest(c)};a.$get=function(a,c){return m(a).get(c)};a.$documentOff=function(a,c){return m(document).off(a,"#"+c)};a.$documentOn=function(a,c,d){return m(document).on(a,"#"+c,d)};a.$getAncestorDiv=function(a,c){return m("div."+c+":has(#"+a+")")[0]};a.$supportsIECrossDomainScripting=function(){return m.support.iecors};a.$attr=function(b,c,d){return a._$(b).attr(c,
|
||||
d)};a.$css=function(b,c){return a._$(b).css(c)};a.$find=function(b,c){return a._$(b).find(c)};a.$focus=function(b){return a._$(b).focus()};a.$html=function(b,c){return a._$(b).html(c)};a.$offset=function(b){return a._$(b).offset()};a.$windowOn=function(a,c){return m(window).on(a,c)};a.$prop=function(b,c,d){var e=a._$(b);return 3==arguments.length?e.prop(c,d):e.prop(c)};a.$remove=function(b){return a._$(b).remove()};a.$scrollTo=function(b,c){var d=a._$(b);return d.scrollTop(0>c?d[0].scrollHeight:c)};
|
||||
a.$setEnabled=function(b,c){return a._$(b).attr("disabled",c?null:"disabled")};a.$getSize=function(b){b=a._$(b);return[b.width(),b.height()]};a.$setSize=function(b,c,d){return a._$(b).width(c).height(d)};a.$is=function(b,c){return a._$(b).is(c)};a.$setVisible=function(b,c){var d=a._$(b);return c?d.show():d.hide()};a.$submit=function(b){return a._$(b).submit()};a.$val=function(b,c){var d=a._$(b);return 1==arguments.length?d.val():d.val(c)};a._clearVars=function(){delete jQuery;delete m;delete a;delete SwingController;
|
||||
delete J;delete JM;delete JS;delete JSV;delete JU;delete JV;delete java;delete javajs;delete Clazz;delete c$};var l=document,h=window,e={};e.ua=navigator.userAgent.toLowerCase();var j;a:{j=["linux","unix","mac","win"];for(var t=j.length;t--;)if(-1!=e.ua.indexOf(j[t])){j=j[t];break a}j="unknown"}e.os=j;e.browser=function(){for(var a=e.ua,c="konqueror webkit omniweb opera webtv icab msie mozilla".split(" "),d=0;d<c.length;d++)if(0<=a.indexOf(c[d]))return c[d];return"unknown"};e.browserName=e.browser();
|
||||
e.browserVersion=parseFloat(e.ua.substring(e.ua.indexOf(e.browserName)+e.browserName.length+1));e.supportsXhr2=function(){return m.support.cors||m.support.iecors};e.allowDestroy="msie"!=e.browserName;e.allowHTML5="msie"!=e.browserName||0>navigator.appVersion.indexOf("MSIE 8");e.getDefaultLanguage=function(){return navigator.language||navigator.userLanguage||"en-US"};e._webGLtest=0;e.supportsWebGL=function(){if(!a.featureDetection._webGLtest){var b;a.featureDetection._webGLtest=h.WebGLRenderingContext&&
|
||||
((b=l.createElement("canvas")).getContext("webgl")||b.getContext("experimental-webgl"))?1:-1}return 0<a.featureDetection._webGLtest};e.supportsLocalization=function(){for(var a=l.getElementsByTagName("meta"),c=a.length;0<=--c;)if(0<=a[c].outerHTML.toLowerCase().indexOf("utf-8"))return!0;return!1};e.supportsJava=function(){a.featureDetection._javaEnabled||(a.featureDetection._javaEnabled=a._isMsie?navigator.javaEnabled()?1:-1:navigator.javaEnabled()&&(!navigator.mimeTypes||navigator.mimeTypes["application/x-java-applet"])?
|
||||
1:-1);return 0<a.featureDetection._javaEnabled};e.compliantBrowser=function(){var a=!!l.getElementById,c=e.os;if("opera"==e.browserName&&7.54>=e.browserVersion&&"mac"==c||"webkit"==e.browserName&&125.12>e.browserVersion||"msie"==e.browserName&&"mac"==c||"konqueror"==e.browserName&&3.3>=e.browserVersion)a=!1;return a};e.isFullyCompliant=function(){return e.compliantBrowser()&&e.supportsJava()};e.useIEObject="win"==e.os&&"msie"==e.browserName&&5.5<=e.browserVersion;e.useHtml4Object="mozilla"==e.browserName&&
|
||||
5<=e.browserVersion||"opera"==e.browserName&&8<=e.browserVersion||"webkit"==e.browserName;e.hasFileReader=h.File&&h.FileReader;a.featureDetection=e;a._ajax=function(b){if(!b.async)return a.$ajax(b).responseText;a._ajaxQueue.push(b);1==a._ajaxQueue.length&&a._ajaxDone()};a._ajaxDone=function(){var b=a._ajaxQueue.shift();b&&a.$ajax(b)};a._grabberOptions=[["$","NCI(small molecules)"],[":","PubChem(small molecules)"],["=","RCSB(macromolecules)"],["*","PDBe(macromolecules)"]];a._getGrabberOptions=function(b){if(0==
|
||||
a._grabberOptions.length)return"";var c='<input type="text" id="ID_query" onfocus="jQuery(this).select()" onkeypress="if(13==event.which){Jmol._applets[\'ID\']._search();return false}" size="32" value="" />',d='<button id="ID_submit" onclick="Jmol._applets[\'ID\']._search()">Search</button></nobr>';1==a._grabberOptions.length?(c="<nobr>"+c+'<span style="display:none">',d="</span>"+d):c+="<br /><nobr>";for(var c=c+'<select id="ID_select">',e=0;e<a._grabberOptions.length;e++)var j=a._grabberOptions[e],
|
||||
c=c+('<option value="'+j[0]+'" '+(0==e?"selected":"")+">"+j[1]+"</option>");c=(c+"</select>"+d).replace(/ID/g,b._id);return"<br />"+c};a._getScriptForDatabase=function(b){return"$"==b?a.db._nciLoadScript:":"==b?a.db._pubChemLoadScript:a.db._fileLoadScript};a._setInfo=function(a,c,d){var e=[],j="";if(0==d.indexOf("ERROR"))j=d;else switch(c){case "=":c=d.split("<dimStructure.structureId>");e=["<table>"];for(d=1;d<c.length;d++)e.push('<tr><td valign=top><a href="javascript:Jmol.search('+a._id+",'="+
|
||||
c[d].substring(0,4)+"')\">"+c[d].substring(0,4)+"</a></td>"),e.push("<td>"+c[d].split("Title>")[1].split("</")[0]+"</td></tr>");e.push("</table>");j=c.length-1+" matches";break;case "$":case ":":break;default:return}a._infoHeader=j;a._info=e.join("");a._showInfo(!0)};a._loadSuccess=function(b,c){c&&(a._ajaxDone(),c(b))};a._loadError=function(b){a._ajaxDone();a.say("Error connecting to server: "+a._ajaxCall);null!=b&&b()};a._isDatabaseCall=function(b){return 0<=a.db._databasePrefixes.indexOf(b.substring(0,
|
||||
1))};a._getDirectDatabaseCall=function(b,c){if(c&&!a.featureDetection.supportsXhr2())return b;var d=2,e=b.substring(0,d),j=a.db._DirectDatabaseCalls[e]||a.db._DirectDatabaseCalls[e=b.substring(0,--d)];j&&(":"==e?(e=b.toLowerCase(),isNaN(parseInt(b.substring(1)))?0==e.indexOf(":smiles:")?(j+="?POST?smiles="+b.substring(8),b="smiles"):0==e.indexOf(":cid:")?b="cid/"+b.substring(5):(0==e.indexOf(":name:")?b=b.substring(5):0==e.indexOf(":cas:")&&(b=b.substring(4)),b="name/"+encodeURIComponent(b.substring(d))):
|
||||
b="cid/"+b.substring(1)):b=encodeURIComponent(b.substring(d)),0<=b.indexOf(".mmtf")?b="https://mmtf.rcsb.org/v1.0/full/"+b.replace(/\.mmtf/,""):0<=j.indexOf("FILENCI")?(b=b.replace(/\%2F/g,"/"),b=j.replace(/\%FILENCI/,b)):b=j.replace(/\%FILE/,b));return b};a._getRawDataFromServer=function(b,c,d,e,j,h){b="?call=getRawDataFromDatabase&database="+b+(0<=c.indexOf("?POST?")?"?POST?":"")+"&query="+encodeURIComponent(c)+(j?"&encoding=base64":"")+(h?"":"&script="+encodeURIComponent(a._getScriptForDatabase(b)));
|
||||
return a._contactServer(b,d,e)};a._checkFileName=function(b,c,d){a._isDatabaseCall(c)&&(d&&a._setQueryTerm(b,c),c=a._getDirectDatabaseCall(c,!0),a._isDatabaseCall(c)&&(c=a._getDirectDatabaseCall(c,!1),d&&(d[0]=!0)));return c};a._checkCache=function(b,c,d){if(b._cacheFiles&&a._fileCache&&!c.endsWith(".js")){if(b=a._fileCache[c])return System.out.println("using "+b.length+" bytes of cached data for "+c),d(b),null;d=function(b,c){d(a._fileCache[b]=c)}}return d};a.playAudio=function(b){a._playAudio(null,
|
||||
b)};a._playAudio=function(a,c){var d=c.get?function(a){return c.get(a)}:null,e=c.put?function(a,b){return c.put(a,b)}:null,j=d?d("audioFile"):c,h=d&&d("audioPlayer"),l=document.createElement("audio");e&&e("audioElement",l);var t=null;h&&(t=function(a){h.processUpdate(a)},h.myClip={open:function(){t("open")},start:function(){l.play();t("start")},loop:function(a){l.loop=0!=a},stop:function(){l.pause()},close:function(){t("close")},setMicrosecondPosition:function(a){l.currentTime=a/1E6}});l.controls=
|
||||
"true";l.src=j;d&&d("loop")&&(l.loop="true");t&&(l.addEventListener("pause",function(){t("pause")}),l.addEventListener("play",function(){t("play")}),l.addEventListener("playing",function(){t("playing")}),l.addEventListener("ended",function(){t("ended")}),t("open"))};a._loadFileData=function(b,c,d,e){var j=[];c=a._checkFileName(b,c,j);d=a._checkCache(b,c,d);j[0]?a._getRawDataFromServer("_",c,d,e):(b={type:"GET",dataType:"text",url:c,async:a._asynchronous,success:function(b){a._loadSuccess(b,d)},error:function(){a._loadError(e)}},
|
||||
a._checkAjaxPost(b),a._ajax(b))};a._getInfoFromDatabase=function(b,c,d){if("===="==c){var e=a.db._restQueryXml.replace(/QUERY/,d),e={dataType:"text",type:"POST",contentType:"application/x-www-form-urlencoded",url:a.db._restQueryUrl,data:encodeURIComponent(e)+"&req=browser",success:function(e){a._ajaxDone();a._extractInfoFromRCSB(b,c,d,e)},error:function(){a._loadError(null)},async:a._asynchronous};return a._ajax(e)}d="?call=getInfoFromDatabase&database="+c+"&query="+encodeURIComponent(d);return a._contactServer(d,
|
||||
function(d){a._setInfo(b,c,d)})};a._extractInfoFromRCSB=function(b,c,d,e){var j=e.length/5;if(0!=j&&4==d.length&&1!=j){d=d.toUpperCase();var h=e.indexOf(d);0<h&&0<="123456789".indexOf(d.substring(0,1))&&(e=d+","+e.substring(0,h)+e.substring(h+5));50<j&&(e=e.substring(0,250));e=e.replace(/\n/g,",");e=a._restReportUrl.replace(/IDLIST/,e);a._loadFileData(b,e,function(d){a._setInfo(b,c,d)})}};a._checkAjaxPost=function(a){var c=a.url.indexOf("?POST?");0<c&&(a.data=a.url.substring(c+6),a.url=a.url.substring(0,
|
||||
c),a.type="POST",a.contentType="application/x-www-form-urlencoded")};a._contactServer=function(b,c,d){b={dataType:"text",type:"GET",url:a._serverUrl+b,success:function(b){a._loadSuccess(b,c)},error:function(){a._loadError(d)},async:c?a._asynchronous:!1};a._checkAjaxPost(b);return a._ajax(b)};a._setQueryTerm=function(b,c){if(c&&b._hasOptions&&"http://"!=c.substring(0,7)){if(a._isDatabaseCall(c)){var d=c.substring(0,1);c=c.substring(1);c.substring(0,1)==d&&0<="=$".indexOf(d)&&(c=c.substring(1));var e=
|
||||
a._getElement(b,"select");if(e&&e.options)for(var j=0;j<e.options.length;j++)e[j].value==d&&(e[j].selected=!0)}a.$val(a.$(b,"query"),c)}};a._search=function(b,c,d){1<arguments.length||(c=null);a._setQueryTerm(b,c);c||(c=a.$val(a.$(b,"query")));0==c.indexOf("!")?b._script(c.substring(1)):(c&&(c=c.replace(/\"/g,"")),b._showInfo(!1),a._searchMol(b,c,d,!0))};a._searchMol=function(b,c,d,e){var j;a._isDatabaseCall(c)?(j=c.substring(0,1),c=c.substring(1)):j=b._hasOptions?a.$val(a.$(b,"select")):"$";"="==
|
||||
j&&3==c.length&&(c="="+c);var h=j+c;if(c&&!(0>h.indexOf("?")&&h==b._thisJmolModel)){b._thisJmolModel=h;var l;e&&null!=b._viewSet&&null!=(l=a.View.__findView(b._viewSet,{chemID:h}))?a.View.__setView(l,b,!1):("$"==j||":"==j?b._jmolFileType="MOL":"="==j&&(b._jmolFileType="PDB"),b._searchDatabase(c,j,d))}};a._searchDatabase=function(b,c,d,e){b._showInfo(!1);return 0<=c.indexOf("?")?(a._getInfoFromDatabase(b,d,c.split("?")[0]),!0):a.db._DirectDatabaseCalls[d]?(b._loadFile(d+c,e),!0):!1};a._syncBinaryOK=
|
||||
"?";a._canSyncBinary=function(b){if(a._isAsync)return!0;if(self.VBArray)return a._syncBinaryOK=!1;if("?"!=a._syncBinaryOK)return a._syncBinaryOK;a._syncBinaryOK=!0;try{var c=new window.XMLHttpRequest;c.open("text",a._ajaxTestSite,!1);c.hasOwnProperty("responseType")?c.responseType="arraybuffer":c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined")}catch(d){return System.out.println("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._alertNoBinary&&
|
||||
!b&&alert("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._syncBinaryOK=!1}return!0};a._binaryTypes="mmtf .gz .bz2 .jpg .gif .png .zip .jmol .bin .smol .spartan .pmb .mrc .map .ccp4 .dn6 .delphi .omap .pse .dcd .uk/pdbe/densities/".split(" ");a._isBinaryUrl=function(b){for(var c=a._binaryTypes.length;0<=--c;)if(0<=b.indexOf(a._binaryTypes[c]))return!0;return!1};a._getFileData=function(b,c,d){var e=a._isBinaryUrl(b),j=0<=b.indexOf(".gz")&&0<=b.indexOf("rcsb.org");
|
||||
j&&(b=b.replace(/\.gz/,""),e=!1);var j=e&&!c&&!a._canSyncBinary(j),h=0<=b.indexOf("?POST?");0==b.indexOf("file:/")&&0!=b.indexOf("file:///")&&(b="file://"+b.substring(5));var l=0>b.indexOf("://")||0==b.indexOf(document.location.protocol)&&0<=b.indexOf(document.location.host),t="https://"==a._httpProto&&0==b.indexOf("http://"),m=a._isDirectCall(b);!m&&0<=b.indexOf("?ALLOWSORIGIN?")&&(m=!0,b=b.replace(/\?ALLOWSORIGIN\?/,""));var s=!l&&a.$supportsIECrossDomainScripting(),u=null;if(t||j||!l&&!m||!c&&
|
||||
s)u=a._getRawDataFromServer("_",b,c,c,j,!0);else{b=b.replace(/file:\/\/\/\//,"file://");var Q={dataType:e?"binary":"text",async:!!c};h?(Q.type="POST",Q.url=b.split("?POST?")[0],Q.data=b.split("?POST?")[1]):(Q.type="GET",Q.url=b);c&&(Q.success=function(){c(a._xhrReturn(Q.xhr))},Q.error=function(){c(Q.xhr.statusText)});Q.xhr=a.$ajax(Q);c||(u=a._xhrReturn(Q.xhr))}if(!d)return u;null==u&&(u="",e=!1);e&&(e=a._canSyncBinary(!0));return e?a._strToBytes(u):JU.SB.newS(u)};a._xhrReturn=function(a){return!a.responseText||
|
||||
self.Clazz&&Clazz.instanceOf(a.response,self.ArrayBuffer)?a.response||a.statusText:a.responseText};a._isDirectCall=function(b){if(0<=b.indexOf("?ALLOWSORIGIN?"))return!0;for(var c in a.db._DirectDatabaseCalls)if(0<=c.indexOf(".")&&0<=b.indexOf(c))return!0;return!1};a._cleanFileData=function(a){return 0<=a.indexOf("\r")&&0<=a.indexOf("\n")?a.replace(/\r\n/g,"\n"):0<=a.indexOf("\r")?a.replace(/\r/g,"\n"):a};a._getFileType=function(a){var c=a.substring(0,1);if("$"==c||":"==c)return"MOL";if("="==c)return"="==
|
||||
a.substring(1,2)?"LCIF":"PDB";a=a.split(".").pop().toUpperCase();return a.substring(0,Math.min(a.length,3))};a._getZ=function(b,c){return b&&b._z&&b._z[c]||a._z[c]};a._incrZ=function(b,c){return b&&b._z&&++b._z[c]||++a._z[c]};a._hideLocalFileReader=function(b){b._localReader&&a.$setVisible(b._localReader,!1);b._readingLocal=!1;a._setCursor(b,0)};a.loadFileFromDialog=function(b){a._loadFileAsynchronously(null,b,null,null)};a._loadFileAsynchronously=function(b,c,d,e){if(d&&0!=d.indexOf("?")){var j=
|
||||
d;d=a._checkFileName(c,d);var h=function(h){a._setData(b,d,j,h,e,c)},h=a._checkCache(c,d,h);0<=d.indexOf("|")&&(d=d.split("|")[0]);return null==h?null:a._getFileData(d,h)}if(!a.featureDetection.hasFileReader)return b?b.setData("Local file reading is not enabled in your browser",null,null,e,c):alert("Local file reading is not enabled in your browser");c._localReader||(h='<div id="ID" style="z-index:'+a._getZ(c,"fileOpener")+';position:absolute;background:#E0E0E0;left:10px;top:10px"><div style="margin:5px 5px 5px 5px;"><button id="ID_loadurl">URL</button><input type="file" id="ID_files" /><button id="ID_loadfile">load</button><button id="ID_cancel">cancel</button></div><div>',
|
||||
a.$after("#"+c._id+"_appletdiv",h.replace(/ID/g,c._id+"_localReader")),c._localReader=a.$(c,"localReader"));a.$appEvent(c,"localReader_loadurl","click");a.$appEvent(c,"localReader_loadurl","click",function(){var b=prompt("Enter a URL");b&&(a._hideLocalFileReader(c,0),a._setData(null,b,b,null,e,c))});a.$appEvent(c,"localReader_loadfile","click");a.$appEvent(c,"localReader_loadfile","click",function(){var d=a.$(c,"localReader_files")[0].files[0],j=new FileReader;j.onloadend=function(j){j.target.readyState==
|
||||
FileReader.DONE&&(a._hideLocalFileReader(c,0),a._setData(b,d.name,d.name,j.target.result,e,c))};try{j.readAsArrayBuffer(d)}catch(h){alert("You must select a file first.")}});a.$appEvent(c,"localReader_cancel","click");a.$appEvent(c,"localReader_cancel","click",function(){a._hideLocalFileReader(c);b&&b.setData("#CANCELED#",null,null,e,c)});a.$setVisible(c._localReader,!0);c._readingLocal=!0};a._setData=function(b,c,d,e,j,h){e&&(e=a._strToBytes(e));null!=e&&(null==b||0<=c.indexOf(".jdx"))&&a.Cache.put("cache://"+
|
||||
c,e);null==b?h._applet.openFileAsyncSpecial(null==e?c:"cache://"+c,1):b.setData(c,d,e,j)};a._doAjax=function(b,c,d){b=b.toString();if(null!=d)return a._saveFile(b,d);c&&(b+="?POST?"+c);return a._getFileData(b,null,!0)};a._saveFile=function(b,c,d,e){if(a._localFileSaveFunction&&a._localFileSaveFunction(b,c))return"OK";b=b.substring(b.lastIndexOf("/")+1);d||(d=0<=b.indexOf(".pdf")?"application/pdf":0<=b.indexOf(".png")?"image/png":0<=b.indexOf(".gif")?"image/gif":0<=b.indexOf(".jpg")?"image/jpg":"");
|
||||
c=(JU?JU:J.util).Base64.getBase64("string"==typeof c?c.getBytes("UTF-8"):c).toString();e||(e="base64");var j=a._serverUrl;j&&0<=j.indexOf("your.server")&&(j="");a._useDataURI||!j?(e=document.createElement("a"),e.href="data:"+d+";base64,"+c,e.type=d||"text/plain;charset=utf-8",e.download=b,e.target="_blank",m("body").append(e),e.click(),e.remove()):(a._formdiv||(a.$after("body",'<div id="__jsmolformdiv__" style="display:none">\t\t\t\t\t\t<form id="__jsmolform__" method="post" target="_blank" action="">\t\t\t\t\t\t<input name="call" value="saveFile"/>\t\t\t\t\t\t<input id="__jsmolmimetype__" name="mimetype" value=""/>\t\t\t\t\t\t<input id="__jsmolencoding__" name="encoding" value=""/>\t\t\t\t\t\t<input id="__jsmolfilename__" name="filename" value=""/>\t\t\t\t\t\t<textarea id="__jsmoldata__" name="data"></textarea>\t\t\t\t\t\t</form>\t\t\t\t\t\t</div>'),
|
||||
a._formdiv="__jsmolform__"),a.$attr(a._formdiv,"action",j+"?"+(new Date).getMilliseconds()),a.$val("__jsmoldata__",c),a.$val("__jsmolfilename__",b),a.$val("__jsmolmimetype__",d),a.$val("__jsmolencoding__",e),a.$submit("__jsmolform__"),a.$val("__jsmoldata__",""),a.$val("__jsmolfilename__",""));return"OK"};a._strToBytes=function(a){if(Clazz.instanceOf(a,self.ArrayBuffer))return Clazz.newByteArray(-1,a);for(var c=Clazz.newByteArray(a.length,0),d=a.length;0<=--d;)c[d]=a.charCodeAt(d)&255;return c};a._setConsoleDiv=
|
||||
function(a){self.Clazz&&Clazz.setConsoleDiv(a)};a._registerApplet=function(b,c){return window[b]=a._applets[b]=a._applets[b+"__"+a._syncId+"__"]=c};a._readyCallback=function(b,c,d,e,j){b=b.split("_object")[0];var h=a._applets[b];if(d=d.booleanValue?d.booleanValue():d)h._appletPanel=j||e,h._applet=e;a._track(h)._readyCallback(b,c,d)};a._getWrapper=function(b,c){var d;if(c){var e="";if(b._coverImage)var e=' onclick="Jmol.coverApplet(ID, false)" title="'+b._coverTitle+'"',j='<image id="ID_coverclickgo" src="'+
|
||||
b._makeLiveImage+'" style="width:25px;height:25px;position:absolute;bottom:10px;left:10px;z-index:'+a._getZ(b,"coverImage")+';opacity:0.5;"'+e+" />",e='<div id="ID_coverdiv" style="background-color:red;z-index:'+a._getZ(b,"coverImage")+';width:100%;height:100%;display:inline;position:absolute;top:0px;left:0px"><image id="ID_coverimage" src="'+b._coverImage+'" style="width:100%;height:100%"'+e+"/>"+j+"</div>";j=b._isJava?"":'<image id="ID_waitimage" src="'+b._j2sPath+'/img/cursor_wait.gif" style="display:none;position:absolute;bottom:10px;left:10px;z-index:'+
|
||||
a._getZ(b,"coverImage")+';" />';d=a._appletCssText.replace(/\'/g,'"');var h=b._getSpinner&&b._getSpinner();b._spinner=h=!h||"none"==h?"":"background-image:url("+h+"); background-repeat:no-repeat; background-position:center;";d=h+(0<=d.indexOf('style="')?d.split('style="')[1]:'" '+d);d='...<div id="ID_appletinfotablediv" style="width:Wpx;height:Hpx;position:relative;font-size:14px;text-align:left">IMG WAIT......<div id="ID_appletdiv" style="z-index:'+a._getZ(b,"header")+";width:100%;height:100%;position:absolute;top:0px;left:0px;"+
|
||||
d+">";var h=b._height,l=b._width;if("string"!==typeof h||0>h.indexOf("%"))h+="px";if("string"!==typeof l||0>l.indexOf("%"))l+="px";d=d.replace(/IMG/,e).replace(/WAIT/,j).replace(/Hpx/g,h).replace(/Wpx/g,l)}else d='......</div>......<div id="ID_2dappletdiv" style="position:absolute;width:100%;height:100%;overflow:hidden;display:none"></div>......<div id="ID_infotablediv" style="width:100%;height:100%;position:absolute;top:0px;left:0px">.........<div id="ID_infoheaderdiv" style="height:20px;width:100%;background:yellow;display:none"><span id="ID_infoheaderspan"></span><span id="ID_infocheckboxspan" style="position:absolute;text-align:right;right:1px;"><a href="javascript:Jmol.showInfo(ID,false)">[x]</a></span></div>.........<div id="ID_infodiv" style="position:absolute;top:20px;bottom:0px;width:100%;height:100%;overflow:auto"></div>......</div>...</div>';
|
||||
return d.replace(/\.\.\./g,"").replace(/[\n\r]/g,"").replace(/ID/g,b._id)};a._hideLoadingSpinner=function(b){b._spinner&&a.$css(a.$(b,"appletdiv"),{"background-image":""})};a._documentWrite=function(b){if(a._document){if(a._isXHTML&&!a._XhtmlElement){var c=document.getElementsByTagName("script");a._XhtmlElement=c.item(c.length-1);a._XhtmlAppendChild=!1}a._XhtmlElement?a._domWrite(b):a._document.write(b)}return b};a._domWrite=function(b){for(var c=[0];c[0]<b.length;){var d=a._getDomElement(b,c);if(!d)break;
|
||||
a._XhtmlAppendChild?a._XhtmlElement.appendChild(d):a._XhtmlElement.parentNode.insertBefore(d,_jmol.XhtmlElement)}};a._getDomElement=function(a,c){var d=document.createElement("span");d.innerHTML=a;c[0]=a.length;return d};a._setObject=function(b,c,d){b._id=c;b.__Info={};d.z&&d.zIndexBase&&(a._z=a._getZOrders(d.zIndexBase));for(var e in d)b.__Info[e]=d[e];(b._z=d.z)||d.zIndexBase&&(b._z=b.__Info.z=a._getZOrders(d.zIndexBase));b._width=d.width;b._height=d.height;b._noscript=!b._isJava&&d.noscript;b._console=
|
||||
d.console;b._cacheFiles=!!d.cacheFiles;b._viewSet=null==d.viewSet||b._isJava?null:"Set"+d.viewSet;null!=b._viewSet&&(a.View.__init(b),b._currentView=null);!a._fileCache&&b._cacheFiles&&(a._fileCache={});b._console||(b._console=b._id+"_infodiv");"none"==b._console&&(b._console=null);b._color=d.color?d.color.replace(/0x/,"#"):"#FFFFFF";b._disableInitialConsole=d.disableInitialConsole;b._noMonitor=d.disableJ2SLoadMonitor;a._j2sPath&&(d.j2sPath=a._j2sPath);b._j2sPath=d.j2sPath;b._coverImage=d.coverImage;
|
||||
b._makeLiveImage=d.makeLiveImage||d.j2sPath+"/img/play_make_live.jpg";b._isCovered=!!b._coverImage;b._deferApplet=d.deferApplet||b._isCovered&&b._isJava;b._deferUncover=d.deferUncover&&!b._isJava;b._coverScript=d.coverScript;b._coverTitle=d.coverTitle;b._coverTitle||(b._coverTitle=b._deferApplet?"activate 3D model":"3D model is loading...");b._containerWidth=b._width+(b._width==parseFloat(b._width)?"px":"");b._containerHeight=b._height+(b._height==parseFloat(b._height)?"px":"");b._info="";b._infoHeader=
|
||||
b._jmolType+' "'+b._id+'"';b._hasOptions=d.addSelectionOptions;b._defaultModel=d.defaultModel;b._readyScript=d.script?d.script:"";b._readyFunction=d.readyFunction;b._coverImage&&!b._deferApplet&&(b._readyScript+=";javascript "+c+"._displayCoverImage(false)");b._src=d.src};a._addDefaultInfo=function(b,c){for(var d in c)"undefined"==typeof b[d]&&(b[d]=c[d]);a._use&&(b.use=a._use);0<=b.use.indexOf("SIGNED")&&(0>b.jarFile.indexOf("Signed")&&(b.jarFile=b.jarFile.replace(/Applet/,"AppletSigned")),b.use=
|
||||
b.use.replace(/SIGNED/,"JAVA"),b.isSigned=!0)};a._syncedApplets=[];a._syncedCommands=[];a._syncedReady=[];a._syncReady=!1;a._isJmolJSVSync=!1;a._setReady=function(b){a._syncedReady[b]=1;for(var c=0,d=0;d<a._syncedApplets.length;d++){if(a._syncedApplets[d]==b._id)a._syncedApplets[d]=b,a._syncedReady[d]=1;else if(!a._syncedReady[d])continue;c++}c==a._syncedApplets.length&&a._setSyncReady()};a._setDestroy=function(b){a.featureDetection.allowDestroy&&a.$windowOn("beforeunload",function(){a._destroy(b)})};
|
||||
a._destroy=function(b){try{b._appletPanel&&b._appletPanel.destroy();b._applet=null;a._unsetMouse(b._canvas);b._canvas=null;for(var c=0,d=0;d<a._syncedApplets.length;d++)a._syncedApplets[d]==b&&(a._syncedApplets[d]=null),a._syncedApplets[d]&&c++;0<c||a._clearVars()}catch(e){}};a._setSyncReady=function(){a._syncReady=!0;for(var b="",c=0;c<a._syncedApplets.length;c++)a._syncedCommands[c]&&(b+="Jmol.script(Jmol._syncedApplets["+c+"], Jmol._syncedCommands["+c+"]);");setTimeout(b,50)};a._mySyncCallback=
|
||||
function(b,c){app=a._applets[b];if(app._viewSet)a.View.updateFromSync(app,c);else{if(!a._syncReady||!a._isJmolJSVSync)return 1;for(var d=0;d<a._syncedApplets.length;d++)0<=c.indexOf(a._syncedApplets[d]._syncKeyword)&&a._syncedApplets[d]._syncScript(c);return 0}};a._getElement=function(a,c){return document.getElementById(a._id+"_"+c)||{}};a._evalJSON=function(a,c){a+="";if(!a)return[];if("{"!=a.charAt(0))return 0<=a.indexOf(" | ")&&(a=a.replace(/\ \|\ /g,"\n")),a;var d=(new Function("return "+a))();
|
||||
return!d?null:c&&void 0!=d[c]?d[c]:d};a._sortMessages=function(a){function c(a,b){return a[0]<b[0]?1:a[0]>b[0]?-1:0}if(!a||"object"!=typeof a)return[];for(var d=[],e=a.length-1;0<=e;e--)for(var j=0,h=a[e].length;j<h;j++)d[d.length]=a[e][j];if(0!=d.length)return d=d.sort(c)};a._setMouseOwner=function(b,c){null==b||c?a._mouseOwner=b:a._mouseOwner==b&&(a._mouseOwner=null)};a._jsGetMouseModifiers=function(a){var c=0;switch(a.button){case 0:c=16;break;case 1:c=8;break;case 2:c=4}a.shiftKey&&(c+=1);a.altKey&&
|
||||
(c+=8);a.ctrlKey&&(c+=2);return c};a._jsGetXY=function(b,c){if(!b.applet._ready||a._touching&&0>c.type.indexOf("touch"))return!1;var d=a.$offset(b.id),e,j=c.originalEvent;c.pageX||(c.pageX=j.pageX);c.pageY||(c.pageY=j.pageY);a._mousePageX=c.pageX;a._mousePageY=c.pageY;j.targetTouches&&j.targetTouches[0]?(e=j.targetTouches[0].pageX-d.left,d=j.targetTouches[0].pageY-d.top):j.changedTouches?(e=j.changedTouches[0].pageX-d.left,d=j.changedTouches[0].pageY-d.top):(e=c.pageX-d.left,d=c.pageY-d.top);return void 0==
|
||||
e?null:[Math.round(e),Math.round(d),a._jsGetMouseModifiers(c)]};a._setCursor=function(b,c){if(!b._isJava&&!b._readingLocal){var d;switch(c){case 1:d="crosshair";break;case 3:d="wait";a.$setVisible(a.$(b,"waitimage"),!0);break;case 8:d="ns-resize";break;case 12:d="grab";break;case 13:d="move";break;default:a.$setVisible(a.$(b,"waitimage"),!1),d="default"}b._canvas.style.cursor=d}};a._gestureUpdate=function(b,c){c.stopPropagation();c.preventDefault();var d=c.originalEvent;switch(c.type){case "touchstart":a._touching=
|
||||
!0;break;case "touchend":a._touching=!1}if(!d.touches||2!=d.touches.length)return!1;switch(c.type){case "touchstart":b._touches=[[],[]];break;case "touchmove":var e=a.$offset(b.id),j=b._touches[0],h=b._touches[1];j.push([d.touches[0].pageX-e.left,d.touches[0].pageY-e.top]);h.push([d.touches[1].pageX-e.left,d.touches[1].pageY-e.top]);d=j.length;3<d&&(j.shift(),h.shift());2<=d&&b.applet._processGesture(b._touches)}return!0};a._jsSetMouse=function(b){var c=function(a){return!a.target||0<=(""+a.target.className).indexOf("swingjs-ui")};
|
||||
a.$bind(b,"mousedown touchstart",function(d){if(c(d))return!0;a._setMouseOwner(b,!0);d.stopPropagation();var e=d.target["data-UI"];(!e||!e.handleJSEvent(b,501,d))&&d.preventDefault();b.isDragging=!0;if("touchstart"==d.type&&a._gestureUpdate(b,d))return!!e;a._setConsoleDiv(b.applet._console);var j=a._jsGetXY(b,d);j&&(2!=d.button&&a.Swing.hideMenus(b.applet),b.applet._processEvent(501,j));return!!e});a.$bind(b,"mouseup touchend",function(d){if(c(d))return!0;a._setMouseOwner(null);d.stopPropagation();
|
||||
var e=d.target["data-UI"];(!e||!e.handleJSEvent(b,502,d))&&d.preventDefault();b.isDragging=!1;if("touchend"==d.type&&a._gestureUpdate(b,d))return!!e;(d=a._jsGetXY(b,d))&&b.applet._processEvent(502,d);return!!e});a.$bind(b,"mousemove touchmove",function(d){if(c(d))return!0;if(a._mouseOwner&&a._mouseOwner!=b&&a._mouseOwner.isDragging){if(!a._mouseOwner.mouseMove)return!0;a._mouseOwner.mouseMove(d);return!1}return a._drag(b,d)});a._drag=function(b,c){c.stopPropagation();c.preventDefault();if("touchmove"==
|
||||
c.type&&a._gestureUpdate(b,c))return!1;var e=a._jsGetXY(b,c);if(!e)return!1;b.isDragging||(e[2]=0);var j=c.target["data-UI"];b.isdragging&&(!j||j.handleJSEvent(b,506,c));b.applet._processEvent(b.isDragging?506:503,e);return!!j};a.$bind(b,"DOMMouseScroll mousewheel",function(d){if(c(d))return!0;d.stopPropagation();d.preventDefault();b.isDragging=!1;var e=d.originalEvent,e=e.detail?e.detail:("mac"==a.featureDetection.os?1:-1)*e.wheelDelta;d=a._jsGetMouseModifiers(d);b.applet._processEvent(507,[0>e?
|
||||
-1:1,0,d]);return!1});a.$bind(b,"contextmenu",function(){return!1});a.$bind(b,"mouseout",function(d){if(c(d))return!0;a._mouseOwner&&!a._mouseOwner.mouseMove&&a._setMouseOwner(null);b.applet._appletPanel&&b.applet._appletPanel.startHoverWatcher(!1);a._jsGetXY(b,d);return!1});a.$bind(b,"mouseenter",function(d){if(c(d))return!0;b.applet._appletPanel&&b.applet._appletPanel.startHoverWatcher(!0);if(0===d.buttons||0===d.which){b.isDragging=!1;d=a._jsGetXY(b,d);if(!d)return!1;b.applet._processEvent(504,
|
||||
d);b.applet._processEvent(502,d);return!1}});a.$bind(b,"mousemoveoutjsmol",function(d,e,j){if(c(j))return!0;if(b==a._mouseOwner&&b.isDragging)return a._drag(b,j)});b.applet._is2D&&a.$resize(function(){b.applet&&b.applet._resize()});a.$bind("body","mouseup touchend",function(d){if(c(d))return!0;b.applet&&(b.isDragging=!1);a._setMouseOwner(null)})};a._jsUnsetMouse=function(b){b.applet=null;a.$bind(b,"mousedown touchstart mousemove touchmove mouseup touchend DOMMouseScroll mousewheel contextmenu mouseout mouseenter",
|
||||
null);a._setMouseOwner(null)};a.Swing={count:0,menuInitialized:0,menuCounter:0,htDialogs:{}};var s=a.Swing;SwingController=s;s.setDraggable=function(b){b=b.prototype;b.setContainer||(b.setContainer=function(b){this.container=b;b.obj=this;this.ignoreMouse=this.isDragging=!1;var d=this;b.bind("mousedown touchstart",function(b){if(d.ignoreMouse)return d.ignoreMouse=!1,!0;a._setMouseOwner(d,!0);d.isDragging=!0;d.pageX=b.pageX;d.pageY=b.pageY;return!1});b.bind("mousemove touchmove",function(b){if(d.isDragging&&
|
||||
a._mouseOwner==d)return d.mouseMove(b),!1});b.bind("mouseup touchend",function(b){d.mouseUp(b);a._setMouseOwner(null)})},b.mouseUp=function(b){if(this.isDragging&&a._mouseOwner==this)return this.pageX0+=b.pageX-this.pageX,this.pageY0+=b.pageY-this.pageY,this.isDragging=!1;a._setMouseOwner(null)},b.setPosition=function(){if(null===a._mousePageX){var b=a.$offset(this.applet._id+"_"+(this.applet._is2D?"canvas2d":"canvas"));a._mousePageX=b.left;a._mousePageY=b.top}this.pageX0=a._mousePageX;this.pageY0=
|
||||
a._mousePageY;this.container.css({top:a._mousePageY+"px",left:a._mousePageX+"px"})},b.mouseMove=function(b){if(this.isDragging&&a._mouseOwner==this){this.timestamp=System.currentTimeMillis();var d=this.pageX0+(b.pageX-this.pageX);b=this.pageY0+(b.pageY-this.pageY);a._mousePageX=d;a._mousePageY=b;this.container.css({top:b+"px",left:d+"px"})}},b.dragBind=function(b){this.applet._ignoreMouse=!b;this.container.unbind("mousemoveoutjsmol");this.container.unbind("touchmoveoutjsmol");this.container.unbind("mouseupoutjsmol");
|
||||
this.container.unbind("touchendoutjsmol");a._setMouseOwner(null);if(b){var d=this;this.container.bind("mousemoveoutjsmol touchmoveoutjsmol",function(a,b,c){d.mouseMove(c)});this.container.bind("mouseupoutjsmol touchendoutjsmol",function(a,b,c){d.mouseUp(c)})}})};s.JSDialog=function(){};s.setDraggable(s.JSDialog);s.getScreenDimensions=function(a){a.width=m(window).width();a.height=m(window).height()};s.dispose=function(b){a.$remove(b.id+"_mover");delete s.htDialogs[b.id];b.container.obj.dragBind(!1)};
|
||||
s.register=function(a,c){a.id=c+ ++s.count;s.htDialogs[a.id]=a};s.setDialog=function(b){a._setMouseOwner(null);a.$remove(b.id);var c=b.id+"_mover",d=a._$(c),e;d[0]?(d.html(b.html),e=d[0].jd):(a.$after("body","<div id='"+c+"' style='position:absolute;left:0px;top:0px;'>"+b.html+"</div>"),e=new s.JSDialog,d=a._$(c),b.container=d,e.applet=b.manager.vwr.html5Applet,e.setContainer(d),e.dialog=b,e.setPosition(),e.dragBind(!0),d[0].jd=e);a.$bind("#"+b.id+" .JButton","mousedown touchstart",function(){e.ignoreMouse=
|
||||
!0});a.$bind("#"+b.id+" .JComboBox","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JCheckBox","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JTextField","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JTable","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JScrollPane","mousedown touchstart",function(){e.ignoreMouse=!0});a.$bind("#"+b.id+" .JEditorPane","mousedown touchstart",function(){e.ignoreMouse=
|
||||
!0})};s.setSelected=function(b){a.$prop(b.id,"checked",!!b.selected)};s.setSelectedIndex=function(b){a.$prop(b.id,"selectedIndex",b.selectedIndex)};s.setText=function(b){a.$prop(b.id,"value",b.text)};s.setVisible=function(b){a.$setVisible(b.id,b._visible)};s.setEnabled=function(b){a.$setEnabled(b.id,b.enabled)};s.click=function(b,c){var d=s.htDialogs[b.id];if(d){var e=d.toString();if(0<=e.indexOf("JCheck"))d.selected=b.checked;else if(0<=e.indexOf("JCombo"))d.selectedIndex=b.selectedIndex;else if(null!=
|
||||
d.text&&(d.text=b.value,c&&13!=(c.charCode||c.keyCode)))return}e=s.htDialogs[a.$getAncestorDiv(b.id,"JDialog").id];e.manager.actionPerformed(d?d.name:e.registryKey+"/"+b.id)};s.setFront=function(b){var c=b.manager.vwr.html5Applet;b.zIndex!=a._getZ(c,"dialog")&&(b.zIndex=a._incrZ(c,"dialog"));b.container&&((b.container[0]||b.container).style.zIndex=b.zIndex)};s.hideMenus=function(a){if(a=a._menus)for(var c in a)a[c]._visible&&s.hideMenu(a[c])};s.windowClosing=function(b){b=s.htDialogs[a.$getAncestorDiv(b.id,
|
||||
"JDialog").id];b.registryKey?b.manager.processWindowClosing(b.registryKey):b.dispose()};a._track=function(b){if(a._tracker){try{var c='<iframe style="display:none" width="0" height="0" frameborder="0" tabindex="-1" src="'+(a._tracker+"&applet="+b._jmolType+"&version="+a._version+"&appver="+a.___JmolVersion+"&url="+encodeURIComponent(document.location.href))+'"></iframe>';a.$after("body",c)}catch(d){}delete a._tracker}return b};var u;a.getProfile=function(a){if(self.Clazz&&self.JSON)return u||Clazz._startProfiling(u=
|
||||
0==arguments.length||a),Clazz.getProfile()};a._getInChIKey=function(a,c){0<=c.indexOf("MOL=")&&c.split("MOL=")[1].split('"')};a._getAttr=function(a,c){var d=a.indexOf(c+"=");return 0<=d&&0<=(d=a.indexOf('"',d))?a.substring(d+1,a.indexOf('"',d+1)):null};a.User={viewUpdatedCallback:null};a.View={count:0,applets:{},sets:{}};(function(b){b.resetView=function(b,d){debugger;if(d){if(d._viewSet){var e=a.View.applets[d._viewSet];for(b in e)b!=d&&a.View.resetView(b)}}else b&&(b._reset(),a.View.updateView(b))};
|
||||
b.updateView=function(c,d){if(null!=c._viewSet){d||(d={});d.chemID||(c._searchQuery=null);d.data||(d.data="N/A");d.type=c._viewType;if(null==(c._currentView=b.__findView(c._viewSet,d)))c._currentView=b.__createViewSet(c._viewSet,d.chemID,d.viewID||d.chemID);c._currentView[d.type].data=d.data;c._currentView[d.type].smiles=c._getSmiles();a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(c,"updateView");b.__setView(c._currentView,c,!1)}};b.updateFromSync=function(c,d){c._updateMsg=d;var e=a._getAttr(d,
|
||||
"sourceID")||a._getAttr(d,"file");if(e){var j=b.__findView(c._viewSet,{viewID:e});if(null==j)return a.updateView(c,d);j!=c._currentView&&b.__setView(j,c,!0);var h=(e=a._getAttr(d,"atoms"))&&0<=d.indexOf("selectionhalos ON")?eval("["+e+"]"):[];setTimeout(function(){c._currentView==j&&b.updateAtomPick(c,h)},10);a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(c,"updateFromSync")}};b.updateAtomPick=function(b,d){var e=b._currentView;if(null!=e){for(var j in e)"info"!=j&&e[j].applet!=b&&e[j].applet._updateAtomPick(d);
|
||||
a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(b,"updateAtomPick")}};b.dumpViews=function(a){var d=b.sets[a];if(d){var e="View set "+a+":\n";a=b.applets[a];for(var j in a)e+="\napplet "+a[j]._id+" currentView="+(a[j]._currentView?a[j]._currentView.info.viewID:null);for(j=d.length;0<=--j;){a=d[j];var e=e+("\n\n<b>view="+j+" viewID="+a.info.viewID+" chemID="+a.info.chemID+"</b>\n"),h,l;for(l in a)"info"!=l&&(e+="\nview="+j+" type="+l+" applet="+((h=a[l]).applet?h.applet._id:null)+" SMILES="+
|
||||
h.smiles+"\n atomMap="+JSON.stringify(h.atomMap)+"\n data=\n"+h.data+"\n")}return e}};b.__init=function(a){var d=a._viewSet,e=b.applets;e[d]||(e[d]={});e[d][a._viewType]=a};b.__findView=function(a,d){var e=b.sets[a];null==e&&(e=b.sets[a]=[]);for(var j=e.length;0<=--j;){var h=e[j];if(d.viewID){if(h.info.viewID==d.viewID)return h}else{if(null!=d.chemID&&d.chemID==h.info.chemID)return h;for(var l in h)if("info"!=l&&(null!=d.data&&null!=h[l].data?d.data==h[l].data:d.type==l))return h}}return null};b.__createViewSet=
|
||||
function(c,d,e){b.count++;d={info:{chemID:d,viewID:e||"model_"+b.count}};for(var j in a._applets)e=a._applets[j],e._viewSet==c&&(d[e._viewType]={applet:e,data:null});b.sets[c].push(d);return d};b.__setView=function(a,b,e){for(var j in a)if("info"!=j){var h=a[j],l=h.applet,t=e||null!=l&&"<modified>"==l._molData;if(!(null==l||l==b&&!t)){var m=null==h.data,s=null!=l._currentView;l._currentView=a;if(!s||!(a[j].data==h.data&&!m&!t))if(l._loadModelFromView(a),m)break}}}})(a.View);a.Cache={fileCache:{}};
|
||||
a.Cache.get=function(b){return a.Cache.fileCache[b]};a.Cache.put=function(b,c){a.Cache.fileCache[b]=c};a.Cache.setDragDrop=function(b){a.$appEvent(b,"appletdiv","dragover",function(a){a=a.originalEvent;a.stopPropagation();a.preventDefault();a.dataTransfer.dropEffect="copy"});a.$appEvent(b,"appletdiv","drop",function(c){var d=c.originalEvent;d.stopPropagation();d.preventDefault();var e=d.dataTransfer.files[0];if(null==e)try{e=""+d.dataTransfer.getData("text"),(0==e.indexOf("file:/")||0==e.indexOf("http:/")||
|
||||
0==e.indexOf("https:/"))&&b._scriptLoad(e)}catch(j){}else d=new FileReader,d.onloadend=function(d){if(d.target.readyState==FileReader.DONE){var j="cache://DROP_"+e.name;d=Clazz.newByteArray(-1,d.target.result);j.endsWith(".spt")||b._appletPanel.cacheFileByName("cache://DROP_*",!1);"JSV"==b._viewType||j.endsWith(".jdx")?a.Cache.put(j,d):b._appletPanel.cachePut(j,d);(d=a._jsGetXY(b._canvas,c))&&(!b._appletPanel.setStatusDragDropped||b._appletPanel.setStatusDragDropped(0,d[0],d[1],j))&&b._appletPanel.openFileAsyncSpecial(j,
|
||||
1)}},d.readAsArrayBuffer(e)})}})(Jmol,jQuery);Jmol._debugCode=!1;
|
||||
(function(a){a._isAsync=!1;a._asyncCallbacks={};a._coreFiles=[];var m=!1,l=[],h=[],e=0,j=[],t=[],s=function(b){arguments.length||(b=!0);delete e;for(var d;0<h.length&&"done"==(d=h[0])[4];)h.shift();if(0!=h.length)if(!a._isAsync&&!b)setTimeout(s,10);else{d.push("done");var j="JSmol exec "+d[0]._id+" "+d[3]+" "+d[2];self.System&&System.out.println(j);self.console&&console.log(j+" -- OK");l.push(j);d[1](d[0],d[2])}},u=function(b){m?s():(m=!0,LoadClazz(),b._noMonitor&&(Clazz._LoaderProgressMonitor.showStatus=
|
||||
function(){}),LoadClazz=null,b.__Info.uncompressed&&Clazz.loadClass(),Clazz._Loader.onGlobalLoaded=function(){Clazz._LoaderProgressMonitor.showStatus("Application loaded.",!0);if(!a._debugCode||!a.haveCore)a.haveCore=!0,s()},Clazz._Loader.loadPackageClasspath("java",null,!0,s))},b=function(a,b){Clazz._Loader.loadClass(b,function(){s()})};a.showExecLog=function(){return l.join("\n")};a._addExec=function(a){a[1]||(a[1]=b);var d="JSmol load "+a[0]._id+" "+a[3];self.console&&console.log(d+"...");l.push(d);
|
||||
h.push(a)};a._addCoreFile=function(b,d,e){b=b.toLowerCase().split(".")[0];if(!(0<=j.join("").indexOf(b))){j.push(b);j.sort();a._coreFiles=[d+"/core/core"+j.join("")+".z.js"];if(e&&(e=e.split(" ")))for(b=0;b<e.length;b++)0>t.join("").indexOf(e[b])&&t.push(d+"/core/core"+e[b]+".z.js");for(b=0;b<t.length;b++)a._coreFiles.push(t[b])}};a._Canvas2D=function(b,d,e,j){this._uniqueId=(""+Math.random()).substring(3);this._id=b;this._is2D=!0;this._isJava=!1;this._jmolType="Jmol._Canvas2D ("+e+")";this._isLayered=
|
||||
d._isLayered||!1;this._isSwing=d._isSwing||!1;this._isJSV=d._isJSV||!1;this._isAstex=d._isAstex||!1;this._platform=d._platform||"";if(j)return this;window[b]=this;this._createCanvas(b,d);if(!a._document||this._deferApplet)return this;this._init();return this};a._setAppletParams=function(b,d,e,j){for(var h in e)if(!b||0<=b.indexOf(";"+h.toLowerCase()+";"))null==e[h]||"language"==h&&!a.featureDetection.supportsLocalization()||(j?d.put(h,!0===e[h]?Boolean.TRUE:!1===e[h]?Boolean.FALSE:e[h]):d[h]=e[h])};
|
||||
a._jsSetPrototype=function(b){b._init=function(){this._setupJS();this._showInfo(!0);this._disableInitialConsole&&this._showInfo(!1)};b._createCanvas=function(b,c,e){a._setObject(this,b,c);e&&(this._GLmol=e,this._GLmol.applet=this,this._GLmol.id=this._id);e=a._getWrapper(this,!0);this._deferApplet||(a._document?(a._documentWrite(e),this._newCanvas(!1),e=""):(this._deferApplet=!0,e+='<script type="text/javascript">'+b+"._cover(false)\x3c/script>"));e+=a._getWrapper(this,!1);c.addSelectionOptions&&(e+=
|
||||
a._getGrabberOptions(this));a._debugAlert&&!a._document&&alert(e);this._code=a._documentWrite(e)};b._newCanvas=function(a){this._is2D?this._createCanvas2d(a):this._GLmol.create()};b._getHtml5Canvas=function(){return this._canvas};b._getWidth=function(){return this._canvas.width};b._getHeight=function(){return this._canvas.height};b._getContentLayer=function(){return a.$(this,"contentLayer")[0]};b._repaintNow=function(){a._repaint(this,!1)};b._createCanvas2d=function(){var b=a.$(this,"appletdiv");
|
||||
try{b[0].removeChild(this._canvas),this._canvas.frontLayer&&b[0].removeChild(this._canvas.frontLayer),this._canvas.rearLayer&&b[0].removeChild(this._canvas.rearLayer),this._canvas.contentLayer&&b[0].removeChild(this._canvas.contentLayer),a._jsUnsetMouse(this._mouseInterface)}catch(c){}var e=Math.round(b.width()),j=Math.round(b.height()),h=document.createElement("canvas");h.applet=this;this._canvas=h;h.style.width="100%";h.style.height="100%";h.width=e;h.height=j;h.id=this._id+"_canvas2d";b.append(h);
|
||||
a._$(h.id).css({"z-index":a._getZ(this,"main")});if(this._isLayered){var l=document.createElement("div");h.contentLayer=l;l.id=this._id+"_contentLayer";b.append(l);a._$(l.id).css({zIndex:a._getZ(this,"image"),position:"absolute",left:"0px",top:"0px",width:(this._isSwing?e:0)+"px",height:(this._isSwing?j:0)+"px",overflow:"hidden"});this._isSwing?(b=document.createElement("div"),b.id=this._id+"_swingdiv",a._$(this._id+"_appletinfotablediv").append(b),a._$(b.id).css({zIndex:a._getZ(this,"rear"),position:"absolute",
|
||||
left:"0px",top:"0px",width:e+"px",height:j+"px",overflow:"hidden"}),this._mouseInterface=h.contentLayer,h.contentLayer.applet=this):this._mouseInterface=this._getLayer("front",b,e,j,!1)}else this._mouseInterface=h;a._jsSetMouse(this._mouseInterface)};b._getLayer=function(b,c,e,j,h){var l=document.createElement("canvas");this._canvas[b+"Layer"]=l;l.style.width="100%";l.style.height="100%";l.id=this._id+"_"+b+"Layer";l.width=e;l.height=j;c.append(l);l.applet=this;a._$(l.id).css({background:h?"rgb(0,0,0,1)":
|
||||
"rgb(0,0,0,0.001)","z-index":a._getZ(this,b),position:"absolute",left:"0px",top:"0px",overflow:"hidden"});return l};b._setupJS=function(){window["j2s.lib"]={base:this._j2sPath+"/",alias:".",console:this._console,monitorZIndex:a._getZ(this,"monitorZIndex")};0==h.length&&a._addExec([this,u,null,"loadClazz"]);this._addCoreFiles();a._addExec([this,this.__startAppletJS,null,"start applet"]);this._isSigned=!0;this._ready=!1;this._applet=null;this._canScript=function(){return!0};this._savedOrientations=
|
||||
[];e&&clearTimeout(e);e=setTimeout(s,100)};b.__startAppletJS=function(b){0==a._version.indexOf("$Date: ")&&(a._version=(a._version.substring(7)+" -").split(" -")[0]+" (JSmol/j2s)");var c=Clazz._4Name("java.util.Hashtable").newInstance();a._setAppletParams(b._availableParams,c,b.__Info,!0);c.put("appletReadyCallback","Jmol._readyCallback");c.put("applet",!0);c.put("name",b._id);c.put("syncId",a._syncId);a._isAsync&&c.put("async",!0);b._color&&c.put("bgcolor",b._color);b._startupScript&&c.put("script",
|
||||
b._startupScript);a._syncedApplets.length&&c.put("synccallback","Jmol._mySyncCallback");c.put("signedApplet","true");c.put("platform",b._platform);b._is2D&&c.put("display",b._id+"_canvas2d");c.put("documentBase",document.location.href);var e=b._j2sPath+"/";if(0>e.indexOf("://")){var j=document.location.href.split("#")[0].split("?")[0].split("/");0==e.indexOf("/")?j=[j[0],e.substring(1)]:j[j.length-1]=e;e=j.join("/")}c.put("codePath",e);a._registerApplet(b._id,b);try{b._newApplet(c)}catch(h){System.out.println((a._isAsync?
|
||||
"normal async abort from ":"")+h);return}b._jsSetScreenDimensions();s()};b._restoreState||(b._restoreState=function(){});b._jsSetScreenDimensions=function(){if(this._appletPanel){var b=a._getElement(this,this._is2D?"canvas2d":"canvas");this._appletPanel.setScreenDimension(b.width,b.height)}};b._show=function(b){a.$setVisible(a.$(this,"appletdiv"),b);b&&a._repaint(this,!0)};b._canScript=function(){return!0};b.equals=function(a){return this==a};b.clone=function(){return this};b.hashCode=function(){return parseInt(this._uniqueId)};
|
||||
b._processGesture=function(a){return this._appletPanel.processTwoPointGesture(a)};b._processEvent=function(a,b){this._appletPanel.processMouseEvent(a,b[0],b[1],b[2],System.currentTimeMillis())};b._resize=function(){var b="__resizeTimeout_"+this._id;a[b]&&clearTimeout(a[b]);var c=this;a[b]=setTimeout(function(){a._repaint(c,!0);a[b]=null},100)};return b};a._repaint=function(b,e){if(b&&b._appletPanel){var j=a.$(b,"appletdiv"),h=Math.round(j.width()),j=Math.round(j.height());if(b._is2D&&(b._canvas.width!=
|
||||
h||b._canvas.height!=j))b._newCanvas(!0),b._appletPanel.setDisplay(b._canvas);b._appletPanel.setScreenDimension(h,j);h=function(){b._appletPanel.paint?b._appletPanel.paint(null):b._appletPanel.update(null)};e?requestAnimationFrame(h):h()}};a._loadImage=function(b,e,j,h,l,t){var m="echo_"+e+j+(h?"_"+h.length:""),s=a._getHiddenCanvas(b.vwr.html5Applet,m,0,0,!1,!0);if(null==s){if(null==t){t=new Image;if(null==h)return t.onload=function(){a._loadImage(b,e,j,null,l,t)},t.src=j,null;System.out.println("Jsmol.js Jmol._loadImage using data URI for "+
|
||||
m);t.src="string"==typeof h?h:"data:"+JU.Rdr.guessMimeTypeForBytes(h)+";base64,"+JU.Base64.getBase64(h)}var u=t.width,U=t.height;"webgl"==e&&(u/=2,U/=2);s=a._getHiddenCanvas(b.vwr.html5Applet,m,u,U,!0,!1);s.imageWidth=u;s.imageHeight=U;s.id=m;s.image=t;a._setCanvasImage(s,u,U)}else System.out.println("Jsmol.js Jmol._loadImage reading cached image for "+m);return null==h?l(s,j):s};a._canvasCache={};a._getHiddenCanvas=function(b,e,j,h,l,t){e=b._id+"_"+e;b=a._canvasCache[e];if(t)return b;if(l||!b||b.width!=
|
||||
j||b.height!=h)b=document.createElement("canvas"),b.width=b.style.width=j,b.height=b.style.height=h,b.id=e,a._canvasCache[e]=b;return b};a._setCanvasImage=function(a,b,e){a.buf32=null;a.width=b;a.height=e;a.getContext("2d").drawImage(a.image,0,0,a.image.width,a.image.height,0,0,b,e)};a._apply=function(a,b){return a(b)}})(Jmol);
|
||||
(function(a,m){a._Applet=function(e,j,h){window[e]=this;this._jmolType="Jmol._Applet"+(j.isSigned?" (signed)":"");this._viewType="Jmol";this._isJava=!0;this._syncKeyword="Select:";this._availableParams=";progressbar;progresscolor;boxbgcolor;boxfgcolor;allowjavascript;boxmessage;\t\t\t\t\t\t\t\t\t;messagecallback;pickcallback;animframecallback;appletreadycallback;atommovedcallback;\t\t\t\t\t\t\t\t\t;echocallback;evalcallback;hovercallback;language;loadstructcallback;measurecallback;\t\t\t\t\t\t\t\t\t;minimizationcallback;resizecallback;scriptcallback;statusform;statustext;statustextarea;\t\t\t\t\t\t\t\t\t;synccallback;usecommandthread;syncid;appletid;startupscript;menufile;";
|
||||
if(h)return this;this._isSigned=j.isSigned;this._readyFunction=j.readyFunction;this._ready=!1;this._isJava=!0;this._isInfoVisible=!1;this._applet=null;this._memoryLimit=j.memoryLimit||512;this._canScript=function(){return!0};this._savedOrientations=[];this._initialize=function(e,h){var b=!1;a._jarFile&&(h=a._jarFile);if(this._jarFile){var c=this._jarFile;0<=c.indexOf("/")?(alert("This web page URL is requesting that the applet used be "+c+". This is a possible security risk, particularly if the applet is signed, because signed applets can read and write files on your local machine or network."),
|
||||
"yes"==prompt("Do you want to use applet "+c+"? ","yes or no")?(e=c.substring(0,c.lastIndexOf("/")),h=c.substring(c.lastIndexOf("/")+1)):b=!0):h=c;this_isSigned=j.isSigned=0<=h.indexOf("Signed")}this._jarPath=j.jarPath=e||".";this._jarFile=j.jarFile="string"==typeof h?h:(h?"JmolAppletSigned":"JmolApplet")+"0.jar";b&&alert("The web page URL was ignored. Continuing using "+this._jarFile+' in directory "'+this._jarPath+'"');void 0==a.controls||a.controls._onloadResetForms()};this._create(e,j);return this};
|
||||
var l=a._Applet,h=a._Applet.prototype;l._get=function(e,j,h){h||(h=!1);j||(j={});a._addDefaultInfo(j,{color:"#FFFFFF",width:300,height:300,addSelectionOptions:!1,serverURL:"http://your.server.here/jsmol.php",defaultModel:"",script:null,src:null,readyFunction:null,use:"HTML5",jarPath:"java",jarFile:"JmolApplet0.jar",isSigned:!1,j2sPath:"j2s",coverImage:null,makeLiveImage:null,coverTitle:"",coverCommand:"",deferApplet:!1,deferUncover:!1,disableJ2SLoadMonitor:!1,disableInitialConsole:!0,debug:!1});a._debugAlert=
|
||||
j.debug;j.serverURL&&(a._serverUrl=j.serverURL);for(var m=!1,u=null,b=j.use.toUpperCase().split("#")[0].split(" "),c=0;c<b.length;c++){switch(b[c]){case "JAVA":m=!0;a.featureDetection.supportsJava()&&(u=new l(e,j,h));break;case "WEBGL":u=l._getCanvas(e,j,h,!0);break;case "HTML5":a.featureDetection.allowHTML5?u=l._getCanvas(e,j,h,!1):b.push("JAVA")}if(null!=u)break}null==u&&(h||!m?u={_jmolType:"none"}:m&&(u=new l(e,j)));return h?u:a._registerApplet(e,u)};l._getCanvas=function(e,j,h,m){j._isLayered=
|
||||
!1;j._platform="J.awtjs2d.Platform";return m&&a.featureDetection.supportsWebGL()?(a._Canvas3D.prototype=a.GLmol.extendApplet(a._jsSetPrototype(new l(e,j,!0))),new a._Canvas3D(e,j,"Jmol",h)):!m?(a._Canvas2D.prototype=a._jsSetPrototype(new l(e,j,!0)),new a._Canvas2D(e,j,"Jmol",h)):null};l._noJavaMsg="Either you do not have Java applets enabled in your web<br />browser or your browser is blocking this applet.<br />\t\t\tCheck the warning message from your browser and/or enable Java applets in<br />\t\t\tyour web browser preferences, or install the Java Runtime Environment from <a href='http://www.java.com'>www.java.com</a>";
|
||||
l._setCommonMethods=function(a){a._showInfo=h._showInfo;a._search=h._search;a._getName=h._getName;a._readyCallback=h._readyCallback};l._createApplet=function(e,j,h){e._initialize(j.jarPath,j.jarFile);var s=e._jarFile;a._isFile&&(s=s.replace(/0\.jar/,".jar"));var u=0<=e._containerWidth.indexOf("px")?e._containerWidth:"100%",b=0<=e._containerHeight.indexOf("px")?e._containerHeight:"100%",u=' style="width:'+u+";height:"+b+'" ',b="name='"+e._id+"_object' id='"+e._id+"_object' \n"+u+"\n";h.codebase=e._jarPath;
|
||||
h.codePath=h.codebase+"/";if(0>h.codePath.indexOf("://")){var c=m.location.href.split("#")[0].split("?")[0].split("/");c[c.length-1]=h.codePath;h.codePath=c.join("/")}h.archive=s;h.mayscript="true";h.java_arguments="-Xmx"+Math.round(j.memoryLimit||e._memoryLimit)+"m";h.permissions=e._isSigned?"all-permissions":"sandbox";h.documentLocation=m.location.href;h.documentBase=m.location.href.split("#")[0].split("?")[0];h.jarPath=j.jarPath;a._syncedApplets.length&&(h.synccallback="Jmol._mySyncCallback");
|
||||
e._startupScript&&(h.script=e._startupScript);var c="\n",d;for(d in h)h[d]&&(c+=" <param name='"+d+"' value='"+h[d]+"' />\n");c=a.featureDetection.useIEObject||a.featureDetection.useHtml4Object?"<object "+b+(a.featureDetection.useIEObject?" classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' codebase='http://java.sun.com/update/1.6.0/jinstall-6u22-windows-i586.cab'>":" type='application/x-java-applet'>")+c+"<p style='background-color:yellow;"+u.split('"')[1]+";text-align:center;vertical-align:middle;'>\n"+
|
||||
l._noJavaMsg+"</p></object>\n":"<applet "+b+" code='"+h.code+"' codebase='"+e._jarPath+"' archive='"+s+"' mayscript='true'>\n"+c+"<table bgcolor='yellow'><tr><td align='center' valign='middle' "+u+">\n"+l._noJavaMsg+"</td></tr></table></applet>\n";e._deferApplet&&(e._javaCode=c,c="");c=a._getWrapper(e,!0)+c+a._getWrapper(e,!1)+(j.addSelectionOptions?a._getGrabberOptions(e):"");a._debugAlert&&alert(c);e._code=a._documentWrite(c)};h._newApplet=function(a){this._is2D||a.put("script",(a.get("script")||
|
||||
"")+";set multipleBondSpacing 0.35;");this._viewerOptions=a;return new J.appletjs.Jmol(a)};h._addCoreFiles=function(){a._addCoreFile("jmol",this._j2sPath,this.__Info.preloadCore);this._is2D||a._addExec([this,null,"J.export.JSExporter","load JSExporter"]);a._debugCode&&a._addExec([this,null,"J.appletjs.Jmol","load Jmol"])};h._create=function(e,j){a._setObject(this,e,j);var h={syncId:a._syncId,progressbar:"true",progresscolor:"blue",boxbgcolor:this._color||"black",boxfgcolor:"white",boxmessage:"Downloading JmolApplet ...",
|
||||
script:this._color?'background "'+this._color+'"':"",code:"JmolApplet.class"};a._setAppletParams(this._availableParams,h,j);var m;j.inlineModel?(m=j.inlineModel,m=m.replace(/\r|\n|\r\n/g,0<=m.indexOf("|")?"\\/n":"|").replace(/'/g,"'"),a._debugAlert&&alert("inline model:\n"+m)):m="";h.loadInline=m;h.appletReadyCallback="Jmol._readyCallback";a._syncedApplets.length&&(h.synccallback="Jmol._mySyncCallback");h.java_arguments="-Xmx"+Math.round(j.memoryLimit||this._memoryLimit)+"m";this._initialize(j.jarPath,
|
||||
j.jarFile);l._createApplet(this,j,h)};h._restoreState=function(e,j){System.out.println("\n\nasynchronous restore state for "+e+" "+j);var h=this,l=h._applet&&h._applet.viewer;switch(j){case "setOptions":return function(){h.__startAppletJS(h)};case "render":return function(){setTimeout(function(){l.refresh(2)},10)};default:switch(e){case "J.shape.Balls":case "J.shape.Sticks":case "J.shape.Frank":return null}if(l&&l.isScriptExecuting&&l.isScriptExecuting()){if(a._asyncCallbacks[e])return System.out.println("...ignored"),
|
||||
1;var m=l.getEvalContextAndHoldQueue(l.eval),b=m.pc-1;m.asyncID=e;a._asyncCallbacks[e]=function(a){m.pc=a;System.out.println("sc.asyncID="+m.asyncID+" sc.pc = "+m.pc);l.eval.resumeEval(m)};l.eval.pc=l.eval.pcEnd;System.out.println("setting resume for pc="+m.pc+" "+e+" to "+a._asyncCallbacks[e]+"//");return function(){System.out.println("resuming "+e+" "+a._asyncCallbacks[e]);a._asyncCallbacks[e](b)}}System.out.println(e+"?????????????????????"+j);return function(){setTimeout(function(){l.refresh(2)},
|
||||
10)}}};h._notifyAudioEnded=function(a){this._applet.notifyAudioEnded(a)};h._readyCallback=function(e,j,h){if(h){a._setDestroy(this);this._ready=!0;e=this._readyScript;this._defaultModel?a._search(this,this._defaultModel,e?";"+e:""):e?this._script(e):this._src&&this._script('load "'+this._src+'"');this._showInfo(!0);this._showInfo(!1);a.Cache.setDragDrop(this);this._readyFunction&&this._readyFunction(this);a._setReady(this);if((e=this._2dapplet)&&e._isEmbedded&&e._ready&&e.__Info.visible)this._show2d(!0),
|
||||
this._show2d(!1),this._show2d(!0);a._hideLoadingSpinner(this)}};h._showInfo=function(e){e&&this._2dapplet&&this._2dapplet._show(!1);a.$html(a.$(this,"infoheaderspan"),this._infoHeader);this._info&&a.$html(a.$(this,"infodiv"),this._info);if(!this._isInfoVisible!=!e){this._isInfoVisible=e;if(this._isJava){var j=e?2:"100%";a.$setSize(a.$(this,"appletdiv"),j,j)}a.$setVisible(a.$(this,"infotablediv"),e);a.$setVisible(a.$(this,"infoheaderdiv"),e);this._show(!e)}};h._show2d=function(a){this._2dapplet._show2d(a);
|
||||
this._2dapplet._isEmbedded&&(this._showInfo(!1),this._show(!a),this._2dapplet.__showContainer(!0,!0))};h._getSpinner=function(){return this.__Info.appletLoadingImage||this._j2sPath+"/img/JSmol_spinner.gif"};h._getAtomCorrelation=function(a){this._loadMolData(a,"atommap = compare({1.1} {2.1} 'MAP' 'H'); zap 2.1",!0);a=this._evaluate("atommap");for(var j=this._evaluate("{*}.count"),h=[],l=[],m=0;m<a.length;m++){var b=a[m];h[b[0]+1]=b[1]-j+1;l[b[1]-j+1]=b[0]+1}return{fromJmol:h,toJmol:l}};h._show=function(e){var j=
|
||||
!e?2:"100%";a.$setSize(a.$(this,"object"),j,j);this._isJava||a.$setVisible(a.$(this,"appletdiv"),e)};h._clearConsole=function(){this._console==this._id+"_infodiv"&&(this.info="");self.Clazz&&(a._setConsoleDiv(this._console),Clazz.Console.clear())};h._addScript=function(a){this._readyScript||(this.readyScript="");this._readyScript&&(this._readyScript+=";");this._readyScript+=a;return!0};h._script=function(e){if(!this._ready)return this._addScript(e);a._setConsoleDiv(this._console);a._hideLocalFileReader(this);
|
||||
this._applet.script(e)};h._syncScript=function(a){this._applet.syncScript(a)};h._scriptCheck=function(a){return this._ready&&this._applet.scriptCheck(a)};h._scriptWait=function(a,j){var h=this._scriptWaitAsArray(a),l="";if(!j)for(var m=h.length;0<=--m;)for(var b=0,c=h[m].length;b<c;b++)l+=h[m][b]+"\n";return l};h._scriptEcho=function(a){a=this._scriptWaitAsArray(a);for(var j="",h=a.length;0<=--h;)for(var l=a[h].length;0<=--l;)"scriptEcho"==a[h][l][1]&&(j+=a[h][l][3]+"\n");return j.replace(/ \| /g,
|
||||
"\n")};h._scriptMessage=function(a){a=this._scriptWaitAsArray(a);for(var j="",h=a.length;0<=--h;)for(var l=a[h].length;0<=--l;)"scriptStatus"==a[h][l][1]&&(j+=a[h][l][3]+"\n");return j.replace(/ \| /g,"\n")};h._scriptWaitOutput=function(a){var j="";try{a&&(j+=this._applet.scriptWaitOutput(a))}catch(h){}return j};h._scriptWaitAsArray=function(e){var j="";try{if(this._getStatus("scriptEcho,scriptMessage,scriptStatus,scriptError"),e&&(j+=this._applet.scriptWait(e),j=a._evalJSON(j,"jmolStatus"),"object"==
|
||||
typeof j))return j}catch(h){}return[[j]]};h._getStatus=function(e){return a._sortMessages(this._getPropertyAsArray("jmolStatus",e))};h._getPropertyAsArray=function(e,j){return a._evalJSON(this._getPropertyAsJSON(e,j),e)};h._getPropertyAsString=function(a,j){void 0==j&&(j="");return this._applet.getPropertyAsString(a,j)+""};h._getPropertyAsJSON=function(a,j){void 0==j&&(j="");try{return this._applet.getPropertyAsJSON(a,j)+""}catch(h){return""}};h._getPropertyAsJavaObject=function(a,j){void 0==j&&(j=
|
||||
"");return this._applet.getProperty(a,j)};h._evaluate=function(a){null!=a||(a="");return this._getPropertyAsArray("variableInfo",a)};h._evaluateDEPRECATED=function(a){a=""+this._getPropertyAsJavaObject("evaluate",a);var j=a.replace(/\-*\d+/,"");if(""==j&&!isNaN(parseInt(a)))return parseInt(a);j=a.replace(/\-*\d*\.\d*/,"");return""==j&&!isNaN(parseFloat(a))?parseFloat(a):a};h._saveOrientation=function(a){return this._savedOrientations[a]=this._getPropertyAsArray("orientationInfo","info").moveTo};h._restoreOrientation=
|
||||
function(a){a=this._savedOrientations[a];return!a||""==a?a.replace(/1\.0/,"0"):this._scriptWait(a)};h._restoreOrientationDelayed=function(a,j){1>arguments.length&&(j=1);var h=this._savedOrientations[a];return!h||""==h?h.replace(/1\.0/,j):this._scriptWait(h)};h._resizeApplet=function(e){function j(e,h){var b=""+e;return 0==b.length?h?"":a._allowedJmolSize[2]:b.indexOf("%")==b.length-1?b:1>=(e=parseFloat(e))&&0<e?100*e+"%":(isNaN(e=Math.floor(e))?a._allowedJmolSize[2]:e<a._allowedJmolSize[0]?a._allowedJmolSize[0]:
|
||||
e>a._allowedJmolSize[1]?a._allowedJmolSize[1]:e)+(h?h:"")}var h;"object"==typeof e&&null!=e?(h=e[0]||e.width,e=e[1]||e.height):h=e;h=[j(h,"px"),j(e,"px")];e=a._getElement(this,"appletinfotablediv");e.style.width=h[0];e.style.height=h[1];this._containerWidth=h[0];this._containerHeight=h[1];this._is2D&&a._repaint(this,!0)};h._search=function(e,h){a._search(this,e,h)};h._searchDatabase=function(e,h,l){if(this._2dapplet&&this._2dapplet._isEmbedded&&!a.$(this,"appletdiv:visible")[0])return this._2dapplet._searchDatabase(e,
|
||||
h,l);this._showInfo(!1);0<=e.indexOf("?")?a._getInfoFromDatabase(this,h,e.split("?")[0]):(l||(l=a._getScriptForDatabase(h)),e=h+e,this._currentView=null,this._searchQuery=e,this._loadFile(e,l,e))};h._loadFile=function(e,h,l){this._showInfo(!1);h||(h="");this._thisJmolModel=""+Math.random();this._fileName=e;if(!this._scriptLoad(e,h)){var m=this;a._loadFileData(this,e,function(a){m.__loadModel(a,h,l)},function(){m.__loadModel(null)})}};h._scriptLoad=function(a,h){h||(h="");var l=this._isJava||!this._noscript;
|
||||
l&&this._script("zap;set echo middle center;echo Retrieving data...");if(!this._isSigned||null!=this._viewSet)return!1;l?this._script('load async "'+a+'";'+h):this._applet.openFile(a);this._checkDeferred("");return!0};h.__loadModel=function(e,h,l){null!=e&&(null!=this._viewSet&&(h||(h=""),h+=";if ({*}.molecule.max > 1 || {*}.modelindex.max > 0){ delete molecule > 1 or modelindex > 0;x = getProperty('extractModel',{*});load inline @x};"),!h&&this._noscript?this._applet.loadInlineString(e,"",!1):this._loadMolData(e,
|
||||
h,!1),null!=this._viewSet&&a.View.updateView(this,{chemID:l,data:e}))};h._loadMolData=function(a,h,l){h||(h="");l=l?"append":"model";this._applet.scriptWait('load DATA "'+l+'"'+a+'\nEND "'+l+'" ;'+h)};h._loadModelFromView=function(e){this._currentView=e;var h=e.Jmol;null!=h.data?this.__loadModel(h.data,null,e.info.chemID):null!=e.info.chemID?a._searchMol(this,e.info.chemID,null,!1):(h=e.JME)&&h.applet._show2d(!1,this)};h._reset=function(){this._scriptWait("zap",!0)};h._updateView=function(){null!=
|
||||
this._viewSet&&this._applet&&(chemID=""+this._getPropertyAsJavaObject("variableInfo","script('show chemical inchiKey')"),chemID=36>chemID.length()?null:chemID.substring(36).split("\n")[0],a.View.updateView(this,{chemID:chemID,data:""+this._getPropertyAsJavaObject("evaluate","extractModel","{visible}")}))};h._atomPickedCallback=function(e,h){if(!(0>h)){var l=[h+1];a.View.updateAtomPick(this,l);this._updateAtomPick(l)}};h._updateAtomPick=function(a){this._script(0==a.length?"select none":"select on visible and (@"+
|
||||
a.join(",@")+")")};h._isDeferred=function(){return!this._canvas&&this._cover&&this._isCovered&&this._deferApplet};h._checkDeferred=function(a){return this._isDeferred()?(this._coverScript=a,this._cover(!1),!0):!1};h._cover=function(e){e||!this._deferApplet?this._displayCoverImage(e):(e=this._coverScript?this._coverScript:"",this._coverScript="",this._deferUncover&&(e+=";refresh;javascript "+this._id+"._displayCoverImage(false)"),this._script(e,!0),this._deferUncover&&"activate 3D model"==this._coverTitle&&
|
||||
(a._getElement(this,"coverimage").title="3D model is loading..."),this._isJava||this._newCanvas(!1),this._defaultModel&&a._search(this,this._defaultModel),this._showInfo(!1),this._deferUncover||this._displayCoverImage(!1),this._isJava&&a.$html(a.$(this,"appletdiv"),this._javaCode),this._init&&this._init())};h._displayCoverImage=function(e){this._coverImage&&this._isCovered!=e&&(this._isCovered=e,a._getElement(this,"coverdiv").style.display=e?"block":"none")};h._getSmiles=function(){return this._evaluate("{visible}.find('SMILES')")};
|
||||
h._getMol=function(){return this._evaluate("getProperty('ExtractModel',{visible})")};h._getMol2D=function(){return this._evaluate("script('select visible;show chemical sdf')")};a.jmolSmiles=function(a){return a._getSmiles()}})(Jmol,document);
|
||||
(function(a){var m=a.controls={_hasResetForms:!1,_scripts:[""],_checkboxMasters:{},_checkboxItems:{},_actions:{},_buttonCount:0,_checkboxCount:0,_radioGroupCount:0,_radioCount:0,_linkCount:0,_cmdCount:0,_menuCount:0,_previousOnloadHandler:null,_control:null,_element:null,_appletCssClass:null,_appletCssText:"",_buttonCssClass:null,_buttonCssText:"",_checkboxCssClass:null,_checkboxCssText:"",_radioCssClass:null,_radioCssText:"",_linkCssClass:null,_linkCssText:"",_menuCssClass:null,_menuCssText:""};
|
||||
m._addScript=function(a,h){var e=m._scripts.length;m._scripts[e]=[a,h];return e};m._getIdForControl=function(a,h){return"string"==typeof a?a:!h||!a._canScript||a._canScript(h)?a._id:null};m._radio=function(a,h,e,j,t,s,u,b){var c=m._getIdForControl(a,h);if(null==c)return null;++m._radioCount;void 0!=s&&null!=s||(s="jmolRadioGroup"+(m._radioGroupCount-1));if(!h)return"";void 0!=u&&null!=u||(u="jmolRadio"+(m._radioCount-1));void 0!=e&&null!=e||(e=h.substring(0,32));t||(t="");a="</span>";m._actions[u]=
|
||||
m._addScript(c,h);h='<span id="span_'+u+'"'+(b?' title="'+b+'"':"")+"><input name='"+s+"' id='"+u+"' type='radio' onclick='Jmol.controls._click(this);return true;' onmouseover='Jmol.controls._mouseOver(this);return true;' onmouseout='Jmol.controls._mouseOut()' "+(j?"checked='true' ":"")+m._radioCssText+" />";0<=e.toLowerCase().indexOf("<td>")&&(h+=a,a="");return h+('<label for="'+u+'">'+e+"</label>"+a+t)};m._scriptExecute=function(l,h){var e=a._applets[h[0]],j=h[1];if("object"==typeof j)j[0](l,j,
|
||||
e);else"function"==typeof j?j(e):a.script(e,j)};m.__checkScript=function(a,h){var e=0<=h.value.indexOf("JSCONSOLE ")||""===a._scriptCheck(h.value);h.style.color=e?"black":"red";return e};m.__getCmd=function(a,h){if(h._cmds&&h._cmds.length){var e=h._cmds[h._cmdpt=(h._cmdpt+h._cmds.length+a)%h._cmds.length];setTimeout(function(){h.value=e},10);h._cmdadd=1;h._cmddir=a}};m._commandKeyPress=function(l,h,e){l=13==l?13:window.event?window.event.keyCode:l?l.keyCode||l.which:0;var j=document.getElementById(h),
|
||||
t=a._applets[e];switch(l){case 13:return h=j.value,m._scriptExecute(j,[e,h]),j._cmds||(j._cmds=[],j._cmddir=0,j._cmdpt=-1,j._cmdadd=0),h&&0==j._cmdadd?(++j._cmdpt,j._cmds.splice(j._cmdpt,0,h),j._cmdadd=0,j._cmddir=0):j._cmdadd=0,j.value="",!1;case 27:return setTimeout(function(){j.value=""},20),!1;case 38:m.__getCmd(-1,j);break;case 40:m.__getCmd(1,j);break;default:j._cmdadd=0}setTimeout(function(){m.__checkScript(t,j)},20);return!0};m._click=function(a,h){m._element=a;1==arguments.length&&(h=m._actions[a.id]);
|
||||
m._scriptExecute(a,m._scripts[h])};m._menuSelected=function(a){var h=a.value;if(void 0!=h)m._scriptExecute(a,m._scripts[h]);else{h=a.length;if("number"==typeof h)for(var e=0;e<h;++e)if(a[e].selected){m._click(a[e],a[e].value);return}alert("?Que? menu selected bug #8734")}};m._cbNotifyMaster=function(a){var h=!0,e=!0,j=!1,t,s;for(s in a.chkGroup)t=a.chkGroup[s],t.checked?e=!1:h=!1,t.indeterminate&&(j=!0);t=a.chkMaster;h?t.checked=!0:e?t.checked=!1:j=!0;t.indeterminate=j;(a=m._checkboxItems[t.id])&&
|
||||
(t=a.chkMaster)&&m._cbNotifyMaster(m._checkboxMasters[t.id])};m._cbNotifyGroup=function(a,h){for(var e in a.chkGroup){var j=a.chkGroup[e];j.checked!=h&&(j.checked=h,m._cbClick(j));m._checkboxMasters[j.id]&&m._cbNotifyGroup(m._checkboxMasters[j.id],h)}};m._cbSetCheckboxGroup=function(a,h,e){var j=a;"number"==typeof j&&(j="jmolCheckbox"+j);(a=document.getElementById(j))||alert("jmolSetCheckboxGroup: master checkbox not found: "+j);var t=m._checkboxMasters[j]={};t.chkMaster=a;t.chkGroup={};"string"==
|
||||
typeof h?(h=e,j=1):j=0;for(a=j;a<h.length;a++)j=h[a],"number"==typeof j&&(j="jmolCheckbox"+j),(e=document.getElementById(j))||alert("jmolSetCheckboxGroup: group checkbox not found: "+j),t.chkGroup[j]=e,m._checkboxItems[j]=t};m._cbClick=function(a){m._control=a;var h=m._actions[a.id][0],e=m._actions[a.id][1];m._click(a,a.checked?h:e);m._checkboxMasters[a.id]&&m._cbNotifyGroup(m._checkboxMasters[a.id],a.checked);m._checkboxItems[a.id]&&m._cbNotifyMaster(m._checkboxItems[a.id])};m._cbOver=function(a){var h=
|
||||
m._actions[a.id][0],e=m._actions[a.id][1];window.status=m._scripts[a.checked?e:h]};m._mouseOver=function(a,h){1==arguments.length&&(h=m._actions[a.id]);window.status=m._scripts[h]};m._mouseOut=function(){window.status=" ";return!0};m._onloadResetForms=function(){m._hasResetForms||(m._hasResetForms=!0,m._previousOnloadHandler=window.onload,window.onload=function(){if(0<m._buttonCount+m._checkboxCount+m._menuCount+m._radioCount+m._radioGroupCount)for(var a=document.forms,h=a.length;0<=--h;)a[h].reset();
|
||||
m._previousOnloadHandler&&m._previousOnloadHandler()})};m._getButton=function(l,h,e,j,t){l=m._getIdForControl(l,h);if(null==l)return"";void 0!=j&&null!=j||(j="jmolButton"+m._buttonCount);void 0!=e&&null!=e||(e=h.substring(0,32));++m._buttonCount;m._actions[j]=m._addScript(l,h);h='<span id="span_'+j+'"'+(t?' title="'+t+'"':"")+"><input type='button' name='"+j+"' id='"+j+"' value='"+e+"' onclick='Jmol.controls._click(this)' onmouseover='Jmol.controls._mouseOver(this);return true' onmouseout='Jmol.controls._mouseOut()' "+
|
||||
m._buttonCssText+" /></span>";a._debugAlert&&alert(h);return a._documentWrite(h)};m._getCheckbox=function(l,h,e,j,t,s,u){var b=m._getIdForControl(l,h);null!=b&&(b=m._getIdForControl(l,e));if(null==b)return"";void 0!=s&&null!=s||(s="jmolCheckbox"+m._checkboxCount);++m._checkboxCount;if(void 0==h||null==h||void 0==e||null==e)alert("jmolCheckbox requires two scripts");else if(void 0==j||null==j)alert("jmolCheckbox requires a label");else return m._actions[s]=[m._addScript(b,h),m._addScript(b,e)],l="</span>",
|
||||
t='<span id="span_'+s+'"'+(u?' title="'+u+'"':"")+"><input type='checkbox' name='"+s+"' id='"+s+"' onclick='Jmol.controls._cbClick(this)' onmouseover='Jmol.controls._cbOver(this);return true' onmouseout='Jmol.controls._mouseOut()' "+(t?"checked='true' ":"")+m._checkboxCssText+" />",0<=j.toLowerCase().indexOf("<td>")&&(t+=l,l=""),t+='<label for="'+s+'">'+j+"</label>"+l,a._debugAlert&&alert(t),a._documentWrite(t)};m._getCommandInput=function(l,h,e,j,t,s){l=m._getIdForControl(l,"x");if(null==l)return"";
|
||||
void 0!=j&&null!=j||(j="jmolCmd"+m._cmdCount);void 0!=h&&null!=h||(h="Execute");void 0!=e&&!isNaN(e)||(e=60);void 0!=s||(s="help");++m._cmdCount;h='<span id="span_'+j+'"'+(t?' title="'+t+'"':"")+"><input name='"+j+"' id='"+j+"' size='"+e+"' onkeydown='return Jmol.controls._commandKeyPress(event,\""+j+'","'+l+"\")' value='"+s+"'/><input type='button' name='"+j+"Btn' id='"+j+"Btn' value = '"+h+"' onclick='Jmol.controls._commandKeyPress(13,\""+j+'","'+l+"\")' /></span>";a._debugAlert&&alert(h);return a._documentWrite(h)};
|
||||
m._getLink=function(l,h,e,j,t){l=m._getIdForControl(l,h);if(null==l)return"";void 0!=j&&null!=j||(j="jmolLink"+m._linkCount);void 0!=e&&null!=e||(e=h.substring(0,32));++m._linkCount;h=m._addScript(l,h);e='<span id="span_'+j+'"'+(t?' title="'+t+'"':"")+"><a name='"+j+"' id='"+j+"' href='javascript:Jmol.controls._click(null,"+h+");' onmouseover='Jmol.controls._mouseOver(null,"+h+");return true;' onmouseout='Jmol.controls._mouseOut()' "+m._linkCssText+">"+e+"</a></span>";a._debugAlert&&alert(e);return a._documentWrite(e)};
|
||||
m._getMenu=function(l,h,e,j,t){var s=m._getIdForControl(l,null);void 0!=j&&null!=j||(j="jmolMenu"+m._menuCount);++m._menuCount;s=typeof h;if(null!=s&&"object"==s&&h.length){var u=h.length;"number"!=typeof e||1==e?e=null:0>e&&(e=u);e='<span id="span_'+j+'"'+(t?' title="'+t+'"':"")+"><select name='"+j+"' id='"+j+"' onChange='Jmol.controls._menuSelected(this)'"+(e?" size='"+e+"' ":"")+m._menuCssText+">";for(j=0;j<u;++j){var b=h[j],s=typeof b,c=null,d=t=null;"object"==s&&null!=b?(c=b[0],t=b[1],d=b[2]):
|
||||
c=t=b;s=m._getIdForControl(l,c);if(null==s)return"";null==t&&(t=c);"#optgroup"==c?e+="<optgroup label='"+t+"'>":"#optgroupEnd"==c?e+="</optgroup>":(s=m._addScript(s,c),e+="<option value='"+s+(d?"' selected='true'>":"'>")+t+"</option>")}e+="</select></span>";a._debugAlert&&alert(e);return a._documentWrite(e)}};m._getRadio=function(l,h,e,j,t,s,u,b){0==m._radioGroupCount&&++m._radioGroupCount;s||(s="jmolRadioGroup"+(m._radioGroupCount-1));l=m._radio(l,h,e,j,t,s,u?u:s+"_"+m._radioCount,b?b:0);if(null==
|
||||
l)return"";a._debugAlert&&alert(l);return a._documentWrite(l)};m._getRadioGroup=function(l,h,e,j,t,s){var u=typeof h;if("object"!=u||null==u||!h.length)alert("invalid arrayOfRadioButtons");else{void 0!=e&&null!=e||(e="  ");var b=h.length;++m._radioGroupCount;j||(j="jmolRadioGroup"+(m._radioGroupCount-1));for(var c="<span id='"+(t?t:j)+"'>",d=0;d<b;++d){d==b-1&&(e="");var q=h[d],u=typeof q,K=null,c="object"==u?c+(K=m._radio(l,q[0],q[1],q[2],e,j,3<q.length?q[3]:(t?t:j)+"_"+d,4<q.length?q[4]:0,
|
||||
s)):c+(K=m._radio(l,q,null,null,e,j,(t?t:j)+"_"+d,s));if(null==K)return""}c+="</span>";a._debugAlert&&alert(c);return a._documentWrite(c)}}})(Jmol);
|
||||
(function(a){var m=function(a){a="&"+a+"=";return decodeURI(("&"+document.location.search.substring(1)+a).split(a)[1].split("&")[0])};a._j2sPath=m("_J2S");a._jarFile=m("_JAR");a._use=m("_USE");a.getVersion=function(){return a._jmolInfo.version};a.getApplet=function(l,h,e){return a._Applet._get(l,h,e)};a.getJMEApplet=function(l,h,e,j){return a._JMEApplet._get(l,h,e,j)};a.getJSVApplet=function(l,h,e){return a._JSVApplet._get(l,h,e)};a.loadFile=function(a,h,e){a._loadFile(h,e)};a.script=function(a,h){a._checkDeferred(h)||
|
||||
a._script(h)};a.scriptCheck=function(a,h){return a&&a._scriptCheck&&a._ready&&a._scriptCheck(h)};a.scriptWait=function(a,h){return a._scriptWait(h)};a.scriptEcho=function(a,h){return a._scriptEcho(h)};a.scriptMessage=function(a,h){return a._scriptMessage(h)};a.scriptWaitOutput=function(a,h){return a._scriptWait(h)};a.scriptWaitAsArray=function(a,h){return a._scriptWaitAsArray(h)};a.search=function(a,h,e){a._search(h,e)};a.evaluateVar=function(a,h){return a._evaluate(h)};a.evaluate=function(a,h){return a._evaluateDEPRECATED(h)};
|
||||
a.getAppletHtml=function(l,h){if(h){var e=a._document;a._document=null;l=a.getApplet(l,h);a._document=e}return l._code};a.getPropertyAsArray=function(a,h,e){return a._getPropertyAsArray(h,e)};a.getPropertyAsJavaObject=function(a,h,e){return a._getPropertyAsJavaObject(h,e)};a.getPropertyAsJSON=function(a,h,e){return a._getPropertyAsJSON(h,e)};a.getPropertyAsString=function(a,h,e){return a._getPropertyAsString(h,e)};a.getStatus=function(a,h){return a._getStatus(h)};a.resizeApplet=function(a,h){return a._resizeApplet(h)};
|
||||
a.restoreOrientation=function(a,h){return a._restoreOrientation(h)};a.restoreOrientationDelayed=function(a,h,e){return a._restoreOrientationDelayed(h,e)};a.saveOrientation=function(a,h){return a._saveOrientation(h)};a.say=function(a){alert(a)};a.clearConsole=function(a){a._clearConsole()};a.getInfo=function(a){return a._info};a.setInfo=function(a,h,e){a._info=h;2<arguments.length&&a._showInfo(e)};a.showInfo=function(a,h){a._showInfo(h)};a.show2d=function(a,h){a._show2d(h)};a.jmolBr=function(){return a._documentWrite("<br>")};
|
||||
a.jmolButton=function(l,h,e,j,m){return a.controls._getButton(l,h,e,j,m)};a.jmolCheckbox=function(l,h,e,j,m,s,u){return a.controls._getCheckbox(l,h,e,j,m,s,u)};a.jmolCommandInput=function(l,h,e,j,m,s){return a.controls._getCommandInput(l,h,e,j,m,s)};a.jmolHtml=function(l){return a._documentWrite(l)};a.jmolLink=function(l,h,e,j,m){return a.controls._getLink(l,h,e,j,m)};a.jmolMenu=function(l,h,e,j,m){return a.controls._getMenu(l,h,e,j,m)};a.jmolRadio=function(l,h,e,j,m,s,u,b){return a.controls._getRadio(l,
|
||||
h,e,j,m,s,u,b)};a.jmolRadioGroup=function(l,h,e,j,m,s){return a.controls._getRadioGroup(l,h,e,j,m,s)};a.setCheckboxGroup=function(l,h){a.controls._cbSetCheckboxGroup(l,h,arguments)};a.setDocument=function(l){a._document=l};a.setXHTML=function(l){a._isXHTML=!0;a._XhtmlElement=null;a._XhtmlAppendChild=!1;l&&(a._XhtmlElement=document.getElementById(l),a._XhtmlAppendChild=!0)};a.setAppletCss=function(l,h){null!=l&&(a._appletCssClass=l);a._appletCssText=h?h+" ":l?'class="'+l+'" ':""};a.setButtonCss=function(l,
|
||||
h){null!=l&&(a.controls._buttonCssClass=l);a.controls._buttonCssText=h?h+" ":l?'class="'+l+'" ':""};a.setCheckboxCss=function(l,h){null!=l&&(a.controls._checkboxCssClass=l);a.controls._checkboxCssText=h?h+" ":l?'class="'+l+'" ':""};a.setRadioCss=function(l,h){null!=l&&(a.controls._radioCssClass=l);a.controls._radioCssText=h?h+" ":l?'class="'+l+'" ':""};a.setLinkCss=function(l,h){null!=l&&(a.controls._linkCssClass=l);a.controls._linkCssText=h?h+" ":l?'class="'+l+'" ':""};a.setMenuCss=function(l,h){null!=
|
||||
l&&(a.controls._menuCssClass=l);a.controls._menuCssText=h?h+" ":l?'class="'+l+'" ':""};a.setAppletSync=function(l,h,e){a._syncedApplets=l;a._syncedCommands=h;a._syncedReady={};a._isJmolJSVSync=e};a.setGrabberOptions=function(l){a._grabberOptions=l};a.setAppletHtml=function(l,h){l._code&&(a.$html(h,l._code),l._init&&!l._deferApplet&&l._init())};a.coverApplet=function(a,h){a._cover&&a._cover(h)};a.setFileCaching=function(l,h){l?l._cacheFiles=h:a.fileCache=h?{}:null};a.resetView=function(l,h){a.View.resetView(l,
|
||||
h)};a.updateView=function(a,h,e){a._updateView(h,e)};a.getChemicalInfo=function(l,h,e){h||(h="name");"string"!=typeof l&&(l=l._getSmiles());return a._getNCIInfo(l,h,e)};a.saveImage=function(a){switch(a._viewType){case "Jmol":a._script('write PNGJ "'+a._id+'.png"');break;case "JSV":a._script("write PDF");break;case "JME":a._script("print")}}})(Jmol);
|
||||
LoadClazz=function(){c$=null;window["j2s.clazzloaded"]||(window["j2s.clazzloaded"]=!1);window["j2s.clazzloaded"]||(window["j2s.clazzloaded"]=!0,window["j2s.object.native"]=!0,Clazz={_isQuiet:!1,_debugging:!1},function(a,m){try{a._debugging=0<=document.location.href.indexOf("j2sdebug")}catch(l){}var h=["j2s.clazzloaded","j2s.object.native"];a.setGlobal=function(a,b){h.push(a);window[a]=b};a.getGlobals=function(){return h.sort().join("\n")};a.setConsoleDiv=function(a){window["j2s.lib"]&&(window["j2s.lib"].console=
|
||||
a)};var e=null;a._startProfiling=function(a){e=a&&self.JSON?{}:null};NullObject=function(){};a._supportsNativeObject=window["j2s.object.native"];a._supportsNativeObject?(a._O=function(){},a._O.__CLASS_NAME__="Object",a._O.getClass=function(){return a._O}):a._O=Object;a.Console={};a.dateToString=Date.prototype.toString;a._hashCode=0;var j=a._O.prototype;j.equals=function(a){return this==a};j.hashCode=function(){return this._$hashcode||(this._$hashcode=++a._hashCode)};j.getClass=function(){return a.getClass(this)};
|
||||
j.clone=function(){return a.clone(this)};a.clone=function(a){var b=a instanceof Array?Array(a.length):new a.constructor,c;for(c in a)b[c]=a[c];return b};j.finalize=function(){};j.notify=function(){};j.notifyAll=function(){};j.wait=function(){};j.to$tring=Object.prototype.toString;j.toString=function(){return this.__CLASS_NAME__?"["+this.__CLASS_NAME__+" object]":this.to$tring.apply(this,arguments)};a._extendedObjectMethods="equals hashCode getClass clone finalize notify notifyAll wait to$tring toString".split(" ");
|
||||
a.extendJO=function(b,c){c&&(b.__CLASS_NAME__=b.prototype.__CLASS_NAME__=c);if(a._supportsNativeObject)for(var d=0;d<a._extendedObjectMethods.length;d++){var e=a._extendedObjectMethods[d];b.prototype[e]=a._O.prototype[e]}};a.extractClassName=function(a){a=a.substring(1,a.length-1);return 0<=a.indexOf("Array")?"Array":0<=a.indexOf("object ")?a.substring(7):a};a.getClassName=function(b,c){if(null==b)return"NullObject";if(b instanceof a.CastedNull)return b.clazzName;switch(typeof b){case "number":return"n";
|
||||
case "boolean":return"b";case "string":return"String";case "function":if(b.__CLASS_NAME__)return c?b.__CLASS_NAME__:"Class";var d=b.toString(),e=d.indexOf("function");if(0>e)return"["==d.charAt(0)?a.extractClassName(d):d.replace(/[^a-zA-Z0-9]/g,"");var e=e+8,h=d.indexOf("(",e);if(0>h)break;d=d.substring(e,h);if(0<=d.indexOf("Array"))return"Array";d=d.replace(/^\s+/,"").replace(/\s+$/,"");return"anonymous"==d||""==d?"Function":d;case "object":if(b.__CLASS_NAME__)return b.__CLASS_NAME__;if(!b.constructor)break;
|
||||
if(!b.constructor.__CLASS_NAME__){if(b instanceof Number)return"Number";if(b instanceof Boolean)return"Boolean";if(b instanceof Array||b.BYTES_PER_ELEMENT)return"Array";d=b.toString();if("["==d.charAt(0))return a.extractClassName(d)}return a.getClassName(b.constructor,!0)}return"Object"};a.getClass=function(b){if(!b)return a._O;if("function"==typeof b)return b;if(b instanceof a.CastedNull)b=b.clazzName;else switch(typeof b){case "string":return String;case "object":if(!b.__CLASS_NAME__)return b.constructor||
|
||||
a._O;b=b.__CLASS_NAME__;break;default:return b.constructor}return a.evalType(b,!0)};var t=function(b,c){for(var d=0;d<a.innerFunctionNames.length;d++)if(c==a.innerFunctionNames[d]&&a._innerFunctions[c]===b[c])return!0;return!1},s=function(){};a.inheritArgs=new s;a.inheritClass=function(b,c,d){for(var e in c)"b$"!=e&&("prototype"!=e&&"superClazz"!=e&&"__CLASS_NAME__"!=e&&"implementz"!=e&&!t(c,e))&&(b[e]=c[e]);a.unloadedClasses[a.getClassName(b,!0)]||(b.prototype=d?d:c!==Number?new c(a.inheritArgs):
|
||||
new Number);b.superClazz=c;b.prototype.__CLASS_NAME__=b.__CLASS_NAME__};a.implementOf=function(a,b){if(2<=arguments.length){a.implementz||(a.implementz=[]);var c=a.implementz;if(2==arguments.length)if("function"==typeof b)c.push(b),u(a,b);else{if(b instanceof Array)for(var d=0;d<b.length;d++)c.push(b[d]),u(a,b[d])}else for(d=1;d<arguments.length;d++)c.push(arguments[d]),u(a,arguments[d])}};var u=function(a,b){for(var c in b)if("b$"!=c&&"prototype"!=c&&"superClazz"!=c&&"__CLASS_NAME__"!=c&&"implementz"!=
|
||||
c&&("function"!=typeof b[c]||!t(b,c)))a[c]=a.prototype[c]=b[c]};a.extendInterface=a.implementOf;a.equalsOrExtendsLevel=function(b,c){if(b===c)return 0;if(b.implementz)for(var d=b.implementz,e=0;e<d.length;e++){var h=a.equalsOrExtendsLevel(d[e],c);if(0<=h)return h+1}return-1};a.getInheritedLevel=function(b,c){if(b===c)return 0;var d="string"==typeof b;if(d&&("void"==b||"unknown"==b))return-1;var e="string"==typeof c;if(e&&("void"==c||"unknown"==c))return-1;if(b===(d?"NullObject":NullObject))switch(c){case "n":case "b":return-1;
|
||||
case Number:case Boolean:case NullObject:break;default:return 0}d&&(b=a.evalType(b));e&&(c=a.evalType(c));if(!c||!b)return-1;d=0;for(e=b;e!==c&&10>d;){if(e.implementz)for(var h=e.implementz,j=0;j<h.length;j++){var l=a.equalsOrExtendsLevel(h[j],c);if(0<=l)return d+l+1}e=e.superClazz;if(!e)return c===Object||c===a._O?d+1.5:-1;d++}return d};a.instanceOf=function(b,c){return null!=b&&c&&(b==c||b instanceof c||0<=a.getInheritedLevel(a.getClassName(b),c))};a.superCall=function(b,c,d,e){var h=null,j=-1,
|
||||
l=b[d];if(l)if(l.claxxOwner)l.claxxOwner!==c&&(h=l);else if(!l.stacks&&(!l.lastClaxxRef||!l.lastClaxxRef.prototype[d]||!l.lastClaxxRef.prototype[d].stacks))h=l;else{var m=l.stacks;m||(m=l.lastClaxxRef.prototype[d].stacks);for(j=m.length;0<=--j;)if(c===m[j]){h=0<j?m[--j].prototype[d]:m[0].prototype[d]["\\unknown"];break}else if(0<a.getInheritedLevel(c,m[j])){h=m[j].prototype[d];break}}if(h)return 0==j&&"construct"==d&&(c=l.stacks)&&(!c[0].superClazz&&c[0].con$truct)&&c[0].con$truct.apply(b,[]),h.apply(b,
|
||||
e||[]);"construct"!=d&&(a.alert(["j2slib","no class found",e.typeString]),fb(b,c,d,a.getParamsType(e).typeString))};a.superConstructor=function(b,c,d){a.superCall(b,c,"construct",d);c.con$truct&&c.con$truct.apply(b,[])};a.CastedNull=function(b){this.clazzName=b?b instanceof String?b:b instanceof Function?a.getClassName(b,!0):""+b:"Object";this.toString=function(){return null};this.valueOf=function(){return null}};a.castNullAs=function(b){return new a.CastedNull(b)};a._initializingException=!1;a._callingStackTraces=
|
||||
[];var b=function(){this.toString=function(){return"J2S MethodException"}},c;try{null.hello()}catch(d){if(j=function(a,b,c){c||(c="[^\\s]+");var d=a.indexOf(b);a=a.substring(0,d)+c+a.substring(d+b.length);return RegExp("^"+a+"$")},/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var j=d.message.indexOf(":"),q=d.message.indexOf(":",j+2),K=d.message.substr(j+1,q-j-20);c=function(a){return-1!=a.message.indexOf(K)}}else if(-1!=navigator.userAgent.toLowerCase().indexOf("webkit")){var B=j(d.message,"hello");
|
||||
c=function(a){return B.test(a.message)}}else B=j(d.message,"$$o$$"),c=function(a){return B.test(a.message)}}a.exceptionOf=function(b,d){if(b.__CLASS_NAME__)return a.instanceOf(b,d);b.getMessage||(b.getMessage=function(){return""+b+(b.stack?"\n"+b.stack:"")});b.printStackTrace||(b.printStackTrace=function(){});if(d==Error){if(0>(""+b).indexOf("Error"))return!1;System.out.println(a.getStackTrace());return!0}return d==Exception||d==Throwable||d==NullPointerException&&c(b)};a.getStackTrace=function(a){a||
|
||||
(a=25);var b="\n",c=arguments.callee,d=0>a;d&&(a=-a);for(var e=0;e<a&&(c=c.caller);e++){var h=c.toString?c.toString().substring(0,c.toString().indexOf("{")):"<native method>",b=b+(e+" "+(c.exName?(c.claxxOwner?c.claxxOwner.__CLASS_NAME__+".":"")+c.exName+h.replace(/function /,""):h)+"\n");if(c==c.caller){b+="<recursing>\n";break}if(d)for(var h=c.arguments,j=0;j<h.length;j++){var l=""+h[j];60<l.length&&(l=l.substring(0,60)+"...");b+=" args["+j+"]="+l.replace(/\s+/g," ")+"\n"}}return b};a.makeConstructor=
|
||||
function(b,c,d){a.defineMethod(b,"construct",c,d);b.con$truct&&(b.con$truct.index=b.con$truct.stacks.length)};a.overrideConstructor=function(b,c,d){a.overrideMethod(b,"construct",c,d);b.con$truct&&(b.con$truct.index=b.con$truct.stacks.length)};a.defineMethod=function(c,d,h,j){h.exName=d;j=Ea(j);var l=c.prototype,m=l[d];a._Loader._checkLoad&&E(c,d,j);if(!m||m.claxxOwner===c&&m.funParams==j)return h.funParams=j,h.claxxOwner=c,h.exClazz=c,l[d]=h;var q=null,s=m.stacks;s||(s=[],q=m,m.claxxOwner&&(s[0]=
|
||||
q.claxxOwner));if(!m.stacks||m.claxxReference!==c){++Q;m=function(){var c;a:{var d=arguments.callee.claxxReference,k=arguments.callee.methodName;c=arguments;fx=this[k];var h=a.getParamsType(c);if(!fx)try{System.out.println(a.getStackTrace(5))}catch(n){}if(e){var j=d.__CLASS_NAME__+" "+k+" ";0>U.indexOf(j)&&(U+=j+"\n");e[j]||(e[j]=0);e[j]++}if(fx.lastParams==h.typeString&&fx.lastClaxxRef===d){if(h.hasCastedNull){d=[];for(k=0;k<c.length;k++)d[k]=c[k]instanceof a.CastedNull?null:c[k]}else d=c;c=fx.lastMethod?
|
||||
fx.lastMethod.apply(this,d):null}else{fx.lastParams=h.typeString;fx.lastClaxxRef=d;j=fx.stacks;j||(j=d.prototype[k].stacks);for(var r=!1,l=j.length;0<=--l;)if(r||j[l]===d){var m=j[l].prototype[k],z=h,r=c,q=fx,s=[],t=!0,F=void 0;for(F in m)if(92==F.charCodeAt(0)){var u=F.substring(1).split("\\");u.length==z.length&&s.push(u);t=!1}else if(t&&"funParams"==F&&m.funParams){F=m.funParams;u=F.substring(1).split("\\");u.length==z.length&&(s[0]=u);break}F=void 0;if(!(F=0==s.length)){F=void 0;for(var F=[],
|
||||
P=s.length,u=0;u<P;u++){for(var x=[],za=!0,C=s[u].length,B=0;B<C;B++)if(x[B]=a.getInheritedLevel(z[B],s[u][B]),0>x[B]){za=!1;break}za&&(x[z.length]=u,F.push(x))}if(0==F.length)F=null;else{P=F[0];for(u=1;u<F.length;u++){x=!0;for(B=0;B<z.length;B++)if(P[B]<F[u][B]){x=!1;break}x&&(P=F[u])}F=s[P[z.length]].join("\\")}F=!(s=F)}if(F)r=new b;else{m=t?m:m["\\"+s];t=null;if(z.hasCastedNull){t=[];for(z=0;z<r.length;z++)t[z]=r[z]instanceof a.CastedNull?null:r[z]}else t=r;q.lastMethod=m;r=m.apply(this,t)}if(!(r instanceof
|
||||
b)){c=r;break a}r=!0}"construct"!=k&&fb(this,d,k,h.typeString);c=void 0}}return c};m.methodName=d;m.claxxReference=c;m=l[d]=m;d=[];for(l=0;l<s.length;l++)d[l]=s[l];m.stacks=d}s=m.stacks;0>rb(s,c)&&s.push(c);q&&(q.claxxOwner===c?(m[q.funParams]=q,q.claxxOwner=null,q.funParams=null):q.claxxOwner||(m["\\unknown"]=q));h.exClazz=c;m[j]=h;return m};duplicatedMethods={};var E=function(b,c,d){var e=b.prototype[c];if(e&&(e.claxxOwner||e.claxxReference)===b)key=b.__CLASS_NAME__+"."+c+d,(b=duplicatedMethods[key])?
|
||||
(c="Warning! Duplicate method found for "+key,System.out.println(c),a.alert(c),duplicatedMethods[key]=b+1):duplicatedMethods[key]=1};a.showDuplicates=function(a){var b="",c=duplicatedMethods,d=0,e;for(e in c)1<c[e]&&(b+=c[e]+"\t"+e+"\n",d++);b="Duplicates: "+d+"\n\n"+b;System.out.println(b);a||alert(b)};var rb=function(a,b){if(a&&b)for(var c=a.length;0<=--c;)if(a[c]===b)return c;return-1},Ya=function(a,b){var c=rb(a,b);if(0<=c){for(var d=a.length-1;c<d;c++)a[c]=a[c+1];a.length--;return!0}},Ea=function(a){return a?
|
||||
a.replace(/~([NABSO])/g,function(a,b){switch(b){case "N":return"n";case "B":return"b";case "S":return"String";case "O":return"Object";case "A":return"Array"}return"Unknown"}).replace(/\s+/g,"").replace(/^|,/g,"\\").replace(/\$/g,"org.eclipse.s"):"\\void"};a.overrideMethod=function(b,c,d,e){d.exName=c;e=Ea(e);a._Loader._checkLoad&&E(b,c,e);d.funParams=e;d.claxxOwner=b;return b.prototype[c]=d};var U="";a.getProfile=function(){var a="";if(e){var a=[],b;for(b in e){var c=""+e[b];a.push(" ".substring(c.length)+
|
||||
c+"\t"+b)}a=a.sort().reverse().join("\r\n");e={}}return a};a.getParamsType=function(b){var c=b.length;switch(c){case 0:var d=["void"];d.typeString="\\void";return d;case 1:switch(typeof obj){case "number":return d=["n"],d.typeString="\\n",d;case "boolean":return d=["b"],d.typeString="\\b",d}}d=[];d.hasCastedNull=!1;if(b)for(var e=0;e<c;e++)d[e]=a.getClassName(b[e]),b[e]instanceof a.CastedNull&&(d.hasCastedNull=!0);d.typeString="\\"+d.join("\\");return d};var Q=0;a.allPackage={};a.allClasses={};a.lastPackageName=
|
||||
null;a.lastPackage=null;a.unloadedClasses=[];a.declarePackage=function(b){if(a.lastPackageName==b)return a.lastPackage;if(b&&b.length){for(var c=b.split(/\./),d=a.allPackage,e=0;e<c.length;e++)d[c[e]]||(d[c[e]]={__PKG_NAME__:d.__PKG_NAME__?d.__PKG_NAME__+"."+c[e]:c[e]},0==e&&a.setGlobal(c[e],d[c[e]])),d=d[c[e]];a.lastPackageName=b;return a.lastPackage=d}};a.evalType=function(b,c){var d=b.lastIndexOf(".");if(-1!=d){var e=b.substring(0,d),e=a.declarePackage(e),d=b.substring(d+1);return e[d]}if(c)return window[b];
|
||||
switch(b){case "string":return String;case "number":return Number;case "object":return a._O;case "boolean":return Boolean;case "function":return Function;case "void":case "undefined":case "unknown":return b;case "NullObject":return NullObject;default:return window[b]}};a.defineType=function(b,c,d,e){var h=a.unloadedClasses[b];h&&(c=h);h=b.lastIndexOf(".");if(-1!=h){var j=b.substring(0,h),j=a.declarePackage(j),h=b.substring(h+1);if(j[h])return j[h];j[h]=c}else{if(window[b])return window[b];a.setGlobal(b,
|
||||
c)}a.decorateAsType(c,b,d,e);b=a._innerFunctions;c.defineMethod=b.defineMethod;c.defineStaticMethod=b.defineStaticMethod;c.makeConstructor=b.makeConstructor;return c};var Fa=!1;-1!=navigator.userAgent.indexOf("Safari")&&(j=navigator.userAgent,q=j.indexOf("Version/"),-1!=q&&(j=j.substring(q+8),Fa=4<=parseFloat(j)));a.instantialize=function(a,b){if(!b||!(1==b.length&&b[0]&&b[0]instanceof s)){a instanceof Number&&(a.valueOf=function(){return this});if(Fa){for(var c=[],d=0;d<b.length;d++)c[d]=b[d];b=
|
||||
c}(c=a.construct)?a.con$truct?a.getClass().superClazz?c.claxxOwner&&c.claxxOwner===a.getClass()||c.stacks&&c.stacks[c.stacks.length-1]==a.getClass()?c.apply(a,b):(c.claxxOwner&&!c.claxxOwner.superClazz&&c.claxxOwner.con$truct?c.claxxOwner.con$truct.apply(a,[]):c.stacks&&(1==c.stacks.length&&!c.stacks[0].superClazz)&&c.stacks[0].con$truct.apply(a,[]),c.apply(a,b),a.con$truct.apply(a,[])):(a.con$truct.apply(a,[]),c.apply(a,b)):c.apply(a,b):a.con$truct&&a.con$truct.apply(a,[])}};a.innerFunctionNames=
|
||||
"isInstance equals hashCode getName getCanonicalName getClassLoader getResource getResourceAsStream defineMethod defineStaticMethod makeConstructor".split(" ");a._innerFunctions={isInstance:function(b){return a.instanceOf(b,this)},equals:function(a){return this===a},hashCode:function(){return this.getName().hashCode()},toString:function(){return"class "+this.getName()},getName:function(){return a.getClassName(this,!0)},getCanonicalName:function(){return this.__CLASS_NAME__},getClassLoader:function(){var b=
|
||||
this.__CLASS_NAME__,c=a._Loader.getClasspathFor(b),d=c.lastIndexOf(b.replace(/\./g,"/")),c=-1!=d?c.substring(0,d):a._Loader.getClasspathFor(b,!0),b=a._Loader.requireLoaderByBase(c);b.getResourceAsStream=a._innerFunctions.getResourceAsStream;b.getResource=a._innerFunctions.getResource;return b},getResource:function(a){return(a=this.getResourceAsStream(a))?a.url:null},getResourceAsStream:function(b){if(!b)return null;b=b.replace(/\\/g,"/");var c=null,d=b,d=this.__CLASS_NAME__;2==arguments.length&&0!=
|
||||
b.indexOf("/")&&(b="/"+b);if(0==b.indexOf("/"))if(2==arguments.length?(c=arguments[1])||(c=a.binaryFolders[0]):a._Loader&&(c=a._Loader.getClasspathFor(d,!0)),c){var c=c.replace(/\\/g,"/"),e=c.length,e=c.charAt(e-1);"/"!=e&&(c+="/");d=c+b.substring(1)}else d=b.substring(1);else{if(this.base)c=this.base;else if(a._Loader)if(c=a._Loader.getClasspathFor(d),e=c.lastIndexOf(d.replace(/\./g,"/")),-1!=e)c=c.substring(0,e);else if(e=-1,c.indexOf(".z.js")==c.length-5&&-1!=(e=c.lastIndexOf("/")))for(var c=c.substring(0,
|
||||
e+1),e=d.split(/\./),h=1;h<e.length;h++){for(var j="/",l=0;l<h;l++)j+=e[l]+"/";if(j.length>c.length)break;if(c.indexOf(j)==c.length-j.length){c=c.substring(0,c.length-j.length+1);break}}else c=a._Loader.getClasspathFor(d,!0);else(e=a.binaryFolders)&&e.length&&(c=e[0]);c||(c="j2s/");c=c.replace(/\\/g,"/");e=c.length;e=c.charAt(e-1);"/"!=e&&(c+="/");this.base?d=c+b:(e=d.lastIndexOf("."),d=-1==e||this.base?c+b:c+d.substring(0,e).replace(/\./g,"/")+"/"+b)}c=null;try{if(0>d.indexOf(":/")){var q=document.location.href.split("?")[0].split("/");
|
||||
q[q.length-1]=d;d=q.join("/")}c=new java.net.URL(d)}catch(s){}q=null==c?null:m._getFileData(d.toString());if(!q||"error"==q||0==q.indexOf("[Exception"))return null;q=(new java.lang.String(q)).getBytes();q=new java.io.BufferedInputStream(new java.io.ByteArrayInputStream(q));q.url=c;return q},defineMethod:function(b,c,d){a.defineMethod(this,b,c,d)},defineStaticMethod:function(b,c,d){a.defineMethod(this,b,c,d);this[b]=this.prototype[b]},makeConstructor:function(b,c){a.makeConstructor(this,b,c)}};var Pa=
|
||||
[];a.pu$h=function(a){a||(a=self.c$);a&&Pa.push(a)};a.p0p=function(){return Pa.pop()};a.decorateAsClass=function(b,c,d,e,h,j){var l=null;c&&(l=c.__PKG_NAME__,l||(l=c.__CLASS_NAME__));var m=(l?l+".":"")+d;a._Loader._classPending[m]&&(delete a._Loader._classPending[m],a._Loader._classCountOK++,a._Loader._classCountPending--);a._Loader&&a._Loader._checkLoad&&System.out.println("decorating class "+l+"."+d);(l=a.unloadedClasses[m])&&(b=l);db(b,c,d);j?a.inheritClass(b,e,j):e&&a.inheritClass(b,e);h&&a.implementOf(b,
|
||||
h);return b};var db=function(b,c,d){var e;c?c.__PKG_NAME__?(e=c.__PKG_NAME__+"."+d,c[d]=b,c===java.lang&&a.setGlobal(d,b)):(e=c.__CLASS_NAME__+"."+d,c[d]=b):(e=d,a.setGlobal(d,b));a.extendJO(b,e);c=a.innerFunctionNames;for(d=0;d<c.length;d++)b[c[d]]=a._innerFunctions[c[d]];a._Loader&&a._Loader.updateNodeForFunctionDecoration(e)};a.declareInterface=function(b,c,d){var e=function(){};db(e,b,c);d&&a.implementOf(e,d);return e};a.declareType=function(b,c,d,e,h){return a.decorateAsClass(function(){a.instantialize(this,
|
||||
arguments)},b,c,d,e,h)};a.declareAnonymous=function(b,c,d,e,h){return a.decorateAsClass(function(){a.prepareCallback(this,arguments);a.instantialize(this,arguments)},b,c,d,e,h)};a.decorateAsType=function(b,c,d,e,h,j){a.extendJO(b,c);b.equals=a._innerFunctions.equals;b.getName=a._innerFunctions.getName;if(j)for(c=0;c<a.innerFunctionNames.length;c++)j=a.innerFunctionNames[c],b[j]=a._innerFunctions[j];h?a.inheritClass(b,d,h):d&&a.inheritClass(b,d);e&&a.implementOf(b,e);return b};Number.prototype._numberToString=
|
||||
Number.prototype.toString;a.declarePackage("java.io");a.declarePackage("java.lang.annotation");a.declarePackage("java.lang.instrument");a.declarePackage("java.lang.management");a.declarePackage("java.lang.reflect");a.declarePackage("java.lang.ref");java.lang.ref.reflect=java.lang.reflect;a.declarePackage("java.util");a.declarePackage("java.security");a.declareInterface(java.io,"Closeable");a.declareInterface(java.io,"DataInput");a.declareInterface(java.io,"DataOutput");a.declareInterface(java.io,
|
||||
"Externalizable");a.declareInterface(java.io,"Flushable");a.declareInterface(java.io,"Serializable");a.declareInterface(java.lang,"Iterable");a.declareInterface(java.lang,"CharSequence");a.declareInterface(java.lang,"Cloneable");a.declareInterface(java.lang,"Appendable");a.declareInterface(java.lang,"Comparable");a.declareInterface(java.lang,"Runnable");a.declareInterface(java.util,"Comparator");java.lang.ClassLoader={__CLASS_NAME__:"ClassLoader"};var fb=function(b,c,d,e){b="";e&&(b=e.substring(1).replace(/\\/g,
|
||||
","));c=(d&&"construct"!=d?"Method":"Constructor")+" "+a.getClassName(c,!0)+"."+d+"("+b+") is not found!";throw new java.lang.NoSuchMethodException(c);};a.prepareCallback=function(b,c){var d=c[0];if(b&&d&&d!==window){var e=a.getClassName(d,!0),h={};if(b.b$)for(var j in b.b$)h[j]=b.b$[j];b.b$=h;h[e]=d;for(e=a.getClass(d);e.superClazz;)e=e.superClazz,h[a.getClassName(e,!0)]=d;if(d=d.b$)for(j in d)h[j]=d[j]}for(h=0;h<c.length-1;h++)c[h]=c[h+1];0<c.length&&c.length--};a.innerTypeInstance=function(b,c,
|
||||
d){b||(b=arguments.callee.caller);var e;if(d||c.$finals)if(e=new b(c,a.inheritArgs),d)if(c.f$){var h={},j;for(j in c.f$)h[j]=c.f$[j];for(j in d)h[j]=d[j];e.f$=h}else e.f$=d;else c.f$&&(e.f$=c.f$);else switch(arguments.length){case 3:return new b(c);case 4:return c.__CLASS_NAME__==b.__CLASS_NAME__&&arguments[3]===a.inheritArgs?c:new b(c,arguments[3]);case 5:return new b(c,arguments[3],arguments[4]);case 6:return new b(c,arguments[3],arguments[4],arguments[5]);case 7:return new b(c,arguments[3],arguments[4],
|
||||
arguments[5],arguments[6]);case 8:return new b(c,arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);case 9:return new b(c,arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);case 10:return new b(c,arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9]);default:e=new b(c,a.inheritArgs)}j=arguments.length-3;for(h=Array(j);0<=--j;)h[j]=arguments[j+3];a.instantialize(e,h);return e};a.cloneFinals=function(){for(var a={},b=arguments.length/
|
||||
2;0<=--b;)a[arguments[b+b]]=arguments[b+b+1];return a};a.isClassDefined=a.isDefinedClass=function(b){if(!b)return!1;if(a.allClasses[b])return!0;for(var c=b.split(/\./),d=null,e=0;e<c.length;e++)if(!(d=d?d[c[e]]:a.allPackage[c[0]]))return!1;return d&&(a.allClasses[b]=!0)};a.defineEnumConstant=function(a,b,c,d,e){e=e?new e:new a;e.$name=b;e.$ordinal=c;d&&d.length&&e.construct.apply(e,d);a[b]=e;a.prototype[b]=e;a["$ values"]||(a["$ values"]=[],a.values=function(){return this["$ values"]});a["$ values"].push(e);
|
||||
return e};a.floatToInt=function(a){return isNaN(a)?0:0>a?Math.ceil(a):Math.floor(a)};a.floatToByte=a.floatToShort=a.floatToLong=a.floatToInt;a.doubleToByte=a.doubleToShort=a.doubleToLong=a.doubleToInt=a.floatToInt;a.floatToChar=function(a){return String.fromCharCode(0>a?Math.ceil(a):Math.floor(a))};a.doubleToChar=a.floatToChar;var gb=function(a,b){a||(a=0);if("object"==typeof a)var c=a;else for(var c=Array(a),d=0;d<a;d++)c[d]=0;c.BYTES_PER_ELEMENT=b>>3;c._fake=!0;return c},va=function(a,b){a||(a=
|
||||
0);b||(b=this.length);if(this._fake){var c=new this.constructor(b-a);System.arraycopy(this,a,c,0,b-a);return c}return new this.constructor(this.buffer.slice(a*this.BYTES_PER_ELEMENT,b*this.BYTES_PER_ELEMENT))};!0==(a.haveInt32=!!(self.Int32Array&&self.Int32Array!=Array))?Int32Array.prototype.sort||(Int32Array.prototype.sort=Array.prototype.sort):(Int32Array=function(a){return gb(a,32)},Int32Array.prototype.sort=Array.prototype.sort,Int32Array.prototype.toString=function(){return"[object Int32Array]"});
|
||||
Int32Array.prototype.slice||(Int32Array.prototype.slice=function(){return va.apply(this,arguments)});Int32Array.prototype.clone=function(){var a=this.slice();a.BYTES_PER_ELEMENT=4;return a};!0==(a.haveFloat64=!!(self.Float64Array&&self.Float64Array!=Array))?Float64Array.prototype.sort||(Float64Array.prototype.sort=Array.prototype.sort):(Float64Array=function(a){return gb(a,64)},Float64Array.prototype.sort=Array.prototype.sort,Float64Array.prototype.toString=function(){return"[object Float64Array]"});
|
||||
Float64Array.prototype.slice||(Float64Array.prototype.slice=function(){return va.apply(this,arguments)});Float64Array.prototype.clone=function(){return this.slice()};a.newArray=function(a,b,c,d){if(-1!=a||2==arguments.length)return ma(arguments,0);a=b.slice(c,d);a.BYTES_PER_ELEMENT=b.BYTES_PER_ELEMENT;return a};var ma=function(a,b){var c=a[0];"string"==typeof c&&(c=c.charCodeAt(0));var d=a.length-1,e=a[d];if(1<d){for(var e=Array(d),h=0;h<d;h++)e[h]=a[h+1];d=Array(c);for(h=0;h<c;h++)d[h]=ma(e,b);return d}0<
|
||||
b&&0>c&&(c=e);switch(b){case 8:return d=new Int8Array(c),d.BYTES_PER_ELEMENT=1,d;case 32:return d=new Int32Array(c),d.BYTES_PER_ELEMENT=4,d;case 64:return d=new Float64Array(c),d.BYTES_PER_ELEMENT=8,d;default:d=0>c?e:Array(c);d.BYTES_PER_ELEMENT=0;if(0<c&&null!=e)for(h=c;0<=--h;)d[h]=e;return d}};a.newByteArray=function(){return ma(arguments,8)};a.newIntArray=function(){return ma(arguments,32)};a.newFloatArray=function(){return ma(arguments,64)};a.newDoubleArray=a.newFloatArray;a.newLongArray=a.newShortArray=
|
||||
a.newIntArray;a.newCharArray=a.newBooleanArray=a.newArray;!0==(a.haveInt8=!!self.Int8Array)?(Int8Array.prototype.sort||(Int8Array.prototype.sort=Array.prototype.sort),Int8Array.prototype.slice||(Int8Array.prototype.slice=function(){return va.apply(this,arguments)})):a.newByteArray=a.newIntArray;Int8Array.prototype.clone=function(){var a=this.slice();a.BYTES_PER_ELEMENT=1;return a};a.isAB=function(a){return a&&"object"==typeof a&&1==a.BYTES_PER_ELEMENT};a.isAI=function(a){return a&&"object"==typeof a&&
|
||||
4==a.BYTES_PER_ELEMENT};a.isAF=function(a){return a&&"object"==typeof a&&8==a.BYTES_PER_ELEMENT};a.isAS=function(a){return a&&"object"==typeof a&&a.constructor==Array&&("string"==typeof a[0]||"undefined"==typeof a[0])};a.isAII=function(b){return b&&"object"==typeof b&&a.isAI(b[0])};a.isAFF=function(b){return b&&"object"==typeof b&&a.isAF(b[0])};a.isAFFF=function(b){return b&&"object"==typeof b&&a.isAFF(b[0])};a.isASS=function(b){return b&&"object"==typeof b&&a.isAS(b[0])};a.isAFloat=function(b){return b&&
|
||||
"object"==typeof b&&b.constructor==Array&&a.instanceOf(b[0],Float)};a.isAP=function(b){return b&&"JU.P3"==a.getClassName(b[0])};a.defineStatics=function(a){for(var b=arguments.length,c=(b-1)/2;0<=--c;){var d=arguments[--b],e=arguments[--b];a[e]=a.prototype[e]=d}};a.prepareFields=function(a,b){var c=[];if(a.con$truct)for(var d=a.con$truct.stacks,e=0;e<d.length;e++)c[e]=d[e];d=a.con$truct=function(){var a=arguments.callee.stacks;if(a)for(var b=0;b<a.length;b++)a[b].apply(this,[])};a.prototype.con$truct=
|
||||
d;c.push(b);a.con$truct.stacks=c;a.con$truct.index=0};a.checkPrivateMethod=function(){me=arguments.callee.caller;caller=arguments.callee.caller.caller;var b="\\"+a.getParamsType(arguments[0]).join("\\");me.privateNote||(me.privateNote="You are seeing this note because the method "+me.exName+b+" in class "+me.exClazz.__CLASS_NAME__+" has a superclass method by the same name (possibly with the same parameters) that is private and therefore might be called improperly from this class. If your code does not run properly, or you want to make it run faster, change the name of this method to something else.",
|
||||
System.out.println(me.privateNote),alert(me.privateNote));return null};java.lang.Object=a._O;a._O.getName=a._innerFunctions.getName;java.lang.System=System={props:null,$props:{},arraycopy:function(a,b,c,d,e){if(a!==c||b>d)for(;0<=--e;)c[d++]=a[b++];else{d+=e;for(b+=e;0<=--e;)a[--d]=a[--b]}},currentTimeMillis:function(){return(new Date).getTime()},gc:function(){},getProperties:function(){return System.props},getProperty:function(a,b){if(System.props)return System.props.getProperty(a,b);var c=System.$props[a];
|
||||
if("undefined"!=typeof c)return c;if(0<a.indexOf(".")){c=null;switch(a){case "java.version":case "file.separator":case "path.separator":c="/";break;case "line.separator":c=0<=navigator.userAgent.indexOf("Windows")?"\r\n":"\n";break;case "os.name":case "os.version":c=navigator.userAgent}if(c)return System.$props[a]=c}return 1==arguments.length?null:null==b?a:b},getSecurityManager:function(){return null},setProperties:function(a){System.props=a},lineSeparator:function(){return"\n"},setProperty:function(a,
|
||||
b){if(!System.props)return System.$props[a]=b;System.props.setProperty(a,b)}};System.identityHashCode=function(b){return null==b?0:b._$hashcode||(b._$hashcode=++a._hashCode)};System.out=new a._O;System.out.__CLASS_NAME__="java.io.PrintStream";System.out.print=function(){};System.out.printf=function(){};System.out.println=function(){};System.out.write=function(){};System.err=new a._O;System.err.__CLASS_NAME__="java.io.PrintStream";System.err.print=function(){};System.err.printf=function(){};System.err.println=
|
||||
function(){};System.err.write=function(){};a.popup=a.assert=a.log=a.error=window.alert;Thread=function(){};Thread.J2S_THREAD=Thread.prototype.J2S_THREAD=new Thread;Thread.currentThread=Thread.prototype.currentThread=function(){return this.J2S_THREAD};a.innerFunctionNames=a.innerFunctionNames.concat("getSuperclass isAssignableFrom getConstructor getDeclaredMethod getDeclaredMethods getMethod getMethods getModifiers newInstance".split(" "));a._innerFunctions.getSuperclass=function(){return this.superClazz};
|
||||
a._innerFunctions.isAssignableFrom=function(b){return 0<=a.getInheritedLevel(b,this)};a._innerFunctions.getConstructor=function(){return new java.lang.reflect.Constructor(this,[],[],java.lang.reflect.Modifier.PUBLIC)};a._innerFunctions.getDeclaredMethods=a._innerFunctions.getMethods=function(){var a=[],b=this.prototype,c;for(c in b)"function"==typeof b[c]&&!b[c].__CLASS_NAME__&&a.push(new java.lang.reflect.Method(this,c,[],java.lang.Void,[],java.lang.reflect.Modifier.PUBLIC));b=this;for(c in b)"function"==
|
||||
typeof b[c]&&!b[c].__CLASS_NAME__&&a.push(new java.lang.reflect.Method(this,c,[],java.lang.Void,[],java.lang.reflect.Modifier.PUBLIC|java.lang.reflect.Modifier.STATIC));return a};a._innerFunctions.getDeclaredMethod=a._innerFunctions.getMethod=function(a){var b=this.prototype,c;for(c in b)if(a==c&&"function"==typeof b[c]&&!b[c].__CLASS_NAME__)return new java.lang.reflect.Method(this,c,[],java.lang.Void,[],java.lang.reflect.Modifier.PUBLIC);b=this;for(c in b)if(a==c&&"function"==typeof b[c]&&!b[c].__CLASS_NAME__)return new java.lang.reflect.Method(this,
|
||||
c,[],java.lang.Void,[],java.lang.reflect.Modifier.PUBLIC|java.lang.reflect.Modifier.STATIC);return null};a._innerFunctions.getModifiers=function(){return java.lang.reflect.Modifier.PUBLIC};a._innerFunctions.newInstance=function(a){switch(null==a?0:a.length){case 0:return new this;case 1:return new this(a[0]);case 2:return new this(a[0],a[1]);case 3:return new this(a[0],a[1],a[2]);case 4:return new this(a[0],a[1],a[2],a[3]);default:for(var b="new "+this.__CLASS_NAME__+"(",c=0;c<a.length;c++)b+=(0==
|
||||
c?"":",")+"a["+c+"]";return eval(b+")")}};j=a.innerFunctionNames;for(q=0;q<j.length;q++)a._O[j[q]]=a._innerFunctions[j[q]],Array[j[q]]=a._innerFunctions[j[q]];a._Loader=a.ClazzLoader=function(){};var x=function(){this.parents=[];this.musts=[];this.optionals=[];this.onLoaded=this.path=this.name=this.declaration=null;this.status=0;this.random=0.13412};(function(a,b){b._checkLoad=m._checkLoad;b.updateNodeForFunctionDecoration=function(a){(a=H(a))&&a.status==x.STATUS_KNOWN&&window.setTimeout(function(a){return function(){updateNode(a)}}(a),
|
||||
1)};x.prototype.toString=function(){return this.name||this.path||"ClazzNode"};x.STATUS_UNKNOWN=0;x.STATUS_KNOWN=1;x.STATUS_CONTENT_LOADED=2;x.STATUS_MUSTS_LOADED=3;x.STATUS_DECLARED=4;x.STATUS_LOAD_COMPLETE=5;var c=[];b.requireLoaderByBase=function(a){for(var d=0;d<c.length;d++)if(c[d].base==a)return c[d];d=new b;d.base=a;c.push(d);return d};var d=new x,e={},h=0,j=6,l=navigator.userAgent.toLowerCase(),q=-1!=l.indexOf("opera"),s=-1!=l.indexOf("msie")&&!q,g=-1!=l.indexOf("gecko");if(q&&(j=1,q=l.indexOf("opera/"),
|
||||
-1!=q)){var t=9;try{t=parseFloat(l.subString(q+6))}catch(u){}9.6<=t&&(j=6)}var B;self.Clazz&&a.isClassDefined?isClassDefined=a.isClassDefined:(B={},isClassDefined=function(a){return!0==B[a]});var C=function(a){if(!a||0==a.length)return[];for(var b=null,c=0;c<a.length;c++)if(a[c]){if("$"==a[c].charAt(0))if("."==a[c].charAt(1)){if(!b)continue;var d=b.lastIndexOf(".");-1!=d&&(b=b.substring(0,d),a[c]=b+a[c].substring(1))}else a[c]="org.eclipse.s"+a[c].substring(1);b=a[c]}return a},E=[],D={},K=0;b.loadPackageClasspath=
|
||||
function(a,c,d,e,g,h){g||(g=0);e||(e=null);h||(h=0);var j=d&&D["@"+a];if(0==g&&(d&&!D["@java"]&&0!=a.indexOf("java")&&null!=window["java.registered"]&&!D["@java"])&&(b.loadPackage("java",e?function(){b.loadPackageClasspath(a,c,d,e,1)}:null),e))return;if(a instanceof Array)if(C(a),e)h<a.length?b.loadPackageClasspath(a[h],c,d,function(){b.loadPackageClasspath(a,c,d,e,1,h+1)},1):e();else for(j=0;j<a.length;j++)b.loadPackageClasspath(a[j],c,d,null);else{switch(a){case "java.*":a="java";case "java":c&&
|
||||
(g="@net.sf.j2s.ajax",D[g]||(D[g]=c),g="@net.sf.j2s",D[g]||(D[g]=c));break;case "swt":a="org.eclipse.swt";break;case "ajax":a="net.sf.j2s.ajax";break;case "j2s":a="net.sf.j2s";break;default:a.lastIndexOf(".*")==a.length-2&&(a=a.substring(0,a.length-2))}c&&(D["@"+a]=c);d&&!j&&!window[a+".registered"]?(K++,"java"==a&&(a="core"),b.loadClass(a+".package",function(){0==--K&&ca()},!0,!0,1)):e&&e()}};a.loadClass=function(c,d,e){self.Class||(Class=a,Class.forName=a._4Name,JavaObject=a._O);return c&&b.loadClass(c,
|
||||
d,!0,e,1)};b.loadClass=function(c,g,h,j,l){l||(l=0);null==j&&(j=!1);if("boolean"==typeof g)return a.evalType(c);null!=window["java.registered"]&&!D["@java"]&&b.loadPackage("java");b.keepOnLoading=!0;if(!h&&(K&&c.lastIndexOf(".package")!=c.length-8||0!=c.indexOf("java.")&&!isClassDefined(da)))La.push([c,g]),System.out.println("loadclass-queuing"+c+da+" "+isClassDefined(da));else if((l=isClassDefined(c))||O["@"+c]){if(l&&g&&(h=H(c),!h||h.status>=x.STATUS_LOAD_COMPLETE))j?window.setTimeout(g,25):g()}else{var m=
|
||||
b.getClasspathFor(c);l=e[m];if(!l)for(j=E.length;0<=--j;)if(E[j].path==m||E[j].name==c){l=!0;break}if(l){if(g&&(l=H(c)))if(l.onLoaded){if(g!=l.onLoaded){var r=l.onLoaded,q=g;l.onLoaded=function(){r();q()}}}else l.onLoaded=g}else{l=a.unloadedClasses[c]&&H(c)||new x;l.name=c;l.path=m;l.isPackage=m.lastIndexOf("package.js")==m.length-10;X(m,c,l);l.onLoaded=g;l.status=x.STATUS_KNOWN;c=!1;for(j=E.length;0<=--j;)if(E[j].status!=x.STATUS_LOAD_COMPLETE){c=!0;break}if(l.isPackage){for(j=E.length;0<=--j&&!E[j].isPackage;)E[j+
|
||||
1]=E[j];E[++j]=l}else c&&E.push(l);if(!c){var s=!1;g&&(s=ha,ha=!0);h&&(g=null);Ja(d,l,!0);V(l,l.path,l.requiredBy,!1,g?function(){ha=s;g()}:null)}}}};b.loadPackage=function(a,c){c||(c=null);window[a+".registered"]=!1;b.loadPackageClasspath(a,b.J2SLibBase||(b.J2SLibBase=b.getJ2SLibBase()||"j2s/"),!0,c)};b.jarClasspath=function(a,b){b instanceof Array||(b=[b]);C(b);m._debugCore&&(a=a.replace(/\.z\./,"."));for(var c=b.length;0<=--c;)D["#"+b[c]]=a;D["$"+a]=b};b.registerPackages=function(c,d){for(var e=
|
||||
b.getClasspathFor(c+".*",!0),g=0;g<d.length;g++)window.Clazz&&a.declarePackage(c+"."+d[g]),b.loadPackageClasspath(c+"."+d[g],e)};b.getClasspathFor=function(c,d,e){var g=D["#"+c];if(!g||d||e){var h,j;if(g){if(c=c.replace(/\./g,"/"),0<=(j=g.lastIndexOf(c))||0<=(j=c.lastIndexOf("/"))&&0<=(j=g.lastIndexOf(c.substring(0,j))))h=g.substring(0,j)}else{for(j=c.length+2;0<=(j=c.lastIndexOf(".",j-2))&&!(h=D["@"+c.substring(0,j)]););d||(c=c.replace(/\./g,"/"))}null==h&&(h=window.Clazz&&a.binaryFolders&&a.binaryFolders.length?
|
||||
a.binaryFolders[0]:b.binaryFolders&&b.binaryFolders.length?b.binaryFolders[0]:"j2s");g=(h.lastIndexOf("/")==h.length-1?h:h+"/")+(d?"":c.lastIndexOf("/*")==c.length-2?c.substring(0,j+1):c+(!e?".js":"."!=e.charAt(0)?"."+e:e))}return g};b.ignore=function(){var a=1==arguments.length&&arguments[0]instanceof Array?a=arguments[0]:null,b=a?a.length:arguments.length;if(!a)for(var a=Array(b),c=0;c<b;c++)a[c]=arguments[c];C(a);for(c=0;c<b;c++)O["@"+a[c]]=1};b.onScriptLoading=function(){};b.onScriptLoaded=function(){};
|
||||
b.onScriptInitialized=function(){};b.onScriptCompleted=function(){};b.onClassUnloaded=function(){};b.onGlobalLoaded=function(){};b.keepOnLoading=!0;var L={},O={},U=function(c,d,e,g){if(!g)try{eval(e+";//# sourceURL="+c)}catch(h){if(a._isQuiet)return;c="[Java2Script] The required class file \n\n"+c+(0==e.indexOf("[Exception")&&e.indexOf("data: no")?"\nwas not found.\n":"\ncould not be loaded. Script error: "+h.message+" \n\ndata:\n\n"+e)+"\n\n"+a.getStackTrace();alert(c);a.alert(c);throw h;}b.onScriptLoaded(c,
|
||||
!1);ta(d)},ba=function(a){return function(){if("interactive"!=a.readyState){try{a.parentNode&&a.parentNode.removeChild(a)}catch(b){}a=null}}},aa=function(a){window["j2s.script.debugging"]||window.setTimeout(ba(a),1)};a._4Name=function(c,d,e){if(a.isClassDefined(c))return a.evalType(c);d=m._isAsync&&d?d._restoreState(c,e):null;if(1==d)return null;if(b.setLoadingMode(d?b.MODE_SCRIPT:"xhr.sync"))return b.loadClass(c,d,!1,!0,1),null;b.loadClass(c);return a.evalType(c)};a.currentPath="";var V=function(c,
|
||||
d,g,j,l){a.currentPath=d;j&&alert("WHY>>");j=e[d];e[d]=!0;Ya(E,d);M=!0;sa=!1;b._checkLoad&&System.out.println("\t"+d+(g?"\n -- required by "+g:"")+" ajax="+M+" async="+sa);g=d;a._debugging&&(d=d.replace(/\.z\.js/,".js"));j||System.out.println("loadScript "+d);b.onScriptLoading(d);if(M&&!sa){var r=m._getFileData(d);try{U(d,g,r,j)}catch(q){alert(q+" loading file "+d+" "+c.name+" "+a.getStackTrace())}l&&l()}else c={dataType:"script",async:!0,type:"GET",url:d,success:ua(d,!1,l),error:ua(d,!0,l)},h++,
|
||||
j?setTimeout(c.success,0):m.$ajax(c)},ua=function(c,d,e){a.getStackTrace();return function(){g&&this.timeoutHandle&&(window.clearTimeout(this.timeoutHandle),this.timeoutHandle=null);0<h&&h--;this.onerror=this.onload=null;d&&alert("There was a problem loading "+c);b.onScriptLoaded(c,!0);var a=this,j;j=e?function(){aa(a);ta(c,e)}:function(){aa(a);ta(c)};0<=W?window.setTimeout(function(){ta(c,j)},W):ta(c,j)}},ha=!0,ga=!1,ta=function(c,g){var l=L["@"+c];if(l){var m,r=D["$"+c];if(r)for(var q=0;q<r.length;q++){var t=
|
||||
r[q];if(t!=l.name&&(m=H(t)))m.status<x.STATUS_CONTENT_LOADED&&(m.status=x.STATUS_CONTENT_LOADED,updateNode(m));else{m=new x;m.name=t;var u=D["#"+t];u||(alert(t+" J2S error in tryToLoadNext"),error("Java2Script implementation error! Please report this bug!"));m.path=u;X(m.path,t,m);m.status=x.STATUS_CONTENT_LOADED;Ja(d,m,!1);updateNode(m)}}if(l instanceof Array)for(q=0;q<l.length;q++)l[q].status<x.STATUS_CONTENT_LOADED&&(l[q].status=x.STATUS_CONTENT_LOADED,updateNode(l[q]));else if(l.status<x.STATUS_CONTENT_LOADED){m=
|
||||
!1;r=document.getElementsByTagName("SCRIPT");for(q=0;q<r.length;q++)if(s){if(r[q].onreadystatechange&&r[q].onreadystatechange.path==l.path&&"interactive"==r[q].readyState){m=!0;break}}else if(r[q].onload&&r[q].onload.path==l.path){m=!0;break}m||(l.status=x.STATUS_CONTENT_LOADED,updateNode(l))}if(b.keepOnLoading){q=!0;if(m=Ka(x.STATUS_KNOWN))for(S(m);h<j&&(m=Ka(x.STATUS_KNOWN));)S(m);else if(0!=E.length)m=E.shift(),!e[m.path]||0!=E.length||!ha||m.musts.length||m.optionals.length?(Ja(d,m,!0),V(m,m.path,
|
||||
m.requiredBy,!1)):ha&&(ha=!1);else if(m=G(x.STATUS_KNOWN))for(S(m);h<j&&(m=G(x.STATUS_KNOWN));)S(m);else q=!1;if(!(q||0<h)){l=[Ka,G];r=null;for(q=0;2>q;q++)for(;m=l[q](x.STATUS_CONTENT_LOADED);)1==q&&r===m&&(m.status=x.STATUS_LOAD_COMPLETE),updateNode(m),r=m;for(;!(ma=[],!na(d,c)););for(q=0;2>q;q++)for(r=null;(m=l[q](x.STATUS_DECLARED))&&r!==m;)updateNode(r=m);r=[];for(q=0;2>q;q++)for(;m=l[q](x.STATUS_DECLARED);)r.push(m),m.status=x.STATUS_LOAD_COMPLETE;if(r.length){for(q=0;q<r.length;q++)Da(r[q]);
|
||||
for(q=0;q<r.length;q++)if(l=r[q].onLoaded)r[q].onLoaded=null,l()}if(g)g();else if(b._classCountPending)for(t in b._classPending){if(m=H(t),System.out.println("class left pending "+t+" "+m),m){updateNode(m);break}}else b._checkLoad&&(System.out.println("I think I'm done: SAEM call count: "+Q),a.showDuplicates(!0));b.onGlobalLoaded()}}}},ma=[],na=function(a,c){var d=ma,e=d.length;d.push(a);for(var g=e;0<=--g&&!(d[g]===a&&d[g].status>=x.STATUS_DECLARED););if(0<=g){if(b._checkLoad){var h;System.out.println("cycle found loading "+
|
||||
c+" for "+a)}for(;g<e;g++){var j=d[g];j.status=x.STATUS_LOAD_COMPLETE;Da(j);for(h=0;h<j.parents.length;h++)updateNode(j.parents[h]);j.parents=[];var k=j.onLoaded;b._checkLoad&&(h="cycle setting status to LOAD_COMPLETE for "+j.name+(k?" firing "+k.toString():""),System.out.println(h));k&&(j.onLoaded=null,k())}d.length=0;return!0}j=[a.musts,a.optionals];for(h=0;2>h;h++){k=j[h];for(g=k.length;0<=--g;)if(k[g].status==x.STATUS_DECLARED&&na(k[g],c))return!0}d.length=e;return!1};b._classCountPending=0;b._classCountOK=
|
||||
0;b._classPending={};b.showPending=function(){var a=[],c;for(c in b._classPending){var d=H(c);d?(a.push(d),System.out.println(va("","",d,"",0))):alert("No node for "+c)}return a};var va=function(a,b,c,d,e){b+="--"+c.name;a+=b+"\n";if(5<e)return a+(d+" ...\n");d+="\t";a+=d+"status: "+c.status+"\n";if(c.parents&&c.parents.length&&c.parents[0]&&c.parents[0].name){a+=d+"parents: "+c.parents.length+"\n";for(var g=0;g<c.parents.length;g++)a=va(a,b,c.parents[g],d+"\t",e+1);a+="\n"}return a};updateNode=function(a){if(!a.name||
|
||||
a.status>=x.STATUS_LOAD_COMPLETE)Da(a);else{var c=!0;if(a.musts.length&&a.declaration)for(var d=a.musts.length,e=d;0<=--e;){var g=a.musts[e];g.requiredBy=a;if(g.status<x.STATUS_DECLARED&&isClassDefined(g.name)){var h=[];g.status=x.STATUS_LOAD_COMPLETE;Da(g);if(g.declaration&&g.declaration.clazzList){for(var j=0,k=g.declaration.clazzList,l=k.length;j<l;j++){var m=H(k[j]);m&&(m.status!=x.STATUS_LOAD_COMPLETE&&m!==g)&&(m.status=g.status,m.declaration=null,Da(m),m.onLoaded&&h.push(m))}g.declaration=null}g.onLoaded&&
|
||||
h.push(g);for(j=0;j<h.length;j++)if(k=h[j].onLoaded)h[j].onLoaded=null,k()}else g.status==x.STATUS_CONTENT_LOADED&&updateNode(g),g.status<x.STATUS_DECLARED&&(c=!1);a.musts.length!=d&&(e=d=a.musts.length,c=!0)}if(c){if(a.status<x.STATUS_DECLARED){if(e=a.declaration)e(),e.executed=!0;b._checkLoad&&b._classPending[a.name]&&(delete b._classPending[a.name],b._classCountOK,b._classCountPending--);a.status=x.STATUS_DECLARED;B&&(B[a.name]=!0);b.onScriptInitialized(a.path);if(a.declaration&&a.declaration.clazzList){j=
|
||||
0;k=a.declaration.clazzList;for(l=k.length;j<l;j++)if((m=H(k[j]))&&m.status!=x.STATUS_DECLARED&&m!==a)m.status=x.STATUS_DECLARED,B&&(B[m.name]=!0),b.onScriptInitialized(m.path)}}c=x.STATUS_DECLARED;if(0==a.optionals.length&&0==a.musts.length||a.status>x.STATUS_KNOWN&&!a.declaration||Ta(a.musts,x.STATUS_LOAD_COMPLETE)&&Ta(a.optionals,x.STATUS_LOAD_COMPLETE)){c=x.STATUS_LOAD_COMPLETE;if(!wa(a,c))return!1;if(a.declaration&&a.declaration.clazzList){j=0;k=a.declaration.clazzList;for(l=k.length;j<l;j++)if((m=
|
||||
H(k[j]))&&m.status!=c&&m!==a)if(m.declaration=null,!wa(m,c))return!1}}if(a.parents&&a.parents.length){for(e=0;e<a.parents.length;e++)j=a.parents[e],j.status<c&&updateNode(j,j.name);c==x.STATUS_LOAD_COMPLETE&&(a.parents=[])}}}};var Ta=function(a,b){for(var c=a.length;0<=--c;)if(a[c].status<b)return!1;return!0},wa=function(a,c){a.status=c;b.onScriptCompleted(a.path);var d=a.onLoaded;if(d&&(a.onLoaded=null,d(),!b.keepOnLoading))return!1;Da(a);return!0},ya={"r0.13412":1},Ba=function(){for(;;){var a=Math.random(),
|
||||
b="r"+a;if(!ya[b])return ya[b]=1,d.random=a}},H=function(a){Ba();return Ea(a,d)},G=function(a){Ba();return Ca(d,a)},Ka=function(a){return ra(d,a)},Ea=function(a,b){var c;return b.name==a?b:(c=$a(a,b.musts))||(c=$a(a,b.optionals))?c:null},$a=function(a,b){for(var c=d.random,e=b.length;0<=--e;){var g=b[e];if(g.name==a||g.random!=c&&(g.random=c,g=Ea(a,g)))return g}return null},Aa=function(a,b){return a.status==b&&(b!=x.STATUS_KNOWN||!e[a.path])&&(b==x.STATUS_DECLARED||!isClassDefined(a.name))},ra=function(a,
|
||||
b){for(var c=a.musts.length;0<=--c;){var d=a.musts[c];if(Aa(d,b)||(d=ra(d,b)))return d}return Aa(a,b)?a:null},Ca=function(a,b){var c;return(c=oa(a.musts,b))||(c=oa(a.optionals,b))||Aa(c=a,b)?c:null},oa=function(a,b){if(a)for(var c=d.random,e=0;e<a.length;e++){var g=a[e];if(Aa(g,b)||g.random!=c&&(g.random=c,g=Ca(g,b)))return g}return null},R=function(a,c,e,g){if(c instanceof Array){C(c);for(var h=0;h<c.length;h++)R(a,c[h],e,g,c)}else{b._checkLoad&&!b._classPending[c]&&(b._classPending[c]=1,0==b._classCountPending++&&
|
||||
(b._classCountOK=0),System.out.println("Loading class "+c));h=L["#"+c];h||(h=(h=H(c))?h:new x,h.name=c,h.path=D["#"+c]||"unknown",X(h.path,c,h),h.status=x.STATUS_KNOWN,Ja(d,h,!1));ja(h,a,!0);5==arguments.length&&g&&(g.status=h.status,g.clazzList=arguments[4]);if(h.declaration=g)h.status=x.STATUS_CONTENT_LOADED;ja(h,e,!1)}},ja=function(a,b,c){if(b&&b.length){C(b);for(var d=0;d<b.length;d++){var e=b[d];if(e&&!isClassDefined(e)&&!O["@"+e]){var g=H(e);g||(g=new x,g.name=e,g.status=x.STATUS_KNOWN);g.requiredBy=
|
||||
a;Ja(a,g,c)}}}};window.Clazz?a.load=R:b.load=R;var X=function(a,b,c){var d="@"+a;if(a=L[d])if(a instanceof Array){for(var d=!1,e=0;e<a.length;e++)if(a[e].name==b){d=!0;break}d||a.push(c)}else L[d]=[a,c];else L[d]=c;L["#"+b]=c},S=function(a){var c=a.name;if(!isClassDefined(c)&&!O["@"+c]){var d=b.getClasspathFor(c);a.path=d;X(d,c,a);if(!e[d])return V(a,d,a.requiredBy,!1),!0}return!1},da=b.runtimeKeyClass="java.lang.String",La=[];b.getJ2SLibBase=function(){var a=window["j2s.lib"];return a?a.base+("."==
|
||||
a.alias?"":(a.alias?a.alias:a.version?a.version:"1.0.0")+"/"):null};var sa=!0,M=!1,W=-1;b.MODE_SCRIPT=4;b.MODE_XHR=2;b.MODE_SYNC=1;b.setLoadingMode=function(a,c){var d=!0,e=!0;"string"==typeof a?(a=a.toLowerCase(),0<=a.indexOf("script")?e=!1:a.indexOf("async"),d=!1):a&b.MODE_SCRIPT?e=!1:d=!(a&b.MODE_SYNC);M=e;W=(sa=d)&&0<=c?c:-1;return d};var ca=function(){if(!K&&isClassDefined(da)){for(var a=La,c=0;c<a.length;c++)b.loadClass(a[c][0],a[c][1]);La=[]}};b.loadZJar=function(a,c){var d=null,e=c instanceof
|
||||
Array;e?c=c[c.length-1]:d=c==da?ca:null;b.jarClasspath(a,e?c:[c]);b.loadClass(c,d,!0)};var Fa={},Pa=[],Ja=function(a,b,c){var e=!1;c?(c=a.musts,b.requiredBy||(b.requiredBy=a)):c=a.optionals;Fa[b.name]||(Pa.push(b),Fa[b.name]=b);for(var g=0;g<c.length;g++)if(c[g].name==b.name){e=!0;break}e||(c.push(b),ha&&(0!=b.name.indexOf("java")&&0!=b.name.indexOf("net.sf.j2s.ajax"))&&(ga&&(ha=!1),ga=!0));a:{if(a.name&&a!=d&&a!=b)for(e=0;e<b.parents.length;e++)if(b.parents[e].name==a.name)break a;b.parents.push(a)}},
|
||||
Da=function(a){var b=a.parents;if(b)for(var c=b.length;0<=--c;)Ya(b[c].musts,a)||Ya(b[c].optionals,a)};a.binaryFolders=b.binaryFolders=[b.getJ2SLibBase()]})(a,a._Loader);a._LoaderProgressMonitor={};var aa=a._LoaderProgressMonitor,L=null,ga=0,O=null,wa=0;aa.DEFAULT_OPACITY=m&&m._j2sLoadMonitorOpacity?m._j2sLoadMonitorOpacity:55;aa.hideMonitor=function(){O.style.display="none"};aa.showStatus=function(a,b){if(!O){var c=document.createElement("DIV");c.id="_Loader-status";c.style.cssText="position:absolute;bottom:4px;left:4px;padding:2px 8px;z-index:"+
|
||||
(window["j2s.lib"].monitorZIndex||1E4)+";background-color:#8e0000;color:yellow;font-family:Arial, sans-serif;font-size:10pt;white-space:nowrap;";c.onmouseover=ub;O=c;document.body.appendChild(c);ya||(ya=!0)}jb(O);if(null==a)b?na():aa.hideMonitor();else{O.appendChild(document.createTextNode(""+a));"none"==O.style.display&&(O.style.display="");kb(aa.DEFAULT_OPACITY);var d,c=navigator.userAgent;d=document.body;var e=d.parentNode,h=e.clientHeight;d=d.scrollTop+d.offsetTop;var j=e.scrollTop+e.offsetTop,
|
||||
c=0>c.indexOf("Opera")&&document.all?0==h?d:j:0>c.indexOf("Gecko")?h==e.offsetHeight&&h==e.scrollHeight?d:j:d;wa!=c&&(wa=c,O.style.bottom=wa+4+"px");b&&na()}};var jb=function(a){if(a)for(var b=a.childNodes.length;0<=--b;){var c=a.childNodes[b];if(c){c.childNodes&&c.childNodes.length&&jb(c);try{a.removeChild(c)}catch(d){}}}},kb=function(a){L&&a==aa.DEFAULT_OPACITY&&(window.clearTimeout(L),L=null);ga=a;navigator.userAgent.toLowerCase();O.style.filter="Alpha(Opacity="+a+")";O.style.opacity=a/100},ub=
|
||||
function(){aa.hideMonitor()},ya=!1,na=function(){"none"!=O.style.display&&(ga==aa.DEFAULT_OPACITY?(L=window.setTimeout(function(){na()},750),ga-=5):0<=ga-10?(kb(ga-10),L=window.setTimeout(function(){na()},40)):O.style.display="none")},C=a.Console,ba=System;C.maxTotalLines=1E4;C.setMaxTotalLines=function(a){C.maxTotalLines=0<a?a:999999};C.maxLatency=40;C.setMaxLatency=function(a){C.maxLatency=0<a?a:40};C.pinning=!1;C.enablePinning=function(a){C.pinning=a};C.linesCount=0;C.metLineBreak=!1;C.createConsoleWindow=
|
||||
function(){var a=document.createElement("DIV");a.style.cssText="font-family:monospace, Arial, sans-serif;";document.body.appendChild(a);return a};var V=String.fromCharCode(160),V=V+(V+V+V);C.consoleOutput=function(a,b){var c=window["j2s.lib"];(c=c&&c.console)&&"string"==typeof c&&(c=document.getElementById(c));if(!c)return!1;if(C.linesCount>C.maxTotalLines){for(var d=0;d<C.linesCount-C.maxTotalLines;d++)c&&0<c.childNodes.length&&c.removeChild(c.childNodes[0]);C.linesCount=C.maxTotalLines}var e=!1;
|
||||
a=("undefined"==typeof a?"":null==a?"null":""+a).replace(/\t/g,V);if(0<a.length)switch(a.charAt(a.length-1)){case "\n":case "\r":a=1<a.length?a.substring(0,a.length-("\r"==a.charAt(a.length-2)?2:1)):"",e=!0}var h=null;a=a.replace(/\t/g,V);for(var h=a.split(/\r\n|\r|\n/g),d=0,j=h.length-1;d<=j;d++){var l=null;if(C.metLineBreak||0==C.linesCount||1>c.childNodes.length)l=document.createElement("DIV"),c.appendChild(l),l.style.whiteSpace="nowrap",C.linesCount++;else try{l=c.childNodes[c.childNodes.length-
|
||||
1]}catch(m){l=document.createElement("DIV"),c.appendChild(l),l.style.whiteSpace="nowrap",C.linesCount++}var q=document.createElement("SPAN");l.appendChild(q);q.style.whiteSpace="nowrap";b&&(q.style.color=b);l=h[d];0==l.length&&(l=V);q.appendChild(document.createTextNode(l));C.pinning||(c.scrollTop+=100);C.metLineBreak=d!=j||e}d=c.parentNode.className;!C.pinning&&(d&&-1!=d.indexOf("composite"))&&(c.parentNode.scrollTop=c.parentNode.scrollHeight);C.lastOutputTime=(new Date).getTime()};C.clear=function(){try{C.metLineBreak=
|
||||
!0;var a=window["j2s.lib"],b=a&&a.console;if(b&&(b=document.getElementById(b))){for(var c=b.childNodes,d=c.length;0<=--d;)b.removeChild(c[d]);C.linesCount=0}}catch(e){}};a.alert=function(a){C.consoleOutput(a+"\r\n")};ba.out.print=function(a){C.consoleOutput(a)};ba.out.println=function(a){C.consoleOutput("undefined"==typeof a?"\r\n":null==a?"null\r\n":a+"\r\n")};ba.out.write=function(a,b,c){ba.out.print(String.instantialize(a).substring(b,b+c))};ba.err.__CLASS_NAME__="java.io.PrintStream";ba.err.print=
|
||||
function(a){C.consoleOutput(a,"red")};ba.err.println=function(a){C.consoleOutput("undefined"==typeof a?"\r\n":null==a?"null\r\n":a+"\r\n","red")};ba.err.write=function(a,b,c){ba.err.print(String.instantialize(a).substring(b,b+c))}}(Clazz,Jmol))};Jmol.___JmolDate="$Date: 2018-02-07 23:40:37 -0600 (Wed, 07 Feb 2018) $";Jmol.___fullJmolProperties="src/org/jmol/viewer/Jmol.properties";Jmol.___JmolVersion="14.29.4";
|
||||
@@ -0,0 +1,258 @@
|
||||
(function(a){function j(a){try{return a?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest}catch(d){}}a.ajaxSettings.xhr=void 0===window.ActiveXObject?j:function(){return(this.url==document.location||0==this.url.indexOf("http")||!this.isLocal)&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&j()||j(1)};a.ajaxTransport("+script",function(a){var d,b=document.head||jQuery("head")[0]||document.documentElement;return{send:function(c,k){d=document.createElement("script");a.scriptCharset&&
|
||||
(d.charset=a.scriptCharset);d.src=a.url;d.onload=d.onreadystatechange=function(a,b){if(b||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,d.parentNode&&d.parentNode.removeChild(d),d=null,b||k(200,"success")};b.insertBefore(d,b.firstChild)},abort:function(){if(d)d.onload(void 0,!0)}}});a.extend(a.support,{iecors:!!window.XDomainRequest});a.support.iecors?a.ajaxTransport(function(a){return{send:function(d,b){var c=new window.XDomainRequest;c.onload=function(){b(200,
|
||||
"OK",{text:c.responseText},{"Content-Type":c.contentType})};a.xhrFields&&(c.onerror=a.xhrFields.error,c.ontimeout=a.xhrFields.timeout);c.open(a.type,a.url);c.send(a.hasContent&&a.data||null)},abort:function(){xdr.abort()}}}):(a.ajaxSetup({accepts:{binary:"text/plain; charset=x-user-defined"},responseFields:{binary:"response"}}),a.ajaxTransport("binary",function(a){var d;return{send:function(b,c){var k=a.xhr();console.log("xhr.open binary async="+a.async+" url="+a.url);k.open(a.type,a.url,a.async);
|
||||
var j=!1;try{k.hasOwnProperty("responseType")&&(k.responseType="arraybuffer",j=!0)}catch(l){}try{!j&&k.overrideMimeType&&k.overrideMimeType("text/plain; charset=x-user-defined")}catch(e){}!a.crossDomain&&!b["X-Requested-With"]&&(b["X-Requested-With"]="XMLHttpRequest");try{for(var f in b)k.setRequestHeader(f,b[f])}catch(h){}k.send(a.hasContent&&a.data||null);d=function(){var e=k.status,f="",h=k.getAllResponseHeaders(),b={};try{if(d&&4===k.readyState){d=void 0;try{b.text="string"===typeof k.responseText?
|
||||
k.responseText:null}catch(j){}try{b.binary=k.response}catch(m){}try{f=k.statusText}catch(l){f=""}!e&&a.isLocal&&!a.crossDomain?e=b.text?200:404:1223===e&&(e=204);c(e,f,b,h)}}catch(u){alert(u),c(-1,u)}};a.async?4===k.readyState?setTimeout(d):k.onreadystatechange=d:d()},abort:function(){}}}))})(jQuery);
|
||||
(function(a,j,g,d){function b(b,g){function m(e){a(l).each(function(){self.Jmol&&(0<=g.indexOf("mouseup")||0<=g.indexOf("touchend"))&&Jmol._setMouseOwner(null);var h=a(this);this!==e.target&&!h.has(e.target).length&&h.triggerHandler(g,[e.target,e])})}g=g||b+d;var l=a(),e=b+"."+g+"-special-event";a.event.special[g]={setup:function(){l=l.add(this);1===l.length&&a(j).bind(e,m)},teardown:function(){self.Jmol&&Jmol._setMouseOwner(null);l=l.not(this);0===l.length&&a(j).unbind(e)},add:function(a){var e=
|
||||
a.handler;a.handler=function(a,f){a.target=f;e.apply(this,arguments)}}}}a.map(g.split(" "),function(a){b(a)});b("focusin","focus"+d);b("focusout","blur"+d)})(jQuery,document,"click mousemove mouseup touchmove touchend","outjsmol");"undefined"==typeof jQuery&&alert("Note -- JSmoljQuery is required for JSmol, but it's not defined.");self.Jmol||(Jmol={});
|
||||
Jmol._version||(Jmol=function(a){var j=function(a){return{rear:a++,header:a++,main:a++,image:a++,front:a++,fileOpener:a++,coverImage:a++,dialog:a++,menu:a+9E4,console:a+91E3,consoleImage:a+91001,monitorZIndex:a+99999}},j={_version:"$Date: 2018-01-28 23:38:52 -0600 (Sun, 28 Jan 2018) $",_alertNoBinary:!0,_allowedJmolSize:[25,2048,300],_appletCssClass:"",_appletCssText:"",_fileCache:null,_jarFile:null,_j2sPath:null,_use:null,_j2sLoadMonitorOpacity:90,_applets:{},_asynchronous:!0,_ajaxQueue:[],_persistentMenu:!1,
|
||||
_getZOrders:j,_z:j(Jmol.z||9E3),_debugCode:!0,_debugCore:!1,db:{_databasePrefixes:"$=:",_fileLoadScript:";if (_loadScript = '' && defaultLoadScript == '' && _filetype == 'Pdb') { select protein or nucleic;cartoons Only;color structure; select * };",_nciLoadScript:";n = ({molecule=1}.length < {molecule=2}.length ? 2 : 1); select molecule=n;display selected;center selected;",_pubChemLoadScript:"",_DirectDatabaseCalls:{"cactus.nci.nih.gov":null,".x3dna.org":null,"rruff.geo.arizona.edu":null,".rcsb.org":null,
|
||||
"ftp.wwpdb.org":null,"pdbe.org":null,"materialsproject.org":null,".ebi.ac.uk":null,"pubchem.ncbi.nlm.nih.gov":null,"www.nmrdb.org/tools/jmol/predict.php":null,$:"https://cactus.nci.nih.gov/chemical/structure/%FILENCI/file?format=sdf&get3d=True",$$:"https://cactus.nci.nih.gov/chemical/structure/%FILENCI/file?format=sdf","=":"https://files.rcsb.org/download/%FILE.pdb","*":"https://www.ebi.ac.uk/pdbe/entry-files/download/%FILE.cif","==":"https://files.rcsb.org/ligands/download/%FILE.cif",":":"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d"},
|
||||
_restQueryUrl:"http://www.rcsb.org/pdb/rest/search",_restQueryXml:"<orgPdbQuery><queryType>org.pdb.query.simple.AdvancedKeywordQuery</queryType><description>Text Search</description><keywords>QUERY</keywords></orgPdbQuery>",_restReportUrl:"http://www.pdb.org/pdb/rest/customReport?pdbids=IDLIST&customReportColumns=structureId,structureTitle"},_debugAlert:!1,_document:a,_isXHTML:!1,_lastAppletID:null,_mousePageX:null,_mouseOwner:null,_serverUrl:"https://your.server.here/jsmol.php",_syncId:(""+Math.random()).substring(3),
|
||||
_touching:!1,_XhtmlElement:null,_XhtmlAppendChild:!1};a=a.location.href.toLowerCase();j._debugCore=0<=a.indexOf("j2sdebugcore");j._httpProto=0==a.indexOf("https")?"https://":"http://";j._isFile=0==a.indexOf("file:");j._isFile&&$.ajaxSetup({mimeType:"text/plain"});j._ajaxTestSite=j._httpProto+"google.com";a=j._isFile||0==a.indexOf("http://localhost")||0==a.indexOf("http://127.");j._tracker=!a&&"https://chemapps.stolaf.edu/jmol/JmolTracker.php?id=UA-45940799-1";j._isChrome=0<=navigator.userAgent.toLowerCase().indexOf("chrome");
|
||||
j._isSafari=!j._isChrome&&0<=navigator.userAgent.toLowerCase().indexOf("safari");j._isMsie=void 0!==window.ActiveXObject;j._isEdge=0<=navigator.userAgent.indexOf("Edge/");j._useDataURI=!j._isSafari&&!j._isMsie&&!j._isEdge;window.requestAnimationFrame||(window.requestAnimationFrame=window.setTimeout);for(var g in Jmol)j[g]=Jmol[g];return j}(document,Jmol));
|
||||
(function(a,j){a.__$=j;j(document).ready(function(){a._document=null});a.$=function(a,f){null==a&&alert(f+arguments.callee.caller.toString());return j(f?"#"+a._id+"_"+f:a)};a._$=function(a){return"string"==typeof a?j("#"+a):a};a.$ajax=function(e){a._ajaxCall=e.url;e.cache="NO"!=e.cache;e.url=a._fixProtocol(e.url);return j.ajax(e)};a._fixProtocol=function(e){0<=e.indexOf("get3d=True")&&(e=e.replace(/get3d\=True/,"get3d=true"));return 0==e.indexOf("http://www.rcsb.org/pdb/files/")&&0>e.indexOf("/ligand/")?
|
||||
"http://files.rcsb.org/view/"+e.substring(30).replace(/\.gz/,""):0==e.indexOf("http://")&&("https://"==a._httpProto||0<e.indexOf(".gov/")||0==e.indexOf("http://www.materialsproject"))?"https"+e.substring(4):e};a._getNCIInfo=function(e,f){return a._getFileData("https://cactus.nci.nih.gov/chemical/structure/"+e+"/"+("name"==f?"names":f))};a.$appEvent=function(e,f,h,b){e=a.$(e,f);e.off(h)&&b&&e.on(h,b)};a.$resize=function(a){return j(window).resize(a)};a.$after=function(a,f){return j(a).after(f)};a.$append=
|
||||
function(a,f){return j(a).append(f)};a.$bind=function(a,f,h){return h?j(a).bind(f,h):j(a).unbind(f)};a.$closest=function(a,f){return j(a).closest(f)};a.$get=function(a,f){return j(a).get(f)};a.$documentOff=function(a,f){return j(document).off(a,"#"+f)};a.$documentOn=function(a,f,h){return j(document).on(a,"#"+f,h)};a.$getAncestorDiv=function(a,f){return j("div."+f+":has(#"+a+")")[0]};a.$supportsIECrossDomainScripting=function(){return j.support.iecors};a.$attr=function(e,f,h){return a._$(e).attr(f,
|
||||
h)};a.$css=function(e,f){return a._$(e).css(f)};a.$find=function(e,f){return a._$(e).find(f)};a.$focus=function(e){return a._$(e).focus()};a.$html=function(e,f){return a._$(e).html(f)};a.$offset=function(e){return a._$(e).offset()};a.$windowOn=function(a,f){return j(window).on(a,f)};a.$prop=function(e,f,h){var b=a._$(e);return 3==arguments.length?b.prop(f,h):b.prop(f)};a.$remove=function(e){return a._$(e).remove()};a.$scrollTo=function(e,f){var h=a._$(e);return h.scrollTop(0>f?h[0].scrollHeight:f)};
|
||||
a.$setEnabled=function(e,f){return a._$(e).attr("disabled",f?null:"disabled")};a.$getSize=function(e){e=a._$(e);return[e.width(),e.height()]};a.$setSize=function(e,f,h){return a._$(e).width(f).height(h)};a.$is=function(e,f){return a._$(e).is(f)};a.$setVisible=function(e,f){var h=a._$(e);return f?h.show():h.hide()};a.$submit=function(e){return a._$(e).submit()};a.$val=function(e,f){var h=a._$(e);return 1==arguments.length?h.val():h.val(f)};a._clearVars=function(){delete jQuery;delete j;delete a;delete SwingController;
|
||||
delete J;delete JM;delete JS;delete JSV;delete JU;delete JV;delete java;delete javajs;delete Clazz;delete c$};var g=document,d=window,b={};b.ua=navigator.userAgent.toLowerCase();var c;a:{c=["linux","unix","mac","win"];for(var k=c.length;k--;)if(-1!=b.ua.indexOf(c[k])){c=c[k];break a}c="unknown"}b.os=c;b.browser=function(){for(var a=b.ua,f="konqueror webkit omniweb opera webtv icab msie mozilla".split(" "),h=0;h<f.length;h++)if(0<=a.indexOf(f[h]))return f[h];return"unknown"};b.browserName=b.browser();
|
||||
b.browserVersion=parseFloat(b.ua.substring(b.ua.indexOf(b.browserName)+b.browserName.length+1));b.supportsXhr2=function(){return j.support.cors||j.support.iecors};b.allowDestroy="msie"!=b.browserName;b.allowHTML5="msie"!=b.browserName||0>navigator.appVersion.indexOf("MSIE 8");b.getDefaultLanguage=function(){return navigator.language||navigator.userLanguage||"en-US"};b._webGLtest=0;b.supportsWebGL=function(){if(!a.featureDetection._webGLtest){var e;a.featureDetection._webGLtest=d.WebGLRenderingContext&&
|
||||
((e=g.createElement("canvas")).getContext("webgl")||e.getContext("experimental-webgl"))?1:-1}return 0<a.featureDetection._webGLtest};b.supportsLocalization=function(){for(var a=g.getElementsByTagName("meta"),f=a.length;0<=--f;)if(0<=a[f].outerHTML.toLowerCase().indexOf("utf-8"))return!0;return!1};b.supportsJava=function(){a.featureDetection._javaEnabled||(a.featureDetection._javaEnabled=a._isMsie?navigator.javaEnabled()?1:-1:navigator.javaEnabled()&&(!navigator.mimeTypes||navigator.mimeTypes["application/x-java-applet"])?
|
||||
1:-1);return 0<a.featureDetection._javaEnabled};b.compliantBrowser=function(){var a=!!g.getElementById,f=b.os;if("opera"==b.browserName&&7.54>=b.browserVersion&&"mac"==f||"webkit"==b.browserName&&125.12>b.browserVersion||"msie"==b.browserName&&"mac"==f||"konqueror"==b.browserName&&3.3>=b.browserVersion)a=!1;return a};b.isFullyCompliant=function(){return b.compliantBrowser()&&b.supportsJava()};b.useIEObject="win"==b.os&&"msie"==b.browserName&&5.5<=b.browserVersion;b.useHtml4Object="mozilla"==b.browserName&&
|
||||
5<=b.browserVersion||"opera"==b.browserName&&8<=b.browserVersion||"webkit"==b.browserName;b.hasFileReader=d.File&&d.FileReader;a.featureDetection=b;a._ajax=function(e){if(!e.async)return a.$ajax(e).responseText;a._ajaxQueue.push(e);1==a._ajaxQueue.length&&a._ajaxDone()};a._ajaxDone=function(){var e=a._ajaxQueue.shift();e&&a.$ajax(e)};a._grabberOptions=[["$","NCI(small molecules)"],[":","PubChem(small molecules)"],["=","RCSB(macromolecules)"],["*","PDBe(macromolecules)"]];a._getGrabberOptions=function(e){if(0==
|
||||
a._grabberOptions.length)return"";var f='<input type="text" id="ID_query" onfocus="jQuery(this).select()" onkeypress="if(13==event.which){Jmol._applets[\'ID\']._search();return false}" size="32" value="" />',h='<button id="ID_submit" onclick="Jmol._applets[\'ID\']._search()">Search</button></nobr>';1==a._grabberOptions.length?(f="<nobr>"+f+'<span style="display:none">',h="</span>"+h):f+="<br /><nobr>";for(var f=f+'<select id="ID_select">',b=0;b<a._grabberOptions.length;b++)var c=a._grabberOptions[b],
|
||||
f=f+('<option value="'+c[0]+'" '+(0==b?"selected":"")+">"+c[1]+"</option>");f=(f+"</select>"+h).replace(/ID/g,e._id);return"<br />"+f};a._getScriptForDatabase=function(e){return"$"==e?a.db._nciLoadScript:":"==e?a.db._pubChemLoadScript:a.db._fileLoadScript};a._setInfo=function(a,f,h){var b=[],c="";if(0==h.indexOf("ERROR"))c=h;else switch(f){case "=":f=h.split("<dimStructure.structureId>");b=["<table>"];for(h=1;h<f.length;h++)b.push('<tr><td valign=top><a href="javascript:Jmol.search('+a._id+",'="+
|
||||
f[h].substring(0,4)+"')\">"+f[h].substring(0,4)+"</a></td>"),b.push("<td>"+f[h].split("Title>")[1].split("</")[0]+"</td></tr>");b.push("</table>");c=f.length-1+" matches";break;case "$":case ":":break;default:return}a._infoHeader=c;a._info=b.join("");a._showInfo(!0)};a._loadSuccess=function(e,f){f&&(a._ajaxDone(),f(e))};a._loadError=function(e){a._ajaxDone();a.say("Error connecting to server: "+a._ajaxCall);null!=e&&e()};a._isDatabaseCall=function(e){return 0<=a.db._databasePrefixes.indexOf(e.substring(0,
|
||||
1))};a._getDirectDatabaseCall=function(e,f){if(f&&!a.featureDetection.supportsXhr2())return e;var h=2,b=e.substring(0,h),c=a.db._DirectDatabaseCalls[b]||a.db._DirectDatabaseCalls[b=e.substring(0,--h)];c&&(":"==b?(b=e.toLowerCase(),isNaN(parseInt(e.substring(1)))?0==b.indexOf(":smiles:")?(c+="?POST?smiles="+e.substring(8),e="smiles"):0==b.indexOf(":cid:")?e="cid/"+e.substring(5):(0==b.indexOf(":name:")?e=e.substring(5):0==b.indexOf(":cas:")&&(e=e.substring(4)),e="name/"+encodeURIComponent(e.substring(h))):
|
||||
e="cid/"+e.substring(1)):e=encodeURIComponent(e.substring(h)),0<=e.indexOf(".mmtf")?e="https://mmtf.rcsb.org/v1.0/full/"+e.replace(/\.mmtf/,""):0<=c.indexOf("FILENCI")?(e=e.replace(/\%2F/g,"/"),e=c.replace(/\%FILENCI/,e)):e=c.replace(/\%FILE/,e));return e};a._getRawDataFromServer=function(e,f,h,b,c,d){e="?call=getRawDataFromDatabase&database="+e+(0<=f.indexOf("?POST?")?"?POST?":"")+"&query="+encodeURIComponent(f)+(c?"&encoding=base64":"")+(d?"":"&script="+encodeURIComponent(a._getScriptForDatabase(e)));
|
||||
return a._contactServer(e,h,b)};a._checkFileName=function(e,f,h){a._isDatabaseCall(f)&&(h&&a._setQueryTerm(e,f),f=a._getDirectDatabaseCall(f,!0),a._isDatabaseCall(f)&&(f=a._getDirectDatabaseCall(f,!1),h&&(h[0]=!0)));return f};a._checkCache=function(e,f,h){if(e._cacheFiles&&a._fileCache&&!f.endsWith(".js")){if(e=a._fileCache[f])return System.out.println("using "+e.length+" bytes of cached data for "+f),h(e),null;h=function(e,f){h(a._fileCache[e]=f)}}return h};a.playAudio=function(e){a._playAudio(null,
|
||||
e)};a._playAudio=function(a,f){var h=f.get?function(a){return f.get(a)}:null,b=f.put?function(a,e){return f.put(a,e)}:null,c=h?h("audioFile"):f,d=h&&h("audioPlayer"),g=document.createElement("audio");b&&b("audioElement",g);var k=null;d&&(k=function(a){d.processUpdate(a)},d.myClip={open:function(){k("open")},start:function(){g.play();k("start")},loop:function(a){g.loop=0!=a},stop:function(){g.pause()},close:function(){k("close")},setMicrosecondPosition:function(a){g.currentTime=a/1E6}});g.controls=
|
||||
"true";g.src=c;h&&h("loop")&&(g.loop="true");k&&(g.addEventListener("pause",function(){k("pause")}),g.addEventListener("play",function(){k("play")}),g.addEventListener("playing",function(){k("playing")}),g.addEventListener("ended",function(){k("ended")}),k("open"))};a._loadFileData=function(e,f,h,b){var c=[];f=a._checkFileName(e,f,c);h=a._checkCache(e,f,h);c[0]?a._getRawDataFromServer("_",f,h,b):(e={type:"GET",dataType:"text",url:f,async:a._asynchronous,success:function(e){a._loadSuccess(e,h)},error:function(){a._loadError(b)}},
|
||||
a._checkAjaxPost(e),a._ajax(e))};a._getInfoFromDatabase=function(e,f,h){if("===="==f){var b=a.db._restQueryXml.replace(/QUERY/,h),b={dataType:"text",type:"POST",contentType:"application/x-www-form-urlencoded",url:a.db._restQueryUrl,data:encodeURIComponent(b)+"&req=browser",success:function(b){a._ajaxDone();a._extractInfoFromRCSB(e,f,h,b)},error:function(){a._loadError(null)},async:a._asynchronous};return a._ajax(b)}h="?call=getInfoFromDatabase&database="+f+"&query="+encodeURIComponent(h);return a._contactServer(h,
|
||||
function(h){a._setInfo(e,f,h)})};a._extractInfoFromRCSB=function(e,f,h,b){var c=b.length/5;if(0!=c&&4==h.length&&1!=c){h=h.toUpperCase();var d=b.indexOf(h);0<d&&0<="123456789".indexOf(h.substring(0,1))&&(b=h+","+b.substring(0,d)+b.substring(d+5));50<c&&(b=b.substring(0,250));b=b.replace(/\n/g,",");b=a._restReportUrl.replace(/IDLIST/,b);a._loadFileData(e,b,function(h){a._setInfo(e,f,h)})}};a._checkAjaxPost=function(a){var f=a.url.indexOf("?POST?");0<f&&(a.data=a.url.substring(f+6),a.url=a.url.substring(0,
|
||||
f),a.type="POST",a.contentType="application/x-www-form-urlencoded")};a._contactServer=function(e,f,h){e={dataType:"text",type:"GET",url:a._serverUrl+e,success:function(e){a._loadSuccess(e,f)},error:function(){a._loadError(h)},async:f?a._asynchronous:!1};a._checkAjaxPost(e);return a._ajax(e)};a._setQueryTerm=function(e,f){if(f&&e._hasOptions&&"http://"!=f.substring(0,7)){if(a._isDatabaseCall(f)){var h=f.substring(0,1);f=f.substring(1);f.substring(0,1)==h&&0<="=$".indexOf(h)&&(f=f.substring(1));var b=
|
||||
a._getElement(e,"select");if(b&&b.options)for(var c=0;c<b.options.length;c++)b[c].value==h&&(b[c].selected=!0)}a.$val(a.$(e,"query"),f)}};a._search=function(e,f,h){1<arguments.length||(f=null);a._setQueryTerm(e,f);f||(f=a.$val(a.$(e,"query")));0==f.indexOf("!")?e._script(f.substring(1)):(f&&(f=f.replace(/\"/g,"")),e._showInfo(!1),a._searchMol(e,f,h,!0))};a._searchMol=function(e,f,h,b){var c;a._isDatabaseCall(f)?(c=f.substring(0,1),f=f.substring(1)):c=e._hasOptions?a.$val(a.$(e,"select")):"$";"="==
|
||||
c&&3==f.length&&(f="="+f);var d=c+f;if(f&&!(0>d.indexOf("?")&&d==e._thisJmolModel)){e._thisJmolModel=d;var g;b&&null!=e._viewSet&&null!=(g=a.View.__findView(e._viewSet,{chemID:d}))?a.View.__setView(g,e,!1):("$"==c||":"==c?e._jmolFileType="MOL":"="==c&&(e._jmolFileType="PDB"),e._searchDatabase(f,c,h))}};a._searchDatabase=function(e,f,h,b){e._showInfo(!1);return 0<=f.indexOf("?")?(a._getInfoFromDatabase(e,h,f.split("?")[0]),!0):a.db._DirectDatabaseCalls[h]?(e._loadFile(h+f,b),!0):!1};a._syncBinaryOK=
|
||||
"?";a._canSyncBinary=function(e){if(a._isAsync)return!0;if(self.VBArray)return a._syncBinaryOK=!1;if("?"!=a._syncBinaryOK)return a._syncBinaryOK;a._syncBinaryOK=!0;try{var f=new window.XMLHttpRequest;f.open("text",a._ajaxTestSite,!1);f.hasOwnProperty("responseType")?f.responseType="arraybuffer":f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined")}catch(h){return System.out.println("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._alertNoBinary&&
|
||||
!e&&alert("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._syncBinaryOK=!1}return!0};a._binaryTypes="mmtf .gz .bz2 .jpg .gif .png .zip .jmol .bin .smol .spartan .pmb .mrc .map .ccp4 .dn6 .delphi .omap .pse .dcd .uk/pdbe/densities/".split(" ");a._isBinaryUrl=function(e){for(var f=a._binaryTypes.length;0<=--f;)if(0<=e.indexOf(a._binaryTypes[f]))return!0;return!1};a._getFileData=function(e,f,h){var b=a._isBinaryUrl(e),c=0<=e.indexOf(".gz")&&0<=e.indexOf("rcsb.org");
|
||||
c&&(e=e.replace(/\.gz/,""),b=!1);var c=b&&!f&&!a._canSyncBinary(c),d=0<=e.indexOf("?POST?");0==e.indexOf("file:/")&&0!=e.indexOf("file:///")&&(e="file://"+e.substring(5));var g=0>e.indexOf("://")||0==e.indexOf(document.location.protocol)&&0<=e.indexOf(document.location.host),k="https://"==a._httpProto&&0==e.indexOf("http://"),j=a._isDirectCall(e);!j&&0<=e.indexOf("?ALLOWSORIGIN?")&&(j=!0,e=e.replace(/\?ALLOWSORIGIN\?/,""));var m=!g&&a.$supportsIECrossDomainScripting(),l=null;if(k||c||!g&&!j||!f&&
|
||||
m)l=a._getRawDataFromServer("_",e,f,f,c,!0);else{e=e.replace(/file:\/\/\/\//,"file://");var q={dataType:b?"binary":"text",async:!!f};d?(q.type="POST",q.url=e.split("?POST?")[0],q.data=e.split("?POST?")[1]):(q.type="GET",q.url=e);f&&(q.success=function(){f(a._xhrReturn(q.xhr))},q.error=function(){f(q.xhr.statusText)});q.xhr=a.$ajax(q);f||(l=a._xhrReturn(q.xhr))}if(!h)return l;null==l&&(l="",b=!1);b&&(b=a._canSyncBinary(!0));return b?a._strToBytes(l):JU.SB.newS(l)};a._xhrReturn=function(a){return!a.responseText||
|
||||
self.Clazz&&Clazz.instanceOf(a.response,self.ArrayBuffer)?a.response||a.statusText:a.responseText};a._isDirectCall=function(e){if(0<=e.indexOf("?ALLOWSORIGIN?"))return!0;for(var f in a.db._DirectDatabaseCalls)if(0<=f.indexOf(".")&&0<=e.indexOf(f))return!0;return!1};a._cleanFileData=function(a){return 0<=a.indexOf("\r")&&0<=a.indexOf("\n")?a.replace(/\r\n/g,"\n"):0<=a.indexOf("\r")?a.replace(/\r/g,"\n"):a};a._getFileType=function(a){var f=a.substring(0,1);if("$"==f||":"==f)return"MOL";if("="==f)return"="==
|
||||
a.substring(1,2)?"LCIF":"PDB";a=a.split(".").pop().toUpperCase();return a.substring(0,Math.min(a.length,3))};a._getZ=function(e,f){return e&&e._z&&e._z[f]||a._z[f]};a._incrZ=function(e,f){return e&&e._z&&++e._z[f]||++a._z[f]};a._hideLocalFileReader=function(e){e._localReader&&a.$setVisible(e._localReader,!1);e._readingLocal=!1;a._setCursor(e,0)};a.loadFileFromDialog=function(e){a._loadFileAsynchronously(null,e,null,null)};a._loadFileAsynchronously=function(e,f,h,b){if(h&&0!=h.indexOf("?")){var c=
|
||||
h;h=a._checkFileName(f,h);var d=function(d){a._setData(e,h,c,d,b,f)},d=a._checkCache(f,h,d);0<=h.indexOf("|")&&(h=h.split("|")[0]);return null==d?null:a._getFileData(h,d)}if(!a.featureDetection.hasFileReader)return e?e.setData("Local file reading is not enabled in your browser",null,null,b,f):alert("Local file reading is not enabled in your browser");f._localReader||(d='<div id="ID" style="z-index:'+a._getZ(f,"fileOpener")+';position:absolute;background:#E0E0E0;left:10px;top:10px"><div style="margin:5px 5px 5px 5px;"><button id="ID_loadurl">URL</button><input type="file" id="ID_files" /><button id="ID_loadfile">load</button><button id="ID_cancel">cancel</button></div><div>',
|
||||
a.$after("#"+f._id+"_appletdiv",d.replace(/ID/g,f._id+"_localReader")),f._localReader=a.$(f,"localReader"));a.$appEvent(f,"localReader_loadurl","click");a.$appEvent(f,"localReader_loadurl","click",function(){var e=prompt("Enter a URL");e&&(a._hideLocalFileReader(f,0),a._setData(null,e,e,null,b,f))});a.$appEvent(f,"localReader_loadfile","click");a.$appEvent(f,"localReader_loadfile","click",function(){var h=a.$(f,"localReader_files")[0].files[0],c=new FileReader;c.onloadend=function(c){c.target.readyState==
|
||||
FileReader.DONE&&(a._hideLocalFileReader(f,0),a._setData(e,h.name,h.name,c.target.result,b,f))};try{c.readAsArrayBuffer(h)}catch(d){alert("You must select a file first.")}});a.$appEvent(f,"localReader_cancel","click");a.$appEvent(f,"localReader_cancel","click",function(){a._hideLocalFileReader(f);e&&e.setData("#CANCELED#",null,null,b,f)});a.$setVisible(f._localReader,!0);f._readingLocal=!0};a._setData=function(e,f,h,b,c,d){b&&(b=a._strToBytes(b));null!=b&&(null==e||0<=f.indexOf(".jdx"))&&a.Cache.put("cache://"+
|
||||
f,b);null==e?d._applet.openFileAsyncSpecial(null==b?f:"cache://"+f,1):e.setData(f,h,b,c)};a._doAjax=function(e,f,h){e=e.toString();if(null!=h)return a._saveFile(e,h);f&&(e+="?POST?"+f);return a._getFileData(e,null,!0)};a._saveFile=function(e,f,h,b){if(a._localFileSaveFunction&&a._localFileSaveFunction(e,f))return"OK";e=e.substring(e.lastIndexOf("/")+1);h||(h=0<=e.indexOf(".pdf")?"application/pdf":0<=e.indexOf(".png")?"image/png":0<=e.indexOf(".gif")?"image/gif":0<=e.indexOf(".jpg")?"image/jpg":"");
|
||||
f=(JU?JU:J.util).Base64.getBase64("string"==typeof f?f.getBytes("UTF-8"):f).toString();b||(b="base64");var c=a._serverUrl;c&&0<=c.indexOf("your.server")&&(c="");a._useDataURI||!c?(b=document.createElement("a"),b.href="data:"+h+";base64,"+f,b.type=h||"text/plain;charset=utf-8",b.download=e,b.target="_blank",j("body").append(b),b.click(),b.remove()):(a._formdiv||(a.$after("body",'<div id="__jsmolformdiv__" style="display:none">\t\t\t\t\t\t<form id="__jsmolform__" method="post" target="_blank" action="">\t\t\t\t\t\t<input name="call" value="saveFile"/>\t\t\t\t\t\t<input id="__jsmolmimetype__" name="mimetype" value=""/>\t\t\t\t\t\t<input id="__jsmolencoding__" name="encoding" value=""/>\t\t\t\t\t\t<input id="__jsmolfilename__" name="filename" value=""/>\t\t\t\t\t\t<textarea id="__jsmoldata__" name="data"></textarea>\t\t\t\t\t\t</form>\t\t\t\t\t\t</div>'),
|
||||
a._formdiv="__jsmolform__"),a.$attr(a._formdiv,"action",c+"?"+(new Date).getMilliseconds()),a.$val("__jsmoldata__",f),a.$val("__jsmolfilename__",e),a.$val("__jsmolmimetype__",h),a.$val("__jsmolencoding__",b),a.$submit("__jsmolform__"),a.$val("__jsmoldata__",""),a.$val("__jsmolfilename__",""));return"OK"};a._strToBytes=function(a){if(Clazz.instanceOf(a,self.ArrayBuffer))return Clazz.newByteArray(-1,a);for(var f=Clazz.newByteArray(a.length,0),h=a.length;0<=--h;)f[h]=a.charCodeAt(h)&255;return f};a._setConsoleDiv=
|
||||
function(a){self.Clazz&&Clazz.setConsoleDiv(a)};a._registerApplet=function(e,f){return window[e]=a._applets[e]=a._applets[e+"__"+a._syncId+"__"]=f};a._readyCallback=function(e,f,h,b,c){e=e.split("_object")[0];var d=a._applets[e];if(h=h.booleanValue?h.booleanValue():h)d._appletPanel=c||b,d._applet=b;a._track(d)._readyCallback(e,f,h)};a._getWrapper=function(e,f){var h;if(f){var b="";if(e._coverImage)var b=' onclick="Jmol.coverApplet(ID, false)" title="'+e._coverTitle+'"',c='<image id="ID_coverclickgo" src="'+
|
||||
e._makeLiveImage+'" style="width:25px;height:25px;position:absolute;bottom:10px;left:10px;z-index:'+a._getZ(e,"coverImage")+';opacity:0.5;"'+b+" />",b='<div id="ID_coverdiv" style="background-color:red;z-index:'+a._getZ(e,"coverImage")+';width:100%;height:100%;display:inline;position:absolute;top:0px;left:0px"><image id="ID_coverimage" src="'+e._coverImage+'" style="width:100%;height:100%"'+b+"/>"+c+"</div>";c=e._isJava?"":'<image id="ID_waitimage" src="'+e._j2sPath+'/img/cursor_wait.gif" style="display:none;position:absolute;bottom:10px;left:10px;z-index:'+
|
||||
a._getZ(e,"coverImage")+';" />';h=a._appletCssText.replace(/\'/g,'"');var d=e._getSpinner&&e._getSpinner();e._spinner=d=!d||"none"==d?"":"background-image:url("+d+"); background-repeat:no-repeat; background-position:center;";h=d+(0<=h.indexOf('style="')?h.split('style="')[1]:'" '+h);h='...<div id="ID_appletinfotablediv" style="width:Wpx;height:Hpx;position:relative;font-size:14px;text-align:left">IMG WAIT......<div id="ID_appletdiv" style="z-index:'+a._getZ(e,"header")+";width:100%;height:100%;position:absolute;top:0px;left:0px;"+
|
||||
h+">";var d=e._height,g=e._width;if("string"!==typeof d||0>d.indexOf("%"))d+="px";if("string"!==typeof g||0>g.indexOf("%"))g+="px";h=h.replace(/IMG/,b).replace(/WAIT/,c).replace(/Hpx/g,d).replace(/Wpx/g,g)}else h='......</div>......<div id="ID_2dappletdiv" style="position:absolute;width:100%;height:100%;overflow:hidden;display:none"></div>......<div id="ID_infotablediv" style="width:100%;height:100%;position:absolute;top:0px;left:0px">.........<div id="ID_infoheaderdiv" style="height:20px;width:100%;background:yellow;display:none"><span id="ID_infoheaderspan"></span><span id="ID_infocheckboxspan" style="position:absolute;text-align:right;right:1px;"><a href="javascript:Jmol.showInfo(ID,false)">[x]</a></span></div>.........<div id="ID_infodiv" style="position:absolute;top:20px;bottom:0px;width:100%;height:100%;overflow:auto"></div>......</div>...</div>';
|
||||
return h.replace(/\.\.\./g,"").replace(/[\n\r]/g,"").replace(/ID/g,e._id)};a._hideLoadingSpinner=function(e){e._spinner&&a.$css(a.$(e,"appletdiv"),{"background-image":""})};a._documentWrite=function(e){if(a._document){if(a._isXHTML&&!a._XhtmlElement){var f=document.getElementsByTagName("script");a._XhtmlElement=f.item(f.length-1);a._XhtmlAppendChild=!1}a._XhtmlElement?a._domWrite(e):a._document.write(e)}return e};a._domWrite=function(e){for(var f=[0];f[0]<e.length;){var b=a._getDomElement(e,f);if(!b)break;
|
||||
a._XhtmlAppendChild?a._XhtmlElement.appendChild(b):a._XhtmlElement.parentNode.insertBefore(b,_jmol.XhtmlElement)}};a._getDomElement=function(a,f){var b=document.createElement("span");b.innerHTML=a;f[0]=a.length;return b};a._setObject=function(e,f,b){e._id=f;e.__Info={};b.z&&b.zIndexBase&&(a._z=a._getZOrders(b.zIndexBase));for(var c in b)e.__Info[c]=b[c];(e._z=b.z)||b.zIndexBase&&(e._z=e.__Info.z=a._getZOrders(b.zIndexBase));e._width=b.width;e._height=b.height;e._noscript=!e._isJava&&b.noscript;e._console=
|
||||
b.console;e._cacheFiles=!!b.cacheFiles;e._viewSet=null==b.viewSet||e._isJava?null:"Set"+b.viewSet;null!=e._viewSet&&(a.View.__init(e),e._currentView=null);!a._fileCache&&e._cacheFiles&&(a._fileCache={});e._console||(e._console=e._id+"_infodiv");"none"==e._console&&(e._console=null);e._color=b.color?b.color.replace(/0x/,"#"):"#FFFFFF";e._disableInitialConsole=b.disableInitialConsole;e._noMonitor=b.disableJ2SLoadMonitor;a._j2sPath&&(b.j2sPath=a._j2sPath);e._j2sPath=b.j2sPath;e._coverImage=b.coverImage;
|
||||
e._makeLiveImage=b.makeLiveImage||b.j2sPath+"/img/play_make_live.jpg";e._isCovered=!!e._coverImage;e._deferApplet=b.deferApplet||e._isCovered&&e._isJava;e._deferUncover=b.deferUncover&&!e._isJava;e._coverScript=b.coverScript;e._coverTitle=b.coverTitle;e._coverTitle||(e._coverTitle=e._deferApplet?"activate 3D model":"3D model is loading...");e._containerWidth=e._width+(e._width==parseFloat(e._width)?"px":"");e._containerHeight=e._height+(e._height==parseFloat(e._height)?"px":"");e._info="";e._infoHeader=
|
||||
e._jmolType+' "'+e._id+'"';e._hasOptions=b.addSelectionOptions;e._defaultModel=b.defaultModel;e._readyScript=b.script?b.script:"";e._readyFunction=b.readyFunction;e._coverImage&&!e._deferApplet&&(e._readyScript+=";javascript "+f+"._displayCoverImage(false)");e._src=b.src};a._addDefaultInfo=function(e,f){for(var b in f)"undefined"==typeof e[b]&&(e[b]=f[b]);a._use&&(e.use=a._use);0<=e.use.indexOf("SIGNED")&&(0>e.jarFile.indexOf("Signed")&&(e.jarFile=e.jarFile.replace(/Applet/,"AppletSigned")),e.use=
|
||||
e.use.replace(/SIGNED/,"JAVA"),e.isSigned=!0)};a._syncedApplets=[];a._syncedCommands=[];a._syncedReady=[];a._syncReady=!1;a._isJmolJSVSync=!1;a._setReady=function(e){a._syncedReady[e]=1;for(var f=0,b=0;b<a._syncedApplets.length;b++){if(a._syncedApplets[b]==e._id)a._syncedApplets[b]=e,a._syncedReady[b]=1;else if(!a._syncedReady[b])continue;f++}f==a._syncedApplets.length&&a._setSyncReady()};a._setDestroy=function(e){a.featureDetection.allowDestroy&&a.$windowOn("beforeunload",function(){a._destroy(e)})};
|
||||
a._destroy=function(e){try{e._appletPanel&&e._appletPanel.destroy();e._applet=null;a._unsetMouse(e._canvas);e._canvas=null;for(var f=0,b=0;b<a._syncedApplets.length;b++)a._syncedApplets[b]==e&&(a._syncedApplets[b]=null),a._syncedApplets[b]&&f++;0<f||a._clearVars()}catch(c){}};a._setSyncReady=function(){a._syncReady=!0;for(var e="",f=0;f<a._syncedApplets.length;f++)a._syncedCommands[f]&&(e+="Jmol.script(Jmol._syncedApplets["+f+"], Jmol._syncedCommands["+f+"]);");setTimeout(e,50)};a._mySyncCallback=
|
||||
function(e,f){app=a._applets[e];if(app._viewSet)a.View.updateFromSync(app,f);else{if(!a._syncReady||!a._isJmolJSVSync)return 1;for(var b=0;b<a._syncedApplets.length;b++)0<=f.indexOf(a._syncedApplets[b]._syncKeyword)&&a._syncedApplets[b]._syncScript(f);return 0}};a._getElement=function(a,f){return document.getElementById(a._id+"_"+f)||{}};a._evalJSON=function(a,f){a+="";if(!a)return[];if("{"!=a.charAt(0))return 0<=a.indexOf(" | ")&&(a=a.replace(/\ \|\ /g,"\n")),a;var b=(new Function("return "+a))();
|
||||
return!b?null:f&&void 0!=b[f]?b[f]:b};a._sortMessages=function(a){function f(a,e){return a[0]<e[0]?1:a[0]>e[0]?-1:0}if(!a||"object"!=typeof a)return[];for(var b=[],c=a.length-1;0<=c;c--)for(var d=0,g=a[c].length;d<g;d++)b[b.length]=a[c][d];if(0!=b.length)return b=b.sort(f)};a._setMouseOwner=function(e,b){null==e||b?a._mouseOwner=e:a._mouseOwner==e&&(a._mouseOwner=null)};a._jsGetMouseModifiers=function(a){var b=0;switch(a.button){case 0:b=16;break;case 1:b=8;break;case 2:b=4}a.shiftKey&&(b+=1);a.altKey&&
|
||||
(b+=8);a.ctrlKey&&(b+=2);return b};a._jsGetXY=function(e,b){if(!e.applet._ready||a._touching&&0>b.type.indexOf("touch"))return!1;var h=a.$offset(e.id),c,d=b.originalEvent;b.pageX||(b.pageX=d.pageX);b.pageY||(b.pageY=d.pageY);a._mousePageX=b.pageX;a._mousePageY=b.pageY;d.targetTouches&&d.targetTouches[0]?(c=d.targetTouches[0].pageX-h.left,h=d.targetTouches[0].pageY-h.top):d.changedTouches?(c=d.changedTouches[0].pageX-h.left,h=d.changedTouches[0].pageY-h.top):(c=b.pageX-h.left,h=b.pageY-h.top);return void 0==
|
||||
c?null:[Math.round(c),Math.round(h),a._jsGetMouseModifiers(b)]};a._setCursor=function(e,b){if(!e._isJava&&!e._readingLocal){var h;switch(b){case 1:h="crosshair";break;case 3:h="wait";a.$setVisible(a.$(e,"waitimage"),!0);break;case 8:h="ns-resize";break;case 12:h="grab";break;case 13:h="move";break;default:a.$setVisible(a.$(e,"waitimage"),!1),h="default"}e._canvas.style.cursor=h}};a._gestureUpdate=function(e,b){b.stopPropagation();b.preventDefault();var h=b.originalEvent;switch(b.type){case "touchstart":a._touching=
|
||||
!0;break;case "touchend":a._touching=!1}if(!h.touches||2!=h.touches.length)return!1;switch(b.type){case "touchstart":e._touches=[[],[]];break;case "touchmove":var c=a.$offset(e.id),d=e._touches[0],g=e._touches[1];d.push([h.touches[0].pageX-c.left,h.touches[0].pageY-c.top]);g.push([h.touches[1].pageX-c.left,h.touches[1].pageY-c.top]);h=d.length;3<h&&(d.shift(),g.shift());2<=h&&e.applet._processGesture(e._touches)}return!0};a._jsSetMouse=function(b){var f=function(a){return!a.target||0<=(""+a.target.className).indexOf("swingjs-ui")};
|
||||
a.$bind(b,"mousedown touchstart",function(h){if(f(h))return!0;a._setMouseOwner(b,!0);h.stopPropagation();var c=h.target["data-UI"];(!c||!c.handleJSEvent(b,501,h))&&h.preventDefault();b.isDragging=!0;if("touchstart"==h.type&&a._gestureUpdate(b,h))return!!c;a._setConsoleDiv(b.applet._console);var d=a._jsGetXY(b,h);d&&(2!=h.button&&a.Swing.hideMenus(b.applet),b.applet._processEvent(501,d));return!!c});a.$bind(b,"mouseup touchend",function(h){if(f(h))return!0;a._setMouseOwner(null);h.stopPropagation();
|
||||
var c=h.target["data-UI"];(!c||!c.handleJSEvent(b,502,h))&&h.preventDefault();b.isDragging=!1;if("touchend"==h.type&&a._gestureUpdate(b,h))return!!c;(h=a._jsGetXY(b,h))&&b.applet._processEvent(502,h);return!!c});a.$bind(b,"mousemove touchmove",function(h){if(f(h))return!0;if(a._mouseOwner&&a._mouseOwner!=b&&a._mouseOwner.isDragging){if(!a._mouseOwner.mouseMove)return!0;a._mouseOwner.mouseMove(h);return!1}return a._drag(b,h)});a._drag=function(b,e){e.stopPropagation();e.preventDefault();if("touchmove"==
|
||||
e.type&&a._gestureUpdate(b,e))return!1;var f=a._jsGetXY(b,e);if(!f)return!1;b.isDragging||(f[2]=0);var c=e.target["data-UI"];b.isdragging&&(!c||c.handleJSEvent(b,506,e));b.applet._processEvent(b.isDragging?506:503,f);return!!c};a.$bind(b,"DOMMouseScroll mousewheel",function(h){if(f(h))return!0;h.stopPropagation();h.preventDefault();b.isDragging=!1;var c=h.originalEvent,c=c.detail?c.detail:("mac"==a.featureDetection.os?1:-1)*c.wheelDelta;h=a._jsGetMouseModifiers(h);b.applet._processEvent(507,[0>c?
|
||||
-1:1,0,h]);return!1});a.$bind(b,"contextmenu",function(){return!1});a.$bind(b,"mouseout",function(h){if(f(h))return!0;a._mouseOwner&&!a._mouseOwner.mouseMove&&a._setMouseOwner(null);b.applet._appletPanel&&b.applet._appletPanel.startHoverWatcher(!1);a._jsGetXY(b,h);return!1});a.$bind(b,"mouseenter",function(h){if(f(h))return!0;b.applet._appletPanel&&b.applet._appletPanel.startHoverWatcher(!0);if(0===h.buttons||0===h.which){b.isDragging=!1;h=a._jsGetXY(b,h);if(!h)return!1;b.applet._processEvent(504,
|
||||
h);b.applet._processEvent(502,h);return!1}});a.$bind(b,"mousemoveoutjsmol",function(h,c,d){if(f(d))return!0;if(b==a._mouseOwner&&b.isDragging)return a._drag(b,d)});b.applet._is2D&&a.$resize(function(){b.applet&&b.applet._resize()});a.$bind("body","mouseup touchend",function(h){if(f(h))return!0;b.applet&&(b.isDragging=!1);a._setMouseOwner(null)})};a._jsUnsetMouse=function(b){b.applet=null;a.$bind(b,"mousedown touchstart mousemove touchmove mouseup touchend DOMMouseScroll mousewheel contextmenu mouseout mouseenter",
|
||||
null);a._setMouseOwner(null)};a.Swing={count:0,menuInitialized:0,menuCounter:0,htDialogs:{}};var m=a.Swing;SwingController=m;m.setDraggable=function(b){b=b.prototype;b.setContainer||(b.setContainer=function(b){this.container=b;b.obj=this;this.ignoreMouse=this.isDragging=!1;var e=this;b.bind("mousedown touchstart",function(b){if(e.ignoreMouse)return e.ignoreMouse=!1,!0;a._setMouseOwner(e,!0);e.isDragging=!0;e.pageX=b.pageX;e.pageY=b.pageY;return!1});b.bind("mousemove touchmove",function(b){if(e.isDragging&&
|
||||
a._mouseOwner==e)return e.mouseMove(b),!1});b.bind("mouseup touchend",function(b){e.mouseUp(b);a._setMouseOwner(null)})},b.mouseUp=function(b){if(this.isDragging&&a._mouseOwner==this)return this.pageX0+=b.pageX-this.pageX,this.pageY0+=b.pageY-this.pageY,this.isDragging=!1;a._setMouseOwner(null)},b.setPosition=function(){if(null===a._mousePageX){var b=a.$offset(this.applet._id+"_"+(this.applet._is2D?"canvas2d":"canvas"));a._mousePageX=b.left;a._mousePageY=b.top}this.pageX0=a._mousePageX;this.pageY0=
|
||||
a._mousePageY;this.container.css({top:a._mousePageY+"px",left:a._mousePageX+"px"})},b.mouseMove=function(b){if(this.isDragging&&a._mouseOwner==this){this.timestamp=System.currentTimeMillis();var e=this.pageX0+(b.pageX-this.pageX);b=this.pageY0+(b.pageY-this.pageY);a._mousePageX=e;a._mousePageY=b;this.container.css({top:b+"px",left:e+"px"})}},b.dragBind=function(b){this.applet._ignoreMouse=!b;this.container.unbind("mousemoveoutjsmol");this.container.unbind("touchmoveoutjsmol");this.container.unbind("mouseupoutjsmol");
|
||||
this.container.unbind("touchendoutjsmol");a._setMouseOwner(null);if(b){var e=this;this.container.bind("mousemoveoutjsmol touchmoveoutjsmol",function(a,b,f){e.mouseMove(f)});this.container.bind("mouseupoutjsmol touchendoutjsmol",function(a,b,f){e.mouseUp(f)})}})};m.JSDialog=function(){};m.setDraggable(m.JSDialog);m.getScreenDimensions=function(a){a.width=j(window).width();a.height=j(window).height()};m.dispose=function(b){a.$remove(b.id+"_mover");delete m.htDialogs[b.id];b.container.obj.dragBind(!1)};
|
||||
m.register=function(a,b){a.id=b+ ++m.count;m.htDialogs[a.id]=a};m.setDialog=function(b){a._setMouseOwner(null);a.$remove(b.id);var f=b.id+"_mover",h=a._$(f),c;h[0]?(h.html(b.html),c=h[0].jd):(a.$after("body","<div id='"+f+"' style='position:absolute;left:0px;top:0px;'>"+b.html+"</div>"),c=new m.JSDialog,h=a._$(f),b.container=h,c.applet=b.manager.vwr.html5Applet,c.setContainer(h),c.dialog=b,c.setPosition(),c.dragBind(!0),h[0].jd=c);a.$bind("#"+b.id+" .JButton","mousedown touchstart",function(){c.ignoreMouse=
|
||||
!0});a.$bind("#"+b.id+" .JComboBox","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JCheckBox","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JTextField","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JTable","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JScrollPane","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JEditorPane","mousedown touchstart",function(){c.ignoreMouse=
|
||||
!0})};m.setSelected=function(b){a.$prop(b.id,"checked",!!b.selected)};m.setSelectedIndex=function(b){a.$prop(b.id,"selectedIndex",b.selectedIndex)};m.setText=function(b){a.$prop(b.id,"value",b.text)};m.setVisible=function(b){a.$setVisible(b.id,b._visible)};m.setEnabled=function(b){a.$setEnabled(b.id,b.enabled)};m.click=function(b,f){var c=m.htDialogs[b.id];if(c){var d=c.toString();if(0<=d.indexOf("JCheck"))c.selected=b.checked;else if(0<=d.indexOf("JCombo"))c.selectedIndex=b.selectedIndex;else if(null!=
|
||||
c.text&&(c.text=b.value,f&&13!=(f.charCode||f.keyCode)))return}d=m.htDialogs[a.$getAncestorDiv(b.id,"JDialog").id];d.manager.actionPerformed(c?c.name:d.registryKey+"/"+b.id)};m.setFront=function(b){var f=b.manager.vwr.html5Applet;b.zIndex!=a._getZ(f,"dialog")&&(b.zIndex=a._incrZ(f,"dialog"));b.container&&((b.container[0]||b.container).style.zIndex=b.zIndex)};m.hideMenus=function(a){if(a=a._menus)for(var b in a)a[b]._visible&&m.hideMenu(a[b])};m.windowClosing=function(b){b=m.htDialogs[a.$getAncestorDiv(b.id,
|
||||
"JDialog").id];b.registryKey?b.manager.processWindowClosing(b.registryKey):b.dispose()};a._track=function(b){if(a._tracker){try{var f='<iframe style="display:none" width="0" height="0" frameborder="0" tabindex="-1" src="'+(a._tracker+"&applet="+b._jmolType+"&version="+a._version+"&appver="+a.___JmolVersion+"&url="+encodeURIComponent(document.location.href))+'"></iframe>';a.$after("body",f)}catch(c){}delete a._tracker}return b};var l;a.getProfile=function(a){if(self.Clazz&&self.JSON)return l||Clazz._startProfiling(l=
|
||||
0==arguments.length||a),Clazz.getProfile()};a._getInChIKey=function(a,b){0<=b.indexOf("MOL=")&&b.split("MOL=")[1].split('"')};a._getAttr=function(a,b){var c=a.indexOf(b+"=");return 0<=c&&0<=(c=a.indexOf('"',c))?a.substring(c+1,a.indexOf('"',c+1)):null};a.User={viewUpdatedCallback:null};a.View={count:0,applets:{},sets:{}};(function(b){b.resetView=function(b,e){debugger;if(e){if(e._viewSet){var c=a.View.applets[e._viewSet];for(b in c)b!=e&&a.View.resetView(b)}}else b&&(b._reset(),a.View.updateView(b))};
|
||||
b.updateView=function(f,c){if(null!=f._viewSet){c||(c={});c.chemID||(f._searchQuery=null);c.data||(c.data="N/A");c.type=f._viewType;if(null==(f._currentView=b.__findView(f._viewSet,c)))f._currentView=b.__createViewSet(f._viewSet,c.chemID,c.viewID||c.chemID);f._currentView[c.type].data=c.data;f._currentView[c.type].smiles=f._getSmiles();a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(f,"updateView");b.__setView(f._currentView,f,!1)}};b.updateFromSync=function(f,c){f._updateMsg=c;var d=a._getAttr(c,
|
||||
"sourceID")||a._getAttr(c,"file");if(d){var g=b.__findView(f._viewSet,{viewID:d});if(null==g)return a.updateView(f,c);g!=f._currentView&&b.__setView(g,f,!0);var k=(d=a._getAttr(c,"atoms"))&&0<=c.indexOf("selectionhalos ON")?eval("["+d+"]"):[];setTimeout(function(){f._currentView==g&&b.updateAtomPick(f,k)},10);a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(f,"updateFromSync")}};b.updateAtomPick=function(b,e){var c=b._currentView;if(null!=c){for(var d in c)"info"!=d&&c[d].applet!=b&&c[d].applet._updateAtomPick(e);
|
||||
a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(b,"updateAtomPick")}};b.dumpViews=function(a){var c=b.sets[a];if(c){var d="View set "+a+":\n";a=b.applets[a];for(var g in a)d+="\napplet "+a[g]._id+" currentView="+(a[g]._currentView?a[g]._currentView.info.viewID:null);for(g=c.length;0<=--g;){a=c[g];var d=d+("\n\n<b>view="+g+" viewID="+a.info.viewID+" chemID="+a.info.chemID+"</b>\n"),k,j;for(j in a)"info"!=j&&(d+="\nview="+g+" type="+j+" applet="+((k=a[j]).applet?k.applet._id:null)+" SMILES="+
|
||||
k.smiles+"\n atomMap="+JSON.stringify(k.atomMap)+"\n data=\n"+k.data+"\n")}return d}};b.__init=function(a){var c=a._viewSet,d=b.applets;d[c]||(d[c]={});d[c][a._viewType]=a};b.__findView=function(a,c){var d=b.sets[a];null==d&&(d=b.sets[a]=[]);for(var g=d.length;0<=--g;){var k=d[g];if(c.viewID){if(k.info.viewID==c.viewID)return k}else{if(null!=c.chemID&&c.chemID==k.info.chemID)return k;for(var j in k)if("info"!=j&&(null!=c.data&&null!=k[j].data?c.data==k[j].data:c.type==j))return k}}return null};b.__createViewSet=
|
||||
function(f,c,d){b.count++;c={info:{chemID:c,viewID:d||"model_"+b.count}};for(var g in a._applets)d=a._applets[g],d._viewSet==f&&(c[d._viewType]={applet:d,data:null});b.sets[f].push(c);return c};b.__setView=function(a,b,e){for(var c in a)if("info"!=c){var d=a[c],g=d.applet,k=e||null!=g&&"<modified>"==g._molData;if(!(null==g||g==b&&!k)){var j=null==d.data,m=null!=g._currentView;g._currentView=a;if(!m||!(a[c].data==d.data&&!j&!k))if(g._loadModelFromView(a),j)break}}}})(a.View);a.Cache={fileCache:{}};
|
||||
a.Cache.get=function(b){return a.Cache.fileCache[b]};a.Cache.put=function(b,f){a.Cache.fileCache[b]=f};a.Cache.setDragDrop=function(b){a.$appEvent(b,"appletdiv","dragover",function(a){a=a.originalEvent;a.stopPropagation();a.preventDefault();a.dataTransfer.dropEffect="copy"});a.$appEvent(b,"appletdiv","drop",function(f){var c=f.originalEvent;c.stopPropagation();c.preventDefault();var d=c.dataTransfer.files[0];if(null==d)try{d=""+c.dataTransfer.getData("text"),(0==d.indexOf("file:/")||0==d.indexOf("http:/")||
|
||||
0==d.indexOf("https:/"))&&b._scriptLoad(d)}catch(g){}else c=new FileReader,c.onloadend=function(c){if(c.target.readyState==FileReader.DONE){var h="cache://DROP_"+d.name;c=Clazz.newByteArray(-1,c.target.result);h.endsWith(".spt")||b._appletPanel.cacheFileByName("cache://DROP_*",!1);"JSV"==b._viewType||h.endsWith(".jdx")?a.Cache.put(h,c):b._appletPanel.cachePut(h,c);(c=a._jsGetXY(b._canvas,f))&&(!b._appletPanel.setStatusDragDropped||b._appletPanel.setStatusDragDropped(0,c[0],c[1],h))&&b._appletPanel.openFileAsyncSpecial(h,
|
||||
1)}},c.readAsArrayBuffer(d)})}})(Jmol,jQuery);Jmol._debugCode=!1;
|
||||
(function(a){a._isAsync=!1;a._asyncCallbacks={};a._coreFiles=[];var j=!1,g=[],d=[],b=0,c=[],k=[],m=function(c){arguments.length||(c=!0);delete b;for(var e;0<d.length&&"done"==(e=d[0])[4];)d.shift();if(0!=d.length)if(!a._isAsync&&!c)setTimeout(m,10);else{e.push("done");var k="JSmol exec "+e[0]._id+" "+e[3]+" "+e[2];self.System&&System.out.println(k);self.console&&console.log(k+" -- OK");g.push(k);e[1](e[0],e[2])}},l=function(b){j?m():(j=!0,LoadClazz(),b._noMonitor&&(Clazz._LoaderProgressMonitor.showStatus=
|
||||
function(){}),LoadClazz=null,b.__Info.uncompressed&&Clazz.loadClass(),Clazz._Loader.onGlobalLoaded=function(){Clazz._LoaderProgressMonitor.showStatus("Application loaded.",!0);if(!a._debugCode||!a.haveCore)a.haveCore=!0,m()},Clazz._Loader.loadPackageClasspath("java",null,!0,m))},e=function(a,b){Clazz._Loader.loadClass(b,function(){m()})};a.showExecLog=function(){return g.join("\n")};a._addExec=function(a){a[1]||(a[1]=e);var b="JSmol load "+a[0]._id+" "+a[3];self.console&&console.log(b+"...");g.push(b);
|
||||
d.push(a)};a._addCoreFile=function(b,e,d){b=b.toLowerCase().split(".")[0];if(!(0<=c.join("").indexOf(b))){c.push(b);c.sort();a._coreFiles=[e+"/core/core"+c.join("")+".z.js"];if(d&&(d=d.split(" ")))for(b=0;b<d.length;b++)0>k.join("").indexOf(d[b])&&k.push(e+"/core/core"+d[b]+".z.js");for(b=0;b<k.length;b++)a._coreFiles.push(k[b])}};a._Canvas2D=function(b,c,e,d){this._uniqueId=(""+Math.random()).substring(3);this._id=b;this._is2D=!0;this._isJava=!1;this._jmolType="Jmol._Canvas2D ("+e+")";this._isLayered=
|
||||
c._isLayered||!1;this._isSwing=c._isSwing||!1;this._isJSV=c._isJSV||!1;this._isAstex=c._isAstex||!1;this._platform=c._platform||"";if(d)return this;window[b]=this;this._createCanvas(b,c);if(!a._document||this._deferApplet)return this;this._init();return this};a._setAppletParams=function(b,c,e,d){for(var g in e)if(!b||0<=b.indexOf(";"+g.toLowerCase()+";"))null==e[g]||"language"==g&&!a.featureDetection.supportsLocalization()||(d?c.put(g,!0===e[g]?Boolean.TRUE:!1===e[g]?Boolean.FALSE:e[g]):c[g]=e[g])};
|
||||
a._jsSetPrototype=function(c){c._init=function(){this._setupJS();this._showInfo(!0);this._disableInitialConsole&&this._showInfo(!1)};c._createCanvas=function(b,c,e){a._setObject(this,b,c);e&&(this._GLmol=e,this._GLmol.applet=this,this._GLmol.id=this._id);e=a._getWrapper(this,!0);this._deferApplet||(a._document?(a._documentWrite(e),this._newCanvas(!1),e=""):(this._deferApplet=!0,e+='<script type="text/javascript">'+b+"._cover(false)\x3c/script>"));e+=a._getWrapper(this,!1);c.addSelectionOptions&&(e+=
|
||||
a._getGrabberOptions(this));a._debugAlert&&!a._document&&alert(e);this._code=a._documentWrite(e)};c._newCanvas=function(a){this._is2D?this._createCanvas2d(a):this._GLmol.create()};c._getHtml5Canvas=function(){return this._canvas};c._getWidth=function(){return this._canvas.width};c._getHeight=function(){return this._canvas.height};c._getContentLayer=function(){return a.$(this,"contentLayer")[0]};c._repaintNow=function(){a._repaint(this,!1)};c._createCanvas2d=function(){var b=a.$(this,"appletdiv");
|
||||
try{b[0].removeChild(this._canvas),this._canvas.frontLayer&&b[0].removeChild(this._canvas.frontLayer),this._canvas.rearLayer&&b[0].removeChild(this._canvas.rearLayer),this._canvas.contentLayer&&b[0].removeChild(this._canvas.contentLayer),a._jsUnsetMouse(this._mouseInterface)}catch(c){}var e=Math.round(b.width()),f=Math.round(b.height()),d=document.createElement("canvas");d.applet=this;this._canvas=d;d.style.width="100%";d.style.height="100%";d.width=e;d.height=f;d.id=this._id+"_canvas2d";b.append(d);
|
||||
a._$(d.id).css({"z-index":a._getZ(this,"main")});if(this._isLayered){var g=document.createElement("div");d.contentLayer=g;g.id=this._id+"_contentLayer";b.append(g);a._$(g.id).css({zIndex:a._getZ(this,"image"),position:"absolute",left:"0px",top:"0px",width:(this._isSwing?e:0)+"px",height:(this._isSwing?f:0)+"px",overflow:"hidden"});this._isSwing?(b=document.createElement("div"),b.id=this._id+"_swingdiv",a._$(this._id+"_appletinfotablediv").append(b),a._$(b.id).css({zIndex:a._getZ(this,"rear"),position:"absolute",
|
||||
left:"0px",top:"0px",width:e+"px",height:f+"px",overflow:"hidden"}),this._mouseInterface=d.contentLayer,d.contentLayer.applet=this):this._mouseInterface=this._getLayer("front",b,e,f,!1)}else this._mouseInterface=d;a._jsSetMouse(this._mouseInterface)};c._getLayer=function(b,c,e,f,d){var g=document.createElement("canvas");this._canvas[b+"Layer"]=g;g.style.width="100%";g.style.height="100%";g.id=this._id+"_"+b+"Layer";g.width=e;g.height=f;c.append(g);g.applet=this;a._$(g.id).css({background:d?"rgb(0,0,0,1)":
|
||||
"rgb(0,0,0,0.001)","z-index":a._getZ(this,b),position:"absolute",left:"0px",top:"0px",overflow:"hidden"});return g};c._setupJS=function(){window["j2s.lib"]={base:this._j2sPath+"/",alias:".",console:this._console,monitorZIndex:a._getZ(this,"monitorZIndex")};0==d.length&&a._addExec([this,l,null,"loadClazz"]);this._addCoreFiles();a._addExec([this,this.__startAppletJS,null,"start applet"]);this._isSigned=!0;this._ready=!1;this._applet=null;this._canScript=function(){return!0};this._savedOrientations=
|
||||
[];b&&clearTimeout(b);b=setTimeout(m,100)};c.__startAppletJS=function(b){0==a._version.indexOf("$Date: ")&&(a._version=(a._version.substring(7)+" -").split(" -")[0]+" (JSmol/j2s)");var c=Clazz._4Name("java.util.Hashtable").newInstance();a._setAppletParams(b._availableParams,c,b.__Info,!0);c.put("appletReadyCallback","Jmol._readyCallback");c.put("applet",!0);c.put("name",b._id);c.put("syncId",a._syncId);a._isAsync&&c.put("async",!0);b._color&&c.put("bgcolor",b._color);b._startupScript&&c.put("script",
|
||||
b._startupScript);a._syncedApplets.length&&c.put("synccallback","Jmol._mySyncCallback");c.put("signedApplet","true");c.put("platform",b._platform);b._is2D&&c.put("display",b._id+"_canvas2d");c.put("documentBase",document.location.href);var e=b._j2sPath+"/";if(0>e.indexOf("://")){var f=document.location.href.split("#")[0].split("?")[0].split("/");0==e.indexOf("/")?f=[f[0],e.substring(1)]:f[f.length-1]=e;e=f.join("/")}c.put("codePath",e);a._registerApplet(b._id,b);try{b._newApplet(c)}catch(d){System.out.println((a._isAsync?
|
||||
"normal async abort from ":"")+d);return}b._jsSetScreenDimensions();m()};c._restoreState||(c._restoreState=function(){});c._jsSetScreenDimensions=function(){if(this._appletPanel){var b=a._getElement(this,this._is2D?"canvas2d":"canvas");this._appletPanel.setScreenDimension(b.width,b.height)}};c._show=function(b){a.$setVisible(a.$(this,"appletdiv"),b);b&&a._repaint(this,!0)};c._canScript=function(){return!0};c.equals=function(a){return this==a};c.clone=function(){return this};c.hashCode=function(){return parseInt(this._uniqueId)};
|
||||
c._processGesture=function(a){return this._appletPanel.processTwoPointGesture(a)};c._processEvent=function(a,b){this._appletPanel.processMouseEvent(a,b[0],b[1],b[2],System.currentTimeMillis())};c._resize=function(){var b="__resizeTimeout_"+this._id;a[b]&&clearTimeout(a[b]);var c=this;a[b]=setTimeout(function(){a._repaint(c,!0);a[b]=null},100)};return c};a._repaint=function(b,c){if(b&&b._appletPanel){var e=a.$(b,"appletdiv"),d=Math.round(e.width()),e=Math.round(e.height());if(b._is2D&&(b._canvas.width!=
|
||||
d||b._canvas.height!=e))b._newCanvas(!0),b._appletPanel.setDisplay(b._canvas);b._appletPanel.setScreenDimension(d,e);d=function(){b._appletPanel.paint?b._appletPanel.paint(null):b._appletPanel.update(null)};c?requestAnimationFrame(d):d()}};a._loadImage=function(b,c,e,d,g,k){var j="echo_"+c+e+(d?"_"+d.length:""),m=a._getHiddenCanvas(b.vwr.html5Applet,j,0,0,!1,!0);if(null==m){if(null==k){k=new Image;if(null==d)return k.onload=function(){a._loadImage(b,c,e,null,g,k)},k.src=e,null;System.out.println("Jsmol.js Jmol._loadImage using data URI for "+
|
||||
j);k.src="string"==typeof d?d:"data:"+JU.Rdr.guessMimeTypeForBytes(d)+";base64,"+JU.Base64.getBase64(d)}var l=k.width,u=k.height;"webgl"==c&&(l/=2,u/=2);m=a._getHiddenCanvas(b.vwr.html5Applet,j,l,u,!0,!1);m.imageWidth=l;m.imageHeight=u;m.id=j;m.image=k;a._setCanvasImage(m,l,u)}else System.out.println("Jsmol.js Jmol._loadImage reading cached image for "+j);return null==d?g(m,e):m};a._canvasCache={};a._getHiddenCanvas=function(b,c,e,d,g,k){c=b._id+"_"+c;b=a._canvasCache[c];if(k)return b;if(g||!b||b.width!=
|
||||
e||b.height!=d)b=document.createElement("canvas"),b.width=b.style.width=e,b.height=b.style.height=d,b.id=c,a._canvasCache[c]=b;return b};a._setCanvasImage=function(a,b,c){a.buf32=null;a.width=b;a.height=c;a.getContext("2d").drawImage(a.image,0,0,a.image.width,a.image.height,0,0,b,c)};a._apply=function(a,b){return a(b)}})(Jmol);
|
||||
(function(a,j){a._Applet=function(b,c,d){window[b]=this;this._jmolType="Jmol._Applet"+(c.isSigned?" (signed)":"");this._viewType="Jmol";this._isJava=!0;this._syncKeyword="Select:";this._availableParams=";progressbar;progresscolor;boxbgcolor;boxfgcolor;allowjavascript;boxmessage;\t\t\t\t\t\t\t\t\t;messagecallback;pickcallback;animframecallback;appletreadycallback;atommovedcallback;\t\t\t\t\t\t\t\t\t;echocallback;evalcallback;hovercallback;language;loadstructcallback;measurecallback;\t\t\t\t\t\t\t\t\t;minimizationcallback;resizecallback;scriptcallback;statusform;statustext;statustextarea;\t\t\t\t\t\t\t\t\t;synccallback;usecommandthread;syncid;appletid;startupscript;menufile;";
|
||||
if(d)return this;this._isSigned=c.isSigned;this._readyFunction=c.readyFunction;this._ready=!1;this._isJava=!0;this._isInfoVisible=!1;this._applet=null;this._memoryLimit=c.memoryLimit||512;this._canScript=function(){return!0};this._savedOrientations=[];this._initialize=function(b,d){var e=!1;a._jarFile&&(d=a._jarFile);if(this._jarFile){var f=this._jarFile;0<=f.indexOf("/")?(alert("This web page URL is requesting that the applet used be "+f+". This is a possible security risk, particularly if the applet is signed, because signed applets can read and write files on your local machine or network."),
|
||||
"yes"==prompt("Do you want to use applet "+f+"? ","yes or no")?(b=f.substring(0,f.lastIndexOf("/")),d=f.substring(f.lastIndexOf("/")+1)):e=!0):d=f;this_isSigned=c.isSigned=0<=d.indexOf("Signed")}this._jarPath=c.jarPath=b||".";this._jarFile=c.jarFile="string"==typeof d?d:(d?"JmolAppletSigned":"JmolApplet")+"0.jar";e&&alert("The web page URL was ignored. Continuing using "+this._jarFile+' in directory "'+this._jarPath+'"');void 0==a.controls||a.controls._onloadResetForms()};this._create(b,c);return this};
|
||||
var g=a._Applet,d=a._Applet.prototype;g._get=function(b,c,d){d||(d=!1);c||(c={});a._addDefaultInfo(c,{color:"#FFFFFF",width:300,height:300,addSelectionOptions:!1,serverURL:"http://your.server.here/jsmol.php",defaultModel:"",script:null,src:null,readyFunction:null,use:"HTML5",jarPath:"java",jarFile:"JmolApplet0.jar",isSigned:!1,j2sPath:"j2s",coverImage:null,makeLiveImage:null,coverTitle:"",coverCommand:"",deferApplet:!1,deferUncover:!1,disableJ2SLoadMonitor:!1,disableInitialConsole:!0,debug:!1});a._debugAlert=
|
||||
c.debug;c.serverURL&&(a._serverUrl=c.serverURL);for(var j=!1,l=null,e=c.use.toUpperCase().split("#")[0].split(" "),f=0;f<e.length;f++){switch(e[f]){case "JAVA":j=!0;a.featureDetection.supportsJava()&&(l=new g(b,c,d));break;case "WEBGL":l=g._getCanvas(b,c,d,!0);break;case "HTML5":a.featureDetection.allowHTML5?l=g._getCanvas(b,c,d,!1):e.push("JAVA")}if(null!=l)break}null==l&&(d||!j?l={_jmolType:"none"}:j&&(l=new g(b,c)));return d?l:a._registerApplet(b,l)};g._getCanvas=function(b,c,d,j){c._isLayered=
|
||||
!1;c._platform="J.awtjs2d.Platform";return j&&a.featureDetection.supportsWebGL()?(a._Canvas3D.prototype=a.GLmol.extendApplet(a._jsSetPrototype(new g(b,c,!0))),new a._Canvas3D(b,c,"Jmol",d)):!j?(a._Canvas2D.prototype=a._jsSetPrototype(new g(b,c,!0)),new a._Canvas2D(b,c,"Jmol",d)):null};g._noJavaMsg="Either you do not have Java applets enabled in your web<br />browser or your browser is blocking this applet.<br />\t\t\tCheck the warning message from your browser and/or enable Java applets in<br />\t\t\tyour web browser preferences, or install the Java Runtime Environment from <a href='http://www.java.com'>www.java.com</a>";
|
||||
g._setCommonMethods=function(a){a._showInfo=d._showInfo;a._search=d._search;a._getName=d._getName;a._readyCallback=d._readyCallback};g._createApplet=function(b,c,d){b._initialize(c.jarPath,c.jarFile);var m=b._jarFile;a._isFile&&(m=m.replace(/0\.jar/,".jar"));var l=0<=b._containerWidth.indexOf("px")?b._containerWidth:"100%",e=0<=b._containerHeight.indexOf("px")?b._containerHeight:"100%",l=' style="width:'+l+";height:"+e+'" ',e="name='"+b._id+"_object' id='"+b._id+"_object' \n"+l+"\n";d.codebase=b._jarPath;
|
||||
d.codePath=d.codebase+"/";if(0>d.codePath.indexOf("://")){var f=j.location.href.split("#")[0].split("?")[0].split("/");f[f.length-1]=d.codePath;d.codePath=f.join("/")}d.archive=m;d.mayscript="true";d.java_arguments="-Xmx"+Math.round(c.memoryLimit||b._memoryLimit)+"m";d.permissions=b._isSigned?"all-permissions":"sandbox";d.documentLocation=j.location.href;d.documentBase=j.location.href.split("#")[0].split("?")[0];d.jarPath=c.jarPath;a._syncedApplets.length&&(d.synccallback="Jmol._mySyncCallback");
|
||||
b._startupScript&&(d.script=b._startupScript);var f="\n",h;for(h in d)d[h]&&(f+=" <param name='"+h+"' value='"+d[h]+"' />\n");f=a.featureDetection.useIEObject||a.featureDetection.useHtml4Object?"<object "+e+(a.featureDetection.useIEObject?" classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' codebase='http://java.sun.com/update/1.6.0/jinstall-6u22-windows-i586.cab'>":" type='application/x-java-applet'>")+f+"<p style='background-color:yellow;"+l.split('"')[1]+";text-align:center;vertical-align:middle;'>\n"+
|
||||
g._noJavaMsg+"</p></object>\n":"<applet "+e+" code='"+d.code+"' codebase='"+b._jarPath+"' archive='"+m+"' mayscript='true'>\n"+f+"<table bgcolor='yellow'><tr><td align='center' valign='middle' "+l+">\n"+g._noJavaMsg+"</td></tr></table></applet>\n";b._deferApplet&&(b._javaCode=f,f="");f=a._getWrapper(b,!0)+f+a._getWrapper(b,!1)+(c.addSelectionOptions?a._getGrabberOptions(b):"");a._debugAlert&&alert(f);b._code=a._documentWrite(f)};d._newApplet=function(a){this._is2D||a.put("script",(a.get("script")||
|
||||
"")+";set multipleBondSpacing 0.35;");this._viewerOptions=a;return new J.appletjs.Jmol(a)};d._addCoreFiles=function(){a._addCoreFile("jmol",this._j2sPath,this.__Info.preloadCore);this._is2D||a._addExec([this,null,"J.export.JSExporter","load JSExporter"]);a._debugCode&&a._addExec([this,null,"J.appletjs.Jmol","load Jmol"])};d._create=function(b,c){a._setObject(this,b,c);var d={syncId:a._syncId,progressbar:"true",progresscolor:"blue",boxbgcolor:this._color||"black",boxfgcolor:"white",boxmessage:"Downloading JmolApplet ...",
|
||||
script:this._color?'background "'+this._color+'"':"",code:"JmolApplet.class"};a._setAppletParams(this._availableParams,d,c);var j;c.inlineModel?(j=c.inlineModel,j=j.replace(/\r|\n|\r\n/g,0<=j.indexOf("|")?"\\/n":"|").replace(/'/g,"'"),a._debugAlert&&alert("inline model:\n"+j)):j="";d.loadInline=j;d.appletReadyCallback="Jmol._readyCallback";a._syncedApplets.length&&(d.synccallback="Jmol._mySyncCallback");d.java_arguments="-Xmx"+Math.round(c.memoryLimit||this._memoryLimit)+"m";this._initialize(c.jarPath,
|
||||
c.jarFile);g._createApplet(this,c,d)};d._restoreState=function(b,c){System.out.println("\n\nasynchronous restore state for "+b+" "+c);var d=this,g=d._applet&&d._applet.viewer;switch(c){case "setOptions":return function(){d.__startAppletJS(d)};case "render":return function(){setTimeout(function(){g.refresh(2)},10)};default:switch(b){case "J.shape.Balls":case "J.shape.Sticks":case "J.shape.Frank":return null}if(g&&g.isScriptExecuting&&g.isScriptExecuting()){if(a._asyncCallbacks[b])return System.out.println("...ignored"),
|
||||
1;var j=g.getEvalContextAndHoldQueue(g.eval),e=j.pc-1;j.asyncID=b;a._asyncCallbacks[b]=function(a){j.pc=a;System.out.println("sc.asyncID="+j.asyncID+" sc.pc = "+j.pc);g.eval.resumeEval(j)};g.eval.pc=g.eval.pcEnd;System.out.println("setting resume for pc="+j.pc+" "+b+" to "+a._asyncCallbacks[b]+"//");return function(){System.out.println("resuming "+b+" "+a._asyncCallbacks[b]);a._asyncCallbacks[b](e)}}System.out.println(b+"?????????????????????"+c);return function(){setTimeout(function(){g.refresh(2)},
|
||||
10)}}};d._notifyAudioEnded=function(a){this._applet.notifyAudioEnded(a)};d._readyCallback=function(b,c,d){if(d){a._setDestroy(this);this._ready=!0;b=this._readyScript;this._defaultModel?a._search(this,this._defaultModel,b?";"+b:""):b?this._script(b):this._src&&this._script('load "'+this._src+'"');this._showInfo(!0);this._showInfo(!1);a.Cache.setDragDrop(this);this._readyFunction&&this._readyFunction(this);a._setReady(this);if((b=this._2dapplet)&&b._isEmbedded&&b._ready&&b.__Info.visible)this._show2d(!0),
|
||||
this._show2d(!1),this._show2d(!0);a._hideLoadingSpinner(this)}};d._showInfo=function(b){b&&this._2dapplet&&this._2dapplet._show(!1);a.$html(a.$(this,"infoheaderspan"),this._infoHeader);this._info&&a.$html(a.$(this,"infodiv"),this._info);if(!this._isInfoVisible!=!b){this._isInfoVisible=b;if(this._isJava){var c=b?2:"100%";a.$setSize(a.$(this,"appletdiv"),c,c)}a.$setVisible(a.$(this,"infotablediv"),b);a.$setVisible(a.$(this,"infoheaderdiv"),b);this._show(!b)}};d._show2d=function(a){this._2dapplet._show2d(a);
|
||||
this._2dapplet._isEmbedded&&(this._showInfo(!1),this._show(!a),this._2dapplet.__showContainer(!0,!0))};d._getSpinner=function(){return this.__Info.appletLoadingImage||this._j2sPath+"/img/JSmol_spinner.gif"};d._getAtomCorrelation=function(a){this._loadMolData(a,"atommap = compare({1.1} {2.1} 'MAP' 'H'); zap 2.1",!0);a=this._evaluate("atommap");for(var c=this._evaluate("{*}.count"),d=[],g=[],j=0;j<a.length;j++){var e=a[j];d[e[0]+1]=e[1]-c+1;g[e[1]-c+1]=e[0]+1}return{fromJmol:d,toJmol:g}};d._show=function(b){var c=
|
||||
!b?2:"100%";a.$setSize(a.$(this,"object"),c,c);this._isJava||a.$setVisible(a.$(this,"appletdiv"),b)};d._clearConsole=function(){this._console==this._id+"_infodiv"&&(this.info="");self.Clazz&&(a._setConsoleDiv(this._console),Clazz.Console.clear())};d._addScript=function(a){this._readyScript||(this.readyScript="");this._readyScript&&(this._readyScript+=";");this._readyScript+=a;return!0};d._script=function(b){if(!this._ready)return this._addScript(b);a._setConsoleDiv(this._console);a._hideLocalFileReader(this);
|
||||
this._applet.script(b)};d._syncScript=function(a){this._applet.syncScript(a)};d._scriptCheck=function(a){return this._ready&&this._applet.scriptCheck(a)};d._scriptWait=function(a,c){var d=this._scriptWaitAsArray(a),g="";if(!c)for(var j=d.length;0<=--j;)for(var e=0,f=d[j].length;e<f;e++)g+=d[j][e]+"\n";return g};d._scriptEcho=function(a){a=this._scriptWaitAsArray(a);for(var c="",d=a.length;0<=--d;)for(var g=a[d].length;0<=--g;)"scriptEcho"==a[d][g][1]&&(c+=a[d][g][3]+"\n");return c.replace(/ \| /g,
|
||||
"\n")};d._scriptMessage=function(a){a=this._scriptWaitAsArray(a);for(var c="",d=a.length;0<=--d;)for(var g=a[d].length;0<=--g;)"scriptStatus"==a[d][g][1]&&(c+=a[d][g][3]+"\n");return c.replace(/ \| /g,"\n")};d._scriptWaitOutput=function(a){var c="";try{a&&(c+=this._applet.scriptWaitOutput(a))}catch(d){}return c};d._scriptWaitAsArray=function(b){var c="";try{if(this._getStatus("scriptEcho,scriptMessage,scriptStatus,scriptError"),b&&(c+=this._applet.scriptWait(b),c=a._evalJSON(c,"jmolStatus"),"object"==
|
||||
typeof c))return c}catch(d){}return[[c]]};d._getStatus=function(b){return a._sortMessages(this._getPropertyAsArray("jmolStatus",b))};d._getPropertyAsArray=function(b,c){return a._evalJSON(this._getPropertyAsJSON(b,c),b)};d._getPropertyAsString=function(a,c){void 0==c&&(c="");return this._applet.getPropertyAsString(a,c)+""};d._getPropertyAsJSON=function(a,c){void 0==c&&(c="");try{return this._applet.getPropertyAsJSON(a,c)+""}catch(d){return""}};d._getPropertyAsJavaObject=function(a,c){void 0==c&&(c=
|
||||
"");return this._applet.getProperty(a,c)};d._evaluate=function(a){null!=a||(a="");return this._getPropertyAsArray("variableInfo",a)};d._evaluateDEPRECATED=function(a){a=""+this._getPropertyAsJavaObject("evaluate",a);var c=a.replace(/\-*\d+/,"");if(""==c&&!isNaN(parseInt(a)))return parseInt(a);c=a.replace(/\-*\d*\.\d*/,"");return""==c&&!isNaN(parseFloat(a))?parseFloat(a):a};d._saveOrientation=function(a){return this._savedOrientations[a]=this._getPropertyAsArray("orientationInfo","info").moveTo};d._restoreOrientation=
|
||||
function(a){a=this._savedOrientations[a];return!a||""==a?a.replace(/1\.0/,"0"):this._scriptWait(a)};d._restoreOrientationDelayed=function(a,c){1>arguments.length&&(c=1);var d=this._savedOrientations[a];return!d||""==d?d.replace(/1\.0/,c):this._scriptWait(d)};d._resizeApplet=function(b){function c(b,c){var e=""+b;return 0==e.length?c?"":a._allowedJmolSize[2]:e.indexOf("%")==e.length-1?e:1>=(b=parseFloat(b))&&0<b?100*b+"%":(isNaN(b=Math.floor(b))?a._allowedJmolSize[2]:b<a._allowedJmolSize[0]?a._allowedJmolSize[0]:
|
||||
b>a._allowedJmolSize[1]?a._allowedJmolSize[1]:b)+(c?c:"")}var d;"object"==typeof b&&null!=b?(d=b[0]||b.width,b=b[1]||b.height):d=b;d=[c(d,"px"),c(b,"px")];b=a._getElement(this,"appletinfotablediv");b.style.width=d[0];b.style.height=d[1];this._containerWidth=d[0];this._containerHeight=d[1];this._is2D&&a._repaint(this,!0)};d._search=function(b,c){a._search(this,b,c)};d._searchDatabase=function(b,c,d){if(this._2dapplet&&this._2dapplet._isEmbedded&&!a.$(this,"appletdiv:visible")[0])return this._2dapplet._searchDatabase(b,
|
||||
c,d);this._showInfo(!1);0<=b.indexOf("?")?a._getInfoFromDatabase(this,c,b.split("?")[0]):(d||(d=a._getScriptForDatabase(c)),b=c+b,this._currentView=null,this._searchQuery=b,this._loadFile(b,d,b))};d._loadFile=function(b,c,d){this._showInfo(!1);c||(c="");this._thisJmolModel=""+Math.random();this._fileName=b;if(!this._scriptLoad(b,c)){var g=this;a._loadFileData(this,b,function(a){g.__loadModel(a,c,d)},function(){g.__loadModel(null)})}};d._scriptLoad=function(a,c){c||(c="");var d=this._isJava||!this._noscript;
|
||||
d&&this._script("zap;set echo middle center;echo Retrieving data...");if(!this._isSigned||null!=this._viewSet)return!1;d?this._script('load async "'+a+'";'+c):this._applet.openFile(a);this._checkDeferred("");return!0};d.__loadModel=function(b,c,d){null!=b&&(null!=this._viewSet&&(c||(c=""),c+=";if ({*}.molecule.max > 1 || {*}.modelindex.max > 0){ delete molecule > 1 or modelindex > 0;x = getProperty('extractModel',{*});load inline @x};"),!c&&this._noscript?this._applet.loadInlineString(b,"",!1):this._loadMolData(b,
|
||||
c,!1),null!=this._viewSet&&a.View.updateView(this,{chemID:d,data:b}))};d._loadMolData=function(a,c,d){c||(c="");d=d?"append":"model";this._applet.scriptWait('load DATA "'+d+'"'+a+'\nEND "'+d+'" ;'+c)};d._loadModelFromView=function(b){this._currentView=b;var c=b.Jmol;null!=c.data?this.__loadModel(c.data,null,b.info.chemID):null!=b.info.chemID?a._searchMol(this,b.info.chemID,null,!1):(c=b.JME)&&c.applet._show2d(!1,this)};d._reset=function(){this._scriptWait("zap",!0)};d._updateView=function(){null!=
|
||||
this._viewSet&&this._applet&&(chemID=""+this._getPropertyAsJavaObject("variableInfo","script('show chemical inchiKey')"),chemID=36>chemID.length()?null:chemID.substring(36).split("\n")[0],a.View.updateView(this,{chemID:chemID,data:""+this._getPropertyAsJavaObject("evaluate","extractModel","{visible}")}))};d._atomPickedCallback=function(b,c){if(!(0>c)){var d=[c+1];a.View.updateAtomPick(this,d);this._updateAtomPick(d)}};d._updateAtomPick=function(a){this._script(0==a.length?"select none":"select on visible and (@"+
|
||||
a.join(",@")+")")};d._isDeferred=function(){return!this._canvas&&this._cover&&this._isCovered&&this._deferApplet};d._checkDeferred=function(a){return this._isDeferred()?(this._coverScript=a,this._cover(!1),!0):!1};d._cover=function(b){b||!this._deferApplet?this._displayCoverImage(b):(b=this._coverScript?this._coverScript:"",this._coverScript="",this._deferUncover&&(b+=";refresh;javascript "+this._id+"._displayCoverImage(false)"),this._script(b,!0),this._deferUncover&&"activate 3D model"==this._coverTitle&&
|
||||
(a._getElement(this,"coverimage").title="3D model is loading..."),this._isJava||this._newCanvas(!1),this._defaultModel&&a._search(this,this._defaultModel),this._showInfo(!1),this._deferUncover||this._displayCoverImage(!1),this._isJava&&a.$html(a.$(this,"appletdiv"),this._javaCode),this._init&&this._init())};d._displayCoverImage=function(b){this._coverImage&&this._isCovered!=b&&(this._isCovered=b,a._getElement(this,"coverdiv").style.display=b?"block":"none")};d._getSmiles=function(){return this._evaluate("{visible}.find('SMILES')")};
|
||||
d._getMol=function(){return this._evaluate("getProperty('ExtractModel',{visible})")};d._getMol2D=function(){return this._evaluate("script('select visible;show chemical sdf')")};a.jmolSmiles=function(a){return a._getSmiles()}})(Jmol,document);
|
||||
(function(a){var j=a.controls={_hasResetForms:!1,_scripts:[""],_checkboxMasters:{},_checkboxItems:{},_actions:{},_buttonCount:0,_checkboxCount:0,_radioGroupCount:0,_radioCount:0,_linkCount:0,_cmdCount:0,_menuCount:0,_previousOnloadHandler:null,_control:null,_element:null,_appletCssClass:null,_appletCssText:"",_buttonCssClass:null,_buttonCssText:"",_checkboxCssClass:null,_checkboxCssText:"",_radioCssClass:null,_radioCssText:"",_linkCssClass:null,_linkCssText:"",_menuCssClass:null,_menuCssText:""};
|
||||
j._addScript=function(a,d){var b=j._scripts.length;j._scripts[b]=[a,d];return b};j._getIdForControl=function(a,d){return"string"==typeof a?a:!d||!a._canScript||a._canScript(d)?a._id:null};j._radio=function(a,d,b,c,k,m,l,e){var f=j._getIdForControl(a,d);if(null==f)return null;++j._radioCount;void 0!=m&&null!=m||(m="jmolRadioGroup"+(j._radioGroupCount-1));if(!d)return"";void 0!=l&&null!=l||(l="jmolRadio"+(j._radioCount-1));void 0!=b&&null!=b||(b=d.substring(0,32));k||(k="");a="</span>";j._actions[l]=
|
||||
j._addScript(f,d);d='<span id="span_'+l+'"'+(e?' title="'+e+'"':"")+"><input name='"+m+"' id='"+l+"' type='radio' onclick='Jmol.controls._click(this);return true;' onmouseover='Jmol.controls._mouseOver(this);return true;' onmouseout='Jmol.controls._mouseOut()' "+(c?"checked='true' ":"")+j._radioCssText+" />";0<=b.toLowerCase().indexOf("<td>")&&(d+=a,a="");return d+('<label for="'+l+'">'+b+"</label>"+a+k)};j._scriptExecute=function(g,d){var b=a._applets[d[0]],c=d[1];if("object"==typeof c)c[0](g,c,
|
||||
b);else"function"==typeof c?c(b):a.script(b,c)};j.__checkScript=function(a,d){var b=0<=d.value.indexOf("JSCONSOLE ")||""===a._scriptCheck(d.value);d.style.color=b?"black":"red";return b};j.__getCmd=function(a,d){if(d._cmds&&d._cmds.length){var b=d._cmds[d._cmdpt=(d._cmdpt+d._cmds.length+a)%d._cmds.length];setTimeout(function(){d.value=b},10);d._cmdadd=1;d._cmddir=a}};j._commandKeyPress=function(g,d,b){g=13==g?13:window.event?window.event.keyCode:g?g.keyCode||g.which:0;var c=document.getElementById(d),
|
||||
k=a._applets[b];switch(g){case 13:return d=c.value,j._scriptExecute(c,[b,d]),c._cmds||(c._cmds=[],c._cmddir=0,c._cmdpt=-1,c._cmdadd=0),d&&0==c._cmdadd?(++c._cmdpt,c._cmds.splice(c._cmdpt,0,d),c._cmdadd=0,c._cmddir=0):c._cmdadd=0,c.value="",!1;case 27:return setTimeout(function(){c.value=""},20),!1;case 38:j.__getCmd(-1,c);break;case 40:j.__getCmd(1,c);break;default:c._cmdadd=0}setTimeout(function(){j.__checkScript(k,c)},20);return!0};j._click=function(a,d){j._element=a;1==arguments.length&&(d=j._actions[a.id]);
|
||||
j._scriptExecute(a,j._scripts[d])};j._menuSelected=function(a){var d=a.value;if(void 0!=d)j._scriptExecute(a,j._scripts[d]);else{d=a.length;if("number"==typeof d)for(var b=0;b<d;++b)if(a[b].selected){j._click(a[b],a[b].value);return}alert("?Que? menu selected bug #8734")}};j._cbNotifyMaster=function(a){var d=!0,b=!0,c=!1,k,m;for(m in a.chkGroup)k=a.chkGroup[m],k.checked?b=!1:d=!1,k.indeterminate&&(c=!0);k=a.chkMaster;d?k.checked=!0:b?k.checked=!1:c=!0;k.indeterminate=c;(a=j._checkboxItems[k.id])&&
|
||||
(k=a.chkMaster)&&j._cbNotifyMaster(j._checkboxMasters[k.id])};j._cbNotifyGroup=function(a,d){for(var b in a.chkGroup){var c=a.chkGroup[b];c.checked!=d&&(c.checked=d,j._cbClick(c));j._checkboxMasters[c.id]&&j._cbNotifyGroup(j._checkboxMasters[c.id],d)}};j._cbSetCheckboxGroup=function(a,d,b){var c=a;"number"==typeof c&&(c="jmolCheckbox"+c);(a=document.getElementById(c))||alert("jmolSetCheckboxGroup: master checkbox not found: "+c);var k=j._checkboxMasters[c]={};k.chkMaster=a;k.chkGroup={};"string"==
|
||||
typeof d?(d=b,c=1):c=0;for(a=c;a<d.length;a++)c=d[a],"number"==typeof c&&(c="jmolCheckbox"+c),(b=document.getElementById(c))||alert("jmolSetCheckboxGroup: group checkbox not found: "+c),k.chkGroup[c]=b,j._checkboxItems[c]=k};j._cbClick=function(a){j._control=a;var d=j._actions[a.id][0],b=j._actions[a.id][1];j._click(a,a.checked?d:b);j._checkboxMasters[a.id]&&j._cbNotifyGroup(j._checkboxMasters[a.id],a.checked);j._checkboxItems[a.id]&&j._cbNotifyMaster(j._checkboxItems[a.id])};j._cbOver=function(a){var d=
|
||||
j._actions[a.id][0],b=j._actions[a.id][1];window.status=j._scripts[a.checked?b:d]};j._mouseOver=function(a,d){1==arguments.length&&(d=j._actions[a.id]);window.status=j._scripts[d]};j._mouseOut=function(){window.status=" ";return!0};j._onloadResetForms=function(){j._hasResetForms||(j._hasResetForms=!0,j._previousOnloadHandler=window.onload,window.onload=function(){if(0<j._buttonCount+j._checkboxCount+j._menuCount+j._radioCount+j._radioGroupCount)for(var a=document.forms,d=a.length;0<=--d;)a[d].reset();
|
||||
j._previousOnloadHandler&&j._previousOnloadHandler()})};j._getButton=function(g,d,b,c,k){g=j._getIdForControl(g,d);if(null==g)return"";void 0!=c&&null!=c||(c="jmolButton"+j._buttonCount);void 0!=b&&null!=b||(b=d.substring(0,32));++j._buttonCount;j._actions[c]=j._addScript(g,d);d='<span id="span_'+c+'"'+(k?' title="'+k+'"':"")+"><input type='button' name='"+c+"' id='"+c+"' value='"+b+"' onclick='Jmol.controls._click(this)' onmouseover='Jmol.controls._mouseOver(this);return true' onmouseout='Jmol.controls._mouseOut()' "+
|
||||
j._buttonCssText+" /></span>";a._debugAlert&&alert(d);return a._documentWrite(d)};j._getCheckbox=function(g,d,b,c,k,m,l){var e=j._getIdForControl(g,d);null!=e&&(e=j._getIdForControl(g,b));if(null==e)return"";void 0!=m&&null!=m||(m="jmolCheckbox"+j._checkboxCount);++j._checkboxCount;if(void 0==d||null==d||void 0==b||null==b)alert("jmolCheckbox requires two scripts");else if(void 0==c||null==c)alert("jmolCheckbox requires a label");else return j._actions[m]=[j._addScript(e,d),j._addScript(e,b)],g="</span>",
|
||||
k='<span id="span_'+m+'"'+(l?' title="'+l+'"':"")+"><input type='checkbox' name='"+m+"' id='"+m+"' onclick='Jmol.controls._cbClick(this)' onmouseover='Jmol.controls._cbOver(this);return true' onmouseout='Jmol.controls._mouseOut()' "+(k?"checked='true' ":"")+j._checkboxCssText+" />",0<=c.toLowerCase().indexOf("<td>")&&(k+=g,g=""),k+='<label for="'+m+'">'+c+"</label>"+g,a._debugAlert&&alert(k),a._documentWrite(k)};j._getCommandInput=function(g,d,b,c,k,m){g=j._getIdForControl(g,"x");if(null==g)return"";
|
||||
void 0!=c&&null!=c||(c="jmolCmd"+j._cmdCount);void 0!=d&&null!=d||(d="Execute");void 0!=b&&!isNaN(b)||(b=60);void 0!=m||(m="help");++j._cmdCount;d='<span id="span_'+c+'"'+(k?' title="'+k+'"':"")+"><input name='"+c+"' id='"+c+"' size='"+b+"' onkeydown='return Jmol.controls._commandKeyPress(event,\""+c+'","'+g+"\")' value='"+m+"'/><input type='button' name='"+c+"Btn' id='"+c+"Btn' value = '"+d+"' onclick='Jmol.controls._commandKeyPress(13,\""+c+'","'+g+"\")' /></span>";a._debugAlert&&alert(d);return a._documentWrite(d)};
|
||||
j._getLink=function(g,d,b,c,k){g=j._getIdForControl(g,d);if(null==g)return"";void 0!=c&&null!=c||(c="jmolLink"+j._linkCount);void 0!=b&&null!=b||(b=d.substring(0,32));++j._linkCount;d=j._addScript(g,d);b='<span id="span_'+c+'"'+(k?' title="'+k+'"':"")+"><a name='"+c+"' id='"+c+"' href='javascript:Jmol.controls._click(null,"+d+");' onmouseover='Jmol.controls._mouseOver(null,"+d+");return true;' onmouseout='Jmol.controls._mouseOut()' "+j._linkCssText+">"+b+"</a></span>";a._debugAlert&&alert(b);return a._documentWrite(b)};
|
||||
j._getMenu=function(g,d,b,c,k){var m=j._getIdForControl(g,null);void 0!=c&&null!=c||(c="jmolMenu"+j._menuCount);++j._menuCount;m=typeof d;if(null!=m&&"object"==m&&d.length){var l=d.length;"number"!=typeof b||1==b?b=null:0>b&&(b=l);b='<span id="span_'+c+'"'+(k?' title="'+k+'"':"")+"><select name='"+c+"' id='"+c+"' onChange='Jmol.controls._menuSelected(this)'"+(b?" size='"+b+"' ":"")+j._menuCssText+">";for(c=0;c<l;++c){var e=d[c],m=typeof e,f=null,h=k=null;"object"==m&&null!=e?(f=e[0],k=e[1],h=e[2]):
|
||||
f=k=e;m=j._getIdForControl(g,f);if(null==m)return"";null==k&&(k=f);"#optgroup"==f?b+="<optgroup label='"+k+"'>":"#optgroupEnd"==f?b+="</optgroup>":(m=j._addScript(m,f),b+="<option value='"+m+(h?"' selected='true'>":"'>")+k+"</option>")}b+="</select></span>";a._debugAlert&&alert(b);return a._documentWrite(b)}};j._getRadio=function(g,d,b,c,k,m,l,e){0==j._radioGroupCount&&++j._radioGroupCount;m||(m="jmolRadioGroup"+(j._radioGroupCount-1));g=j._radio(g,d,b,c,k,m,l?l:m+"_"+j._radioCount,e?e:0);if(null==
|
||||
g)return"";a._debugAlert&&alert(g);return a._documentWrite(g)};j._getRadioGroup=function(g,d,b,c,k,m){var l=typeof d;if("object"!=l||null==l||!d.length)alert("invalid arrayOfRadioButtons");else{void 0!=b&&null!=b||(b="  ");var e=d.length;++j._radioGroupCount;c||(c="jmolRadioGroup"+(j._radioGroupCount-1));for(var f="<span id='"+(k?k:c)+"'>",h=0;h<e;++h){h==e-1&&(b="");var r=d[h],l=typeof r,L=null,f="object"==l?f+(L=j._radio(g,r[0],r[1],r[2],b,c,3<r.length?r[3]:(k?k:c)+"_"+h,4<r.length?r[4]:0,
|
||||
m)):f+(L=j._radio(g,r,null,null,b,c,(k?k:c)+"_"+h,m));if(null==L)return""}f+="</span>";a._debugAlert&&alert(f);return a._documentWrite(f)}}})(Jmol);
|
||||
(function(a){var j=function(a){a="&"+a+"=";return decodeURI(("&"+document.location.search.substring(1)+a).split(a)[1].split("&")[0])};a._j2sPath=j("_J2S");a._jarFile=j("_JAR");a._use=j("_USE");a.getVersion=function(){return a._jmolInfo.version};a.getApplet=function(g,d,b){return a._Applet._get(g,d,b)};a.getJMEApplet=function(g,d,b,c){return a._JMEApplet._get(g,d,b,c)};a.getJSVApplet=function(g,d,b){return a._JSVApplet._get(g,d,b)};a.loadFile=function(a,d,b){a._loadFile(d,b)};a.script=function(a,d){a._checkDeferred(d)||
|
||||
a._script(d)};a.scriptCheck=function(a,d){return a&&a._scriptCheck&&a._ready&&a._scriptCheck(d)};a.scriptWait=function(a,d){return a._scriptWait(d)};a.scriptEcho=function(a,d){return a._scriptEcho(d)};a.scriptMessage=function(a,d){return a._scriptMessage(d)};a.scriptWaitOutput=function(a,d){return a._scriptWait(d)};a.scriptWaitAsArray=function(a,d){return a._scriptWaitAsArray(d)};a.search=function(a,d,b){a._search(d,b)};a.evaluateVar=function(a,d){return a._evaluate(d)};a.evaluate=function(a,d){return a._evaluateDEPRECATED(d)};
|
||||
a.getAppletHtml=function(g,d){if(d){var b=a._document;a._document=null;g=a.getApplet(g,d);a._document=b}return g._code};a.getPropertyAsArray=function(a,d,b){return a._getPropertyAsArray(d,b)};a.getPropertyAsJavaObject=function(a,d,b){return a._getPropertyAsJavaObject(d,b)};a.getPropertyAsJSON=function(a,d,b){return a._getPropertyAsJSON(d,b)};a.getPropertyAsString=function(a,d,b){return a._getPropertyAsString(d,b)};a.getStatus=function(a,d){return a._getStatus(d)};a.resizeApplet=function(a,d){return a._resizeApplet(d)};
|
||||
a.restoreOrientation=function(a,d){return a._restoreOrientation(d)};a.restoreOrientationDelayed=function(a,d,b){return a._restoreOrientationDelayed(d,b)};a.saveOrientation=function(a,d){return a._saveOrientation(d)};a.say=function(a){alert(a)};a.clearConsole=function(a){a._clearConsole()};a.getInfo=function(a){return a._info};a.setInfo=function(a,d,b){a._info=d;2<arguments.length&&a._showInfo(b)};a.showInfo=function(a,d){a._showInfo(d)};a.show2d=function(a,d){a._show2d(d)};a.jmolBr=function(){return a._documentWrite("<br>")};
|
||||
a.jmolButton=function(g,d,b,c,j){return a.controls._getButton(g,d,b,c,j)};a.jmolCheckbox=function(g,d,b,c,j,m,l){return a.controls._getCheckbox(g,d,b,c,j,m,l)};a.jmolCommandInput=function(g,d,b,c,j,m){return a.controls._getCommandInput(g,d,b,c,j,m)};a.jmolHtml=function(g){return a._documentWrite(g)};a.jmolLink=function(g,d,b,c,j){return a.controls._getLink(g,d,b,c,j)};a.jmolMenu=function(g,d,b,c,j){return a.controls._getMenu(g,d,b,c,j)};a.jmolRadio=function(g,d,b,c,j,m,l,e){return a.controls._getRadio(g,
|
||||
d,b,c,j,m,l,e)};a.jmolRadioGroup=function(g,d,b,c,j,m){return a.controls._getRadioGroup(g,d,b,c,j,m)};a.setCheckboxGroup=function(g,d){a.controls._cbSetCheckboxGroup(g,d,arguments)};a.setDocument=function(g){a._document=g};a.setXHTML=function(g){a._isXHTML=!0;a._XhtmlElement=null;a._XhtmlAppendChild=!1;g&&(a._XhtmlElement=document.getElementById(g),a._XhtmlAppendChild=!0)};a.setAppletCss=function(g,d){null!=g&&(a._appletCssClass=g);a._appletCssText=d?d+" ":g?'class="'+g+'" ':""};a.setButtonCss=function(g,
|
||||
d){null!=g&&(a.controls._buttonCssClass=g);a.controls._buttonCssText=d?d+" ":g?'class="'+g+'" ':""};a.setCheckboxCss=function(g,d){null!=g&&(a.controls._checkboxCssClass=g);a.controls._checkboxCssText=d?d+" ":g?'class="'+g+'" ':""};a.setRadioCss=function(g,d){null!=g&&(a.controls._radioCssClass=g);a.controls._radioCssText=d?d+" ":g?'class="'+g+'" ':""};a.setLinkCss=function(g,d){null!=g&&(a.controls._linkCssClass=g);a.controls._linkCssText=d?d+" ":g?'class="'+g+'" ':""};a.setMenuCss=function(g,d){null!=
|
||||
g&&(a.controls._menuCssClass=g);a.controls._menuCssText=d?d+" ":g?'class="'+g+'" ':""};a.setAppletSync=function(g,d,b){a._syncedApplets=g;a._syncedCommands=d;a._syncedReady={};a._isJmolJSVSync=b};a.setGrabberOptions=function(g){a._grabberOptions=g};a.setAppletHtml=function(g,d){g._code&&(a.$html(d,g._code),g._init&&!g._deferApplet&&g._init())};a.coverApplet=function(a,d){a._cover&&a._cover(d)};a.setFileCaching=function(g,d){g?g._cacheFiles=d:a.fileCache=d?{}:null};a.resetView=function(g,d){a.View.resetView(g,
|
||||
d)};a.updateView=function(a,d,b){a._updateView(d,b)};a.getChemicalInfo=function(g,d,b){d||(d="name");"string"!=typeof g&&(g=g._getSmiles());return a._getNCIInfo(g,d,b)};a.saveImage=function(a){switch(a._viewType){case "Jmol":a._script('write PNGJ "'+a._id+'.png"');break;case "JSV":a._script("write PDF");break;case "JME":a._script("print")}}})(Jmol);
|
||||
LoadClazz=function(){c$=null;window["j2s.clazzloaded"]||(window["j2s.clazzloaded"]=!1);window["j2s.clazzloaded"]||(window["j2s.clazzloaded"]=!0,window["j2s.object.native"]=!0,Clazz={_isQuiet:!1,_debugging:!1},function(a,j){try{a._debugging=0<=document.location.href.indexOf("j2sdebug")}catch(g){}var d=["j2s.clazzloaded","j2s.object.native"];a.setGlobal=function(a,b){d.push(a);window[a]=b};a.getGlobals=function(){return d.sort().join("\n")};a.setConsoleDiv=function(a){window["j2s.lib"]&&(window["j2s.lib"].console=
|
||||
a)};var b=null;a._startProfiling=function(a){b=a&&self.JSON?{}:null};NullObject=function(){};a._supportsNativeObject=window["j2s.object.native"];a._supportsNativeObject?(a._O=function(){},a._O.__CLASS_NAME__="Object",a._O.getClass=function(){return a._O}):a._O=Object;a.Console={};a.dateToString=Date.prototype.toString;a._hashCode=0;var c=a._O.prototype;c.equals=function(a){return this==a};c.hashCode=function(){return this._$hashcode||(this._$hashcode=++a._hashCode)};c.getClass=function(){return a.getClass(this)};
|
||||
c.clone=function(){return a.clone(this)};a.clone=function(a){var b=a instanceof Array?Array(a.length):new a.constructor,c;for(c in a)b[c]=a[c];return b};c.finalize=function(){};c.notify=function(){};c.notifyAll=function(){};c.wait=function(){};c.to$tring=Object.prototype.toString;c.toString=function(){return this.__CLASS_NAME__?"["+this.__CLASS_NAME__+" object]":this.to$tring.apply(this,arguments)};a._extendedObjectMethods="equals hashCode getClass clone finalize notify notifyAll wait to$tring toString".split(" ");
|
||||
a.extendJO=function(b,c){c&&(b.__CLASS_NAME__=b.prototype.__CLASS_NAME__=c);if(a._supportsNativeObject)for(var d=0;d<a._extendedObjectMethods.length;d++){var e=a._extendedObjectMethods[d];b.prototype[e]=a._O.prototype[e]}};a.extractClassName=function(a){a=a.substring(1,a.length-1);return 0<=a.indexOf("Array")?"Array":0<=a.indexOf("object ")?a.substring(7):a};a.getClassName=function(b,c){if(null==b)return"NullObject";if(b instanceof a.CastedNull)return b.clazzName;switch(typeof b){case "number":return"n";
|
||||
case "boolean":return"b";case "string":return"String";case "function":if(b.__CLASS_NAME__)return c?b.__CLASS_NAME__:"Class";var d=b.toString(),e=d.indexOf("function");if(0>e)return"["==d.charAt(0)?a.extractClassName(d):d.replace(/[^a-zA-Z0-9]/g,"");var e=e+8,f=d.indexOf("(",e);if(0>f)break;d=d.substring(e,f);if(0<=d.indexOf("Array"))return"Array";d=d.replace(/^\s+/,"").replace(/\s+$/,"");return"anonymous"==d||""==d?"Function":d;case "object":if(b.__CLASS_NAME__)return b.__CLASS_NAME__;if(!b.constructor)break;
|
||||
if(!b.constructor.__CLASS_NAME__){if(b instanceof Number)return"Number";if(b instanceof Boolean)return"Boolean";if(b instanceof Array||b.BYTES_PER_ELEMENT)return"Array";d=b.toString();if("["==d.charAt(0))return a.extractClassName(d)}return a.getClassName(b.constructor,!0)}return"Object"};a.getClass=function(b){if(!b)return a._O;if("function"==typeof b)return b;if(b instanceof a.CastedNull)b=b.clazzName;else switch(typeof b){case "string":return String;case "object":if(!b.__CLASS_NAME__)return b.constructor||
|
||||
a._O;b=b.__CLASS_NAME__;break;default:return b.constructor}return a.evalType(b,!0)};var k=function(b,c){for(var d=0;d<a.innerFunctionNames.length;d++)if(c==a.innerFunctionNames[d]&&a._innerFunctions[c]===b[c])return!0;return!1},m=function(){};a.inheritArgs=new m;a.inheritClass=function(b,c,d){for(var e in c)"b$"!=e&&("prototype"!=e&&"superClazz"!=e&&"__CLASS_NAME__"!=e&&"implementz"!=e&&!k(c,e))&&(b[e]=c[e]);a.unloadedClasses[a.getClassName(b,!0)]||(b.prototype=d?d:c!==Number?new c(a.inheritArgs):
|
||||
new Number);b.superClazz=c;b.prototype.__CLASS_NAME__=b.__CLASS_NAME__};a.implementOf=function(a,b){if(2<=arguments.length){a.implementz||(a.implementz=[]);var c=a.implementz;if(2==arguments.length)if("function"==typeof b)c.push(b),l(a,b);else{if(b instanceof Array)for(var d=0;d<b.length;d++)c.push(b[d]),l(a,b[d])}else for(d=1;d<arguments.length;d++)c.push(arguments[d]),l(a,arguments[d])}};var l=function(a,b){for(var c in b)if("b$"!=c&&"prototype"!=c&&"superClazz"!=c&&"__CLASS_NAME__"!=c&&"implementz"!=
|
||||
c&&("function"!=typeof b[c]||!k(b,c)))a[c]=a.prototype[c]=b[c]};a.extendInterface=a.implementOf;a.equalsOrExtendsLevel=function(b,c){if(b===c)return 0;if(b.implementz)for(var d=b.implementz,e=0;e<d.length;e++){var f=a.equalsOrExtendsLevel(d[e],c);if(0<=f)return f+1}return-1};a.getInheritedLevel=function(b,c){if(b===c)return 0;var d="string"==typeof b;if(d&&("void"==b||"unknown"==b))return-1;var e="string"==typeof c;if(e&&("void"==c||"unknown"==c))return-1;if(b===(d?"NullObject":NullObject))switch(c){case "n":case "b":return-1;
|
||||
case Number:case Boolean:case NullObject:break;default:return 0}d&&(b=a.evalType(b));e&&(c=a.evalType(c));if(!c||!b)return-1;d=0;for(e=b;e!==c&&10>d;){if(e.implementz)for(var f=e.implementz,g=0;g<f.length;g++){var h=a.equalsOrExtendsLevel(f[g],c);if(0<=h)return d+h+1}e=e.superClazz;if(!e)return c===Object||c===a._O?d+1.5:-1;d++}return d};a.instanceOf=function(b,c){return null!=b&&c&&(b==c||b instanceof c||0<=a.getInheritedLevel(a.getClassName(b),c))};a.superCall=function(b,c,d,e){var f=null,g=-1,
|
||||
h=b[d];if(h)if(h.claxxOwner)h.claxxOwner!==c&&(f=h);else if(!h.stacks&&(!h.lastClaxxRef||!h.lastClaxxRef.prototype[d]||!h.lastClaxxRef.prototype[d].stacks))f=h;else{var j=h.stacks;j||(j=h.lastClaxxRef.prototype[d].stacks);for(g=j.length;0<=--g;)if(c===j[g]){f=0<g?j[--g].prototype[d]:j[0].prototype[d]["\\unknown"];break}else if(0<a.getInheritedLevel(c,j[g])){f=j[g].prototype[d];break}}if(f)return 0==g&&"construct"==d&&(c=h.stacks)&&(!c[0].superClazz&&c[0].con$truct)&&c[0].con$truct.apply(b,[]),f.apply(b,
|
||||
e||[]);"construct"!=d&&(a.alert(["j2slib","no class found",e.typeString]),V(b,c,d,a.getParamsType(e).typeString))};a.superConstructor=function(b,c,d){a.superCall(b,c,"construct",d);c.con$truct&&c.con$truct.apply(b,[])};a.CastedNull=function(b){this.clazzName=b?b instanceof String?b:b instanceof Function?a.getClassName(b,!0):""+b:"Object";this.toString=function(){return null};this.valueOf=function(){return null}};a.castNullAs=function(b){return new a.CastedNull(b)};a._initializingException=!1;a._callingStackTraces=
|
||||
[];var e=function(){this.toString=function(){return"J2S MethodException"}},f;try{null.hello()}catch(h){if(c=function(a,b,c){c||(c="[^\\s]+");var d=a.indexOf(b);a=a.substring(0,d)+c+a.substring(d+b.length);return RegExp("^"+a+"$")},/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var c=h.message.indexOf(":"),r=h.message.indexOf(":",c+2),L=h.message.substr(c+1,r-c-20);f=function(a){return-1!=a.message.indexOf(L)}}else if(-1!=navigator.userAgent.toLowerCase().indexOf("webkit")){var N=c(h.message,"hello");
|
||||
f=function(a){return N.test(a.message)}}else N=c(h.message,"$$o$$"),f=function(a){return N.test(a.message)}}a.exceptionOf=function(b,c){if(b.__CLASS_NAME__)return a.instanceOf(b,c);b.getMessage||(b.getMessage=function(){return""+b+(b.stack?"\n"+b.stack:"")});b.printStackTrace||(b.printStackTrace=function(){});if(c==Error){if(0>(""+b).indexOf("Error"))return!1;System.out.println(a.getStackTrace());return!0}return c==Exception||c==Throwable||c==NullPointerException&&f(b)};a.getStackTrace=function(a){a||
|
||||
(a=25);var b="\n",c=arguments.callee,d=0>a;d&&(a=-a);for(var e=0;e<a&&(c=c.caller);e++){var f=c.toString?c.toString().substring(0,c.toString().indexOf("{")):"<native method>",b=b+(e+" "+(c.exName?(c.claxxOwner?c.claxxOwner.__CLASS_NAME__+".":"")+c.exName+f.replace(/function /,""):f)+"\n");if(c==c.caller){b+="<recursing>\n";break}if(d)for(var f=c.arguments,g=0;g<f.length;g++){var h=""+f[g];60<h.length&&(h=h.substring(0,60)+"...");b+=" args["+g+"]="+h.replace(/\s+/g," ")+"\n"}}return b};a.makeConstructor=
|
||||
function(b,c,d){a.defineMethod(b,"construct",c,d);b.con$truct&&(b.con$truct.index=b.con$truct.stacks.length)};a.overrideConstructor=function(b,c,d){a.overrideMethod(b,"construct",c,d);b.con$truct&&(b.con$truct.index=b.con$truct.stacks.length)};a.defineMethod=function(c,d,f,g){f.exName=d;g=T(g);var h=c.prototype,j=h[d];a._Loader._checkLoad&&R(c,d,g);if(!j||j.claxxOwner===c&&j.funParams==g)return f.funParams=g,f.claxxOwner=c,f.exClazz=c,h[d]=f;var k=null,m=j.stacks;m||(m=[],k=j,j.claxxOwner&&(m[0]=
|
||||
k.claxxOwner));if(!j.stacks||j.claxxReference!==c){++q;j=function(){var c;a:{var d=arguments.callee.claxxReference,f=arguments.callee.methodName;c=arguments;fx=this[f];var U=a.getParamsType(c);if(!fx)try{System.out.println(a.getStackTrace(5))}catch(va){}if(b){var g=d.__CLASS_NAME__+" "+f+" ";0>u.indexOf(g)&&(u+=g+"\n");b[g]||(b[g]=0);b[g]++}if(fx.lastParams==U.typeString&&fx.lastClaxxRef===d){if(U.hasCastedNull){d=[];for(f=0;f<c.length;f++)d[f]=c[f]instanceof a.CastedNull?null:c[f]}else d=c;c=fx.lastMethod?
|
||||
fx.lastMethod.apply(this,d):null}else{fx.lastParams=U.typeString;fx.lastClaxxRef=d;g=fx.stacks;g||(g=d.prototype[f].stacks);for(var h=!1,j=g.length;0<=--j;)if(h||g[j]===d){var t=g[j].prototype[f],D=U,h=c,k=fx,m=[],G=!0,l=void 0;for(l in t)if(92==l.charCodeAt(0)){var B=l.substring(1).split("\\");B.length==D.length&&m.push(B);G=!1}else if(G&&"funParams"==l&&t.funParams){l=t.funParams;B=l.substring(1).split("\\");B.length==D.length&&(m[0]=B);break}if(!(l=0==m.length)){for(var l=D,B=[],n=m.length,E=0;E<
|
||||
n;E++){for(var p=[],sa=!0,r=m[E].length,q=0;q<r;q++)if(p[q]=a.getInheritedLevel(l[q],m[E][q]),0>p[q]){sa=!1;break}sa&&(p[l.length]=E,B.push(p))}if(0==B.length)m=null;else{n=B[0];for(E=1;E<B.length;E++){p=!0;for(q=0;q<l.length;q++)if(n[q]<B[E][q]){p=!1;break}p&&(n=B[E])}m=m[n[l.length]].join("\\")}l=!m}if(l)h=new e;else{t=G?t:t["\\"+m];G=null;if(D.hasCastedNull){G=[];for(D=0;D<h.length;D++)G[D]=h[D]instanceof a.CastedNull?null:h[D]}else G=h;k.lastMethod=t;h=t.apply(this,G)}if(!(h instanceof e)){c=
|
||||
h;break a}h=!0}"construct"!=f&&V(this,d,f,U.typeString);c=void 0}}return c};j.methodName=d;j.claxxReference=c;j=h[d]=j;d=[];for(h=0;h<m.length;h++)d[h]=m[h];j.stacks=d}m=j.stacks;0>S(m,c)&&m.push(c);k&&(k.claxxOwner===c?(j[k.funParams]=k,k.claxxOwner=null,k.funParams=null):k.claxxOwner||(j["\\unknown"]=k));f.exClazz=c;j[g]=f;return j};duplicatedMethods={};var R=function(b,c,d){var e=b.prototype[c];if(e&&(e.claxxOwner||e.claxxReference)===b)key=b.__CLASS_NAME__+"."+c+d,(b=duplicatedMethods[key])?(c=
|
||||
"Warning! Duplicate method found for "+key,System.out.println(c),a.alert(c),duplicatedMethods[key]=b+1):duplicatedMethods[key]=1};a.showDuplicates=function(a){var b="",c=duplicatedMethods,d=0,e;for(e in c)1<c[e]&&(b+=c[e]+"\t"+e+"\n",d++);b="Duplicates: "+d+"\n\n"+b;System.out.println(b);a||alert(b)};var S=function(a,b){if(a&&b)for(var c=a.length;0<=--c;)if(a[c]===b)return c;return-1},la=function(a,b){var c=S(a,b);if(0<=c){for(var d=a.length-1;c<d;c++)a[c]=a[c+1];a.length--;return!0}},T=function(a){return a?
|
||||
a.replace(/~([NABSO])/g,function(a,b){switch(b){case "N":return"n";case "B":return"b";case "S":return"String";case "O":return"Object";case "A":return"Array"}return"Unknown"}).replace(/\s+/g,"").replace(/^|,/g,"\\").replace(/\$/g,"org.eclipse.s"):"\\void"};a.overrideMethod=function(b,c,d,e){d.exName=c;e=T(e);a._Loader._checkLoad&&R(b,c,e);d.funParams=e;d.claxxOwner=b;return b.prototype[c]=d};var u="";a.getProfile=function(){var a="";if(b){var a=[],c;for(c in b){var d=""+b[c];a.push(" ".substring(d.length)+
|
||||
d+"\t"+c)}a=a.sort().reverse().join("\r\n");b={}}return a};a.getParamsType=function(b){var c=b.length;switch(c){case 0:var d=["void"];d.typeString="\\void";return d;case 1:switch(typeof obj){case "number":return d=["n"],d.typeString="\\n",d;case "boolean":return d=["b"],d.typeString="\\b",d}}d=[];d.hasCastedNull=!1;if(b)for(var e=0;e<c;e++)d[e]=a.getClassName(b[e]),b[e]instanceof a.CastedNull&&(d.hasCastedNull=!0);d.typeString="\\"+d.join("\\");return d};var q=0;a.allPackage={};a.allClasses={};a.lastPackageName=
|
||||
null;a.lastPackage=null;a.unloadedClasses=[];a.declarePackage=function(b){if(a.lastPackageName==b)return a.lastPackage;if(b&&b.length){for(var c=b.split(/\./),d=a.allPackage,e=0;e<c.length;e++)d[c[e]]||(d[c[e]]={__PKG_NAME__:d.__PKG_NAME__?d.__PKG_NAME__+"."+c[e]:c[e]},0==e&&a.setGlobal(c[e],d[c[e]])),d=d[c[e]];a.lastPackageName=b;return a.lastPackage=d}};a.evalType=function(b,c){var d=b.lastIndexOf(".");if(-1!=d){var e=b.substring(0,d),e=a.declarePackage(e),d=b.substring(d+1);return e[d]}if(c)return window[b];
|
||||
switch(b){case "string":return String;case "number":return Number;case "object":return a._O;case "boolean":return Boolean;case "function":return Function;case "void":case "undefined":case "unknown":return b;case "NullObject":return NullObject;default:return window[b]}};a.defineType=function(b,c,d,e){var f=a.unloadedClasses[b];f&&(c=f);f=b.lastIndexOf(".");if(-1!=f){var g=b.substring(0,f),g=a.declarePackage(g),f=b.substring(f+1);if(g[f])return g[f];g[f]=c}else{if(window[b])return window[b];a.setGlobal(b,
|
||||
c)}a.decorateAsType(c,b,d,e);b=a._innerFunctions;c.defineMethod=b.defineMethod;c.defineStaticMethod=b.defineStaticMethod;c.makeConstructor=b.makeConstructor;return c};var X=!1;-1!=navigator.userAgent.indexOf("Safari")&&(c=navigator.userAgent,r=c.indexOf("Version/"),-1!=r&&(c=c.substring(r+8),X=4<=parseFloat(c)));a.instantialize=function(a,b){if(!b||!(1==b.length&&b[0]&&b[0]instanceof m)){a instanceof Number&&(a.valueOf=function(){return this});if(X){for(var c=[],d=0;d<b.length;d++)c[d]=b[d];b=c}(c=
|
||||
a.construct)?a.con$truct?a.getClass().superClazz?c.claxxOwner&&c.claxxOwner===a.getClass()||c.stacks&&c.stacks[c.stacks.length-1]==a.getClass()?c.apply(a,b):(c.claxxOwner&&!c.claxxOwner.superClazz&&c.claxxOwner.con$truct?c.claxxOwner.con$truct.apply(a,[]):c.stacks&&(1==c.stacks.length&&!c.stacks[0].superClazz)&&c.stacks[0].con$truct.apply(a,[]),c.apply(a,b),a.con$truct.apply(a,[])):(a.con$truct.apply(a,[]),c.apply(a,b)):c.apply(a,b):a.con$truct&&a.con$truct.apply(a,[])}};a.innerFunctionNames="isInstance equals hashCode getName getCanonicalName getClassLoader getResource getResourceAsStream defineMethod defineStaticMethod makeConstructor".split(" ");
|
||||
a._innerFunctions={isInstance:function(b){return a.instanceOf(b,this)},equals:function(a){return this===a},hashCode:function(){return this.getName().hashCode()},toString:function(){return"class "+this.getName()},getName:function(){return a.getClassName(this,!0)},getCanonicalName:function(){return this.__CLASS_NAME__},getClassLoader:function(){var b=this.__CLASS_NAME__,c=a._Loader.getClasspathFor(b),d=c.lastIndexOf(b.replace(/\./g,"/")),c=-1!=d?c.substring(0,d):a._Loader.getClasspathFor(b,!0),b=a._Loader.requireLoaderByBase(c);
|
||||
b.getResourceAsStream=a._innerFunctions.getResourceAsStream;b.getResource=a._innerFunctions.getResource;return b},getResource:function(a){return(a=this.getResourceAsStream(a))?a.url:null},getResourceAsStream:function(b){if(!b)return null;b=b.replace(/\\/g,"/");var c=null,d=b,d=this.__CLASS_NAME__;2==arguments.length&&0!=b.indexOf("/")&&(b="/"+b);if(0==b.indexOf("/"))if(2==arguments.length?(c=arguments[1])||(c=a.binaryFolders[0]):a._Loader&&(c=a._Loader.getClasspathFor(d,!0)),c){var c=c.replace(/\\/g,
|
||||
"/"),e=c.length,e=c.charAt(e-1);"/"!=e&&(c+="/");d=c+b.substring(1)}else d=b.substring(1);else{if(this.base)c=this.base;else if(a._Loader)if(c=a._Loader.getClasspathFor(d),e=c.lastIndexOf(d.replace(/\./g,"/")),-1!=e)c=c.substring(0,e);else if(e=-1,c.indexOf(".z.js")==c.length-5&&-1!=(e=c.lastIndexOf("/")))for(var c=c.substring(0,e+1),e=d.split(/\./),f=1;f<e.length;f++){for(var g="/",h=0;h<f;h++)g+=e[h]+"/";if(g.length>c.length)break;if(c.indexOf(g)==c.length-g.length){c=c.substring(0,c.length-g.length+
|
||||
1);break}}else c=a._Loader.getClasspathFor(d,!0);else(e=a.binaryFolders)&&e.length&&(c=e[0]);c||(c="j2s/");c=c.replace(/\\/g,"/");e=c.length;e=c.charAt(e-1);"/"!=e&&(c+="/");this.base?d=c+b:(e=d.lastIndexOf("."),d=-1==e||this.base?c+b:c+d.substring(0,e).replace(/\./g,"/")+"/"+b)}c=null;try{if(0>d.indexOf(":/")){var k=document.location.href.split("?")[0].split("/");k[k.length-1]=d;d=k.join("/")}c=new java.net.URL(d)}catch(m){}k=null==c?null:j._getFileData(d.toString());if(!k||"error"==k||0==k.indexOf("[Exception"))return null;
|
||||
k=(new java.lang.String(k)).getBytes();k=new java.io.BufferedInputStream(new java.io.ByteArrayInputStream(k));k.url=c;return k},defineMethod:function(b,c,d){a.defineMethod(this,b,c,d)},defineStaticMethod:function(b,c,d){a.defineMethod(this,b,c,d);this[b]=this.prototype[b]},makeConstructor:function(b,c){a.makeConstructor(this,b,c)}};var Y=[];a.pu$h=function(a){a||(a=self.c$);a&&Y.push(a)};a.p0p=function(){return Y.pop()};a.decorateAsClass=function(b,c,d,e,f,g){var h=null;c&&(h=c.__PKG_NAME__,h||(h=
|
||||
c.__CLASS_NAME__));var j=(h?h+".":"")+d;a._Loader._classPending[j]&&(delete a._Loader._classPending[j],a._Loader._classCountOK++,a._Loader._classCountPending--);a._Loader&&a._Loader._checkLoad&&System.out.println("decorating class "+h+"."+d);(h=a.unloadedClasses[j])&&(b=h);Z(b,c,d);g?a.inheritClass(b,e,g):e&&a.inheritClass(b,e);f&&a.implementOf(b,f);return b};var Z=function(b,c,d){var e;c?c.__PKG_NAME__?(e=c.__PKG_NAME__+"."+d,c[d]=b,c===java.lang&&a.setGlobal(d,b)):(e=c.__CLASS_NAME__+"."+d,c[d]=
|
||||
b):(e=d,a.setGlobal(d,b));a.extendJO(b,e);c=a.innerFunctionNames;for(d=0;d<c.length;d++)b[c[d]]=a._innerFunctions[c[d]];a._Loader&&a._Loader.updateNodeForFunctionDecoration(e)};a.declareInterface=function(b,c,d){var e=function(){};Z(e,b,c);d&&a.implementOf(e,d);return e};a.declareType=function(b,c,d,e,f){return a.decorateAsClass(function(){a.instantialize(this,arguments)},b,c,d,e,f)};a.declareAnonymous=function(b,c,d,e,f){return a.decorateAsClass(function(){a.prepareCallback(this,arguments);a.instantialize(this,
|
||||
arguments)},b,c,d,e,f)};a.decorateAsType=function(b,c,d,e,f,g){a.extendJO(b,c);b.equals=a._innerFunctions.equals;b.getName=a._innerFunctions.getName;if(g)for(c=0;c<a.innerFunctionNames.length;c++)g=a.innerFunctionNames[c],b[g]=a._innerFunctions[g];f?a.inheritClass(b,d,f):d&&a.inheritClass(b,d);e&&a.implementOf(b,e);return b};Number.prototype._numberToString=Number.prototype.toString;a.declarePackage("java.io");a.declarePackage("java.lang.annotation");a.declarePackage("java.lang.instrument");a.declarePackage("java.lang.management");
|
||||
a.declarePackage("java.lang.reflect");a.declarePackage("java.lang.ref");java.lang.ref.reflect=java.lang.reflect;a.declarePackage("java.util");a.declarePackage("java.security");a.declareInterface(java.io,"Closeable");a.declareInterface(java.io,"DataInput");a.declareInterface(java.io,"DataOutput");a.declareInterface(java.io,"Externalizable");a.declareInterface(java.io,"Flushable");a.declareInterface(java.io,"Serializable");a.declareInterface(java.lang,"Iterable");a.declareInterface(java.lang,"CharSequence");
|
||||
a.declareInterface(java.lang,"Cloneable");a.declareInterface(java.lang,"Appendable");a.declareInterface(java.lang,"Comparable");a.declareInterface(java.lang,"Runnable");a.declareInterface(java.util,"Comparator");java.lang.ClassLoader={__CLASS_NAME__:"ClassLoader"};var V=function(b,c,d,e){b="";e&&(b=e.substring(1).replace(/\\/g,","));c=(d&&"construct"!=d?"Method":"Constructor")+" "+a.getClassName(c,!0)+"."+d+"("+b+") is not found!";throw new java.lang.NoSuchMethodException(c);};a.prepareCallback=function(b,
|
||||
c){var d=c[0];if(b&&d&&d!==window){var e=a.getClassName(d,!0),f={};if(b.b$)for(var g in b.b$)f[g]=b.b$[g];b.b$=f;f[e]=d;for(e=a.getClass(d);e.superClazz;)e=e.superClazz,f[a.getClassName(e,!0)]=d;if(d=d.b$)for(g in d)f[g]=d[g]}for(f=0;f<c.length-1;f++)c[f]=c[f+1];0<c.length&&c.length--};a.innerTypeInstance=function(b,c,d){b||(b=arguments.callee.caller);var e;if(d||c.$finals)if(e=new b(c,a.inheritArgs),d)if(c.f$){var f={},g;for(g in c.f$)f[g]=c.f$[g];for(g in d)f[g]=d[g];e.f$=f}else e.f$=d;else c.f$&&
|
||||
(e.f$=c.f$);else switch(arguments.length){case 3:return new b(c);case 4:return c.__CLASS_NAME__==b.__CLASS_NAME__&&arguments[3]===a.inheritArgs?c:new b(c,arguments[3]);case 5:return new b(c,arguments[3],arguments[4]);case 6:return new b(c,arguments[3],arguments[4],arguments[5]);case 7:return new b(c,arguments[3],arguments[4],arguments[5],arguments[6]);case 8:return new b(c,arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);case 9:return new b(c,arguments[3],arguments[4],arguments[5],
|
||||
arguments[6],arguments[7],arguments[8]);case 10:return new b(c,arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9]);default:e=new b(c,a.inheritArgs)}g=arguments.length-3;for(f=Array(g);0<=--g;)f[g]=arguments[g+3];a.instantialize(e,f);return e};a.cloneFinals=function(){for(var a={},b=arguments.length/2;0<=--b;)a[arguments[b+b]]=arguments[b+b+1];return a};a.isClassDefined=a.isDefinedClass=function(b){if(!b)return!1;if(a.allClasses[b])return!0;for(var c=b.split(/\./),
|
||||
d=null,e=0;e<c.length;e++)if(!(d=d?d[c[e]]:a.allPackage[c[0]]))return!1;return d&&(a.allClasses[b]=!0)};a.defineEnumConstant=function(a,b,c,d,e){e=e?new e:new a;e.$name=b;e.$ordinal=c;d&&d.length&&e.construct.apply(e,d);a[b]=e;a.prototype[b]=e;a["$ values"]||(a["$ values"]=[],a.values=function(){return this["$ values"]});a["$ values"].push(e);return e};a.floatToInt=function(a){return isNaN(a)?0:0>a?Math.ceil(a):Math.floor(a)};a.floatToByte=a.floatToShort=a.floatToLong=a.floatToInt;a.doubleToByte=
|
||||
a.doubleToShort=a.doubleToLong=a.doubleToInt=a.floatToInt;a.floatToChar=function(a){return String.fromCharCode(0>a?Math.ceil(a):Math.floor(a))};a.doubleToChar=a.floatToChar;var aa=function(a,b){a||(a=0);if("object"==typeof a)var c=a;else for(var c=Array(a),d=0;d<a;d++)c[d]=0;c.BYTES_PER_ELEMENT=b>>3;c._fake=!0;return c},O=function(a,b){a||(a=0);b||(b=this.length);if(this._fake){var c=new this.constructor(b-a);System.arraycopy(this,a,c,0,b-a);return c}return new this.constructor(this.buffer.slice(a*
|
||||
this.BYTES_PER_ELEMENT,b*this.BYTES_PER_ELEMENT))};!0==(a.haveInt32=!!(self.Int32Array&&self.Int32Array!=Array))?Int32Array.prototype.sort||(Int32Array.prototype.sort=Array.prototype.sort):(Int32Array=function(a){return aa(a,32)},Int32Array.prototype.sort=Array.prototype.sort,Int32Array.prototype.toString=function(){return"[object Int32Array]"});Int32Array.prototype.slice||(Int32Array.prototype.slice=function(){return O.apply(this,arguments)});Int32Array.prototype.clone=function(){var a=this.slice();
|
||||
a.BYTES_PER_ELEMENT=4;return a};!0==(a.haveFloat64=!!(self.Float64Array&&self.Float64Array!=Array))?Float64Array.prototype.sort||(Float64Array.prototype.sort=Array.prototype.sort):(Float64Array=function(a){return aa(a,64)},Float64Array.prototype.sort=Array.prototype.sort,Float64Array.prototype.toString=function(){return"[object Float64Array]"});Float64Array.prototype.slice||(Float64Array.prototype.slice=function(){return O.apply(this,arguments)});Float64Array.prototype.clone=function(){return this.slice()};
|
||||
a.newArray=function(a,b,c,d){if(-1!=a||2==arguments.length)return I(arguments,0);a=b.slice(c,d);a.BYTES_PER_ELEMENT=b.BYTES_PER_ELEMENT;return a};var I=function(a,b){var c=a[0];"string"==typeof c&&(c=c.charCodeAt(0));var d=a.length-1,e=a[d];if(1<d){for(var e=Array(d),f=0;f<d;f++)e[f]=a[f+1];d=Array(c);for(f=0;f<c;f++)d[f]=I(e,b);return d}0<b&&0>c&&(c=e);switch(b){case 8:return d=new Int8Array(c),d.BYTES_PER_ELEMENT=1,d;case 32:return d=new Int32Array(c),d.BYTES_PER_ELEMENT=4,d;case 64:return d=new Float64Array(c),
|
||||
d.BYTES_PER_ELEMENT=8,d;default:d=0>c?e:Array(c);d.BYTES_PER_ELEMENT=0;if(0<c&&null!=e)for(f=c;0<=--f;)d[f]=e;return d}};a.newByteArray=function(){return I(arguments,8)};a.newIntArray=function(){return I(arguments,32)};a.newFloatArray=function(){return I(arguments,64)};a.newDoubleArray=a.newFloatArray;a.newLongArray=a.newShortArray=a.newIntArray;a.newCharArray=a.newBooleanArray=a.newArray;!0==(a.haveInt8=!!self.Int8Array)?(Int8Array.prototype.sort||(Int8Array.prototype.sort=Array.prototype.sort),
|
||||
Int8Array.prototype.slice||(Int8Array.prototype.slice=function(){return O.apply(this,arguments)})):a.newByteArray=a.newIntArray;Int8Array.prototype.clone=function(){var a=this.slice();a.BYTES_PER_ELEMENT=1;return a};a.isAB=function(a){return a&&"object"==typeof a&&1==a.BYTES_PER_ELEMENT};a.isAI=function(a){return a&&"object"==typeof a&&4==a.BYTES_PER_ELEMENT};a.isAF=function(a){return a&&"object"==typeof a&&8==a.BYTES_PER_ELEMENT};a.isAS=function(a){return a&&"object"==typeof a&&a.constructor==Array&&
|
||||
("string"==typeof a[0]||"undefined"==typeof a[0])};a.isAII=function(b){return b&&"object"==typeof b&&a.isAI(b[0])};a.isAFF=function(b){return b&&"object"==typeof b&&a.isAF(b[0])};a.isAFFF=function(b){return b&&"object"==typeof b&&a.isAFF(b[0])};a.isASS=function(b){return b&&"object"==typeof b&&a.isAS(b[0])};a.isAFloat=function(b){return b&&"object"==typeof b&&b.constructor==Array&&a.instanceOf(b[0],Float)};a.isAP=function(b){return b&&"JU.P3"==a.getClassName(b[0])};a.defineStatics=function(a){for(var b=
|
||||
arguments.length,c=(b-1)/2;0<=--c;){var d=arguments[--b],e=arguments[--b];a[e]=a.prototype[e]=d}};a.prepareFields=function(a,b){var c=[];if(a.con$truct)for(var d=a.con$truct.stacks,e=0;e<d.length;e++)c[e]=d[e];d=a.con$truct=function(){var a=arguments.callee.stacks;if(a)for(var b=0;b<a.length;b++)a[b].apply(this,[])};a.prototype.con$truct=d;c.push(b);a.con$truct.stacks=c;a.con$truct.index=0};a.checkPrivateMethod=function(){me=arguments.callee.caller;caller=arguments.callee.caller.caller;var b="\\"+
|
||||
a.getParamsType(arguments[0]).join("\\");me.privateNote||(me.privateNote="You are seeing this note because the method "+me.exName+b+" in class "+me.exClazz.__CLASS_NAME__+" has a superclass method by the same name (possibly with the same parameters) that is private and therefore might be called improperly from this class. If your code does not run properly, or you want to make it run faster, change the name of this method to something else.",System.out.println(me.privateNote),alert(me.privateNote));
|
||||
return null};java.lang.Object=a._O;a._O.getName=a._innerFunctions.getName;java.lang.System=System={props:null,$props:{},arraycopy:function(a,b,c,d,e){if(a!==c||b>d)for(;0<=--e;)c[d++]=a[b++];else{d+=e;for(b+=e;0<=--e;)a[--d]=a[--b]}},currentTimeMillis:function(){return(new Date).getTime()},gc:function(){},getProperties:function(){return System.props},getProperty:function(a,b){if(System.props)return System.props.getProperty(a,b);var c=System.$props[a];if("undefined"!=typeof c)return c;if(0<a.indexOf(".")){c=
|
||||
null;switch(a){case "java.version":case "file.separator":case "path.separator":c="/";break;case "line.separator":c=0<=navigator.userAgent.indexOf("Windows")?"\r\n":"\n";break;case "os.name":case "os.version":c=navigator.userAgent}if(c)return System.$props[a]=c}return 1==arguments.length?null:null==b?a:b},getSecurityManager:function(){return null},setProperties:function(a){System.props=a},lineSeparator:function(){return"\n"},setProperty:function(a,b){if(!System.props)return System.$props[a]=b;System.props.setProperty(a,
|
||||
b)}};System.identityHashCode=function(b){return null==b?0:b._$hashcode||(b._$hashcode=++a._hashCode)};System.out=new a._O;System.out.__CLASS_NAME__="java.io.PrintStream";System.out.print=function(){};System.out.printf=function(){};System.out.println=function(){};System.out.write=function(){};System.err=new a._O;System.err.__CLASS_NAME__="java.io.PrintStream";System.err.print=function(){};System.err.printf=function(){};System.err.println=function(){};System.err.write=function(){};a.popup=a.assert=
|
||||
a.log=a.error=window.alert;Thread=function(){};Thread.J2S_THREAD=Thread.prototype.J2S_THREAD=new Thread;Thread.currentThread=Thread.prototype.currentThread=function(){return this.J2S_THREAD};a.innerFunctionNames=a.innerFunctionNames.concat("getSuperclass isAssignableFrom getConstructor getDeclaredMethod getDeclaredMethods getMethod getMethods getModifiers newInstance".split(" "));a._innerFunctions.getSuperclass=function(){return this.superClazz};a._innerFunctions.isAssignableFrom=function(b){return 0<=
|
||||
a.getInheritedLevel(b,this)};a._innerFunctions.getConstructor=function(){return new java.lang.reflect.Constructor(this,[],[],java.lang.reflect.Modifier.PUBLIC)};a._innerFunctions.getDeclaredMethods=a._innerFunctions.getMethods=function(){var a=[],b=this.prototype,c;for(c in b)"function"==typeof b[c]&&!b[c].__CLASS_NAME__&&a.push(new java.lang.reflect.Method(this,c,[],java.lang.Void,[],java.lang.reflect.Modifier.PUBLIC));b=this;for(c in b)"function"==typeof b[c]&&!b[c].__CLASS_NAME__&&a.push(new java.lang.reflect.Method(this,
|
||||
c,[],java.lang.Void,[],java.lang.reflect.Modifier.PUBLIC|java.lang.reflect.Modifier.STATIC));return a};a._innerFunctions.getDeclaredMethod=a._innerFunctions.getMethod=function(a){var b=this.prototype,c;for(c in b)if(a==c&&"function"==typeof b[c]&&!b[c].__CLASS_NAME__)return new java.lang.reflect.Method(this,c,[],java.lang.Void,[],java.lang.reflect.Modifier.PUBLIC);b=this;for(c in b)if(a==c&&"function"==typeof b[c]&&!b[c].__CLASS_NAME__)return new java.lang.reflect.Method(this,c,[],java.lang.Void,
|
||||
[],java.lang.reflect.Modifier.PUBLIC|java.lang.reflect.Modifier.STATIC);return null};a._innerFunctions.getModifiers=function(){return java.lang.reflect.Modifier.PUBLIC};a._innerFunctions.newInstance=function(a){switch(null==a?0:a.length){case 0:return new this;case 1:return new this(a[0]);case 2:return new this(a[0],a[1]);case 3:return new this(a[0],a[1],a[2]);case 4:return new this(a[0],a[1],a[2],a[3]);default:for(var b="new "+this.__CLASS_NAME__+"(",c=0;c<a.length;c++)b+=(0==c?"":",")+"a["+c+"]";
|
||||
return eval(b+")")}};c=a.innerFunctionNames;for(r=0;r<c.length;r++)a._O[c[r]]=a._innerFunctions[c[r]],Array[c[r]]=a._innerFunctions[c[r]];a._Loader=a.ClazzLoader=function(){};var n=function(){this.parents=[];this.musts=[];this.optionals=[];this.onLoaded=this.path=this.name=this.declaration=null;this.status=0;this.random=0.13412};(function(a,b){b._checkLoad=j._checkLoad;b.updateNodeForFunctionDecoration=function(a){(a=C(a))&&a.status==n.STATUS_KNOWN&&window.setTimeout(function(a){return function(){updateNode(a)}}(a),
|
||||
1)};n.prototype.toString=function(){return this.name||this.path||"ClazzNode"};n.STATUS_UNKNOWN=0;n.STATUS_KNOWN=1;n.STATUS_CONTENT_LOADED=2;n.STATUS_MUSTS_LOADED=3;n.STATUS_DECLARED=4;n.STATUS_LOAD_COMPLETE=5;var c=[];b.requireLoaderByBase=function(a){for(var d=0;d<c.length;d++)if(c[d].base==a)return c[d];d=new b;d.base=a;c.push(d);return d};var d=new n,e={},f=0,g=6,h=navigator.userAgent.toLowerCase(),k=-1!=h.indexOf("opera"),m=-1!=h.indexOf("msie")&&!k,l=-1!=h.indexOf("gecko");if(k&&(g=1,k=h.indexOf("opera/"),
|
||||
-1!=k)){var p=9;try{p=parseFloat(h.subString(k+6))}catch(r){}9.6<=p&&(g=6)}var u;self.Clazz&&a.isClassDefined?isClassDefined=a.isClassDefined:(u={},isClassDefined=function(a){return!0==u[a]});var v=function(a){if(!a||0==a.length)return[];for(var b=null,c=0;c<a.length;c++)if(a[c]){if("$"==a[c].charAt(0))if("."==a[c].charAt(1)){if(!b)continue;var d=b.lastIndexOf(".");-1!=d&&(b=b.substring(0,d),a[c]=b+a[c].substring(1))}else a[c]="org.eclipse.s"+a[c].substring(1);b=a[c]}return a},x=[],w={},z=0;b.loadPackageClasspath=
|
||||
function(a,c,d,e,f,g){f||(f=0);e||(e=null);g||(g=0);var h=d&&w["@"+a];if(0==f&&(d&&!w["@java"]&&0!=a.indexOf("java")&&null!=window["java.registered"]&&!w["@java"])&&(b.loadPackage("java",e?function(){b.loadPackageClasspath(a,c,d,e,1)}:null),e))return;if(a instanceof Array)if(v(a),e)g<a.length?b.loadPackageClasspath(a[g],c,d,function(){b.loadPackageClasspath(a,c,d,e,1,g+1)},1):e();else for(h=0;h<a.length;h++)b.loadPackageClasspath(a[h],c,d,null);else{switch(a){case "java.*":a="java";case "java":c&&
|
||||
(f="@net.sf.j2s.ajax",w[f]||(w[f]=c),f="@net.sf.j2s",w[f]||(w[f]=c));break;case "swt":a="org.eclipse.swt";break;case "ajax":a="net.sf.j2s.ajax";break;case "j2s":a="net.sf.j2s";break;default:a.lastIndexOf(".*")==a.length-2&&(a=a.substring(0,a.length-2))}c&&(w["@"+a]=c);d&&!h&&!window[a+".registered"]?(z++,"java"==a&&(a="core"),b.loadClass(a+".package",function(){0==--z&&ta()},!0,!0,1)):e&&e()}};a.loadClass=function(c,d,e){self.Class||(Class=a,Class.forName=a._4Name,JavaObject=a._O);return c&&b.loadClass(c,
|
||||
d,!0,e,1)};b.loadClass=function(c,f,g,h,j){j||(j=0);null==h&&(h=!1);if("boolean"==typeof f)return a.evalType(c);null!=window["java.registered"]&&!w["@java"]&&b.loadPackage("java");b.keepOnLoading=!0;if(!g&&(z&&c.lastIndexOf(".package")!=c.length-8||0!=c.indexOf("java.")&&!isClassDefined(ba)))ma.push([c,f]),System.out.println("loadclass-queuing"+c+ba+" "+isClassDefined(ba));else if((j=isClassDefined(c))||A["@"+c]){if(j&&f&&(g=C(c),!g||g.status>=n.STATUS_LOAD_COMPLETE))h?window.setTimeout(f,25):f()}else{var k=
|
||||
b.getClasspathFor(c);j=e[k];if(!j)for(h=x.length;0<=--h;)if(x[h].path==k||x[h].name==c){j=!0;break}if(j){if(f&&(j=C(c)))if(j.onLoaded){if(f!=j.onLoaded){var m=j.onLoaded,l=f;j.onLoaded=function(){m();l()}}}else j.onLoaded=f}else{j=a.unloadedClasses[c]&&C(c)||new n;j.name=c;j.path=k;j.isPackage=k.lastIndexOf("package.js")==k.length-10;ga(k,c,j);j.onLoaded=f;j.status=n.STATUS_KNOWN;c=!1;for(h=x.length;0<=--h;)if(x[h].status!=n.STATUS_LOAD_COMPLETE){c=!0;break}if(j.isPackage){for(h=x.length;0<=--h&&
|
||||
!x[h].isPackage;)x[h+1]=x[h];x[++h]=j}else c&&x.push(j);if(!c){var t=!1;f&&(t=H,H=!0);g&&(f=null);ca(d,j,!0);F(j,j.path,j.requiredBy,!1,f?function(){H=t;f()}:null)}}}};b.loadPackage=function(a,c){c||(c=null);window[a+".registered"]=!1;b.loadPackageClasspath(a,b.J2SLibBase||(b.J2SLibBase=b.getJ2SLibBase()||"j2s/"),!0,c)};b.jarClasspath=function(a,b){b instanceof Array||(b=[b]);v(b);j._debugCore&&(a=a.replace(/\.z\./,"."));for(var c=b.length;0<=--c;)w["#"+b[c]]=a;w["$"+a]=b};b.registerPackages=function(c,
|
||||
d){for(var e=b.getClasspathFor(c+".*",!0),f=0;f<d.length;f++)window.Clazz&&a.declarePackage(c+"."+d[f]),b.loadPackageClasspath(c+"."+d[f],e)};b.getClasspathFor=function(c,d,e){var f=w["#"+c];if(!f||d||e){var g,h;if(f){if(c=c.replace(/\./g,"/"),0<=(h=f.lastIndexOf(c))||0<=(h=c.lastIndexOf("/"))&&0<=(h=f.lastIndexOf(c.substring(0,h))))g=f.substring(0,h)}else{for(h=c.length+2;0<=(h=c.lastIndexOf(".",h-2))&&!(g=w["@"+c.substring(0,h)]););d||(c=c.replace(/\./g,"/"))}null==g&&(g=window.Clazz&&a.binaryFolders&&
|
||||
a.binaryFolders.length?a.binaryFolders[0]:b.binaryFolders&&b.binaryFolders.length?b.binaryFolders[0]:"j2s");f=(g.lastIndexOf("/")==g.length-1?g:g+"/")+(d?"":c.lastIndexOf("/*")==c.length-2?c.substring(0,h+1):c+(!e?".js":"."!=e.charAt(0)?"."+e:e))}return f};b.ignore=function(){var a=1==arguments.length&&arguments[0]instanceof Array?a=arguments[0]:null,b=a?a.length:arguments.length;if(!a)for(var a=Array(b),c=0;c<b;c++)a[c]=arguments[c];v(a);for(c=0;c<b;c++)A["@"+a[c]]=1};b.onScriptLoading=function(){};
|
||||
b.onScriptLoaded=function(){};b.onScriptInitialized=function(){};b.onScriptCompleted=function(){};b.onClassUnloaded=function(){};b.onGlobalLoaded=function(){};b.keepOnLoading=!0;var y={},A={},K=function(c,d,e,f){if(!f)try{eval(e+";//# sourceURL="+c)}catch(g){if(a._isQuiet)return;c="[Java2Script] The required class file \n\n"+c+(0==e.indexOf("[Exception")&&e.indexOf("data: no")?"\nwas not found.\n":"\ncould not be loaded. Script error: "+g.message+" \n\ndata:\n\n"+e)+"\n\n"+a.getStackTrace();alert(c);
|
||||
a.alert(c);throw g;}b.onScriptLoaded(c,!1);W(d)},L=function(a){return function(){if("interactive"!=a.readyState){try{a.parentNode&&a.parentNode.removeChild(a)}catch(b){}a=null}}},I=function(a){window["j2s.script.debugging"]||window.setTimeout(L(a),1)};a._4Name=function(c,d,e){if(a.isClassDefined(c))return a.evalType(c);d=j._isAsync&&d?d._restoreState(c,e):null;if(1==d)return null;if(b.setLoadingMode(d?b.MODE_SCRIPT:"xhr.sync"))return b.loadClass(c,d,!1,!0,1),null;b.loadClass(c);return a.evalType(c)};
|
||||
a.currentPath="";var F=function(c,d,g,h,k){a.currentPath=d;h&&alert("WHY>>");h=e[d];e[d]=!0;la(x,d);ha=!0;ia=!1;b._checkLoad&&System.out.println("\t"+d+(g?"\n -- required by "+g:"")+" ajax="+ha+" async="+ia);g=d;a._debugging&&(d=d.replace(/\.z\.js/,".js"));h||System.out.println("loadScript "+d);b.onScriptLoading(d);if(ha&&!ia){var m=j._getFileData(d);try{K(d,g,m,h)}catch(l){alert(l+" loading file "+d+" "+c.name+" "+a.getStackTrace())}k&&k()}else c={dataType:"script",async:!0,type:"GET",url:d,success:M(d,
|
||||
!1,k),error:M(d,!0,k)},f++,h?setTimeout(c.success,0):j.$ajax(c)},M=function(c,d,e){a.getStackTrace();return function(){l&&this.timeoutHandle&&(window.clearTimeout(this.timeoutHandle),this.timeoutHandle=null);0<f&&f--;this.onerror=this.onload=null;d&&alert("There was a problem loading "+c);b.onScriptLoaded(c,!0);var a=this,g;g=e?function(){I(a);W(c,e)}:function(){I(a);W(c)};0<=na?window.setTimeout(function(){W(c,g)},na):W(c,g)}},H=!0,N=!1,W=function(c,h){var j=y["@"+c];if(j){var k,s=w["$"+c];if(s)for(var l=
|
||||
0;l<s.length;l++){var t=s[l];if(t!=j.name&&(k=C(t)))k.status<n.STATUS_CONTENT_LOADED&&(k.status=n.STATUS_CONTENT_LOADED,updateNode(k));else{k=new n;k.name=t;var p=w["#"+t];p||(alert(t+" J2S error in tryToLoadNext"),error("Java2Script implementation error! Please report this bug!"));k.path=p;ga(k.path,t,k);k.status=n.STATUS_CONTENT_LOADED;ca(d,k,!1);updateNode(k)}}if(j instanceof Array)for(l=0;l<j.length;l++)j[l].status<n.STATUS_CONTENT_LOADED&&(j[l].status=n.STATUS_CONTENT_LOADED,updateNode(j[l]));
|
||||
else if(j.status<n.STATUS_CONTENT_LOADED){k=!1;s=document.getElementsByTagName("SCRIPT");for(l=0;l<s.length;l++)if(m){if(s[l].onreadystatechange&&s[l].onreadystatechange.path==j.path&&"interactive"==s[l].readyState){k=!0;break}}else if(s[l].onload&&s[l].onload.path==j.path){k=!0;break}k||(j.status=n.STATUS_CONTENT_LOADED,updateNode(j))}if(b.keepOnLoading){l=!0;if(k=oa(n.STATUS_KNOWN))for(ja(k);f<g&&(k=oa(n.STATUS_KNOWN));)ja(k);else if(0!=x.length)k=x.shift(),!e[k.path]||0!=x.length||!H||k.musts.length||
|
||||
k.optionals.length?(ca(d,k,!0),F(k,k.path,k.requiredBy,!1)):H&&(H=!1);else if(k=pa(n.STATUS_KNOWN))for(ja(k);f<g&&(k=pa(n.STATUS_KNOWN));)ja(k);else l=!1;if(!(l||0<f)){j=[oa,pa];s=null;for(l=0;2>l;l++)for(;k=j[l](n.STATUS_CONTENT_LOADED);)1==l&&s===k&&(k.status=n.STATUS_LOAD_COMPLETE),updateNode(k),s=k;for(;!(O=[],!Q(d,c)););for(l=0;2>l;l++)for(s=null;(k=j[l](n.STATUS_DECLARED))&&s!==k;)updateNode(s=k);s=[];for(l=0;2>l;l++)for(;k=j[l](n.STATUS_DECLARED);)s.push(k),k.status=n.STATUS_LOAD_COMPLETE;
|
||||
if(s.length){for(l=0;l<s.length;l++)P(s[l]);for(l=0;l<s.length;l++)if(j=s[l].onLoaded)s[l].onLoaded=null,j()}if(h)h();else if(b._classCountPending)for(t in b._classPending){if(k=C(t),System.out.println("class left pending "+t+" "+k),k){updateNode(k);break}}else b._checkLoad&&(System.out.println("I think I'm done: SAEM call count: "+q),a.showDuplicates(!0));b.onGlobalLoaded()}}}},O=[],Q=function(a,c){var d=O,e=d.length;d.push(a);for(var f=e;0<=--f&&!(d[f]===a&&d[f].status>=n.STATUS_DECLARED););if(0<=
|
||||
f){if(b._checkLoad){var g;System.out.println("cycle found loading "+c+" for "+a)}for(;f<e;f++){var h=d[f];h.status=n.STATUS_LOAD_COMPLETE;P(h);for(g=0;g<h.parents.length;g++)updateNode(h.parents[g]);h.parents=[];var j=h.onLoaded;b._checkLoad&&(g="cycle setting status to LOAD_COMPLETE for "+h.name+(j?" firing "+j.toString():""),System.out.println(g));j&&(h.onLoaded=null,j())}d.length=0;return!0}h=[a.musts,a.optionals];for(g=0;2>g;g++){j=h[g];for(f=j.length;0<=--f;)if(j[f].status==n.STATUS_DECLARED&&
|
||||
Q(j[f],c))return!0}d.length=e;return!1};b._classCountPending=0;b._classCountOK=0;b._classPending={};b.showPending=function(){var a=[],c;for(c in b._classPending){var d=C(c);d?(a.push(d),System.out.println(R("","",d,"",0))):alert("No node for "+c)}return a};var R=function(a,b,c,d,e){b+="--"+c.name;a+=b+"\n";if(5<e)return a+(d+" ...\n");d+="\t";a+=d+"status: "+c.status+"\n";if(c.parents&&c.parents.length&&c.parents[0]&&c.parents[0].name){a+=d+"parents: "+c.parents.length+"\n";for(var f=0;f<c.parents.length;f++)a=
|
||||
R(a,b,c.parents[f],d+"\t",e+1);a+="\n"}return a};updateNode=function(a){if(!a.name||a.status>=n.STATUS_LOAD_COMPLETE)P(a);else{var c=!0;if(a.musts.length&&a.declaration)for(var d=a.musts.length,e=d;0<=--e;){var f=a.musts[e];f.requiredBy=a;if(f.status<n.STATUS_DECLARED&&isClassDefined(f.name)){var g=[];f.status=n.STATUS_LOAD_COMPLETE;P(f);if(f.declaration&&f.declaration.clazzList){for(var h=0,j=f.declaration.clazzList,k=j.length;h<k;h++){var l=C(j[h]);l&&(l.status!=n.STATUS_LOAD_COMPLETE&&l!==f)&&
|
||||
(l.status=f.status,l.declaration=null,P(l),l.onLoaded&&g.push(l))}f.declaration=null}f.onLoaded&&g.push(f);for(h=0;h<g.length;h++)if(j=g[h].onLoaded)g[h].onLoaded=null,j()}else f.status==n.STATUS_CONTENT_LOADED&&updateNode(f),f.status<n.STATUS_DECLARED&&(c=!1);a.musts.length!=d&&(e=d=a.musts.length,c=!0)}if(c){if(a.status<n.STATUS_DECLARED){if(e=a.declaration)e(),e.executed=!0;b._checkLoad&&b._classPending[a.name]&&(delete b._classPending[a.name],b._classCountOK,b._classCountPending--);a.status=n.STATUS_DECLARED;
|
||||
u&&(u[a.name]=!0);b.onScriptInitialized(a.path);if(a.declaration&&a.declaration.clazzList){h=0;j=a.declaration.clazzList;for(k=j.length;h<k;h++)if((l=C(j[h]))&&l.status!=n.STATUS_DECLARED&&l!==a)l.status=n.STATUS_DECLARED,u&&(u[l.name]=!0),b.onScriptInitialized(l.path)}}c=n.STATUS_DECLARED;if(0==a.optionals.length&&0==a.musts.length||a.status>n.STATUS_KNOWN&&!a.declaration||S(a.musts,n.STATUS_LOAD_COMPLETE)&&S(a.optionals,n.STATUS_LOAD_COMPLETE)){c=n.STATUS_LOAD_COMPLETE;if(!T(a,c))return!1;if(a.declaration&&
|
||||
a.declaration.clazzList){h=0;j=a.declaration.clazzList;for(k=j.length;h<k;h++)if((l=C(j[h]))&&l.status!=c&&l!==a)if(l.declaration=null,!T(l,c))return!1}}if(a.parents&&a.parents.length){for(e=0;e<a.parents.length;e++)h=a.parents[e],h.status<c&&updateNode(h,h.name);c==n.STATUS_LOAD_COMPLETE&&(a.parents=[])}}}};var S=function(a,b){for(var c=a.length;0<=--c;)if(a[c].status<b)return!1;return!0},T=function(a,c){a.status=c;b.onScriptCompleted(a.path);var d=a.onLoaded;if(d&&(a.onLoaded=null,d(),!b.keepOnLoading))return!1;
|
||||
P(a);return!0},V={"r0.13412":1},X=function(){for(;;){var a=Math.random(),b="r"+a;if(!V[b])return V[b]=1,d.random=a}},C=function(a){X();return Y(a,d)},pa=function(a){X();return da(d,a)},oa=function(a){return aa(d,a)},Y=function(a,b){var c;return b.name==a?b:(c=Z(a,b.musts))||(c=Z(a,b.optionals))?c:null},Z=function(a,b){for(var c=d.random,e=b.length;0<=--e;){var f=b[e];if(f.name==a||f.random!=c&&(f.random=c,f=Y(a,f)))return f}return null},ka=function(a,b){return a.status==b&&(b!=n.STATUS_KNOWN||!e[a.path])&&
|
||||
(b==n.STATUS_DECLARED||!isClassDefined(a.name))},aa=function(a,b){for(var c=a.musts.length;0<=--c;){var d=a.musts[c];if(ka(d,b)||(d=aa(d,b)))return d}return ka(a,b)?a:null},da=function(a,b){var c;return(c=ea(a.musts,b))||(c=ea(a.optionals,b))||ka(c=a,b)?c:null},ea=function(a,b){if(a)for(var c=d.random,e=0;e<a.length;e++){var f=a[e];if(ka(f,b)||f.random!=c&&(f.random=c,f=da(f,b)))return f}return null},qa=function(a,c,e,f){if(c instanceof Array){v(c);for(var g=0;g<c.length;g++)qa(a,c[g],e,f,c)}else{b._checkLoad&&
|
||||
!b._classPending[c]&&(b._classPending[c]=1,0==b._classCountPending++&&(b._classCountOK=0),System.out.println("Loading class "+c));g=y["#"+c];g||(g=(g=C(c))?g:new n,g.name=c,g.path=w["#"+c]||"unknown",ga(g.path,c,g),g.status=n.STATUS_KNOWN,ca(d,g,!1));fa(g,a,!0);5==arguments.length&&f&&(f.status=g.status,f.clazzList=arguments[4]);if(g.declaration=f)g.status=n.STATUS_CONTENT_LOADED;fa(g,e,!1)}},fa=function(a,b,c){if(b&&b.length){v(b);for(var d=0;d<b.length;d++){var e=b[d];if(e&&!isClassDefined(e)&&
|
||||
!A["@"+e]){var f=C(e);f||(f=new n,f.name=e,f.status=n.STATUS_KNOWN);f.requiredBy=a;ca(a,f,c)}}}};window.Clazz?a.load=qa:b.load=qa;var ga=function(a,b,c){var d="@"+a;if(a=y[d])if(a instanceof Array){for(var d=!1,e=0;e<a.length;e++)if(a[e].name==b){d=!0;break}d||a.push(c)}else y[d]=[a,c];else y[d]=c;y["#"+b]=c},ja=function(a){var c=a.name;if(!isClassDefined(c)&&!A["@"+c]){var d=b.getClasspathFor(c);a.path=d;ga(d,c,a);if(!e[d])return F(a,d,a.requiredBy,!1),!0}return!1},ba=b.runtimeKeyClass="java.lang.String",
|
||||
ma=[];b.getJ2SLibBase=function(){var a=window["j2s.lib"];return a?a.base+("."==a.alias?"":(a.alias?a.alias:a.version?a.version:"1.0.0")+"/"):null};var ia=!0,ha=!1,na=-1;b.MODE_SCRIPT=4;b.MODE_XHR=2;b.MODE_SYNC=1;b.setLoadingMode=function(a,c){var d=!0,e=!0;"string"==typeof a?(a=a.toLowerCase(),0<=a.indexOf("script")?e=!1:a.indexOf("async"),d=!1):a&b.MODE_SCRIPT?e=!1:d=!(a&b.MODE_SYNC);ha=e;na=(ia=d)&&0<=c?c:-1;return d};var ta=function(){if(!z&&isClassDefined(ba)){for(var a=ma,c=0;c<a.length;c++)b.loadClass(a[c][0],
|
||||
a[c][1]);ma=[]}};b.loadZJar=function(a,c){var d=null,e=c instanceof Array;e?c=c[c.length-1]:d=c==ba?ta:null;b.jarClasspath(a,e?c:[c]);b.loadClass(c,d,!0)};var ua={},ra=[],ca=function(a,b,c){var e=!1;c?(c=a.musts,b.requiredBy||(b.requiredBy=a)):c=a.optionals;ua[b.name]||(ra.push(b),ua[b.name]=b);for(var f=0;f<c.length;f++)if(c[f].name==b.name){e=!0;break}e||(c.push(b),H&&(0!=b.name.indexOf("java")&&0!=b.name.indexOf("net.sf.j2s.ajax"))&&(N&&(H=!1),N=!0));a:{if(a.name&&a!=d&&a!=b)for(e=0;e<b.parents.length;e++)if(b.parents[e].name==
|
||||
a.name)break a;b.parents.push(a)}},P=function(a){var b=a.parents;if(b)for(var c=b.length;0<=--c;)la(b[c].musts,a)||la(b[c].optionals,a)};a.binaryFolders=b.binaryFolders=[b.getJ2SLibBase()]})(a,a._Loader);a._LoaderProgressMonitor={};var y=a._LoaderProgressMonitor,F=null,K=0,v=null,Q=0;y.DEFAULT_OPACITY=j&&j._j2sLoadMonitorOpacity?j._j2sLoadMonitorOpacity:55;y.hideMonitor=function(){v.style.display="none"};y.showStatus=function(a,b){if(!v){var c=document.createElement("DIV");c.id="_Loader-status";c.style.cssText=
|
||||
"position:absolute;bottom:4px;left:4px;padding:2px 8px;z-index:"+(window["j2s.lib"].monitorZIndex||1E4)+";background-color:#8e0000;color:yellow;font-family:Arial, sans-serif;font-size:10pt;white-space:nowrap;";c.onmouseover=ra;v=c;document.body.appendChild(c);da||(da=!0)}ea(v);if(null==a)b?M():y.hideMonitor();else{v.appendChild(document.createTextNode(""+a));"none"==v.style.display&&(v.style.display="");fa(y.DEFAULT_OPACITY);var d,c=navigator.userAgent;d=document.body;var e=d.parentNode,f=e.clientHeight;
|
||||
d=d.scrollTop+d.offsetTop;var g=e.scrollTop+e.offsetTop,c=0>c.indexOf("Opera")&&document.all?0==f?d:g:0>c.indexOf("Gecko")?f==e.offsetHeight&&f==e.scrollHeight?d:g:d;Q!=c&&(Q=c,v.style.bottom=Q+4+"px");b&&M()}};var ea=function(a){if(a)for(var b=a.childNodes.length;0<=--b;){var c=a.childNodes[b];if(c){c.childNodes&&c.childNodes.length&&ea(c);try{a.removeChild(c)}catch(d){}}}},fa=function(a){F&&a==y.DEFAULT_OPACITY&&(window.clearTimeout(F),F=null);K=a;navigator.userAgent.toLowerCase();v.style.filter=
|
||||
"Alpha(Opacity="+a+")";v.style.opacity=a/100},ra=function(){y.hideMonitor()},da=!1,M=function(){"none"!=v.style.display&&(K==y.DEFAULT_OPACITY?(F=window.setTimeout(function(){M()},750),K-=5):0<=K-10?(fa(K-10),F=window.setTimeout(function(){M()},40)):v.style.display="none")},p=a.Console,z=System;p.maxTotalLines=1E4;p.setMaxTotalLines=function(a){p.maxTotalLines=0<a?a:999999};p.maxLatency=40;p.setMaxLatency=function(a){p.maxLatency=0<a?a:40};p.pinning=!1;p.enablePinning=function(a){p.pinning=a};p.linesCount=
|
||||
0;p.metLineBreak=!1;p.createConsoleWindow=function(){var a=document.createElement("DIV");a.style.cssText="font-family:monospace, Arial, sans-serif;";document.body.appendChild(a);return a};var A=String.fromCharCode(160),A=A+(A+A+A);p.consoleOutput=function(a,b){var c=window["j2s.lib"];(c=c&&c.console)&&"string"==typeof c&&(c=document.getElementById(c));if(!c)return!1;if(p.linesCount>p.maxTotalLines){for(var d=0;d<p.linesCount-p.maxTotalLines;d++)c&&0<c.childNodes.length&&c.removeChild(c.childNodes[0]);
|
||||
p.linesCount=p.maxTotalLines}var e=!1;a=("undefined"==typeof a?"":null==a?"null":""+a).replace(/\t/g,A);if(0<a.length)switch(a.charAt(a.length-1)){case "\n":case "\r":a=1<a.length?a.substring(0,a.length-("\r"==a.charAt(a.length-2)?2:1)):"",e=!0}var f=null;a=a.replace(/\t/g,A);for(var f=a.split(/\r\n|\r|\n/g),d=0,g=f.length-1;d<=g;d++){var h=null;if(p.metLineBreak||0==p.linesCount||1>c.childNodes.length)h=document.createElement("DIV"),c.appendChild(h),h.style.whiteSpace="nowrap",p.linesCount++;else try{h=
|
||||
c.childNodes[c.childNodes.length-1]}catch(j){h=document.createElement("DIV"),c.appendChild(h),h.style.whiteSpace="nowrap",p.linesCount++}var k=document.createElement("SPAN");h.appendChild(k);k.style.whiteSpace="nowrap";b&&(k.style.color=b);h=f[d];0==h.length&&(h=A);k.appendChild(document.createTextNode(h));p.pinning||(c.scrollTop+=100);p.metLineBreak=d!=g||e}d=c.parentNode.className;!p.pinning&&(d&&-1!=d.indexOf("composite"))&&(c.parentNode.scrollTop=c.parentNode.scrollHeight);p.lastOutputTime=(new Date).getTime()};
|
||||
p.clear=function(){try{p.metLineBreak=!0;var a=window["j2s.lib"],b=a&&a.console;if(b&&(b=document.getElementById(b))){for(var c=b.childNodes,d=c.length;0<=--d;)b.removeChild(c[d]);p.linesCount=0}}catch(e){}};a.alert=function(a){p.consoleOutput(a+"\r\n")};z.out.print=function(a){p.consoleOutput(a)};z.out.println=function(a){p.consoleOutput("undefined"==typeof a?"\r\n":null==a?"null\r\n":a+"\r\n")};z.out.write=function(a,b,c){z.out.print(String.instantialize(a).substring(b,b+c))};z.err.__CLASS_NAME__=
|
||||
"java.io.PrintStream";z.err.print=function(a){p.consoleOutput(a,"red")};z.err.println=function(a){p.consoleOutput("undefined"==typeof a?"\r\n":null==a?"null\r\n":a+"\r\n","red")};z.err.write=function(a,b,c){z.err.print(String.instantialize(a).substring(b,b+c))}}(Clazz,Jmol))};Jmol.___JmolDate="$Date: 2018-02-07 23:40:37 -0600 (Wed, 07 Feb 2018) $";Jmol.___fullJmolProperties="src/org/jmol/viewer/Jmol.properties";Jmol.___JmolVersion="14.29.4";
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* Console application, which adds textdomain argument
|
||||
* to all i18n function calls
|
||||
*
|
||||
* @package wordpress-i18n
|
||||
*/
|
||||
error_reporting(E_ALL);
|
||||
|
||||
require_once dirname( __FILE__ ) . '/makepot.php';
|
||||
|
||||
class AddTextdomain {
|
||||
|
||||
var $modified_contents = '';
|
||||
var $funcs;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$makepot = new MakePOT;
|
||||
$this->funcs = array_keys( $makepot->rules );
|
||||
$this->funcs[] = 'translate_nooped_plural';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints CLI usage.
|
||||
*/
|
||||
public function usage() {
|
||||
$usage = "Usage: php add-textdomain.php [-i] <domain> <file>\n\nAdds the string <domain> as a last argument to all i18n function calls in <file>\nand prints the modified php file on standard output.\n\nOptions:\n -i Modifies the PHP file in place, instead of printing it to standard output.\n";
|
||||
fwrite(STDERR, $usage);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds textdomain to a single file.
|
||||
*
|
||||
* @see AddTextdomain::process_string()
|
||||
*
|
||||
* @param string $domain Text domain.
|
||||
* @param string $source_filename Filename with optional path.
|
||||
* @param bool $inplace True to modifies the PHP file in place. False to print to standard output.
|
||||
*/
|
||||
public function process_file( $domain, $source_filename, $inplace ) {
|
||||
$new_source = $this->process_string( $domain, file_get_contents( $source_filename ) );
|
||||
|
||||
if ( $inplace ) {
|
||||
$f = fopen( $source_filename, 'w' );
|
||||
fwrite( $f, $new_source );
|
||||
fclose( $f );
|
||||
} else {
|
||||
echo $new_source;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds textdomain to a string of PHP.
|
||||
*
|
||||
* Functions calls should be wrapped in opening and closing PHP delimiters as usual.
|
||||
*
|
||||
* @see AddTextdomain::process_tokens()
|
||||
*
|
||||
* @param string $domain Text domain.
|
||||
* @param string $string PHP code to parse.
|
||||
* @return string Modified source.
|
||||
*/
|
||||
public function process_string( $domain, $string ) {
|
||||
$tokens = token_get_all( $string );
|
||||
return $this->process_tokens( $domain, $tokens );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds textdomain to a set of PHP tokens.
|
||||
*
|
||||
* @param string $domain Text domain.
|
||||
* @param array $tokens PHP tokens. An array of token identifiers. Each individual token identifier is either a
|
||||
* single character (i.e.: ;, ., >, !, etc.), or a three element array containing the token
|
||||
* index in element 0, the string content of the original token in element 1 and the line
|
||||
* number in element 2.
|
||||
* @return string Modified source.
|
||||
*/
|
||||
public function process_tokens( $domain, $tokens ) {
|
||||
$this->modified_contents = '';
|
||||
$domain = addslashes( $domain );
|
||||
|
||||
$in_func = false;
|
||||
$args_started = false;
|
||||
$parens_balance = 0;
|
||||
$found_domain = false;
|
||||
|
||||
foreach($tokens as $index => $token) {
|
||||
$string_success = false;
|
||||
if (is_array($token)) {
|
||||
list($id, $text) = $token;
|
||||
if (T_STRING == $id && in_array($text, $this->funcs)) {
|
||||
$in_func = true;
|
||||
$parens_balance = 0;
|
||||
$args_started = false;
|
||||
$found_domain = false;
|
||||
} elseif (T_CONSTANT_ENCAPSED_STRING == $id && ("'$domain'" == $text || "\"$domain\"" == $text)) {
|
||||
if ($in_func && $args_started) {
|
||||
$found_domain = true;
|
||||
}
|
||||
}
|
||||
$token = $text;
|
||||
} elseif ('(' == $token){
|
||||
$args_started = true;
|
||||
++$parens_balance;
|
||||
} elseif (')' == $token) {
|
||||
--$parens_balance;
|
||||
if ($in_func && 0 == $parens_balance) {
|
||||
if ( ! $found_domain ) {
|
||||
$token = ", '$domain'";
|
||||
if ( T_WHITESPACE == $tokens[ $index - 1 ][0] ) {
|
||||
$token .= ' '; // Maintain code standards if previously present
|
||||
// Remove previous whitespace token to account for it.
|
||||
$this->modified_contents = trim( $this->modified_contents );
|
||||
}
|
||||
$token .= ')';
|
||||
}
|
||||
$in_func = false;
|
||||
$args_started = false;
|
||||
$found_domain = false;
|
||||
}
|
||||
}
|
||||
$this->modified_contents .= $token;
|
||||
}
|
||||
|
||||
return $this->modified_contents;
|
||||
}
|
||||
}
|
||||
|
||||
// Run the CLI only if the file wasn't included.
|
||||
$included_files = get_included_files();
|
||||
if ($included_files[0] == __FILE__) {
|
||||
$adddomain = new AddTextdomain();
|
||||
|
||||
if (!isset($argv[1]) || !isset($argv[2])) {
|
||||
$adddomain->usage();
|
||||
}
|
||||
|
||||
$inplace = false;
|
||||
if ('-i' == $argv[1]) {
|
||||
$inplace = true;
|
||||
if (!isset($argv[3])) $adddomain->usage();
|
||||
array_shift($argv);
|
||||
}
|
||||
|
||||
if ( is_dir( $argv[2] ) ) {
|
||||
$directory = new RecursiveDirectoryIterator( $argv[2], RecursiveDirectoryIterator::SKIP_DOTS );
|
||||
$files = new RecursiveIteratorIterator( $directory );
|
||||
foreach ( $files as $file ) {
|
||||
if ( 'php' === $file->getExtension() ) {
|
||||
$adddomain->process_file( $argv[1], $file->getPathname(), $inplace );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$adddomain->process_file( $argv[1], $argv[2], $inplace );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
<?php
|
||||
|
||||
class jsMol2wp{
|
||||
|
||||
var $fileURL = '';
|
||||
var $instance = 0;
|
||||
var $acc = '';
|
||||
var $appletID = '';
|
||||
var $type = '';
|
||||
var $load = '';
|
||||
|
||||
public function __construct($acc, $type, $caption, $id, $fileURL, $isosurface){
|
||||
$this->path = plugins_url().'/jsmol2wp/';
|
||||
$this->acc = $acc;
|
||||
$this->type = $type;
|
||||
$p = get_post();
|
||||
# determine the instance if there are multiple copies
|
||||
# of the shortcode in this post
|
||||
# we want to do this without preg_match to work on different PHP versions
|
||||
$m = explode('[jsmol', get_the_content());
|
||||
array_shift($m);
|
||||
foreach($m as $i => $match){
|
||||
$t = explode(']', $match);
|
||||
# there could be nested shortcodes or other shortcodes in the text
|
||||
# but trim off what is safe to trim off
|
||||
if(count($t) > 1){
|
||||
array_pop($t);
|
||||
$match = implode(']', $t);
|
||||
}
|
||||
# odd bug requires recasting as a string to get stripos to work
|
||||
$match = (string)$match;
|
||||
# catenate the post_id to the instance to make the id unique
|
||||
# when displaying multiple posts per page
|
||||
|
||||
if( ($acc == '' || stripos($match, $acc) > 0 ) &&
|
||||
($caption == '' || stripos($match, $caption) > 0) &&
|
||||
($fileURL == '' || stripos($match, $fileURL) > 0) &&
|
||||
($isosurface == '' || stripos($match, $isosurface) > 0) &&
|
||||
($id == '' || stripos($match, $id) > 0)
|
||||
) $this->instance = $p->ID."_$i";
|
||||
}
|
||||
|
||||
if($fileURL != ''){
|
||||
# use a passed url if it's there
|
||||
$this->fileURL = $fileURL;
|
||||
}else{
|
||||
# otherwise, look for an attachment
|
||||
# $attachment = get_page_by_title($acc, OBJECT, 'attachment' );
|
||||
$attachment = self::getAttachmentPost("$acc.$type");
|
||||
if(!is_null($attachment) && isset($attachment->guid)){
|
||||
$this->fileURL = $attachment->guid;
|
||||
}
|
||||
}
|
||||
$this->isosurface = $isosurface;
|
||||
if($isosurface != ''){
|
||||
# isosurface will be an uploaded file or a URL
|
||||
# replace if it's an attachment
|
||||
$attachment = self::getAttachmentPost($isosurface);
|
||||
if(!is_null($attachment) && isset($attachment->guid)){
|
||||
$this->isosurface = $attachment->guid;
|
||||
}
|
||||
}
|
||||
$this->appletID = "jmolApplet".$this->instance;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function makeViewer($acc, $type, $load, $caption, $commands, $wrap, $debug){
|
||||
# not used?
|
||||
$mydiv = "myDiv".$this->instance;
|
||||
# initialize output
|
||||
$html = "";
|
||||
$template = $this->getTemplate($load);
|
||||
$template = str_replace('jmolApplet0',$this->appletID, $template );
|
||||
$template = str_replace('XXXX',$acc, $template );
|
||||
$template = str_replace('__caption__',$caption, $template );
|
||||
$template = $this->makeScriptButtons($commands, $template, $wrap);
|
||||
$html .= $template;
|
||||
if($debug != 'false'){
|
||||
$html .= $this->debug($debug);
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function makeScriptButtons($commands, $template, $wrap = 4){
|
||||
$buttons = '';
|
||||
$customButtons = '';
|
||||
$jmolCommandInput = '';
|
||||
$notButtons = 0;
|
||||
$applet = $this->appletID;
|
||||
$commands = str_replace("\n",' ', strip_tags($commands));
|
||||
if($commands != ''){
|
||||
$commandsSet = explode('|||', $commands);
|
||||
foreach($commandsSet as $i => $command){
|
||||
list($label, $script) = explode('=', $command."=",2);
|
||||
$label = trim($label);
|
||||
$script = trim($script,"\n=");
|
||||
# if there is no script, assume that the line is raw Jmol script
|
||||
switch($label){
|
||||
case '':
|
||||
# if label is not set, we assume the user wants Jmol script not
|
||||
# wrapped in a button
|
||||
$buttons .= "Jmol.script($applet,\"$script\");\n";
|
||||
# if it's the first one, append to the load for the reset script
|
||||
if($i == 0) $this->load .= $script;
|
||||
$notButtons++;
|
||||
break;
|
||||
case 'jmolCommandInput':
|
||||
# this is a special case to add a command line input
|
||||
$jmolCommandInput .= "Jmol.jmolCommandInput($applet);\n";
|
||||
$notButtons++;
|
||||
break;
|
||||
default:
|
||||
$customButtons .= "jmolButton('$script','$label')\n";
|
||||
}
|
||||
$j = $i-$notButtons;
|
||||
if($j%$wrap == 0 && $j != 0) $customButtons .= "jmolBr();\n";
|
||||
}
|
||||
}
|
||||
if(strpos($this->load, 'isosurface') > 0){
|
||||
$buttons .= 'jmolButton("if(surfaceflag == false);isosurface on;surfaceflag = true;else;isosurface off;surfaceflag = false;endif","isosurface");';
|
||||
}
|
||||
$buttons .= "jmolButton('reset;select all;$this->load','reset')\njmolBr();\n";
|
||||
$buttons .= $customButtons;
|
||||
$buttons .= $this->standardButtons($wrap).$jmolCommandInput;
|
||||
$template = str_replace('__commands__',$buttons, $template );
|
||||
return $template;
|
||||
}
|
||||
/*
|
||||
jmolBr() to make $wrap buttons/row
|
||||
*/
|
||||
function standardButtons($wrap){
|
||||
$str = "Jmol.setButtonCss(null,\"style='width:100px'\")\n";
|
||||
$stdButtons = array();
|
||||
switch ($this->type){
|
||||
case 'pdb':
|
||||
$stdButtons = explode("\n",
|
||||
'jmolButton("color cpk", "'.__('color cpk','jsmol2wp').'");
|
||||
jmolButton("color group", "'.__('color group','jsmol2wp').'");
|
||||
jmolButton("color amino", "'.__('color amino','jsmol2wp').'");
|
||||
jmolButton("color structure", "'.__('color structure','jsmol2wp').'");
|
||||
jmolButton("trace only");
|
||||
jmolButton("cartoon only");
|
||||
jmolButton("backbone only");
|
||||
jmolButton("spacefill 23%;wireframe 0.15","ball&stick");'
|
||||
);
|
||||
break;
|
||||
default:
|
||||
$stdButtons = explode("\n",
|
||||
'jmolButton("color cpk");
|
||||
jmolButton("color grey");
|
||||
jmolButton("spacefill","spacefill");
|
||||
jmolButton("if(dotsflag);dots off;dotsflag = false;else;dots on;dotsflag = true;endif","dots");
|
||||
jmolButton("spacefill off;wireframe 0.15","wireframe");
|
||||
jmolButton("spacefill 23%;wireframe 0.15","ball&stick");'
|
||||
);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
foreach($stdButtons as $i => $button){
|
||||
if($i%$wrap == 0 && $i != 0) $str .= "jmolBr();\n";
|
||||
$str .= $button;
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
/*
|
||||
Gets the template and creates the molecule load and format commands
|
||||
*/
|
||||
function getTemplate($load){
|
||||
$template = file_get_contents(dirname(__FILE__).'/jsmol_template.htm');
|
||||
# if load is set, it is used and we don't guess
|
||||
if($load != ''){
|
||||
$loadStr = $load;
|
||||
}else{
|
||||
# otherwise try to guess the right load string
|
||||
$loadStr = '';
|
||||
if($this->load != ''){
|
||||
$loadStr = $this->load;
|
||||
}else{
|
||||
if($this->acc != '' && ($this->acc{0} == '$'||$this->acc{0} == ':')){
|
||||
$loadStr = "load $this->acc;spacefill 23%;wireframe 0.15;color cpk;spin off;";
|
||||
$this->type = 'mol';
|
||||
}
|
||||
# if the type is pdb, look for it at rcsb.org
|
||||
if($this->type == 'pdb'){
|
||||
$loadStr = "load \"https://files.rcsb.org/view/$this->acc.pdb\";";
|
||||
}
|
||||
# if there is a local file, override the guessed remote load and if needed, guess the type
|
||||
if($this->fileURL != ''){
|
||||
$this->type = pathinfo($this->fileURL, PATHINFO_EXTENSION);
|
||||
$loadStr = "load $this->fileURL;";
|
||||
}
|
||||
# add the default format
|
||||
switch ($this->type){
|
||||
case 'obj':
|
||||
#this is going to only be with a fileURL?
|
||||
$loadStr = str_replace(
|
||||
"load",
|
||||
"isosurface OBJ ",
|
||||
$loadStr);
|
||||
$loadStr .= " spacefill 23%;wireframe 0.15;color cpk;spin off;";
|
||||
break;
|
||||
case 'xyz':
|
||||
case 'mol':
|
||||
case 'mol2':
|
||||
#change the default load coloring and display
|
||||
$loadStr .= ' spacefill 23%;wireframe 0.15;color cpk;spin off;';
|
||||
break;
|
||||
case 'mrc':
|
||||
return "Support for binary type: $this->type is not implemented yet";
|
||||
break;
|
||||
case 'pdb':
|
||||
$loadStr .= ' spacefill off;wireframe off;cartoons on;color structure;spin off;';
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
# add isosurface if it's present
|
||||
if($this->isosurface != ''){
|
||||
$loadStr .= " isosurface $this->isosurface;";
|
||||
}
|
||||
# add the acc label
|
||||
if($this->acc != '') $loadStr .= "set echo top center; echo ".ltrim($this->acc,'$:').';';
|
||||
|
||||
# save the loadstr for use by the reset button. Do this before set lang if needed
|
||||
$this->load = $loadStr;
|
||||
|
||||
# set default language if available from WP
|
||||
$lang = get_locale();
|
||||
if($lang != 'en_US'){
|
||||
$loadStr = "set language $lang;".$loadStr;
|
||||
}
|
||||
$template = str_replace('__load__', $loadStr, $template);
|
||||
$template = str_replace('http://chemapps.stolaf.edu/jmol/jsmol/',$this->path, $template );
|
||||
$template = str_replace('__j2s__',$this->path."j2s", $template );
|
||||
# button text
|
||||
$template = str_replace('__toggle_spin__',__('Toggle Spin', 'jsmol2wp'), $template );
|
||||
|
||||
|
||||
# help file link
|
||||
|
||||
$template = str_replace('__help__', "<a href='$this->path/help.htm'>".__('About/Help','jsmol2wp')."</a>", $template );
|
||||
return $template;
|
||||
}
|
||||
|
||||
static function getAttachmentPost($filename){
|
||||
$attachment = null;
|
||||
$args = array('post_type' => 'attachment', 'posts_per_page'=>-1, 'post_status' => 'any', 'post_parent' => null);
|
||||
$media = get_posts( $args );
|
||||
foreach($media as $p){
|
||||
$attFileName = basename($p->guid);
|
||||
if($filename == $attFileName){
|
||||
$attachment = $p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
wp_reset_postdata();
|
||||
# if the above fails, check for a case where the extension was not given in type
|
||||
if(is_null($attachment)) $attachment = get_page_by_title($filename, OBJECT, 'attachment' );
|
||||
return $attachment;
|
||||
}
|
||||
|
||||
function debug($debug){
|
||||
$str = '<pre>';
|
||||
# file path
|
||||
switch($debug){
|
||||
case 'short':
|
||||
$str .= "applet ID: $this->appletID\n";
|
||||
$str .= "acc: $this->acc\n";
|
||||
$str .= "type:$this->type\n";
|
||||
break;
|
||||
case 'full':
|
||||
default:
|
||||
$str .= print_r($this,true);
|
||||
$dirpath = dirname(__FILE__);
|
||||
$str .= "Directory path:$dirpath\n";
|
||||
$fileTests = array(
|
||||
'JSmol.min.nojq.js' => "$this->path",
|
||||
'package.js' => "$this->path/j2s/core/"
|
||||
);
|
||||
|
||||
$str .= "test whether various files are readable by wp_remote_fopen\n";
|
||||
foreach($fileTests as $file => $path){
|
||||
if(!wp_remote_fopen("$path$file")){
|
||||
$str .= "can't load $path$file\n";
|
||||
}else{
|
||||
$str .= "$file load OK\n";
|
||||
}
|
||||
}
|
||||
$str .= 'file_get_contents: ';
|
||||
$str .= file_get_contents(__FILE__) ? 'Enabled' : 'Disabled';
|
||||
if($this->fileURL != ''){
|
||||
$str .= "\npath to uploaded file:".$this->fileURL."\n";
|
||||
$tmp = wp_remote_fopen($this->fileURL);
|
||||
$str .= "Excerpt from file:".substr($tmp, 0, 20)."...\n";
|
||||
$attachment = get_page_by_title($this->acc, OBJECT, 'attachment' );
|
||||
if(is_null($attachment)) $str .= "attachment for $this->acc not found\n";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$str .= "</pre>";
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin:5px;
|
||||
padding:5px;
|
||||
}
|
||||
158
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/help.htm
Normal file
158
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/help.htm
Normal file
@@ -0,0 +1,158 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>About JSmol2wp</title>
|
||||
<meta name="generator" content="BBEdit 10.5" />
|
||||
<link rel="stylesheet" type="text/css" href="css/help.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h2>About JSmol2wp</h2>
|
||||
<p>This Wordpress plugin is based on the <a href="http://wiki.jmol.org/index.php/Jmol_JavaScript_Object#JSmol">JSmol molecular graphics viewer</a> from Bob Hanson, Zhou Renjian, and Takanori Nakane. Adaptation of JSmol to a Wordpress plugin was started by Jim Hu in June 2014. JSmol2wp should be considered beta!!! Use at your own risk and please report problems.</p>
|
||||
|
||||
<p>This is a shortcode extension. Use</p><pre>[jsmol pdb='<em>accession</em>']</pre><p> for a minimal version showing macromolecule structures from the PDB.</p>
|
||||
|
||||
<h2>Installation</h2>
|
||||
<span style="color: #ff0000;"><b>Warning: JSmol2wp alters the allowed MIME types for uploaded files to include chemical/pdb, whether or not you ever use the shortcode!!</b>.</span>
|
||||
|
||||
Installation is typical for Wordpress plugins not yet in the Wordpress ecosystem.
|
||||
<ul>
|
||||
<li>Obtain the zip archive from <a href="https://github.com/jimhu-tamu/wordpress/tree/master/plugins">github</a>.</li>
|
||||
<li>From plugins control, click Add new</li>
|
||||
<li>Select upload and upload the zip file</li>
|
||||
<li>Activate it.</li>
|
||||
</ul>
|
||||
<h2>Usage</h2>
|
||||
<h3>Loading a structure</h3>
|
||||
<h4>Proteins remotely from the pdb</h4>
|
||||
<pre>[jsmol pdb='<em>accession</em>']</pre><p> is equivalent to</p> <pre>[jsmol acc='<em>accession</em>' type='pdb']</pre>
|
||||
<h4>Small molecules remotely from NCI and from PubChem</h4>
|
||||
<div style='float:right;width:300px;border-style:solid;border-width:1px;padding:5px;font-size:small;'><img src = 'images/jsmol-1.png' width=300px><p>Figure 1. Screenshot of JSmol2wp viewer for a small molecule</p></div>
|
||||
<p>Jmol can look up small molecules by name at the NCI resolver (<a href="http://cactus.nci.nih.gov/chemical/structure">http://cactus.nci.nih.gov/chemical/structure</a>). Use</p>
|
||||
|
||||
<pre>[jsmol acc = $<em>name</em>]</pre>
|
||||
|
||||
where name is a molecule name. For example, acc='$tryptophan' loads the tryptophan structure (Figure 1).</p>
|
||||
<p>Alternatively, you can use the NCBI PubChem server with:
|
||||
</p>
|
||||
<pre>[jsmol acc = :<em>name</em>]</pre>
|
||||
|
||||
<h4>From files uploaded to your media library</h4>
|
||||
JSmol2wp can also work with files that are uploaded to your media library. JSmol2wp modifies your Wordpress installation to allow additional mime types to be uploaded. The following have been added so far:
|
||||
<ul>
|
||||
<li>.pdb = 'chemical/x-pdb'</li>
|
||||
<li>.cif' = 'chemical/x-cif'</li>
|
||||
<li>.cml = 'chemical/x-cml+xml'</li>
|
||||
<li>.jvxi = 'chemical/x-jvxi'</li>
|
||||
<li>.mol = 'chemical/x-mdl-molfile'</li>
|
||||
<li>.mol2 = 'chemical/x-mol2'</li>
|
||||
<li>.xyz = 'chemical/x-xyz'</li>
|
||||
<li>.ccp4 = 'text/ccp4'</li>
|
||||
</ul>
|
||||
<p>If you use acc=<em>accession</em> and type=<em>extension</em>; JSmol2wp uses these to find the matching filename among the Wordpress uploaded media files. JSmol2wp will look to see if a file has been uploaded to your wordpress and it will use that file if it can find it. Example </p>
|
||||
<pre>[jsmol acc='caffeine' type='mol']</pre>
|
||||
<p>Will look for an uploaded file named caffeine.mol. If it can't find a matching post for an uploaded attachment and type=pdb, it will try <a href="http://rcsb.org/pdb">http://rcsb.org/pdb</a>. If it can't find a match there either, you'll get an error message in the JSmol window.</p>
|
||||
<h4>telling JSmol2wp where to look for a data file</h4>
|
||||
<p>Alternatively, you can point JSmol2wp to a file path that is not in your media library. You can use</p>
|
||||
<pre>fileurl='http://path_to_file'</pre>
|
||||
|
||||
<p>to force JSmol2wp to use that file. You can use any file with a publicly accessible URL</p>
|
||||
<h3>Add a caption</h3>
|
||||
<p>The captions parameter adds a text caption above the applet viewer.</p>
|
||||
<h3>Commands and buttons</h3>
|
||||
<p>JSmol2wp will always put a set of standard buttons below your viewer. It will try to guess which set of buttons to use, depending on whether you are loading a protein or a small molecule. This is determined by type (pdb or anything else)</p>
|
||||
<p>The commands parameter allows you to run additional Jmol commands on loading or create buttons that will run commands. Separate commands with three pipes ( '|||")</p>
|
||||
<h4>Commands syntax</h4>
|
||||
<p>Individual ommands have the format label=script, where label is the text you want on the button, and script is the Jmol script you want to run.JSmol2wp parses these, first by splitting on the ||| string and then on the = character. There are three kinds of command pairs.</p>
|
||||
<ul>
|
||||
<li>JSmol2wp creates a button with the label. Clicking the button runs the script, unless:</li>
|
||||
<li>If the label is blank, JSmol2wp runs the script immediately. Use this to override the initialization on a per applet basis</li>
|
||||
<li>If the label is jmolCommandInput JSmol2wp appends a command input box at the bottom.</li>
|
||||
</ul>
|
||||
<h3>Debugging problems</h3>
|
||||
<p>add debug=value where the value can be:</p>
|
||||
<ul>
|
||||
<li>short: just shows
|
||||
<ul>
|
||||
<li>the applet id</li>
|
||||
<li>the accession</li>
|
||||
<li>the type</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>full: dumps the jsmol2wp object and runs other tests.</li>
|
||||
</ul>
|
||||
<h3>Additional parameters</h3>
|
||||
<div style='float:right;width:300px;border-style:solid;border-width:1px;padding:5px;font-size:small;'><img src = 'images/jsmol-2.png' width=300px><p>Figure 2. Screenshot of JSmol2wp viewer for a with an isosurface loaded from a local file</p></div>
|
||||
<p>JSmol2wp can take additional optional parameters:</p>
|
||||
<ul>
|
||||
<li>acc: accession. Use as an alternative to pdb=, and use this for accessions that are not pdb files.</li>
|
||||
<li>type: the type of viewer. Default = pdb. JSmol will try to guess what you want for the default view.</li>
|
||||
<li>wrap: the number of buttons to put in each row. default = 4</li>
|
||||
<li>id: use this to distinguish multiple copies of the shortcode if needed</li>
|
||||
<li>isosurface: filename of an uploaded file, or a URL for an isosurface.</li>
|
||||
<li>load: override the how JSmol does its loading with your own Jmol commands.</li>
|
||||
<li>debug: show information about paths to required js files. default = false</li>
|
||||
</ul>
|
||||
<p>Figure 2 shows a structure and isosurface loaded from files uploaded to a local directory outside the Wordpress uploads path. The markup is:</p>
|
||||
<pre>[jsmol acc='isosurface_example'
|
||||
caption="Isosurface test from Henry Rzepa"
|
||||
fileurl='http://localhost/tmp/s_den.cub_.xyz'
|
||||
isosurface='http://localhost/tmp/s_den.cub_.jvxl']
|
||||
</pre>
|
||||
<p>Note that in this example, the acc parameter isn't really an accession. It's only being used to create a text label in the applet viewer.</p>
|
||||
<br clear='all'>
|
||||
<h2>Examples</h2>
|
||||
<h3>Basic</h3>
|
||||
<pre>[jsmol pdb='1LMB' caption='lambda repressor headpiece']</pre>
|
||||
<h3>Advanced</h3>
|
||||
<div style='float:right;width:300px;border-style:solid;border-width:1px;padding:5px;font-size:small;'><img src = 'images/jsmol-3.png' width=300px><p>Figure 2. Screenshot of JSmol2wp viewer for a protein, with custom command/script execution buttons</p></div>
|
||||
<p>Figure 3 is a screenshot of the sample viewer in this example post <a href="http://biochemistry.tamu.edu/jsmol2wp/">here</a>. The markup for the lambda repressor example in that post is:</p>
|
||||
<pre>[jsmol pdb='1LMB' caption='&lambda; repressor headpiece'
|
||||
commands='
|
||||
arm = select 1-6:3, 1-6:4;color yellow;|||
|
||||
helix-turn-helix = select 33-52:3, 33-52:4; color yellow; hide hoh;|||
|
||||
helix 5 = select *:3,*:4; spacefill off; cartoon; select 84,87; color yellow;
|
||||
spacefill on; select *;
|
||||
hide hoh; hide *:1,*:2;
|
||||
#moveto 2 0 1 0 0 0 0;
|
||||
zoomto (84:4) 300;|||
|
||||
DNA only =
|
||||
display all;
|
||||
hide protein;|||
|
||||
Protein only =
|
||||
hide all;
|
||||
display protein;|||
|
||||
DNA interaction =
|
||||
hide all;
|
||||
display 33-52:3, 33-52:4, 1-6:3, 1-6:4, *:1, *:2;
|
||||
cartoon only;
|
||||
select 40-52:4;
|
||||
spacefill 23%;
|
||||
wireframe 0.15;
|
||||
color cpk;
|
||||
zoomto (45:4) 300;
|
||||
']
|
||||
</pre>
|
||||
<p>This creates six custom buttons based on the text from the shortcode, and a reset button that tries to restore the original view. A lot of the suboptimal behavior of those buttons is from my lack of mastery of Jmol scripting. Note that Jmol commands can be used to load command sets from files.</p>
|
||||
|
||||
<h2>Known issues</h2>
|
||||
<ul>
|
||||
<li>Some themes will add HTML tags inside the scripting stanzas created by JSmol2wp. This can cause the plugin to fail. You can detect this by viewing source in your favorite browser. Please let me know what theme caused the problem, and if it's a free one Ican do some testing to see if we can overcome the problem.</li>
|
||||
<li>HTML entities to make symbols in the captions can behave oddly if you edit the post with the visual editor.</li>
|
||||
<li>Accessions can't have spaces.</li>
|
||||
</ul>
|
||||
<h2>Please report bugs</h2>
|
||||
at <a href="https://github.com/jimhu-tamu/wordpress">GitHub</a> or send a tweet to @jimhu
|
||||
<h2>See also</h2>
|
||||
<ul>
|
||||
<li><a href="http://wiki.jmol.org">Jmol and JSmol wiki</a></li>
|
||||
<li><a href="http://chemapps.stolaf.edu/jmol/docs/#zoom">Jmol/JSmol scripting guide</a></li>
|
||||
<li><a href='http://wiki.jmol.org/index.php/Mouse_Manual'>mouse gestures</a></li>
|
||||
</ul>
|
||||
<h2>License</h2>
|
||||
JSmol2wp is available under the <a href="http://opensource.org/licenses/GPL-3.0">GPL-3.0 license</a>
|
||||
|
||||
this document updated by Jim Hu on June 23, 2014
|
||||
</body>
|
||||
</html>
|
||||
2601
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ar.po
Normal file
2601
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ar.po
Normal file
File diff suppressed because it is too large
Load Diff
2564
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/bs.po
Normal file
2564
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/bs.po
Normal file
File diff suppressed because it is too large
Load Diff
2649
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ca.po
Normal file
2649
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ca.po
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2643
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/cs.po
Normal file
2643
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/cs.po
Normal file
File diff suppressed because it is too large
Load Diff
2636
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/da.po
Normal file
2636
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/da.po
Normal file
File diff suppressed because it is too large
Load Diff
2661
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/de.po
Normal file
2661
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/de.po
Normal file
File diff suppressed because it is too large
Load Diff
2605
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/el.po
Normal file
2605
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/el.po
Normal file
File diff suppressed because it is too large
Load Diff
2636
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/en_GB.po
Normal file
2636
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/en_GB.po
Normal file
File diff suppressed because it is too large
Load Diff
2599
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/es.po
Normal file
2599
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/es.po
Normal file
File diff suppressed because it is too large
Load Diff
2575
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/et.po
Normal file
2575
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/et.po
Normal file
File diff suppressed because it is too large
Load Diff
2628
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/eu.po
Normal file
2628
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/eu.po
Normal file
File diff suppressed because it is too large
Load Diff
2647
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/fi.po
Normal file
2647
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/fi.po
Normal file
File diff suppressed because it is too large
Load Diff
2652
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/fr.po
Normal file
2652
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/fr.po
Normal file
File diff suppressed because it is too large
Load Diff
2564
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/fy.po
Normal file
2564
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/fy.po
Normal file
File diff suppressed because it is too large
Load Diff
2619
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/hu.po
Normal file
2619
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/hu.po
Normal file
File diff suppressed because it is too large
Load Diff
2568
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/hy.po
Normal file
2568
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/hy.po
Normal file
File diff suppressed because it is too large
Load Diff
2641
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/id.po
Normal file
2641
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/id.po
Normal file
File diff suppressed because it is too large
Load Diff
2650
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/it.po
Normal file
2650
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/it.po
Normal file
File diff suppressed because it is too large
Load Diff
2637
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ja.po
Normal file
2637
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ja.po
Normal file
File diff suppressed because it is too large
Load Diff
2585
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/jv.po
Normal file
2585
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/jv.po
Normal file
File diff suppressed because it is too large
Load Diff
2617
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ko.po
Normal file
2617
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ko.po
Normal file
File diff suppressed because it is too large
Load Diff
2641
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ms.po
Normal file
2641
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ms.po
Normal file
File diff suppressed because it is too large
Load Diff
2590
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/nb.po
Normal file
2590
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/nb.po
Normal file
File diff suppressed because it is too large
Load Diff
2641
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/nl.po
Normal file
2641
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/nl.po
Normal file
File diff suppressed because it is too large
Load Diff
2603
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/oc.po
Normal file
2603
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/oc.po
Normal file
File diff suppressed because it is too large
Load Diff
2605
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/pl.po
Normal file
2605
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/pl.po
Normal file
File diff suppressed because it is too large
Load Diff
2611
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/pt.po
Normal file
2611
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/pt.po
Normal file
File diff suppressed because it is too large
Load Diff
2654
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/pt_BR.po
Normal file
2654
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/pt_BR.po
Normal file
File diff suppressed because it is too large
Load Diff
2636
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ru.po
Normal file
2636
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ru.po
Normal file
File diff suppressed because it is too large
Load Diff
2599
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/sl.po
Normal file
2599
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/sl.po
Normal file
File diff suppressed because it is too large
Load Diff
2637
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/sv.po
Normal file
2637
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/sv.po
Normal file
File diff suppressed because it is too large
Load Diff
2578
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ta.po
Normal file
2578
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ta.po
Normal file
File diff suppressed because it is too large
Load Diff
2566
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/te.po
Normal file
2566
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/te.po
Normal file
File diff suppressed because it is too large
Load Diff
2626
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/tr.po
Normal file
2626
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/tr.po
Normal file
File diff suppressed because it is too large
Load Diff
2564
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ug.po
Normal file
2564
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/ug.po
Normal file
File diff suppressed because it is too large
Load Diff
2656
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/uk.po
Normal file
2656
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/uk.po
Normal file
File diff suppressed because it is too large
Load Diff
2532
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/uz.po
Normal file
2532
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/uz.po
Normal file
File diff suppressed because it is too large
Load Diff
2623
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/zh_CN.po
Normal file
2623
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/zh_CN.po
Normal file
File diff suppressed because it is too large
Load Diff
2627
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/zh_TW.po
Normal file
2627
CTF/Smol/wordpress.old/wp-content/plugins/jsmol2wp/idioma/zh_TW.po
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
@@ -0,0 +1,3 @@
|
||||
Jmol.___JmolDate="$Date: 2018-02-07 23:40:37 -0600 (Wed, 07 Feb 2018) $"
|
||||
Jmol.___fullJmolProperties="src/org/jmol/viewer/Jmol.properties"
|
||||
Jmol.___JmolVersion="14.29.4"
|
||||
@@ -0,0 +1,210 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.aflow");
|
||||
Clazz.load (["J.adapter.readers.xtal.VaspPoscarReader", "java.util.Hashtable"], "J.adapter.readers.aflow.AFLOWReader", ["java.lang.Float", "java.util.Arrays", "JU.BS", "$.Lst", "$.PT", "$.SB", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.aabb = null;
|
||||
this.readPRE = false;
|
||||
this.fracB = NaN;
|
||||
this.compositions = null;
|
||||
this.getComposition = false;
|
||||
this.listKey = null;
|
||||
this.listKeyCase = null;
|
||||
this.fileModelNumber = 0;
|
||||
this.havePRE = false;
|
||||
this.titleMsg = null;
|
||||
this.keyMap = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.aflow, "AFLOWReader", J.adapter.readers.xtal.VaspPoscarReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.keyMap = new java.util.Hashtable ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.readPRE = this.checkFilterKey ("PRE");
|
||||
var s;
|
||||
s = this.getFilter ("CA=");
|
||||
if (s != null) this.fracB = (1 - this.parseFloatStr (s));
|
||||
s = this.getFilter ("CB=");
|
||||
if (s != null) this.fracB = this.parseFloatStr (s);
|
||||
s = this.getFilter ("LIST=");
|
||||
this.listKey = (s == null ? "HF" : s);
|
||||
this.listKeyCase = this.listKey;
|
||||
this.getComposition = !Float.isNaN (this.fracB);
|
||||
this.discardLinesUntilStartsWith ("[");
|
||||
this.aabb = this.line.substring (1, this.line.indexOf ("]"));
|
||||
var pt = (JU.PT.isUpperCase (this.aabb.charAt (1)) ? 1 : 2);
|
||||
this.defaultLabels = Clazz.newArray (-1, [this.aabb.substring (0, pt), this.aabb.substring (pt)]);
|
||||
while (this.rd ().indexOf ("] REFERENCE:") >= 0) this.appendLoadNote (this.line);
|
||||
|
||||
this.compositions = new java.util.Hashtable ();
|
||||
this.quiet = true;
|
||||
this.asc.bsAtoms = new JU.BS ();
|
||||
this.addJmolScript ("unitcell off;axes off;");
|
||||
this.havePRE = (this.line.indexOf ("Structure PRE") >= 0);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (!this.havePRE) this.discardLinesUntilContains ("Structure PRE");
|
||||
this.havePRE = false;
|
||||
if (this.line == null) return false;
|
||||
this.continuing = new Boolean (this.continuing & this.readPrePost ()).valueOf ();
|
||||
return this.continuing;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readPrePost",
|
||||
function () {
|
||||
this.fileModelNumber++;
|
||||
this.titleMsg = "#" + (this.modelNumber + 1) + (this.getComposition ? "," + this.fileModelNumber + ", Cb=" + this.fracB : "");
|
||||
this.elementLabel = null;
|
||||
var n0 = this.asc.bsAtoms.cardinality ();
|
||||
if (this.readPRE) {
|
||||
this.readStructure (this.titleMsg);
|
||||
} else {
|
||||
this.readElementLabelsOnly ();
|
||||
this.discardLinesUntilContains ("Structure POST");
|
||||
this.readStructure (this.titleMsg);
|
||||
}if (this.getData ()) {
|
||||
this.applySymmetryAndSetTrajectory ();
|
||||
} else {
|
||||
this.asc.bsAtoms.clearBits (this.asc.getLastAtomSetAtomIndex (), this.asc.ac);
|
||||
this.doCheckUnitCell = false;
|
||||
}this.finalizeModel ();
|
||||
if (n0 != this.asc.bsAtoms.cardinality ()) JU.Logger.info ("AFLOW: file#, saved#, atoms: " + this.fileModelNumber + " " + this.modelNumber + " " + (this.asc.bsAtoms.cardinality () - n0));
|
||||
return !this.haveModel || this.modelNumber != this.desiredModelNumber;
|
||||
});
|
||||
Clazz.defineMethod (c$, "finalizeModel",
|
||||
function () {
|
||||
var n = this.asc.ac;
|
||||
var nremoved = 0;
|
||||
var i0 = this.asc.getLastAtomSetAtomIndex ();
|
||||
var nnow = 0;
|
||||
for (var i = i0; i < n; i++) {
|
||||
if (!this.asc.bsAtoms.get (i)) {
|
||||
nremoved++;
|
||||
this.asc.ac--;
|
||||
this.asc.atoms[i] = null;
|
||||
continue;
|
||||
}if (nremoved > 0) {
|
||||
this.asc.atoms[this.asc.atoms[i].index = i - nremoved] = this.asc.atoms[i];
|
||||
this.asc.atoms[i] = null;
|
||||
}nnow++;
|
||||
}
|
||||
this.asc.atomSetAtomCounts[this.asc.iSet] = nnow;
|
||||
if (nnow == 0) {
|
||||
this.asc.iSet--;
|
||||
this.asc.atomSetCount--;
|
||||
} else {
|
||||
this.asc.bsAtoms.setBits (i0, i0 + nnow);
|
||||
}});
|
||||
Clazz.defineMethod (c$, "readElementLabelsOnly",
|
||||
function () {
|
||||
this.readLines (5);
|
||||
this.rdline ();
|
||||
var n = this.getTokens ().length;
|
||||
this.elementLabel = new Array (n);
|
||||
this.rdline ();
|
||||
this.line = "";
|
||||
var s = null;
|
||||
var last = null;
|
||||
for (var i = 0; i < n; i++) {
|
||||
while (s == null || s.equals (last)) {
|
||||
this.rdline ();
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length != 4 || (s = this.elementLabel[i] = this.getElement (tokens[3])) == null) {
|
||||
i = n + 1;
|
||||
break;
|
||||
}}
|
||||
last = s;
|
||||
}
|
||||
if (s == null) this.elementLabel = this.defaultLabels;
|
||||
});
|
||||
Clazz.defineMethod (c$, "getData",
|
||||
function () {
|
||||
this.discardLinesUntilContains ("- DATA -");
|
||||
var htAFLOW = new java.util.Hashtable ();
|
||||
htAFLOW.put ("fileModelNumber", Integer.$valueOf (this.fileModelNumber));
|
||||
htAFLOW.put ("modelNumber", Integer.$valueOf (this.modelNumber + 1));
|
||||
htAFLOW.put ("AaBb", this.aabb);
|
||||
var pt = 0;
|
||||
var sb = new JU.SB ();
|
||||
var listVal = 3.4028235E38;
|
||||
var strcb = "?";
|
||||
var listValStr = null;
|
||||
var cb = 0;
|
||||
while (this.rdline () != null && (pt = this.line.indexOf (" # ")) >= 0) {
|
||||
var key = this.line.substring (pt + 3).trim ();
|
||||
var val = this.line.substring (0, pt).trim ();
|
||||
sb.append (key).append ("=").append (val).append (" | ");
|
||||
if (key.toUpperCase ().startsWith (this.listKey)) {
|
||||
this.listKey = key.toUpperCase ();
|
||||
this.listKeyCase = key;
|
||||
listValStr = val;
|
||||
listVal = this.parseFloatStr (val);
|
||||
}if (key.equals ("Ca")) {
|
||||
var ca = this.parseFloatStr (val);
|
||||
if (this.getComposition && Math.abs ((1 - ca) - this.fracB) > 0.01) return false;
|
||||
} else if (key.equals ("Cb")) {
|
||||
cb = this.parseFloatStr (strcb = val);
|
||||
if (this.getComposition && Math.abs (cb - this.fracB) > 0.01) return false;
|
||||
} else if (key.equals ("Hf_atom [eV] (VASP)")) {
|
||||
var e = this.parseFloatStr (val);
|
||||
this.asc.setAtomSetEnergy (val, e);
|
||||
}}
|
||||
this.asc.setAtomSetName (this.titleMsg + (this.getComposition ? "" : " Cb=" + cb) + " " + this.listKey + "=" + listValStr);
|
||||
var count_min = this.compositions.get (strcb);
|
||||
if (!this.doGetModel (++this.modelNumber, null)) return false;
|
||||
if (count_min == null) this.compositions.put (strcb, count_min = Clazz.newFloatArray (-1, [0, 3.4028235E38, 0]));
|
||||
count_min[0]++;
|
||||
if (listVal < count_min[1]) {
|
||||
count_min[1] = listVal;
|
||||
count_min[2] = this.fileModelNumber;
|
||||
}while (this.line.indexOf ("- URL -") < 0) this.rdline ();
|
||||
|
||||
sb.append ("URL=" + this.rdline () + "|");
|
||||
while (this.line.indexOf ("aurl=") < 0) this.rdline ();
|
||||
|
||||
sb.append (this.line);
|
||||
var pairs = JU.PT.split (sb.toString (), " | ");
|
||||
for (var i = pairs.length; --i >= 0; ) {
|
||||
var kv = pairs[i].$plit ("=");
|
||||
if (kv.length < 2) continue;
|
||||
var f = this.parseFloatStr (kv[1]);
|
||||
var o = Float.isNaN (f) ? kv[1] : Float.$valueOf (f);
|
||||
htAFLOW.put (kv[0], o);
|
||||
var kvclean = this.cleanKey (kv[0]);
|
||||
if (kvclean !== kv[0]) htAFLOW.put (kvclean, o);
|
||||
}
|
||||
this.asc.setCurrentModelInfo ("aflowInfo", htAFLOW);
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "cleanKey",
|
||||
function (key) {
|
||||
var kclean = this.keyMap.get (key);
|
||||
if (kclean != null) return kclean;
|
||||
var chars = key.toCharArray ();
|
||||
for (var i = chars.length; --i >= 0; ) if (!JU.PT.isLetterOrDigit (chars[i])) chars[i] = '_';
|
||||
|
||||
this.keyMap.put (key, kclean = JU.PT.trim (JU.PT.rep ( String.instantialize (chars), "__", "_"), "_"));
|
||||
return kclean;
|
||||
}, "~S");
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
this.alignUnitCells ();
|
||||
this.listCompositions ();
|
||||
this.finalizeReaderASCR ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "listCompositions",
|
||||
function () {
|
||||
var list = new JU.Lst ();
|
||||
for (var e, $e = this.compositions.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
|
||||
var count_min = e.getValue ();
|
||||
list.addLast (e.getKey () + "\t" + (Clazz.floatToInt (count_min[0])) + "\t" + Clazz.floatToInt (count_min[2]) + "\t" + this.listKeyCase + "\t" + count_min[1]);
|
||||
}
|
||||
var a = new Array (list.size ());
|
||||
list.toArray (a);
|
||||
java.util.Arrays.sort (a);
|
||||
for (var i = 0, n = a.length; i < n; i++) this.appendLoadNote (this.aabb + "\t" + a[i]);
|
||||
|
||||
});
|
||||
Clazz.defineMethod (c$, "alignUnitCells",
|
||||
function () {
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,198 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.cif");
|
||||
Clazz.load (["JU.CifDataParser"], "J.adapter.readers.cif.Cif2DataParser", ["java.lang.Float", "java.util.Hashtable", "JU.Lst", "$.PT"], function () {
|
||||
c$ = Clazz.declareType (J.adapter.readers.cif, "Cif2DataParser", JU.CifDataParser);
|
||||
Clazz.overrideMethod (c$, "getVersion",
|
||||
function () {
|
||||
return 2;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "toUnicode",
|
||||
function (data) {
|
||||
return data;
|
||||
}, "~S");
|
||||
Clazz.overrideMethod (c$, "isQuote",
|
||||
function (ch) {
|
||||
switch (ch) {
|
||||
case '\1':
|
||||
case '\'':
|
||||
case '\"':
|
||||
case '[':
|
||||
case ']':
|
||||
case '{':
|
||||
case '}':
|
||||
case ';':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, "~S");
|
||||
Clazz.overrideMethod (c$, "getQuotedStringOrObject",
|
||||
function (ch) {
|
||||
return this.processQuotedString ();
|
||||
}, "~S");
|
||||
Clazz.overrideMethod (c$, "preprocessString",
|
||||
function () {
|
||||
this.line = (this.ich == 0 ? this.str : this.str.substring (this.ich));
|
||||
return this.setString (this.processSemiString ());
|
||||
});
|
||||
Clazz.defineMethod (c$, "processQuotedString",
|
||||
function () {
|
||||
var str = null;
|
||||
var quoteChar = this.str.charAt (this.ich);
|
||||
var tripleChar = null;
|
||||
try {
|
||||
switch (quoteChar) {
|
||||
case '\1':
|
||||
str = this.str.substring (1, (this.ich = this.str.indexOf ("\1", this.ich + 1)));
|
||||
this.ich++;
|
||||
break;
|
||||
case '[':
|
||||
return this.readList ();
|
||||
case ']':
|
||||
this.ich++;
|
||||
return "]";
|
||||
case '{':
|
||||
return this.readTable ();
|
||||
case '}':
|
||||
this.ich++;
|
||||
return "}";
|
||||
case '\'':
|
||||
case '"':
|
||||
if (this.str.indexOf ("'''") == this.ich) tripleChar = "'''";
|
||||
else if (this.str.indexOf ("\"\"\"") == this.ich) tripleChar = "\"\"\"";
|
||||
var nchar = (tripleChar == null ? 1 : 3);
|
||||
var pt = this.ich + nchar;
|
||||
var pt1 = 0;
|
||||
while ((pt1 = (tripleChar == null ? this.str.indexOf (quoteChar, pt) : this.str.indexOf (tripleChar, pt))) < 0) {
|
||||
if (this.readLine () == null) break;
|
||||
this.str += this.line;
|
||||
}
|
||||
this.ich = pt1 + nchar;
|
||||
this.cch = this.str.length;
|
||||
str = this.str.substring (pt, pt1);
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
System.out.println ("exception in Cif2DataParser ; " + e);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return (this.cterm == '\0' || this.asObject ? str : JU.PT.esc (str));
|
||||
});
|
||||
Clazz.defineMethod (c$, "processSemiString",
|
||||
function () {
|
||||
var pt1;
|
||||
var pt2;
|
||||
var str = this.preprocessSemiString ();
|
||||
if (str.indexOf (';') != 1 && (pt1 = str.indexOf ('\\')) > 1 && ((pt2 = str.indexOf ('\n')) > pt1 || pt2 < 0)) {
|
||||
var prefix = str.substring (1, pt1);
|
||||
str = JU.PT.rep (str, "\n" + prefix, "\n");
|
||||
str = "\1" + str.substring (str.charAt (pt1 + 1) == '\\' ? pt1 + 1 : pt2 < 0 ? str.length - 1 : pt2 + 1);
|
||||
}this.ich = 0;
|
||||
return this.fixLineFolding (str);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readList",
|
||||
function () {
|
||||
this.ich++;
|
||||
var cterm0 = this.cterm;
|
||||
this.cterm = ']';
|
||||
var ns = this.nullString;
|
||||
this.nullString = null;
|
||||
var lst = (this.asObject ? new JU.Lst () : null);
|
||||
var n = 0;
|
||||
var str = "";
|
||||
while (true) {
|
||||
var value = (this.asObject ? this.getNextTokenObject () : this.getNextToken ());
|
||||
if (value == null || value.equals ("]")) break;
|
||||
if (this.asObject) {
|
||||
lst.addLast (value);
|
||||
} else {
|
||||
if (n++ > 0) str += ",";
|
||||
str += value;
|
||||
}}
|
||||
this.cterm = cterm0;
|
||||
this.nullString = ns;
|
||||
return (this.asObject ? lst : "[" + str + "]");
|
||||
});
|
||||
Clazz.defineMethod (c$, "readTable",
|
||||
function () {
|
||||
this.ich++;
|
||||
var cterm0 = this.cterm;
|
||||
this.cterm = '}';
|
||||
var ns = this.nullString;
|
||||
this.nullString = null;
|
||||
var map = (this.asObject ? new java.util.Hashtable () : null);
|
||||
var n = 0;
|
||||
var str = "";
|
||||
while (true) {
|
||||
var key = this.getNextToken ();
|
||||
if (key == null || key.equals ("}")) break;
|
||||
while (this.isSpaceOrColon (this.ich)) this.ich++;
|
||||
|
||||
if (this.asObject) {
|
||||
map.put (key, this.getNextTokenObject ());
|
||||
} else {
|
||||
if (n++ > 0) str += ",";
|
||||
str += key + " : " + this.getNextToken ();
|
||||
}}
|
||||
this.cterm = cterm0;
|
||||
this.nullString = ns;
|
||||
return (this.asObject ? map : "{" + str + "}");
|
||||
});
|
||||
Clazz.defineMethod (c$, "isSpaceOrColon",
|
||||
function (ich) {
|
||||
if (ich < this.cch) switch (this.line.charAt (ich)) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case ':':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, "~N");
|
||||
Clazz.overrideMethod (c$, "unquoted",
|
||||
function (s) {
|
||||
if (this.cterm == '\0' && !this.asObject) return s;
|
||||
var n = s.length;
|
||||
if (n > 0) {
|
||||
var c = s.charAt (0);
|
||||
if (JU.PT.isDigit (c) || c == '-' || c == '.' && n > 1) {
|
||||
var pt = s.indexOf ('(');
|
||||
var isFloat = (s.indexOf (".") >= 0);
|
||||
if (n > 1 && pt > 0 && s.indexOf (')', pt + 1) == n - 1) s = s.substring (0, pt);
|
||||
try {
|
||||
if (isFloat) {
|
||||
var f = Float.parseFloat (s);
|
||||
if (this.asObject) return Float.$valueOf (f);
|
||||
s = "" + f;
|
||||
if (s.indexOf (".") < 0 && s.indexOf ("E") < 0) s += ".0";
|
||||
return s;
|
||||
}var i = Integer.parseInt (s);
|
||||
return (this.asObject ? Integer.$valueOf (i) : "" + i);
|
||||
} catch (e) {
|
||||
}
|
||||
}}return (this.asObject ? s : JU.PT.esc (s));
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "fixLineFolding",
|
||||
function (str) {
|
||||
if (str.indexOf ('\\') < 0) return str;
|
||||
var n = str.length;
|
||||
if (str.endsWith ("\\\1")) str = str.substring (0, n - 1) + "\n\1";
|
||||
var pt = 0;
|
||||
while ((pt = str.indexOf ('\\', pt + 1)) >= 0) {
|
||||
var eol = str.indexOf ('\n', pt);
|
||||
if (eol < 0) break;
|
||||
for (var i = eol; --i > pt; ) {
|
||||
var ch = str.charAt (i);
|
||||
if (!JU.PT.isWhitespace (ch)) {
|
||||
if (ch == '\\') {
|
||||
pt = i;
|
||||
break;
|
||||
}pt = eol;
|
||||
break;
|
||||
}}
|
||||
if (pt < eol) str = str.substring (0, pt) + str.substring (eol + 1);
|
||||
}
|
||||
return str;
|
||||
}, "~S");
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.cif");
|
||||
Clazz.load (["J.adapter.readers.cif.CifReader"], "J.adapter.readers.cif.Cif2Reader", ["J.adapter.readers.cif.Cif2DataParser"], function () {
|
||||
c$ = Clazz.declareType (J.adapter.readers.cif, "Cif2Reader", J.adapter.readers.cif.CifReader);
|
||||
Clazz.overrideMethod (c$, "getCifDataParser",
|
||||
function () {
|
||||
return new J.adapter.readers.cif.Cif2DataParser ().set (this, null, this.debugging);
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,709 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.cif");
|
||||
Clazz.load (["J.adapter.readers.cif.CifReader"], "J.adapter.readers.cif.MMCifReader", ["java.lang.Boolean", "java.util.Hashtable", "JU.BS", "$.Lst", "$.M4", "$.P3", "$.PT", "$.SB", "J.adapter.smarter.Atom", "$.Structure", "J.c.STR", "JU.BSUtil", "$.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.isBiomolecule = false;
|
||||
this.byChain = false;
|
||||
this.bySymop = false;
|
||||
this.chainAtomMap = null;
|
||||
this.chainAtomCounts = null;
|
||||
this.vBiomolecules = null;
|
||||
this.htBiomts = null;
|
||||
this.htSites = null;
|
||||
this.htHetero = null;
|
||||
this.htBondMap = null;
|
||||
this.assemblyIdAtoms = null;
|
||||
this.thisChain = -1;
|
||||
this.modelIndex = 0;
|
||||
this.chainSum = null;
|
||||
this.chainAtomCount = null;
|
||||
this.isLigandBondBug = false;
|
||||
this.mident = null;
|
||||
this.requiresSorting = false;
|
||||
this.structConnMap = null;
|
||||
this.structConnList = "";
|
||||
this.doSetBonds = false;
|
||||
this.modelStrings = "";
|
||||
this.done = false;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.cif, "MMCifReader", J.adapter.readers.cif.CifReader);
|
||||
Clazz.overrideMethod (c$, "initSubclass",
|
||||
function () {
|
||||
this.setIsPDB ();
|
||||
this.mident = JU.M4.newM4 (null);
|
||||
this.isMMCIF = true;
|
||||
if (this.isDSSP1) this.asc.setInfo ("isDSSP1", Boolean.TRUE);
|
||||
if (this.htParams.containsKey ("isMutate")) this.asc.setInfo ("isMutate", Boolean.TRUE);
|
||||
this.doSetBonds = this.checkFilterKey ("ADDBONDS");
|
||||
this.byChain = this.checkFilterKey ("BYCHAIN");
|
||||
if (this.checkFilterKey ("BIOMOLECULE")) this.filter = JU.PT.rep (this.filter, "BIOMOLECULE", "ASSEMBLY");
|
||||
this.isBiomolecule = this.checkFilterKey ("ASSEMBLY");
|
||||
if (this.isBiomolecule) {
|
||||
this.filter = this.filter.$replace (':', ' ');
|
||||
this.bySymop = this.checkFilterKey ("BYSYMOP");
|
||||
}this.isCourseGrained = this.byChain || this.bySymop;
|
||||
if (this.isCourseGrained) {
|
||||
this.chainAtomMap = new java.util.Hashtable ();
|
||||
this.chainAtomCounts = new java.util.Hashtable ();
|
||||
}this.isLigandBondBug = (this.stateScriptVersionInt >= 140204 && this.stateScriptVersionInt <= 140208 || this.stateScriptVersionInt >= 140304 && this.stateScriptVersionInt <= 140308);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "processSubclassEntry",
|
||||
function () {
|
||||
if (this.key0.startsWith ("_pdbx_struct_assembly_gen.") || this.key0.startsWith ("_struct_conn.") || this.key0.startsWith ("_struct_ref_seq_dif.") || this.key0.startsWith ("_struct_conf.") || this.key0.startsWith ("_struct_sheet_range.")) this.processSubclassLoopBlock ();
|
||||
else if (this.key.equals ("_rna3d")) {
|
||||
this.addedData = this.data;
|
||||
this.addedDataKey = this.key;
|
||||
} else if (this.key.equals ("_dssr")) {
|
||||
this.dssr = this.vwr.parseJSONMap (this.reader.readLine ());
|
||||
this.reader.readLine ();
|
||||
}});
|
||||
Clazz.overrideMethod (c$, "processSubclassLoopBlock",
|
||||
function () {
|
||||
if (this.key0.startsWith ("_struct_ncs_oper.")) return this.processStructOperListBlock (true);
|
||||
if (this.key0.startsWith ("_pdbx_struct_oper_list.")) return this.processStructOperListBlock (false);
|
||||
if (this.key0.startsWith ("_pdbx_struct_assembly_gen.")) return this.processAssemblyGenBlock ();
|
||||
if (this.key0.startsWith ("_struct_ref_seq_dif.")) return this.processSequence ();
|
||||
if (this.isCourseGrained) return false;
|
||||
if (this.key0.startsWith ("_struct_site_gen.")) return this.processStructSiteBlock ();
|
||||
if (this.key0.startsWith ("_chem_comp.")) return this.processChemCompLoopBlock ();
|
||||
if (this.key0.startsWith ("_struct_conf.")) return this.processStructConfLoopBlock ();
|
||||
if (this.key0.startsWith ("_struct_sheet_range.")) return this.processStructSheetRangeLoopBlock ();
|
||||
if (this.isLigandBondBug) return false;
|
||||
if (this.key0.startsWith ("_chem_comp_bond.")) return this.processCompBondLoopBlock ();
|
||||
if (this.key0.startsWith ("_struct_conn.")) return this.processStructConnLoopBlock ();
|
||||
return false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "sortAssemblyModels",
|
||||
function () {
|
||||
var natoms = this.asc.ac;
|
||||
var lastSet = -1;
|
||||
var atoms = this.asc.atoms;
|
||||
var newAtoms = new Array (natoms);
|
||||
var ids = JU.PT.split ("," + this.modelStrings + ",", ",,");
|
||||
var bsAtomsNew = (this.asc.bsAtoms == null ? null : JU.BS.newN (this.asc.bsAtoms.size ()));
|
||||
for (var im = 1, n = 0; im < ids.length; im++) {
|
||||
var sModel = ids[im];
|
||||
var modelIndex = -1;
|
||||
for (var is = 0; is < this.asc.atomSetCount; is++) {
|
||||
var ia0 = this.asc.getAtomSetAtomIndex (is);
|
||||
var ia1 = ia0 + this.asc.getAtomSetAtomCount (is);
|
||||
var am = "" + this.modelMap.get ("_" + is);
|
||||
if (am.equals (sModel)) {
|
||||
if (modelIndex < 0 && (modelIndex = is) > lastSet) lastSet = is;
|
||||
for (var i = ia0; i < ia1; i++) {
|
||||
if (bsAtomsNew == null || this.asc.bsAtoms.get (i)) {
|
||||
if (bsAtomsNew != null) bsAtomsNew.set (n);
|
||||
atoms[i].atomSetIndex = modelIndex;
|
||||
newAtoms[n++] = atoms[i];
|
||||
}}
|
||||
}}
|
||||
}
|
||||
this.asc.atoms = newAtoms;
|
||||
this.asc.bsAtoms = bsAtomsNew;
|
||||
if (++lastSet < this.asc.atomSetCount) this.asc.atomSetCount = lastSet;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "finalizeSubclass",
|
||||
function () {
|
||||
if (this.byChain && !this.isBiomolecule) for (var id, $id = this.chainAtomMap.keySet ().iterator (); $id.hasNext () && ((id = $id.next ()) || true);) this.createParticle (id);
|
||||
|
||||
var haveBiomolecule = (this.isBiomolecule && this.vBiomolecules != null && this.vBiomolecules.size () > 0);
|
||||
if (!this.isCourseGrained && this.asc.ac == this.nAtoms) {
|
||||
this.asc.removeCurrentAtomSet ();
|
||||
} else {
|
||||
if ((this.dssr != null || this.validation != null || this.addedData != null) && !this.isCourseGrained && !this.requiresSorting) {
|
||||
var vs = (this.getInterface ("J.adapter.readers.cif.MMCifValidationParser")).set (this);
|
||||
var note = null;
|
||||
if (this.addedData == null) {
|
||||
if (this.validation != null || this.dssr != null) note = vs.finalizeValidations (this.vwr, this.modelMap);
|
||||
} else if (this.addedDataKey.equals ("_rna3d")) {
|
||||
note = vs.finalizeRna3d (this.modelMap);
|
||||
}if (note != null) this.appendLoadNote (note);
|
||||
}this.setHetero ();
|
||||
if (this.doSetBonds) this.setBonds ();
|
||||
}if (this.asc.ac == 0 && !this.isCourseGrained) return false;
|
||||
var spaceGroup = this.sgName;
|
||||
if (this.htSites != null) this.addSites (this.htSites);
|
||||
if (haveBiomolecule) {
|
||||
this.asc.setCurrentModelInfo ("biomolecules", this.vBiomolecules);
|
||||
this.setBiomolecules ();
|
||||
if (this.thisBiomolecule != null) {
|
||||
if (this.iHaveFractionalCoordinates) this.fractionalizeCoordinates (false);
|
||||
this.asc.getXSymmetry ().applySymmetryBio (this.thisBiomolecule, this.applySymmetryToBonds, this.filter);
|
||||
this.asc.xtalSymmetry = null;
|
||||
}this.doCheckUnitCell = new Boolean (this.doCheckUnitCell & (this.iHaveUnitCell && this.doApplySymmetry)).valueOf ();
|
||||
if (this.doCheckUnitCell) {
|
||||
this.ignoreFileSpaceGroupName = true;
|
||||
this.sgName = spaceGroup;
|
||||
this.fractionalizeCoordinates (true);
|
||||
this.asc.setCurrentModelInfo ("biosymmetry", null);
|
||||
this.asc.setCurrentModelInfo ("biosymmetryCount", null);
|
||||
this.asc.checkSpecial = false;
|
||||
if (this.byChain) return true;
|
||||
}}if (this.latticeCells != null && this.latticeCells[0] != 0) this.addJmolScript ("unitcell;axes on;axes unitcell;");
|
||||
if (this.requiresSorting) this.sortAssemblyModels ();
|
||||
return true;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkSubclassSymmetry",
|
||||
function () {
|
||||
this.asc.checkSpecial = false;
|
||||
var modelIndex = this.asc.iSet;
|
||||
this.asc.setCurrentModelInfo ("PDB_CONECT_firstAtom_count_max", Clazz.newIntArray (-1, [this.asc.getAtomSetAtomIndex (modelIndex), this.asc.getAtomSetAtomCount (modelIndex), this.maxSerial]));
|
||||
return false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "setBonds",
|
||||
function () {
|
||||
if (this.htBondMap == null) return;
|
||||
var bsAtoms = this.asc.bsAtoms;
|
||||
if (bsAtoms == null) bsAtoms = JU.BSUtil.newBitSet2 (0, this.asc.ac);
|
||||
var atoms = this.asc.atoms;
|
||||
var seqid = -1;
|
||||
var comp = null;
|
||||
var map = null;
|
||||
for (var i = bsAtoms.nextSetBit (0); i >= 0; i = bsAtoms.nextSetBit (i + 1)) {
|
||||
var a = atoms[i];
|
||||
var pt = (a.vib == null ? a.sequenceNumber : a.vib.x);
|
||||
if (pt != seqid) {
|
||||
seqid = pt;
|
||||
if (comp != null) this.processBonds (this.htBondMap.get (comp), map, false);
|
||||
map = new java.util.Hashtable ();
|
||||
comp = atoms[i].group3;
|
||||
if (!this.htBondMap.containsKey (comp)) {
|
||||
comp = null;
|
||||
continue;
|
||||
}}if (comp == null) continue;
|
||||
map.put (a.atomName, Integer.$valueOf (a.index));
|
||||
}
|
||||
if (comp != null) this.processBonds (this.htBondMap.get (comp), map, false);
|
||||
if (this.structConnMap != null) {
|
||||
map = new java.util.Hashtable ();
|
||||
seqid = -1;
|
||||
comp = null;
|
||||
for (var i = bsAtoms.nextSetBit (0); i >= 0; i = bsAtoms.nextSetBit (i + 1)) {
|
||||
var a = atoms[i];
|
||||
var pt = (a.vib == null ? a.sequenceNumber : a.vib.x);
|
||||
if (pt != seqid) {
|
||||
seqid = pt;
|
||||
var ckey = a.chainID + a.group3 + seqid;
|
||||
if (this.structConnList.indexOf (ckey) < 0) {
|
||||
comp = null;
|
||||
continue;
|
||||
}comp = ckey;
|
||||
}if (comp == null) continue;
|
||||
map.put (comp + a.atomName + a.altLoc, Integer.$valueOf (a.index));
|
||||
}
|
||||
this.processBonds (this.structConnMap, map, true);
|
||||
}this.appendLoadNote (this.asc.bondCount + " bonds added");
|
||||
});
|
||||
Clazz.defineMethod (c$, "processBonds",
|
||||
function (cmap, map, isStructConn) {
|
||||
var i1;
|
||||
var i2;
|
||||
for (var i = 0, n = cmap.size (); i < n; i++) {
|
||||
var o = cmap.get (i);
|
||||
if ((i1 = map.get (o[0])) == null || (i2 = map.get (o[1])) == null) continue;
|
||||
if (this.debugging) JU.Logger.debug ((isStructConn ? "_struct_conn" : "_comp_bond") + " adding bond " + i1 + " " + i2 + " order=" + o[2]);
|
||||
this.asc.addNewBondWithOrder (i1.intValue (), i2.intValue (), (o[2]).intValue ());
|
||||
}
|
||||
}, "JU.Lst,java.util.Map,~B");
|
||||
Clazz.defineMethod (c$, "processSequence",
|
||||
function () {
|
||||
this.parseLoopParameters (J.adapter.readers.cif.MMCifReader.structRefFields);
|
||||
var g1;
|
||||
var g3;
|
||||
while (this.parser.getData ()) {
|
||||
if (this.isNull (g1 = this.getField (1).toLowerCase ()) || g1.length != 1 || this.isNull (g3 = this.getField (0))) continue;
|
||||
if (this.htGroup1 == null) this.asc.setInfo ("htGroup1", this.htGroup1 = new java.util.Hashtable ());
|
||||
this.htGroup1.put (g3, g1);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "processAssemblyGenBlock",
|
||||
function () {
|
||||
this.parseLoopParameters (J.adapter.readers.cif.MMCifReader.assemblyFields);
|
||||
while (this.parser.getData ()) {
|
||||
var assem = new Array (3);
|
||||
var count = 0;
|
||||
var p;
|
||||
var n = this.parser.getColumnCount ();
|
||||
for (var i = 0; i < n; ++i) {
|
||||
switch (p = this.fieldProperty (i)) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
count++;
|
||||
assem[p] = this.field;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (count == 3) this.addAssembly (assem);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "addAssembly",
|
||||
function (assem) {
|
||||
var id = assem[0];
|
||||
var list = assem[2];
|
||||
var operators = assem[1];
|
||||
var name = "biomolecule " + id;
|
||||
JU.Logger.info (name + " operators " + operators + " ASYM_IDs " + list);
|
||||
this.appendLoadNote ("found " + name + ": " + list);
|
||||
if (this.vBiomolecules == null) this.vBiomolecules = new JU.Lst ();
|
||||
var info = null;
|
||||
for (var i = this.vBiomolecules.size (); --i >= 0; ) if (this.vBiomolecules.get (i).get ("name").equals (name)) {
|
||||
info = this.vBiomolecules.get (i);
|
||||
break;
|
||||
}
|
||||
if (info == null) {
|
||||
info = new java.util.Hashtable ();
|
||||
info.put ("name", name);
|
||||
var iMolecule = this.parseIntStr (id);
|
||||
info.put ("molecule", iMolecule == -2147483648 ? id : Integer.$valueOf (iMolecule));
|
||||
info.put ("biomts", new JU.Lst ());
|
||||
info.put ("chains", new JU.Lst ());
|
||||
info.put ("assemblies", new JU.Lst ());
|
||||
info.put ("operators", new JU.Lst ());
|
||||
this.vBiomolecules.addLast (info);
|
||||
}(info.get ("assemblies")).addLast ("$" + list.$replace (',', '$'));
|
||||
(info.get ("operators")).addLast (this.decodeAssemblyOperators (operators));
|
||||
this.checkFilterAssembly (id, info);
|
||||
}, "~A");
|
||||
Clazz.defineMethod (c$, "checkFilterAssembly",
|
||||
function (id, info) {
|
||||
if (this.checkFilterKey ("ASSEMBLY " + id + ";") || this.checkFilterKey ("ASSEMBLY=" + id + ";")) this.thisBiomolecule = info;
|
||||
}, "~S,java.util.Map");
|
||||
Clazz.defineMethod (c$, "decodeAssemblyOperators",
|
||||
function (ops) {
|
||||
var pt = ops.indexOf (")(");
|
||||
if (pt >= 0) return this.crossBinary (this.decodeAssemblyOperators (ops.substring (0, pt + 1)), this.decodeAssemblyOperators (ops.substring (pt + 1)));
|
||||
if (ops.startsWith ("(")) {
|
||||
if (ops.indexOf ("-") >= 0) ops = JU.BS.unescape ("({" + ops.substring (1, ops.length - 1).$replace ('-', ':').$replace (',', ' ') + "})").toJSON ();
|
||||
ops = JU.PT.rep (ops, " ", "");
|
||||
ops = ops.substring (1, ops.length - 1);
|
||||
}return ops;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "crossBinary",
|
||||
function (ops1, ops2) {
|
||||
var sb = new JU.SB ();
|
||||
var opsLeft = JU.PT.split (ops1, ",");
|
||||
var opsRight = JU.PT.split (ops2, ",");
|
||||
for (var i = 0; i < opsLeft.length; i++) for (var j = 0; j < opsRight.length; j++) sb.append (",").append (opsLeft[i]).append ("|").append (opsRight[j]);
|
||||
|
||||
|
||||
return sb.toString ().substring (1);
|
||||
}, "~S,~S");
|
||||
Clazz.defineMethod (c$, "processStructOperListBlock",
|
||||
function (isNCS) {
|
||||
this.parseLoopParametersFor ((isNCS ? "_struct_ncs_oper" : "_pdbx_struct_oper_list"), isNCS ? J.adapter.readers.cif.MMCifReader.ncsoperFields : J.adapter.readers.cif.MMCifReader.operFields);
|
||||
var m = Clazz.newFloatArray (16, 0);
|
||||
m[15] = 1;
|
||||
while (this.parser.getData ()) {
|
||||
var count = 0;
|
||||
var id = null;
|
||||
var xyz = null;
|
||||
var n = this.parser.getColumnCount ();
|
||||
for (var i = 0; i < n; ++i) {
|
||||
var p = this.fieldProperty (i);
|
||||
switch (p) {
|
||||
case -1:
|
||||
break;
|
||||
case 12:
|
||||
id = this.field;
|
||||
break;
|
||||
case 13:
|
||||
xyz = this.field;
|
||||
break;
|
||||
default:
|
||||
m[p] = this.parseFloatStr (this.field);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
if (id != null && (count == 12 || xyz != null && this.symmetry != null)) {
|
||||
JU.Logger.info ((isNCS ? "noncrystallographic symmetry operator " : "assembly operator ") + id + " " + xyz);
|
||||
var m4 = new JU.M4 ();
|
||||
if (count != 12) {
|
||||
this.symmetry.getMatrixFromString (xyz, m, false, 0);
|
||||
m[3] *= this.symmetry.getUnitCellInfoType (0) / 12;
|
||||
m[7] *= this.symmetry.getUnitCellInfoType (1) / 12;
|
||||
m[11] *= this.symmetry.getUnitCellInfoType (2) / 12;
|
||||
}m4.setA (m);
|
||||
this.addMatrix (id, m4, isNCS);
|
||||
}}
|
||||
return true;
|
||||
}, "~B");
|
||||
Clazz.defineMethod (c$, "addMatrix",
|
||||
function (id, m4, isNCS) {
|
||||
if (isNCS) {
|
||||
if (m4.equals (this.mident)) return;
|
||||
m4.m33 = 0;
|
||||
if (this.lstNCS == null) this.lstNCS = new JU.Lst ();
|
||||
this.lstNCS.addLast (m4);
|
||||
} else {
|
||||
if (this.htBiomts == null) this.htBiomts = new java.util.Hashtable ();
|
||||
this.htBiomts.put (id, m4);
|
||||
}}, "~S,JU.M4,~B");
|
||||
Clazz.defineMethod (c$, "processChemCompLoopBlock",
|
||||
function () {
|
||||
this.parseLoopParameters (J.adapter.readers.cif.MMCifReader.chemCompFields);
|
||||
var groupName;
|
||||
var hetName;
|
||||
while (this.parser.getData ()) if (!this.isNull (groupName = this.getField (0)) && !this.isNull (hetName = this.getField (1))) this.addHetero (groupName, hetName, true, true);
|
||||
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "addHetero",
|
||||
function (groupName, hetName, doCheck, addNote) {
|
||||
if (doCheck && !this.vwr.getJBR ().isHetero (groupName)) return;
|
||||
if (this.htHetero == null) this.htHetero = new java.util.Hashtable ();
|
||||
if (doCheck && this.htHetero.containsKey (groupName)) return;
|
||||
this.htHetero.put (groupName, hetName);
|
||||
if (addNote) this.appendLoadNote (groupName + " = " + hetName);
|
||||
}, "~S,~S,~B,~B");
|
||||
Clazz.defineMethod (c$, "processStructConfLoopBlock",
|
||||
function () {
|
||||
if (this.ignoreStructure) {
|
||||
this.parser.skipLoop (false);
|
||||
return false;
|
||||
}this.parseLoopParametersFor ("_struct_conf", J.adapter.readers.cif.MMCifReader.structConfFields);
|
||||
if (!this.checkAllFieldsPresent (J.adapter.readers.cif.MMCifReader.structConfFields, -1, true)) {
|
||||
this.parser.skipLoop (true);
|
||||
return false;
|
||||
}while (this.parser.getData ()) {
|
||||
var structure = new J.adapter.smarter.Structure (-1, J.c.STR.HELIX, J.c.STR.HELIX, null, 0, 0, null);
|
||||
var type = this.getField (0);
|
||||
if (type.startsWith ("TURN")) structure.structureType = structure.substructureType = J.c.STR.TURN;
|
||||
else if (!type.startsWith ("HELX")) structure.structureType = structure.substructureType = J.c.STR.NONE;
|
||||
else structure.substructureType = J.adapter.smarter.Structure.getHelixType (this.parseIntStr (this.getField (9)));
|
||||
structure.serialID = this.parseIntStr (this.getField (8));
|
||||
structure.structureID = this.getField (7);
|
||||
this.addStructure (structure);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "addStructure",
|
||||
function (structure) {
|
||||
structure.startChainID = this.vwr.getChainID (structure.startChainStr = this.getField (1), true);
|
||||
structure.startSequenceNumber = this.parseIntStr (this.getField (2));
|
||||
structure.startInsertionCode = this.getField (3).charAt (0);
|
||||
structure.endChainID = this.vwr.getChainID (structure.endChainStr = this.getField (4), true);
|
||||
structure.endSequenceNumber = this.parseIntStr (this.getField (5));
|
||||
structure.endInsertionCode = this.getField (6).charAt (0);
|
||||
this.asc.addStructure (structure);
|
||||
}, "J.adapter.smarter.Structure");
|
||||
Clazz.defineMethod (c$, "processStructSheetRangeLoopBlock",
|
||||
function () {
|
||||
if (this.ignoreStructure) {
|
||||
this.parser.skipLoop (false);
|
||||
return false;
|
||||
}this.parseLoopParametersFor ("_struct_sheet_range", J.adapter.readers.cif.MMCifReader.structSheetRangeFields);
|
||||
if (!this.checkAllFieldsPresent (J.adapter.readers.cif.MMCifReader.structSheetRangeFields, -1, true)) {
|
||||
this.parser.skipLoop (true);
|
||||
return false;
|
||||
}while (this.parser.getData ()) this.addStructure ( new J.adapter.smarter.Structure (-1, J.c.STR.SHEET, J.c.STR.SHEET, this.getField (0), this.parseIntStr (this.getField (7)), 1, null));
|
||||
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "processStructSiteBlock",
|
||||
function () {
|
||||
this.parseLoopParametersFor ("_struct_site_gen", J.adapter.readers.cif.MMCifReader.structSiteFields);
|
||||
var htSite = null;
|
||||
this.htSites = new java.util.Hashtable ();
|
||||
var seqNum;
|
||||
var resID;
|
||||
while (this.parser.getData ()) {
|
||||
if (this.isNull (seqNum = this.getField (3)) || this.isNull (resID = this.getField (1))) continue;
|
||||
var siteID = this.getField (0);
|
||||
htSite = this.htSites.get (siteID);
|
||||
if (htSite == null) {
|
||||
htSite = new java.util.Hashtable ();
|
||||
htSite.put ("groups", "");
|
||||
this.htSites.put (siteID, htSite);
|
||||
}var insCode = this.getField (4);
|
||||
var chainID = this.getField (2);
|
||||
var group = "[" + resID + "]" + seqNum + (this.isNull (insCode) ? "" : "^" + insCode) + (this.isNull (chainID) ? "" : ":" + chainID);
|
||||
var groups = htSite.get ("groups");
|
||||
groups += (groups.length == 0 ? "" : ",") + group;
|
||||
htSite.put ("groups", groups);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "setBiomolecules",
|
||||
function () {
|
||||
if (this.assemblyIdAtoms == null && this.chainAtomCounts == null) return;
|
||||
var bsAll = new JU.BS ();
|
||||
for (var i = this.vBiomolecules.size (); --i >= 0; ) {
|
||||
var biomolecule = this.vBiomolecules.get (i);
|
||||
this.setBiomolecule (biomolecule, (biomolecule === this.thisBiomolecule ? bsAll : null));
|
||||
}
|
||||
if (this.isBiomolecule && bsAll.cardinality () < this.asc.ac) {
|
||||
if (this.asc.bsAtoms != null) this.asc.bsAtoms.and (bsAll);
|
||||
else if (!this.isCourseGrained) this.asc.bsAtoms = bsAll;
|
||||
}});
|
||||
Clazz.defineMethod (c$, "setBiomolecule",
|
||||
function (biomolecule, bsAll) {
|
||||
var biomtchains = biomolecule.get ("chains");
|
||||
var biomts = biomolecule.get ("biomts");
|
||||
var operators = biomolecule.get ("operators");
|
||||
var assemblies = biomolecule.get ("assemblies");
|
||||
var sum = new JU.P3 ();
|
||||
var count = 0;
|
||||
var bsAtoms = new JU.BS ();
|
||||
var nAtomsTotal = 0;
|
||||
var isBioCourse = (this.isBiomolecule && this.isCourseGrained);
|
||||
for (var i = operators.size (); --i >= 0; ) {
|
||||
var ops = JU.PT.split (operators.get (i), ",");
|
||||
var ids = JU.PT.split (assemblies.get (i), "$");
|
||||
var chainlist = "";
|
||||
var nAtoms = 0;
|
||||
for (var j = 1; j < ids.length; j++) {
|
||||
var id = ids[j];
|
||||
chainlist += ":" + id + ";";
|
||||
if (this.assemblyIdAtoms != null) {
|
||||
biomolecule.put ("asemblyIdAtoms", this.assemblyIdAtoms);
|
||||
var bs = this.assemblyIdAtoms.get (id);
|
||||
if (bs != null) {
|
||||
bsAtoms.or (bs);
|
||||
if (bsAll != null) bsAll.or (bs);
|
||||
nAtoms += bs.cardinality ();
|
||||
}} else if (isBioCourse) {
|
||||
var asum = this.chainAtomMap.get (id);
|
||||
if (asum != null) {
|
||||
if (this.bySymop) {
|
||||
sum.add (asum);
|
||||
count += this.chainAtomCounts.get (id)[0];
|
||||
} else {
|
||||
this.createParticle (id);
|
||||
nAtoms++;
|
||||
}}}}
|
||||
if (!this.isBiomolecule) continue;
|
||||
for (var j = 0; j < ops.length; j++) {
|
||||
var m = this.getOpMatrix (ops[j]);
|
||||
if (m == null) return 0;
|
||||
if (m.equals (this.mident)) {
|
||||
biomts.add (0, this.mident);
|
||||
biomtchains.add (0, chainlist);
|
||||
} else {
|
||||
biomts.addLast (m);
|
||||
biomtchains.addLast (chainlist);
|
||||
}}
|
||||
if (this.bySymop && bsAll != null) {
|
||||
nAtoms = 1;
|
||||
var a1 = new J.adapter.smarter.Atom ();
|
||||
a1.setT (sum);
|
||||
a1.scale (1 / count);
|
||||
a1.radius = 16;
|
||||
this.asc.addAtom (a1);
|
||||
}nAtoms *= ops.length;
|
||||
nAtomsTotal += nAtoms;
|
||||
}
|
||||
biomolecule.put ("atomCount", Integer.$valueOf (nAtomsTotal));
|
||||
return nAtomsTotal;
|
||||
}, "java.util.Map,JU.BS");
|
||||
Clazz.defineMethod (c$, "createParticle",
|
||||
function (id) {
|
||||
var asum = this.chainAtomMap.get (id);
|
||||
var c = this.chainAtomCounts.get (id)[0];
|
||||
var a = new J.adapter.smarter.Atom ();
|
||||
a.setT (asum);
|
||||
a.scale (1 / c);
|
||||
a.elementSymbol = "Pt";
|
||||
this.setChainID (a, id);
|
||||
a.radius = 16;
|
||||
this.asc.addAtom (a);
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "getOpMatrix",
|
||||
function (ops) {
|
||||
if (this.htBiomts == null) return JU.M4.newM4 (null);
|
||||
var pt = ops.indexOf ("|");
|
||||
if (pt >= 0) {
|
||||
var m = JU.M4.newM4 (this.htBiomts.get (ops.substring (0, pt)));
|
||||
m.mul (this.htBiomts.get (ops.substring (pt + 1)));
|
||||
return m;
|
||||
}return this.htBiomts.get (ops);
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "processStructConnLoopBlock",
|
||||
function () {
|
||||
this.parseLoopParametersFor ("_struct_conn", J.adapter.readers.cif.MMCifReader.structConnFields);
|
||||
while (this.parser.getData ()) {
|
||||
var sym1 = this.getField (5);
|
||||
var sym2 = this.getField (11);
|
||||
if (!sym1.equals (sym2) || !this.isNull (sym1) && !sym1.equals ("1_555")) continue;
|
||||
var type = this.getField (12);
|
||||
if (!type.startsWith ("covale") && !type.equals ("disulf") && !type.equals ("metalc")) continue;
|
||||
if (this.htBondMap == null) this.htBondMap = new java.util.Hashtable ();
|
||||
var key1 = this.vwr.getChainID (this.getField (0), true) + this.getField (2) + this.parseFloatStr (this.getField (1)) + this.getField (3) + this.getField (4);
|
||||
var key2 = this.vwr.getChainID (this.getField (6), true) + this.getField (8) + this.parseFloatStr (this.getField (7)) + this.getField (9) + this.getField (10);
|
||||
var order = this.getBondOrder (this.getField (13));
|
||||
if (this.structConnMap == null) this.structConnMap = new JU.Lst ();
|
||||
this.structConnMap.addLast ( Clazz.newArray (-1, [key1, key2, Integer.$valueOf (order)]));
|
||||
if (this.structConnList.indexOf (key1) < 0) this.structConnList += key1;
|
||||
if (this.structConnList.indexOf (key2) < 0) this.structConnList += key2;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "processCompBondLoopBlock",
|
||||
function () {
|
||||
this.doSetBonds = true;
|
||||
this.parseLoopParametersFor ("_chem_comp_bond", J.adapter.readers.cif.MMCifReader.chemCompBondFields);
|
||||
while (this.parser.getData ()) {
|
||||
var comp = this.getField (0);
|
||||
var atom1 = this.getField (1);
|
||||
var atom2 = this.getField (2);
|
||||
var order = this.getBondOrder (this.getField (3));
|
||||
if ((this.getField (4).charAt (0) == 'Y')) switch (order) {
|
||||
case 1:
|
||||
order = 513;
|
||||
break;
|
||||
case 2:
|
||||
order = 514;
|
||||
break;
|
||||
}
|
||||
if (this.isLigand) {
|
||||
this.asc.addNewBondWithOrderA (this.asc.getAtomFromName (atom1), this.asc.getAtomFromName (atom2), order);
|
||||
} else if (this.haveHAtoms || this.htHetero != null && this.htHetero.containsKey (comp)) {
|
||||
if (this.htBondMap == null) this.htBondMap = new java.util.Hashtable ();
|
||||
var cmap = this.htBondMap.get (comp);
|
||||
if (cmap == null) this.htBondMap.put (comp, cmap = new JU.Lst ());
|
||||
cmap.addLast ( Clazz.newArray (-1, [atom1, atom2, Integer.$valueOf (this.haveHAtoms ? order : 1)]));
|
||||
}}
|
||||
return true;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "processSubclassAtom",
|
||||
function (atom, assemblyId, strChain) {
|
||||
if (this.isBiomolecule) {
|
||||
if (this.isCourseGrained) {
|
||||
var sum = this.chainAtomMap.get (assemblyId);
|
||||
if (sum == null) {
|
||||
this.chainAtomMap.put (assemblyId, sum = new JU.P3 ());
|
||||
this.chainAtomCounts.put (assemblyId, Clazz.newIntArray (1, 0));
|
||||
}this.chainAtomCounts.get (assemblyId)[0]++;
|
||||
sum.add (atom);
|
||||
return false;
|
||||
}} else if (this.byChain) {
|
||||
if (this.thisChain != atom.chainID) {
|
||||
this.thisChain = atom.chainID;
|
||||
this.chainSum = this.chainAtomMap.get (strChain);
|
||||
if (this.chainSum == null) {
|
||||
this.chainAtomMap.put (strChain, this.chainSum = new JU.P3 ());
|
||||
this.chainAtomCounts.put (strChain, this.chainAtomCount = Clazz.newIntArray (1, 0));
|
||||
}}this.chainSum.add (atom);
|
||||
this.chainAtomCount[0]++;
|
||||
return false;
|
||||
}if (assemblyId != null) {
|
||||
if (this.assemblyIdAtoms == null) this.assemblyIdAtoms = new java.util.Hashtable ();
|
||||
var bs = this.assemblyIdAtoms.get (assemblyId);
|
||||
if (bs == null) this.assemblyIdAtoms.put (assemblyId, bs = new JU.BS ());
|
||||
bs.set (this.ac);
|
||||
}return true;
|
||||
}, "J.adapter.smarter.Atom,~S,~S");
|
||||
Clazz.overrideMethod (c$, "checkPDBModelField",
|
||||
function (modelField, currentModelNo) {
|
||||
this.fieldProperty (modelField);
|
||||
var modelNo = this.parseIntStr (this.field);
|
||||
return (modelNo == currentModelNo ? modelNo : this.incrementModel (modelNo));
|
||||
}, "~N,~N");
|
||||
Clazz.defineMethod (c$, "incrementModel",
|
||||
function (modelNo) {
|
||||
var isAssembly = (this.thisDataSetName != null && this.thisDataSetName.indexOf ("-assembly-") >= 0);
|
||||
if (isAssembly) {
|
||||
this.useFileModelNumbers = true;
|
||||
var key = "," + modelNo + ",";
|
||||
if (this.modelStrings.indexOf (key) >= 0) {
|
||||
this.requiresSorting = true;
|
||||
} else {
|
||||
this.modelStrings += key;
|
||||
}}if (this.iHaveDesiredModel && this.asc.atomSetCount > 0 && !isAssembly) {
|
||||
this.done = true;
|
||||
if (this.parser != null) {
|
||||
this.parser.skipLoop (false);
|
||||
this.skipping = false;
|
||||
}this.continuing = true;
|
||||
return -2147483648;
|
||||
}var modelNumberToUse = (this.useFileModelNumbers ? modelNo : ++this.modelIndex);
|
||||
this.setHetero ();
|
||||
this.newModel (modelNumberToUse);
|
||||
if (!this.skipping) {
|
||||
this.nextAtomSet ();
|
||||
if (this.modelMap == null || this.asc.ac == 0) this.modelMap = new java.util.Hashtable ();
|
||||
this.modelMap.put ("" + modelNo, Integer.$valueOf (Math.max (0, this.asc.iSet)));
|
||||
this.modelMap.put ("_" + Math.max (0, this.asc.iSet), Integer.$valueOf (modelNo));
|
||||
}return modelNo;
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "setHetero",
|
||||
function () {
|
||||
if (this.htHetero != null) {
|
||||
this.asc.setCurrentModelInfo ("hetNames", this.htHetero);
|
||||
this.asc.setInfo ("hetNames", this.htHetero);
|
||||
}});
|
||||
Clazz.defineStatics (c$,
|
||||
"OPER_ID", 12,
|
||||
"OPER_XYZ", 13,
|
||||
"FAMILY_NCS_CAT", "_struct_ncs_oper.",
|
||||
"FAMILY_NCS", "_struct_ncs_oper",
|
||||
"ncsoperFields", Clazz.newArray (-1, ["*_matrix[1][1]", "*_matrix[1][2]", "*_matrix[1][3]", "*_vector[1]", "*_matrix[2][1]", "*_matrix[2][2]", "*_matrix[2][3]", "*_vector[2]", "*_matrix[3][1]", "*_matrix[3][2]", "*_matrix[3][3]", "*_vector[3]", "*_id", "*_symmetry_operation"]),
|
||||
"FAMILY_OPER_CAT", "_pdbx_struct_oper_list.",
|
||||
"FAMILY_OPER", "_pdbx_struct_oper_list",
|
||||
"operFields", Clazz.newArray (-1, ["*_matrix[1][1]", "*_matrix[1][2]", "*_matrix[1][3]", "*_vector[1]", "*_matrix[2][1]", "*_matrix[2][2]", "*_matrix[2][3]", "*_vector[2]", "*_matrix[3][1]", "*_matrix[3][2]", "*_matrix[3][3]", "*_vector[3]", "*_id", "*_symmetry_operation"]),
|
||||
"ASSEM_ID", 0,
|
||||
"ASSEM_OPERS", 1,
|
||||
"ASSEM_LIST", 2,
|
||||
"FAMILY_ASSEM_CAT", "_pdbx_struct_assembly_gen.",
|
||||
"assemblyFields", Clazz.newArray (-1, ["_pdbx_struct_assembly_gen_assembly_id", "_pdbx_struct_assembly_gen_oper_expression", "_pdbx_struct_assembly_gen_asym_id_list"]),
|
||||
"FAMILY_SEQUENCEDIF_CAT", "_struct_ref_seq_dif.",
|
||||
"STRUCT_REF_G3", 0,
|
||||
"STRUCT_REF_G1", 1,
|
||||
"structRefFields", Clazz.newArray (-1, ["_struct_ref_seq_dif_mon_id", "_struct_ref_seq_dif_db_mon_id"]),
|
||||
"CHEM_COMP_ID", 0,
|
||||
"CHEM_COMP_NAME", 1,
|
||||
"FAMILY_CHEMCOMP_CAT", "_chem_comp.",
|
||||
"chemCompFields", Clazz.newArray (-1, ["_chem_comp_id", "_chem_comp_name"]),
|
||||
"CONF_TYPE_ID", 0,
|
||||
"BEG_ASYM_ID", 1,
|
||||
"BEG_SEQ_ID", 2,
|
||||
"BEG_INS_CODE", 3,
|
||||
"END_ASYM_ID", 4,
|
||||
"END_SEQ_ID", 5,
|
||||
"END_INS_CODE", 6,
|
||||
"STRUCT_ID", 7,
|
||||
"SERIAL_NO", 8,
|
||||
"HELIX_CLASS", 9,
|
||||
"FAMILY_STRUCTCONF_CAT", "_struct_conf.",
|
||||
"FAMILY_STRUCTCONF", "_struct_conf",
|
||||
"structConfFields", Clazz.newArray (-1, ["*_conf_type_id", "*_beg_auth_asym_id", "*_beg_auth_seq_id", "*_pdbx_beg_pdb_ins_code", "*_end_auth_asym_id", "*_end_auth_seq_id", "*_pdbx_end_pdb_ins_code", "*_id", "*_pdbx_pdb_helix_id", "*_pdbx_pdb_helix_class"]),
|
||||
"SHEET_ID", 0,
|
||||
"STRAND_ID", 7,
|
||||
"FAMILY_SHEET_CAT", "_struct_sheet_range.",
|
||||
"FAMILY_SHEET", "_struct_sheet_range",
|
||||
"structSheetRangeFields", Clazz.newArray (-1, ["*_sheet_id", "*_beg_auth_asym_id", "*_beg_auth_seq_id", "*_pdbx_beg_pdb_ins_code", "*_end_auth_asym_id", "*_end_auth_seq_id", "*_pdbx_end_pdb_ins_code", "*_id"]),
|
||||
"SITE_ID", 0,
|
||||
"SITE_COMP_ID", 1,
|
||||
"SITE_ASYM_ID", 2,
|
||||
"SITE_SEQ_ID", 3,
|
||||
"SITE_INS_CODE", 4,
|
||||
"FAMILY_STRUCSITE_CAT", "_struct_site_gen.",
|
||||
"FAMILY_STRUCSITE", "_struct_site_gen",
|
||||
"structSiteFields", Clazz.newArray (-1, ["*_site_id", "*_auth_comp_id", "*_auth_asym_id", "*_auth_seq_id", "*_label_alt_id"]),
|
||||
"STRUCT_CONN_ASYM1", 0,
|
||||
"STRUCT_CONN_SEQ1", 1,
|
||||
"STRUCT_CONN_COMP1", 2,
|
||||
"STRUCT_CONN_ATOM1", 3,
|
||||
"STRUCT_CONN_ALT1", 4,
|
||||
"STRUCT_CONN_SYMM1", 5,
|
||||
"STRUCT_CONN_ASYM2", 6,
|
||||
"STRUCT_CONN_SEQ2", 7,
|
||||
"STRUCT_CONN_COMP2", 8,
|
||||
"STRUCT_CONN_ATOM2", 9,
|
||||
"STRUCT_CONN_ALT2", 10,
|
||||
"STRUCT_CONN_SYMM2", 11,
|
||||
"STRUCT_CONN_TYPE", 12,
|
||||
"STRUCT_CONN_ORDER", 13,
|
||||
"FAMILY_STRUCTCONN_CAT", "_struct_conn.",
|
||||
"FAMILY_STRUCTCONN", "_struct_conn",
|
||||
"structConnFields", Clazz.newArray (-1, ["*_ptnr1_auth_asym_id", "*_ptnr1_auth_seq_id", "*_ptnr1_auth_comp_id", "*_ptnr1_label_atom_id", "*_pdbx_ptnr1_label_alt_id", "*_ptnr1_symmetry", "*_ptnr2_auth_asym_id", "*_ptnr2_auth_seq_id", "*_ptnr2_auth_comp_id", "*_ptnr2_label_atom_id", "*_pdbx_ptnr2_label_alt_id", "*_ptnr2_symmetry", "*_conn_type_id", "*_pdbx_value_order"]),
|
||||
"CHEM_COMP_BOND_ID", 0,
|
||||
"CHEM_COMP_BOND_ATOM_ID_1", 1,
|
||||
"CHEM_COMP_BOND_ATOM_ID_2", 2,
|
||||
"CHEM_COMP_BOND_VALUE_ORDER", 3,
|
||||
"CHEM_COMP_BOND_AROMATIC_FLAG", 4,
|
||||
"FAMILY_COMPBOND_CAT", "_chem_comp_bond.",
|
||||
"FAMILY_COMPBOND", "_chem_comp_bond",
|
||||
"chemCompBondFields", Clazz.newArray (-1, ["*_comp_id", "*_atom_id_1", "*_atom_id_2", "*_value_order", "*_pdbx_aromatic_flag"]));
|
||||
});
|
||||
@@ -0,0 +1,132 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.cif");
|
||||
Clazz.load (null, "J.adapter.readers.cif.MMCifValidationParser", ["java.lang.Character", "java.util.Hashtable", "JU.Lst", "$.PT", "JS.SV", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.asResidues = false;
|
||||
this.reader = null;
|
||||
this.resMap = null;
|
||||
this.atomMap = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.cif, "MMCifValidationParser");
|
||||
Clazz.makeConstructor (c$,
|
||||
function () {
|
||||
});
|
||||
Clazz.defineMethod (c$, "set",
|
||||
function (reader) {
|
||||
this.reader = reader;
|
||||
this.asResidues = reader.checkFilterKey ("ASRES");
|
||||
return this;
|
||||
}, "J.adapter.smarter.AtomSetCollectionReader");
|
||||
Clazz.defineMethod (c$, "finalizeValidations",
|
||||
function (vwr, modelMap) {
|
||||
var map = this.reader.dssr;
|
||||
if (map != null) return vwr.getAnnotationParser (true).fixDSSRJSONMap (map);
|
||||
this.mapAtomResIDs (modelMap);
|
||||
var svMap = this.reader.validation;
|
||||
var retProps = this.reader.vwr.getAnnotationParser (false).catalogValidations (this.reader.vwr, svMap, this.getModelAtomIndices (), this.resMap, (this.asResidues ? null : this.atomMap), modelMap);
|
||||
var note = (retProps == null || retProps.size () == 0 ? null : this.setProperties (retProps));
|
||||
svMap.mapPut ("_note", JS.SV.newS (note));
|
||||
return note;
|
||||
}, "JV.Viewer,java.util.Map");
|
||||
Clazz.defineMethod (c$, "finalizeRna3d",
|
||||
function (modelMap) {
|
||||
this.mapAtomResIDs (modelMap);
|
||||
var svMap = this.getRna3dMap (this.reader.addedData);
|
||||
var note = this.reader.vwr.getAnnotationParser (false).catalogStructureUnits (this.reader.vwr, svMap, this.getModelAtomIndices (), this.resMap, null, modelMap);
|
||||
svMap.mapPut ("_note", JS.SV.newS (note));
|
||||
for (var i = this.reader.asc.atomSetCount; --i >= 0; ) {
|
||||
var info = this.reader.asc.getAtomSetAuxiliaryInfo (i);
|
||||
info.put ("rna3d", svMap);
|
||||
}
|
||||
return note;
|
||||
}, "java.util.Map");
|
||||
Clazz.defineMethod (c$, "getRna3dMap",
|
||||
function (addedData) {
|
||||
var map = new java.util.Hashtable ();
|
||||
var next = Clazz.newIntArray (1, 0);
|
||||
var id = "";
|
||||
while ((id = JU.PT.getQuotedStringNext (addedData, next)).length > 0) {
|
||||
var units = JU.PT.getQuotedStringNext (addedData, next);
|
||||
var type = "?";
|
||||
switch (id.charAt (0)) {
|
||||
case 'H':
|
||||
type = "hairpinLoops";
|
||||
break;
|
||||
case 'I':
|
||||
type = "internalLoops";
|
||||
break;
|
||||
case 'J':
|
||||
type = "junctions";
|
||||
break;
|
||||
default:
|
||||
JU.Logger.error ("MMCif could not read: " + id + " " + units);
|
||||
continue;
|
||||
}
|
||||
var list = map.get (type);
|
||||
if (list == null) map.put (type, list = new JU.Lst ());
|
||||
var m = new java.util.Hashtable ();
|
||||
m.put ("index", Integer.$valueOf (JU.PT.parseInt (id.substring (id.lastIndexOf ("_") + 1))));
|
||||
m.put ("units", units);
|
||||
list.addLast (m);
|
||||
}
|
||||
return JS.SV.getVariableMap (map);
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "mapAtomResIDs",
|
||||
function (modelMap) {
|
||||
var atoms = this.reader.asc.atoms;
|
||||
this.resMap = new java.util.Hashtable ();
|
||||
this.atomMap = new java.util.Hashtable ();
|
||||
var iresLast = -1;
|
||||
var resLast = null;
|
||||
var smodel = "" + modelMap.get ("_0");
|
||||
for (var i = 0, model = 1, i0 = 0, n = this.reader.asc.getAtomSetAtomCount (0); i < n; i++) {
|
||||
var a = atoms[i];
|
||||
var ires = a.sequenceNumber;
|
||||
var res = smodel + "_" + a.chainID + "_" + ires + "_" + (a.insertionCode == '\0' ? "" : "" + a.insertionCode);
|
||||
var atom = res + "_" + a.atomName.toUpperCase () + "_" + (a.altLoc == '\0' ? "" : "" + Character.toLowerCase (a.altLoc));
|
||||
var ia = Integer.$valueOf (i - i0);
|
||||
if (ires != iresLast) {
|
||||
iresLast = ires;
|
||||
if (resLast != null) resLast[1] = i - i0;
|
||||
this.resMap.put (res, resLast = Clazz.newIntArray (-1, [i - i0, n]));
|
||||
}this.atomMap.put (atom, ia);
|
||||
if (i == n - 1) {
|
||||
i0 += n;
|
||||
n = this.reader.asc.getAtomSetAtomCount (model++);
|
||||
}}
|
||||
}, "java.util.Map");
|
||||
Clazz.defineMethod (c$, "getModelAtomIndices",
|
||||
function () {
|
||||
var indices = Clazz.newIntArray (this.reader.asc.atomSetCount + 1, 0);
|
||||
for (var m = indices.length - 1; --m >= 0; ) indices[m] = this.reader.baseAtomIndex + this.reader.asc.getAtomSetAtomIndex (m);
|
||||
|
||||
indices[indices.length - 1] = this.reader.asc.ac;
|
||||
return indices;
|
||||
});
|
||||
Clazz.defineMethod (c$, "setProperties",
|
||||
function (propList) {
|
||||
var note = "Validations loaded:";
|
||||
for (var i = 0, n = propList.size (); i < n; ) {
|
||||
var key = propList.get (i++);
|
||||
var f = propList.get (i++);
|
||||
var model = (propList.get (i++)).intValue ();
|
||||
var isGroup = (propList.get (i++)).booleanValue ();
|
||||
var count = 0;
|
||||
var max = 0;
|
||||
var reslast = -1;
|
||||
var i0 = this.reader.asc.getAtomSetAtomIndex (model);
|
||||
for (var j = f.length; --j >= 0; ) if (f[j] != 0) {
|
||||
if (isGroup) {
|
||||
var res = this.reader.asc.atoms[i0 + j].sequenceNumber;
|
||||
if (res != reslast) {
|
||||
reslast = res;
|
||||
count++;
|
||||
}} else {
|
||||
count++;
|
||||
}max = Math.max (f[j], max);
|
||||
}
|
||||
note += "\n property_" + key + " (" + (isGroup ? "residues: " : "atoms: ") + count + (max == 1 ? "" : ", max: " + (Clazz.floatToInt (max * 100)) / 100) + ")";
|
||||
this.reader.asc.setAtomProperties (key, f, model, isGroup);
|
||||
}
|
||||
return note;
|
||||
}, "JU.Lst");
|
||||
});
|
||||
@@ -0,0 +1,286 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.cif");
|
||||
Clazz.load (["J.adapter.readers.cif.MMCifReader"], "J.adapter.readers.cif.MMTFReader", ["java.lang.Boolean", "java.util.Hashtable", "JU.BS", "$.Lst", "$.M4", "$.MessagePackReader", "$.PT", "$.SB", "J.adapter.smarter.Atom", "$.Bond", "$.Structure", "JS.SV", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.haveStructure = false;
|
||||
this.$pdbID = null;
|
||||
this.map = null;
|
||||
this.fileAtomCount = 0;
|
||||
this.opCount = 0;
|
||||
this.groupModels = null;
|
||||
this.groupMap = null;
|
||||
this.groupDSSP = null;
|
||||
this.atomGroup = null;
|
||||
this.labelAsymList = null;
|
||||
this.atomMap = null;
|
||||
this.entities = null;
|
||||
this.groupCount = 0;
|
||||
this.ac0 = 0;
|
||||
this.bsStructures = null;
|
||||
this.lastGroup = 0;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.cif, "MMTFReader", J.adapter.readers.cif.MMCifReader);
|
||||
Clazz.overrideMethod (c$, "addHeader",
|
||||
function () {
|
||||
});
|
||||
Clazz.overrideMethod (c$, "setup",
|
||||
function (fullPath, htParams, reader) {
|
||||
this.isBinary = true;
|
||||
this.isMMCIF = true;
|
||||
this.iHaveFractionalCoordinates = false;
|
||||
this.setupASCR (fullPath, htParams, reader);
|
||||
}, "~S,java.util.Map,~O");
|
||||
Clazz.overrideMethod (c$, "processBinaryDocument",
|
||||
function () {
|
||||
var doDoubleBonds = (!this.isCourseGrained && !this.checkFilterKey ("NODOUBLE"));
|
||||
this.isDSSP1 = !this.checkFilterKey ("DSSP2");
|
||||
var mmtfImplementsDSSP2 = false;
|
||||
this.applySymmetryToBonds = true;
|
||||
this.map = ( new JU.MessagePackReader (this.binaryDoc, true)).readMap ();
|
||||
this.entities = this.map.get ("entityList");
|
||||
if (JU.Logger.debugging) {
|
||||
for (var s, $s = this.map.keySet ().iterator (); $s.hasNext () && ((s = $s.next ()) || true);) JU.Logger.info (s);
|
||||
|
||||
}this.asc.setInfo ("noAutoBond", Boolean.TRUE);
|
||||
JU.Logger.info ("MMTF version " + this.map.get ("mmtfVersion"));
|
||||
JU.Logger.info ("MMTF Producer " + this.map.get ("mmtfProducer"));
|
||||
var title = this.map.get ("title");
|
||||
if (title != null) this.appendLoadNote (title);
|
||||
this.$pdbID = this.map.get ("structureId");
|
||||
if (this.$pdbID == null) this.$pdbID = this.map.get ("pdbId");
|
||||
this.fileAtomCount = (this.map.get ("numAtoms")).intValue ();
|
||||
var nBonds = (this.map.get ("numBonds")).intValue ();
|
||||
this.groupCount = (this.map.get ("numGroups")).intValue ();
|
||||
this.groupModels = Clazz.newIntArray (this.groupCount, 0);
|
||||
this.groupDSSP = Clazz.newIntArray (this.groupCount, 0);
|
||||
this.groupMap = Clazz.newIntArray (this.groupCount, 0);
|
||||
var modelCount = (this.map.get ("numModels")).intValue ();
|
||||
this.appendLoadNote ("id=" + this.$pdbID + " numAtoms=" + this.fileAtomCount + " numBonds=" + nBonds + " numGroups=" + this.groupCount + " numModels=" + modelCount);
|
||||
this.getMMTFAtoms (doDoubleBonds);
|
||||
if (!this.isCourseGrained) {
|
||||
var bo = this.decode ("bondOrderList");
|
||||
var bi = this.decode ("bondAtomList");
|
||||
this.addMMTFBonds (bo, bi, 0, doDoubleBonds, true);
|
||||
if (this.isDSSP1 || mmtfImplementsDSSP2) this.getStructure ();
|
||||
}this.setMMTFSymmetry ();
|
||||
this.getMMTFBioAssembly ();
|
||||
this.setModelPDB (true);
|
||||
if (JU.Logger.debuggingHigh) JU.Logger.info (JS.SV.getVariable (this.map).asString ());
|
||||
});
|
||||
Clazz.defineMethod (c$, "applySymmetryAndSetTrajectory",
|
||||
function () {
|
||||
this.ac0 = this.ac;
|
||||
Clazz.superCall (this, J.adapter.readers.cif.MMTFReader, "applySymmetryAndSetTrajectory", []);
|
||||
if (this.haveStructure) this.addStructureSymmetry ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "getMMTFAtoms",
|
||||
function (doMulti) {
|
||||
var chainsPerModel = this.map.get ("chainsPerModel");
|
||||
var groupsPerChain = this.map.get ("groupsPerChain");
|
||||
this.labelAsymList = this.decode ("chainIdList");
|
||||
var authAsymList = this.decode ("chainNameList");
|
||||
var groupTypeList = this.decode ("groupTypeList");
|
||||
var groupIdList = this.decode ("groupIdList");
|
||||
var groupList = this.map.get ("groupList");
|
||||
var insCodes = this.decode ("insCodeList");
|
||||
var atomId = this.decode ("atomIdList");
|
||||
var haveSerial = (atomId != null);
|
||||
var altloc = this.decode ("altLocList");
|
||||
var occ = this.decode ("occupancyList");
|
||||
var x = this.decode ("xCoordList");
|
||||
var y = this.decode ("yCoordList");
|
||||
var z = this.decode ("zCoordList");
|
||||
var bf = this.decode ("bFactorList");
|
||||
var nameList = (this.useAuthorChainID ? authAsymList : this.labelAsymList);
|
||||
var iModel = -1;
|
||||
var iChain = 0;
|
||||
var nChain = 0;
|
||||
var iGroup = 0;
|
||||
var nGroup = 0;
|
||||
var chainpt = 0;
|
||||
var seqNo = 0;
|
||||
var iatom = 0;
|
||||
var chainID = "";
|
||||
var authAsym = "";
|
||||
var labelAsym = "";
|
||||
var insCode = '\u0000';
|
||||
this.atomMap = new Array (this.fileAtomCount);
|
||||
this.atomGroup = Clazz.newIntArray (this.fileAtomCount, 0);
|
||||
for (var j = 0, thisGroup = -1; j < this.groupCount; j++) {
|
||||
if (++iGroup >= nGroup) {
|
||||
chainID = nameList[chainpt];
|
||||
authAsym = authAsymList[chainpt];
|
||||
labelAsym = this.labelAsymList[chainpt];
|
||||
nGroup = groupsPerChain[chainpt++];
|
||||
iGroup = 0;
|
||||
if (++iChain >= nChain) {
|
||||
this.groupModels[j] = ++iModel;
|
||||
nChain = chainsPerModel[iModel];
|
||||
iChain = 0;
|
||||
this.setModelPDB (true);
|
||||
this.incrementModel (iModel + 1);
|
||||
this.asc.setCurrentModelInfo ("pdbID", this.$pdbID);
|
||||
this.nAtoms0 = this.asc.ac;
|
||||
if (this.done) return;
|
||||
}}var g = groupList[groupTypeList[j]];
|
||||
var atomNameList = g.get ("atomNameList");
|
||||
var len = atomNameList.length;
|
||||
if (this.skipping) {
|
||||
iatom += len;
|
||||
continue;
|
||||
}var a0 = iatom;
|
||||
if (insCodes != null) insCode = insCodes[j];
|
||||
seqNo = groupIdList[j];
|
||||
var group3 = g.get ("groupName");
|
||||
var isHetero = this.vwr.getJBR ().isHetero (group3);
|
||||
if (isHetero) {
|
||||
var hetName = "" + g.get ("chemCompType");
|
||||
if (this.htHetero == null || !this.htHetero.containsKey (group3)) {
|
||||
if (this.entities != null && hetName.equals ("NON-POLYMER")) out : for (var i = this.entities.length; --i >= 0; ) {
|
||||
var entity = this.entities[i];
|
||||
var chainList = entity.get ("chainIndexList");
|
||||
for (var k = chainList.length; --k >= 0; ) if (chainList[k] == iChain) {
|
||||
hetName = "a component of the entity \"" + entity.get ("description") + "\"";
|
||||
break out;
|
||||
}
|
||||
}
|
||||
this.addHetero (group3, hetName, false, true);
|
||||
}}var elementList = g.get ("elementList");
|
||||
var haveAtom = false;
|
||||
for (var ia = 0, pt = 0; ia < len; ia++, iatom++) {
|
||||
var a = new J.adapter.smarter.Atom ();
|
||||
a.isHetero = isHetero;
|
||||
if (insCode.charCodeAt (0) != 0) a.insertionCode = insCode;
|
||||
this.setAtomCoordXYZ (a, x[iatom], y[iatom], z[iatom]);
|
||||
a.elementSymbol = elementList[pt];
|
||||
a.atomName = atomNameList[pt++];
|
||||
if (seqNo >= 0) this.maxSerial = Math.max (this.maxSerial, a.sequenceNumber = seqNo);
|
||||
a.group3 = group3;
|
||||
this.setChainID (a, chainID);
|
||||
if (bf != null) a.bfactor = bf[iatom];
|
||||
if (altloc != null) a.altLoc = altloc[iatom];
|
||||
if (occ != null) a.foccupancy = occ[iatom];
|
||||
if (haveSerial) a.atomSerial = atomId[iatom];
|
||||
if (!this.filterAtom (a, -1) || !this.processSubclassAtom (a, labelAsym, authAsym)) continue;
|
||||
if (!haveAtom) {
|
||||
thisGroup++;
|
||||
haveAtom = true;
|
||||
}if (haveSerial) {
|
||||
this.asc.addAtomWithMappedSerialNumber (a);
|
||||
} else {
|
||||
this.asc.addAtom (a);
|
||||
}this.atomMap[iatom] = a;
|
||||
this.atomGroup[this.ac] = j;
|
||||
this.groupMap[j] = this.lastGroup = thisGroup;
|
||||
this.ac++;
|
||||
}
|
||||
if (!this.isCourseGrained) {
|
||||
var bo = g.get ("bondOrderList");
|
||||
var bi = g.get ("bondAtomList");
|
||||
this.addMMTFBonds (bo, bi, a0, doMulti, false);
|
||||
}}
|
||||
this.asc.setCurrentModelInfo ("pdbID", this.$pdbID);
|
||||
}, "~B");
|
||||
Clazz.defineMethod (c$, "addMMTFBonds",
|
||||
function (bo, bi, a0, doMulti, isInter) {
|
||||
if (bi == null) return;
|
||||
doMulti = new Boolean (doMulti & (bo != null)).valueOf ();
|
||||
for (var bj = 0, pt = 0, nj = Clazz.doubleToInt (bi.length / 2); bj < nj; bj++) {
|
||||
var a1 = this.atomMap[bi[pt++] + a0];
|
||||
var a2 = this.atomMap[bi[pt++] + a0];
|
||||
if (a1 != null && a2 != null) {
|
||||
var bond = new J.adapter.smarter.Bond (a1.index, a2.index, doMulti ? bo[bj] : 1);
|
||||
this.asc.addBond (bond);
|
||||
if (JU.Logger.debugging && isInter) {
|
||||
JU.Logger.info ("inter-group (" + (a1.atomSetIndex + 1) + "." + a1.index + "/" + (a2.atomSetIndex + 1) + "." + a2.index + ") bond " + a1.group3 + a1.sequenceNumber + "." + a1.atomName + " - " + a2.group3 + a2.sequenceNumber + "." + a2.atomName + " " + bond.order);
|
||||
}}}
|
||||
}, "~A,~A,~N,~B,~B");
|
||||
Clazz.defineMethod (c$, "setMMTFSymmetry",
|
||||
function () {
|
||||
this.setSpaceGroupName (this.map.get ("spaceGroup"));
|
||||
var o = this.map.get ("unitCell");
|
||||
if (o != null) for (var i = 0; i < 6; i++) this.setUnitCellItem (i, o[i]);
|
||||
|
||||
});
|
||||
Clazz.defineMethod (c$, "getMMTFBioAssembly",
|
||||
function () {
|
||||
var o = this.map.get ("bioAssemblyList");
|
||||
if (o == null) return;
|
||||
if (this.vBiomolecules == null) this.vBiomolecules = new JU.Lst ();
|
||||
for (var i = o.length; --i >= 0; ) {
|
||||
var info = new java.util.Hashtable ();
|
||||
this.vBiomolecules.addLast (info);
|
||||
var iMolecule = i + 1;
|
||||
this.checkFilterAssembly ("" + iMolecule, info);
|
||||
info.put ("name", "biomolecule " + iMolecule);
|
||||
info.put ("molecule", Integer.$valueOf (iMolecule));
|
||||
var assemb = new JU.Lst ();
|
||||
var ops = new JU.Lst ();
|
||||
info.put ("biomts", new JU.Lst ());
|
||||
info.put ("chains", new JU.Lst ());
|
||||
info.put ("assemblies", assemb);
|
||||
info.put ("operators", ops);
|
||||
var m = o[i];
|
||||
var tlist = m.get ("transformList");
|
||||
var chlist = new JU.SB ();
|
||||
for (var j = 0, n = tlist.length; j < n; j++) {
|
||||
var t = tlist[j];
|
||||
chlist.setLength (0);
|
||||
var chainList = t.get ("chainIndexList");
|
||||
for (var k = 0, kn = chainList.length; k < kn; k++) chlist.append ("$").append (this.labelAsymList[chainList[k]]);
|
||||
|
||||
assemb.addLast (chlist.append ("$").toString ());
|
||||
var id = "" + (++this.opCount);
|
||||
this.addMatrix (id, JU.M4.newA16 (t.get ("matrix")), false);
|
||||
ops.addLast (id);
|
||||
}
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "getStructure",
|
||||
function () {
|
||||
var a = this.decode ("secStructList");
|
||||
if (JU.Logger.debugging) JU.Logger.info (JU.PT.toJSON ("secStructList", a));
|
||||
this.bsStructures = Clazz.newArray (-1, [ new JU.BS (), null, new JU.BS (), new JU.BS (), new JU.BS (), null, new JU.BS ()]);
|
||||
var lastGroup = -1;
|
||||
for (var j = 0; j < a.length; j++) {
|
||||
var type = a[j];
|
||||
switch (type) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
var igroup = this.groupMap[j];
|
||||
this.bsStructures[type].set (igroup);
|
||||
this.groupDSSP[igroup] = type + 1;
|
||||
lastGroup = j;
|
||||
}
|
||||
}
|
||||
var n = (this.isDSSP1 ? this.asc.iSet : this.groupModels[lastGroup]);
|
||||
if (lastGroup >= 0) {
|
||||
this.haveStructure = true;
|
||||
this.asc.addStructure ( new J.adapter.smarter.Structure (n, null, null, null, 0, 0, this.bsStructures));
|
||||
}});
|
||||
Clazz.defineMethod (c$, "addStructureSymmetry",
|
||||
function () {
|
||||
if (this.asc.ac == 0) return;
|
||||
var atoms = this.asc.atoms;
|
||||
var bsAtoms = this.asc.bsAtoms;
|
||||
var ptGroup = this.lastGroup;
|
||||
var mygroup = -1;
|
||||
for (var i = this.ac0, n = this.asc.ac; i < n; i++) {
|
||||
if (bsAtoms == null || bsAtoms.get (i)) {
|
||||
var a = atoms[i];
|
||||
var igroup = this.atomGroup[a.atomSite];
|
||||
if (igroup != mygroup) {
|
||||
mygroup = igroup;
|
||||
ptGroup++;
|
||||
}var dssp = this.groupDSSP[igroup];
|
||||
if (dssp > 0) {
|
||||
this.bsStructures[dssp - 1].set (ptGroup);
|
||||
}}}
|
||||
});
|
||||
Clazz.defineMethod (c$, "decode",
|
||||
function (key) {
|
||||
return JU.MessagePackReader.decode (this.map.get (key));
|
||||
}, "~S");
|
||||
});
|
||||
@@ -0,0 +1,367 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.cif");
|
||||
Clazz.load (["J.adapter.readers.cif.MSRdr"], "J.adapter.readers.cif.MSCifParser", ["java.lang.Character", "$.Double", "JU.M3", "$.Matrix", "$.PT"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.field = null;
|
||||
this.comSSMat = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.cif, "MSCifParser", J.adapter.readers.cif.MSRdr);
|
||||
Clazz.makeConstructor (c$,
|
||||
function () {
|
||||
Clazz.superConstructor (this, J.adapter.readers.cif.MSCifParser, []);
|
||||
});
|
||||
Clazz.defineMethod (c$, "processEntry",
|
||||
function () {
|
||||
var cr = this.cr;
|
||||
if (cr.key.equals ("_cell_commen_t_section_1")) {
|
||||
this.isCommensurate = true;
|
||||
this.commensurateSection1 = cr.parseIntStr (cr.data);
|
||||
}if (cr.key.startsWith ("_cell_commen_supercell_matrix")) {
|
||||
this.isCommensurate = true;
|
||||
if (this.comSSMat == null) this.comSSMat = JU.M3.newM3 (null);
|
||||
var tokens = JU.PT.split (cr.key, "_");
|
||||
var r = cr.parseIntStr (tokens[tokens.length - 2]);
|
||||
var c = cr.parseIntStr (tokens[tokens.length - 1]);
|
||||
if (r > 0 && c > 0) this.comSSMat.setElement (r - 1, c - 1, cr.parseFloatStr (cr.data));
|
||||
}});
|
||||
Clazz.defineMethod (c$, "processLoopBlock",
|
||||
function () {
|
||||
var cr = this.cr;
|
||||
var key = cr.key;
|
||||
if (key.equals ("_cell_subsystem_code")) return this.processSubsystemLoopBlock ();
|
||||
if (!key.startsWith ("_cell_wave") && !key.contains ("fourier") && !key.contains ("legendre") && !key.contains ("_special_func")) {
|
||||
if (key.contains ("crenel_ortho")) cr.appendLoadNote ("WARNING: Orthogonalized non-Legendre functions not supported.\nThe following block has been ignored. Use Legendre functions instead.\n\n" + cr.parser.skipLoop (true) + "=================================\n");
|
||||
return 0;
|
||||
}if (cr.asc.iSet < 0) cr.asc.newAtomSet ();
|
||||
cr.parseLoopParametersFor ("_atom_site", J.adapter.readers.cif.MSCifParser.modulationFields);
|
||||
var tok;
|
||||
if (cr.key2col[8] != -1) {
|
||||
cr.key2col[5] = cr.key2col[6] = cr.key2col[7] = -1;
|
||||
}while (cr.parser.getData ()) {
|
||||
var ignore = false;
|
||||
var type_id = null;
|
||||
var atomLabel = null;
|
||||
var axis = null;
|
||||
var pt = Clazz.newDoubleArray (-1, [NaN, NaN, NaN]);
|
||||
var c = NaN;
|
||||
var w = NaN;
|
||||
var fid = null;
|
||||
var n = cr.parser.getColumnCount ();
|
||||
for (var i = 0; i < n; ++i) {
|
||||
switch (tok = this.fieldProperty (cr, i)) {
|
||||
case 1:
|
||||
cr.haveCellWaveVector = true;
|
||||
case 0:
|
||||
case 40:
|
||||
case 41:
|
||||
case 42:
|
||||
pt[0] = pt[1] = pt[2] = 0;
|
||||
case 13:
|
||||
case 25:
|
||||
case 50:
|
||||
case 35:
|
||||
case 43:
|
||||
case 44:
|
||||
case 45:
|
||||
switch (tok) {
|
||||
case 1:
|
||||
type_id = "W_";
|
||||
break;
|
||||
case 0:
|
||||
type_id = "F_";
|
||||
break;
|
||||
case 40:
|
||||
case 41:
|
||||
case 42:
|
||||
fid = "?" + this.field;
|
||||
pt[2] = 1;
|
||||
continue;
|
||||
case 43:
|
||||
case 44:
|
||||
case 45:
|
||||
atomLabel = axis = "*";
|
||||
case 13:
|
||||
case 25:
|
||||
case 50:
|
||||
case 35:
|
||||
type_id = Character.toUpperCase (J.adapter.readers.cif.MSCifParser.modulationFields[tok].charAt (11)) + "_";
|
||||
break;
|
||||
}
|
||||
type_id += this.field;
|
||||
break;
|
||||
case 46:
|
||||
type_id = "J_O";
|
||||
pt[0] = pt[2] = 1;
|
||||
axis = "0";
|
||||
atomLabel = this.field;
|
||||
break;
|
||||
case 30:
|
||||
type_id = "O_0";
|
||||
axis = "0";
|
||||
atomLabel = this.field;
|
||||
break;
|
||||
case 18:
|
||||
type_id = "D_S";
|
||||
axis = "0";
|
||||
atomLabel = this.field;
|
||||
break;
|
||||
case 55:
|
||||
type_id = "M_T";
|
||||
axis = "0";
|
||||
atomLabel = this.field;
|
||||
break;
|
||||
case 61:
|
||||
type_id = "D_L";
|
||||
atomLabel = this.field;
|
||||
break;
|
||||
case 65:
|
||||
type_id = "U_L";
|
||||
atomLabel = this.field;
|
||||
break;
|
||||
case 69:
|
||||
type_id = "O_L";
|
||||
atomLabel = this.field;
|
||||
break;
|
||||
case 11:
|
||||
case 24:
|
||||
case 48:
|
||||
case 33:
|
||||
atomLabel = this.field;
|
||||
break;
|
||||
case 12:
|
||||
case 49:
|
||||
case 62:
|
||||
axis = this.field;
|
||||
if (this.modAxes != null && this.modAxes.indexOf (axis.toUpperCase ()) < 0) ignore = true;
|
||||
break;
|
||||
case 66:
|
||||
case 34:
|
||||
axis = this.field.toUpperCase ();
|
||||
break;
|
||||
default:
|
||||
var f = cr.parseFloatStr (this.field);
|
||||
switch (tok) {
|
||||
case 64:
|
||||
case 71:
|
||||
case 68:
|
||||
pt[0] = f;
|
||||
if (f != 0) pt[2] = 0;
|
||||
break;
|
||||
case 27:
|
||||
case 31:
|
||||
case 15:
|
||||
case 52:
|
||||
case 37:
|
||||
case 77:
|
||||
case 73:
|
||||
case 75:
|
||||
pt[2] = 0;
|
||||
case 2:
|
||||
case 5:
|
||||
case 19:
|
||||
case 56:
|
||||
pt[0] = f;
|
||||
break;
|
||||
case 8:
|
||||
type_id += "_coefs_";
|
||||
pt = Clazz.newDoubleArray (this.modDim, 0);
|
||||
pt[0] = f;
|
||||
break;
|
||||
case 16:
|
||||
case 28:
|
||||
case 53:
|
||||
case 38:
|
||||
pt[0] = f;
|
||||
pt[2] = 1;
|
||||
break;
|
||||
case 70:
|
||||
case 74:
|
||||
case 26:
|
||||
axis = "0";
|
||||
case 63:
|
||||
case 67:
|
||||
case 3:
|
||||
case 6:
|
||||
case 9:
|
||||
case 17:
|
||||
case 29:
|
||||
case 54:
|
||||
case 39:
|
||||
case 32:
|
||||
case 20:
|
||||
case 57:
|
||||
case 47:
|
||||
case 14:
|
||||
case 51:
|
||||
case 36:
|
||||
case 72:
|
||||
case 76:
|
||||
pt[1] = f;
|
||||
break;
|
||||
case 4:
|
||||
case 7:
|
||||
case 10:
|
||||
case 21:
|
||||
case 58:
|
||||
pt[2] = f;
|
||||
break;
|
||||
case 22:
|
||||
case 59:
|
||||
c = f;
|
||||
break;
|
||||
case 23:
|
||||
case 60:
|
||||
w = f;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ignore || type_id == null || atomLabel != null && !atomLabel.equals ("*") && cr.rejectAtomName (atomLabel)) continue;
|
||||
var ok = true;
|
||||
for (var j = 0, nzero = pt.length; j < pt.length; j++) if (Double.isNaN (pt[j]) || pt[j] > 1e100 || pt[j] == 0 && --nzero == 0) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
if (!ok) continue;
|
||||
switch (type_id.charAt (0)) {
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'O':
|
||||
case 'M':
|
||||
case 'U':
|
||||
case 'J':
|
||||
if (atomLabel == null || axis == null) continue;
|
||||
if (type_id.equals ("D_S") || type_id.equals ("M_T")) {
|
||||
if (Double.isNaN (c) || Double.isNaN (w)) continue;
|
||||
if (pt[0] != 0) this.addMod (type_id + "#x;" + atomLabel, fid, Clazz.newDoubleArray (-1, [c, w, pt[0]]));
|
||||
if (pt[1] != 0) this.addMod (type_id + "#y;" + atomLabel, fid, Clazz.newDoubleArray (-1, [c, w, pt[1]]));
|
||||
if (pt[2] != 0) this.addMod (type_id + "#z;" + atomLabel, fid, Clazz.newDoubleArray (-1, [c, w, pt[2]]));
|
||||
continue;
|
||||
}if (type_id.indexOf ("_L") == 1) {
|
||||
if (type_id.startsWith ("U")) type_id += Clazz.doubleToInt (pt[1]);
|
||||
else axis += Clazz.doubleToInt (pt[1]);
|
||||
}type_id += "#" + axis + ";" + atomLabel;
|
||||
break;
|
||||
}
|
||||
this.addMod (type_id, fid, pt);
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
Clazz.defineMethod (c$, "addMod",
|
||||
function (id, fid, params) {
|
||||
if (fid != null) id += fid;
|
||||
this.addModulation (null, id, params, -1);
|
||||
}, "~S,~S,~A");
|
||||
Clazz.defineMethod (c$, "processSubsystemLoopBlock",
|
||||
function () {
|
||||
var cr = this.cr;
|
||||
cr.parseLoopParameters (null);
|
||||
while (cr.parser.getData ()) {
|
||||
this.fieldProperty (cr, 0);
|
||||
var id = this.field;
|
||||
this.addSubsystem (id, this.getSparseMatrix (cr, "_w_", 1, 3 + this.modDim));
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
Clazz.defineMethod (c$, "getSparseMatrix",
|
||||
function (cr, term, i, dim) {
|
||||
var m = new JU.Matrix (null, dim, dim);
|
||||
var a = m.getArray ();
|
||||
var key;
|
||||
var p;
|
||||
var n = cr.parser.getColumnCount ();
|
||||
for (; i < n; ++i) {
|
||||
if ((p = this.fieldProperty (cr, i)) < 0 || !(key = cr.parser.getColumnName (p)).contains (term)) continue;
|
||||
var tokens = JU.PT.split (key, "_");
|
||||
var r = cr.parseIntStr (tokens[tokens.length - 2]);
|
||||
var c = cr.parseIntStr (tokens[tokens.length - 1]);
|
||||
if (r > 0 && c > 0) a[r - 1][c - 1] = cr.parseFloatStr (this.field);
|
||||
}
|
||||
return m;
|
||||
}, "J.adapter.readers.cif.CifReader,~S,~N,~N");
|
||||
Clazz.defineMethod (c$, "fieldProperty",
|
||||
function (cr, i) {
|
||||
return ((this.field = cr.parser.getColumnData (i)).length > 0 && this.field.charAt (0) != '\0' ? cr.col2key[i] : -1);
|
||||
}, "J.adapter.readers.cif.CifReader,~N");
|
||||
Clazz.defineStatics (c$,
|
||||
"FWV_ID", 0,
|
||||
"WV_ID", 1,
|
||||
"WV_X", 2,
|
||||
"WV_Y", 3,
|
||||
"WV_Z", 4,
|
||||
"FWV_X", 5,
|
||||
"FWV_Y", 6,
|
||||
"FWV_Z", 7,
|
||||
"JANA_FWV_Q1_COEF", 8,
|
||||
"JANA_FWV_Q2_COEF", 9,
|
||||
"JANA_FWV_Q3_COEF", 10,
|
||||
"FWV_DISP_LABEL", 11,
|
||||
"FWV_DISP_AXIS", 12,
|
||||
"FWV_DISP_SEQ_ID", 13,
|
||||
"FWV_DISP_COS", 14,
|
||||
"FWV_DISP_SIN", 15,
|
||||
"FWV_DISP_MODULUS", 16,
|
||||
"FWV_DISP_PHASE", 17,
|
||||
"DISP_SPEC_LABEL", 18,
|
||||
"DISP_SAW_AX", 19,
|
||||
"DISP_SAW_AY", 20,
|
||||
"DISP_SAW_AZ", 21,
|
||||
"DISP_SAW_C", 22,
|
||||
"DISP_SAW_W", 23,
|
||||
"FWV_OCC_LABEL", 24,
|
||||
"FWV_OCC_SEQ_ID", 25,
|
||||
"FWV_OCC_COS", 26,
|
||||
"FWV_OCC_SIN", 27,
|
||||
"FWV_OCC_MODULUS", 28,
|
||||
"FWV_OCC_PHASE", 29,
|
||||
"OCC_SPECIAL_LABEL", 30,
|
||||
"OCC_CRENEL_C", 31,
|
||||
"OCC_CRENEL_W", 32,
|
||||
"FWV_U_LABEL", 33,
|
||||
"FWV_U_TENS", 34,
|
||||
"FWV_U_SEQ_ID", 35,
|
||||
"FWV_U_COS", 36,
|
||||
"FWV_U_SIN", 37,
|
||||
"FWV_U_MODULUS", 38,
|
||||
"FWV_U_PHASE", 39,
|
||||
"FD_ID", 40,
|
||||
"FO_ID", 41,
|
||||
"FU_ID", 42,
|
||||
"FDP_ID", 43,
|
||||
"FOP_ID", 44,
|
||||
"FUP_ID", 45,
|
||||
"JANA_OCC_ABS_LABEL", 46,
|
||||
"JANA_OCC_ABS_O_0", 47,
|
||||
"FWV_SPIN_LABEL", 48,
|
||||
"FWV_SPIN_AXIS", 49,
|
||||
"FWV_SPIN_SEQ_ID", 50,
|
||||
"FWV_SPIN_COS", 51,
|
||||
"FWV_SPIN_SIN", 52,
|
||||
"FWV_SPIN_MODULUS", 53,
|
||||
"FWV_SPIN_PHASE", 54,
|
||||
"SPIN_SPEC_LABEL", 55,
|
||||
"SPIN_SAW_AX", 56,
|
||||
"SPIN_SAW_AY", 57,
|
||||
"SPIN_SAW_AZ", 58,
|
||||
"SPIN_SAW_C", 59,
|
||||
"SPIN_SAW_W", 60,
|
||||
"LEG_DISP_LABEL", 61,
|
||||
"LEG_DISP_AXIS", 62,
|
||||
"LEG_DISP_ORDER", 63,
|
||||
"LEG_DISP_COEF", 64,
|
||||
"LEG_U_LABEL", 65,
|
||||
"LEG_U_TENS", 66,
|
||||
"LEG_U_ORDER", 67,
|
||||
"LEG_U_COEF", 68,
|
||||
"LEG_OCC_LABEL", 69,
|
||||
"LEG_OCC_ORDER", 70,
|
||||
"LEG_OCC_COEF", 71,
|
||||
"DEPR_FD_COS", 72,
|
||||
"DEPR_FD_SIN", 73,
|
||||
"DEPR_FO_COS", 74,
|
||||
"DEPR_FO_SIN", 75,
|
||||
"DEPR_FU_COS", 76,
|
||||
"DEPR_FU_SIN", 77,
|
||||
"modulationFields", Clazz.newArray (-1, ["*_fourier_wave_vector_seq_id", "_cell_wave_vector_seq_id", "_cell_wave_vector_x", "_cell_wave_vector_y", "_cell_wave_vector_z", "*_fourier_wave_vector_x", "*_fourier_wave_vector_y", "*_fourier_wave_vector_z", "*_fourier_wave_vector_q1_coeff", "*_fourier_wave_vector_q2_coeff", "*_fourier_wave_vector_q3_coeff", "*_displace_fourier_atom_site_label", "*_displace_fourier_axis", "*_displace_fourier_wave_vector_seq_id", "*_displace_fourier_param_cos", "*_displace_fourier_param_sin", "*_displace_fourier_param_modulus", "*_displace_fourier_param_phase", "*_displace_special_func_atom_site_label", "*_displace_special_func_sawtooth_ax", "*_displace_special_func_sawtooth_ay", "*_displace_special_func_sawtooth_az", "*_displace_special_func_sawtooth_c", "*_displace_special_func_sawtooth_w", "*_occ_fourier_atom_site_label", "*_occ_fourier_wave_vector_seq_id", "*_occ_fourier_param_cos", "*_occ_fourier_param_sin", "*_occ_fourier_param_modulus", "*_occ_fourier_param_phase", "*_occ_special_func_atom_site_label", "*_occ_special_func_crenel_c", "*_occ_special_func_crenel_w", "*_u_fourier_atom_site_label", "*_u_fourier_tens_elem", "*_u_fourier_wave_vector_seq_id", "*_u_fourier_param_cos", "*_u_fourier_param_sin", "*_u_fourier_param_modulus", "*_u_fourier_param_phase", "*_displace_fourier_id", "*_occ_fourier_id", "*_u_fourier_id", "*_displace_fourier_param_id", "*_occ_fourier_param_id", "*_u_fourier_param_id", "*_occ_fourier_absolute_site_label", "*_occ_fourier_absolute", "*_moment_fourier_atom_site_label", "*_moment_fourier_axis", "*_moment_fourier_wave_vector_seq_id", "*_moment_fourier_param_cos", "*_moment_fourier_param_sin", "*_moment_fourier_param_modulus", "*_moment_fourier_param_phase", "*_moment_special_func_atom_site_label", "*_moment_special_func_sawtooth_ax", "*_moment_special_func_sawtooth_ay", "*_moment_special_func_sawtooth_az", "*_moment_special_func_sawtooth_c", "*_moment_special_func_sawtooth_w", "*_displace_legendre_atom_site_label", "*_displace_legendre_axis", "*_displace_legendre_param_order", "*_displace_legendre_param_coeff", "*_u_legendre_atom_site_label", "*_u_legendre_tens_elem", "*_u_legendre_param_order", "*_u_legendre_param_coeff", "*_occ_legendre_atom_site_label", "*_occ_legendre_param_order", "*_occ_legendre_param_coeff", "*_displace_fourier_cos", "*_displace_fourier_sin", "*_occ_fourier_cos", "*_occ_fourier_sin", "*_u_fourier_cos", "*_u_fourier_sin"]),
|
||||
"NONE", -1);
|
||||
});
|
||||
@@ -0,0 +1,593 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.cif");
|
||||
Clazz.load (["J.adapter.smarter.MSInterface"], "J.adapter.readers.cif.MSRdr", ["java.lang.Boolean", "$.Exception", "$.Float", "java.util.Hashtable", "JU.Lst", "$.M3", "$.Matrix", "$.P3", "$.PT", "J.adapter.readers.cif.Subsystem", "J.adapter.smarter.AtomSetCollectionReader", "JU.BSUtil", "$.BoxInfo", "$.Escape", "$.Logger", "$.Modulation", "$.ModulationSet", "$.Vibration"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.cr = null;
|
||||
this.modDim = 0;
|
||||
this.modAxes = null;
|
||||
this.modAverage = false;
|
||||
this.isCommensurate = false;
|
||||
this.commensurateSection1 = 0;
|
||||
this.modPack = false;
|
||||
this.modVib = false;
|
||||
this.modType = null;
|
||||
this.modCell = null;
|
||||
this.modDebug = false;
|
||||
this.modSelected = -1;
|
||||
this.modLast = false;
|
||||
this.sigma = null;
|
||||
this.htModulation = null;
|
||||
this.htAtomMods = null;
|
||||
this.iopLast = -1;
|
||||
this.gammaE = null;
|
||||
this.nOps = 0;
|
||||
this.haveOccupancy = false;
|
||||
this.atoms = null;
|
||||
this.ac = 0;
|
||||
this.haveAtomMods = false;
|
||||
this.modCoord = false;
|
||||
this.finalized = false;
|
||||
this.symmetry = null;
|
||||
this.supercellSymmetry = null;
|
||||
this.legendres = null;
|
||||
this.atModel = "@0";
|
||||
this.modMatrices = null;
|
||||
this.qlist100 = null;
|
||||
this.qs = null;
|
||||
this.modCount = 0;
|
||||
this.modTUV = null;
|
||||
this.htSubsystems = null;
|
||||
this.minXYZ0 = null;
|
||||
this.maxXYZ0 = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.cif, "MSRdr", null, J.adapter.smarter.MSInterface);
|
||||
Clazz.defineMethod (c$, "getSigma",
|
||||
function () {
|
||||
return this.sigma;
|
||||
});
|
||||
Clazz.makeConstructor (c$,
|
||||
function () {
|
||||
});
|
||||
Clazz.overrideMethod (c$, "initialize",
|
||||
function (r, modDim) {
|
||||
this.cr = r;
|
||||
this.modCoord = r.checkFilterKey ("MODCOORD");
|
||||
this.modDebug = r.checkFilterKey ("MODDEBUG");
|
||||
this.modPack = !r.checkFilterKey ("MODNOPACK");
|
||||
this.modLast = r.checkFilterKey ("MODLAST");
|
||||
this.modAxes = r.getFilter ("MODAXES=");
|
||||
this.modType = r.getFilter ("MODTYPE=");
|
||||
this.modCell = r.getFilter ("MODCELL=");
|
||||
this.modSelected = r.parseIntStr ("" + r.getFilter ("MOD="));
|
||||
this.modVib = r.checkFilterKey ("MODVIB");
|
||||
this.modAverage = r.checkFilterKey ("MODAVE");
|
||||
var smodTUV = r.getFilter ("MODT=");
|
||||
if (smodTUV != null || (smodTUV = r.getFilter ("MODTUV=")) != null) {
|
||||
this.modTUV = new JU.P3 ();
|
||||
var tuv = (JU.PT.replaceAllCharacters (smodTUV, "{}()", "") + ",0,0,0").$plit (",");
|
||||
this.modTUV.x = JU.PT.parseFloatFraction (tuv[0]);
|
||||
this.modTUV.y = JU.PT.parseFloatFraction (tuv[1]);
|
||||
this.modTUV.z = JU.PT.parseFloatFraction (tuv[2]);
|
||||
if (Float.isNaN (this.modTUV.lengthSquared ())) {
|
||||
JU.Logger.error ("MSRdr cannot read modTUV=" + smodTUV);
|
||||
this.modTUV = null;
|
||||
}}this.setModDim (modDim);
|
||||
return modDim;
|
||||
}, "J.adapter.smarter.AtomSetCollectionReader,~N");
|
||||
Clazz.defineMethod (c$, "setSubsystemOptions",
|
||||
function () {
|
||||
this.cr.forceSymmetry (this.modPack);
|
||||
if (this.modCell != null) this.cr.addJmolScript ("unitcell {%" + this.modCell + "}");
|
||||
});
|
||||
Clazz.defineMethod (c$, "setModDim",
|
||||
function (ndim) {
|
||||
this.htModulation = new java.util.Hashtable ();
|
||||
this.modDim = ndim;
|
||||
this.cr.appendLoadNote ("Modulation dimension = " + this.modDim);
|
||||
}, "~N");
|
||||
Clazz.overrideMethod (c$, "addModulation",
|
||||
function (map, id, pt, iModel) {
|
||||
var ch = id.charAt (0);
|
||||
switch (ch) {
|
||||
case 'O':
|
||||
case 'D':
|
||||
case 'M':
|
||||
case 'U':
|
||||
if (this.modType != null && this.modType.indexOf (ch) < 0 || this.modSelected > 0 && this.modSelected != 1) return;
|
||||
break;
|
||||
}
|
||||
var isOK = false;
|
||||
for (var i = pt.length; --i >= 0; ) {
|
||||
if (this.modSelected > 0 && i + 1 != this.modSelected && id.contains ("_coefs_")) {
|
||||
pt[i] = 0;
|
||||
} else if (pt[i] != 0) {
|
||||
isOK = true;
|
||||
break;
|
||||
}}
|
||||
if (!isOK) return;
|
||||
if (map == null) map = this.htModulation;
|
||||
if (id.indexOf ("@") < 0) id += "@" + (iModel >= 0 ? iModel : this.cr.asc.iSet);
|
||||
if (id.startsWith ("D_L#") || id.startsWith ("U_L")) {
|
||||
if (this.legendres == null) this.legendres = new JU.Lst ();
|
||||
this.legendres.addLast (id);
|
||||
}JU.Logger.info ("Adding " + id + " " + JU.Escape.e (pt));
|
||||
map.put (id, pt);
|
||||
}, "java.util.Map,~S,~A,~N");
|
||||
Clazz.overrideMethod (c$, "setModulation",
|
||||
function (isPost, symmetry) {
|
||||
if (this.modDim == 0 || this.htModulation == null) return;
|
||||
if (this.modDebug) JU.Logger.debugging = JU.Logger.debuggingHigh = true;
|
||||
this.cr.asc.setInfo ("someModelsAreModulated", Boolean.TRUE);
|
||||
this.symmetry = symmetry;
|
||||
this.setModulationForStructure (this.cr.asc.iSet, isPost);
|
||||
if (this.modDebug) JU.Logger.debugging = JU.Logger.debuggingHigh = false;
|
||||
}, "~B,J.api.SymmetryInterface");
|
||||
Clazz.overrideMethod (c$, "finalizeModulation",
|
||||
function () {
|
||||
if (!this.finalized && this.modDim > 0 && !this.modVib) {
|
||||
if (this.modTUV != null) this.cr.appendLoadNote ("modTUV=" + this.modTUV);
|
||||
this.cr.asc.setInfo ("modulationOn", this.modTUV == null ? Boolean.TRUE : this.modTUV);
|
||||
this.cr.addJmolScript ("set modulateOccupancy " + (this.haveOccupancy && !this.isCommensurate ? true : false));
|
||||
}this.finalized = true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "checkKey",
|
||||
function (key, checkQ) {
|
||||
var pt = key.indexOf (this.atModel);
|
||||
return (pt < 0 || key.indexOf ("_pos#") >= 0 || key.indexOf ("*;*") >= 0 || checkQ && key.indexOf ("?") >= 0 ? null : key.substring (0, pt));
|
||||
}, "~S,~B");
|
||||
Clazz.overrideMethod (c$, "getMod",
|
||||
function (key) {
|
||||
return this.htModulation.get (key + this.atModel);
|
||||
}, "~S");
|
||||
Clazz.overrideMethod (c$, "getModulationMap",
|
||||
function () {
|
||||
return this.htModulation;
|
||||
});
|
||||
Clazz.defineMethod (c$, "setModulationForStructure",
|
||||
function (iModel, isPost) {
|
||||
this.atModel = "@" + iModel;
|
||||
if (this.htModulation.containsKey ("X_" + this.atModel)) return;
|
||||
if (!isPost) {
|
||||
this.initModForStructure (iModel);
|
||||
return;
|
||||
}this.htModulation.put ("X_" + this.atModel, Clazz.newDoubleArray (0, 0));
|
||||
this.cr.appendLoadNote (this.modCount + " modulations for " + this.ac + " modulated atoms");
|
||||
if (!this.haveAtomMods) return;
|
||||
var n = this.cr.asc.ac;
|
||||
this.atoms = this.cr.asc.atoms;
|
||||
if (this.symmetry != null) this.nOps = this.symmetry.getSpaceGroupOperationCount ();
|
||||
this.supercellSymmetry = this.cr.asc.getXSymmetry ().symmetry;
|
||||
if (this.supercellSymmetry === this.symmetry) this.supercellSymmetry = null;
|
||||
this.iopLast = -1;
|
||||
var i0 = this.cr.asc.getLastAtomSetAtomIndex ();
|
||||
for (var i = i0; i < n; i++) this.modulateAtom (this.atoms[i]);
|
||||
|
||||
this.htAtomMods = null;
|
||||
if (this.minXYZ0 != null) this.trimAtomSet ();
|
||||
this.htSubsystems = null;
|
||||
}, "~N,~B");
|
||||
Clazz.defineMethod (c$, "initModForStructure",
|
||||
function (iModel) {
|
||||
var key;
|
||||
if (this.legendres != null) this.fixLegendre ();
|
||||
this.sigma = new JU.Matrix (null, this.modDim, 3);
|
||||
this.qs = null;
|
||||
this.modMatrices = Clazz.newArray (-1, [this.sigma, null]);
|
||||
var pt;
|
||||
for (var i = 0; i < this.modDim; i++) {
|
||||
pt = this.getMod ("W_" + (i + 1));
|
||||
if (pt == null) {
|
||||
JU.Logger.info ("Not enough cell wave vectors for d=" + this.modDim);
|
||||
return;
|
||||
}this.fixDouble (pt);
|
||||
this.cr.appendLoadNote ("W_" + (i + 1) + " = " + JU.Escape.e (pt));
|
||||
this.cr.appendUunitCellInfo ("q" + (i + 1) + "=" + pt[0] + " " + pt[1] + " " + pt[2]);
|
||||
this.sigma.getArray ()[i] = Clazz.newDoubleArray (-1, [pt[0], pt[1], pt[2]]);
|
||||
}
|
||||
var map = new java.util.Hashtable ();
|
||||
for (var e, $e = this.htModulation.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
|
||||
if ((key = this.checkKey (e.getKey (), false)) == null) continue;
|
||||
pt = e.getValue ();
|
||||
switch (key.charAt (0)) {
|
||||
case 'O':
|
||||
this.haveOccupancy = true;
|
||||
case 'D':
|
||||
case 'M':
|
||||
case 'U':
|
||||
if (pt[2] == 1 && key.charAt (2) != 'S' && key.charAt (2) != 'T' && key.charAt (2) != 'L') {
|
||||
var ipt = key.indexOf ("?");
|
||||
if (ipt >= 0) {
|
||||
var s = key.substring (ipt + 1);
|
||||
pt = this.getMod (key.substring (0, 2) + s + "#*;*");
|
||||
if (pt != null) this.addModulation (map, key = key.substring (0, ipt), pt, iModel);
|
||||
} else {
|
||||
var a = pt[0];
|
||||
var d = 2 * 3.141592653589793 * pt[1];
|
||||
pt[0] = (a * Math.cos (d));
|
||||
pt[1] = (a * Math.sin (-d));
|
||||
pt[2] = 0;
|
||||
JU.Logger.info ("msCIF setting " + key + " " + JU.Escape.e (pt));
|
||||
}}break;
|
||||
case 'W':
|
||||
if (this.modDim > 1) {
|
||||
continue;
|
||||
}case 'F':
|
||||
if (key.indexOf ("_coefs_") >= 0) {
|
||||
this.cr.appendLoadNote ("Wave vector " + key + "=" + JU.Escape.eAD (pt));
|
||||
} else {
|
||||
var ptHarmonic = this.calculateQCoefs (pt);
|
||||
if (ptHarmonic == null) {
|
||||
this.cr.appendLoadNote ("Cannot match atom wave vector " + key + " " + JU.Escape.eAD (pt) + " to a cell wave vector or its harmonic");
|
||||
} else {
|
||||
var k2 = key + "_coefs_";
|
||||
if (!this.htModulation.containsKey (k2 + this.atModel)) {
|
||||
this.addModulation (map, k2, ptHarmonic, iModel);
|
||||
if (key.startsWith ("F_")) this.cr.appendLoadNote ("atom wave vector " + key + " = " + JU.Escape.e (pt) + " fn = " + JU.Escape.e (ptHarmonic));
|
||||
}}}break;
|
||||
}
|
||||
}
|
||||
if (!map.isEmpty ()) this.htModulation.putAll (map);
|
||||
if (this.htSubsystems == null) {
|
||||
this.haveAtomMods = false;
|
||||
} else {
|
||||
this.cr.strSupercell = null;
|
||||
this.haveAtomMods = true;
|
||||
this.htAtomMods = new java.util.Hashtable ();
|
||||
}for (var e, $e = this.htModulation.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
|
||||
if ((key = this.checkKey (e.getKey (), true)) == null) continue;
|
||||
var params = e.getValue ();
|
||||
var atomName = key.substring (key.indexOf (";") + 1);
|
||||
var pt_ = atomName.indexOf ("#=");
|
||||
if (pt_ >= 0) {
|
||||
params = this.getMod (atomName.substring (pt_ + 2));
|
||||
atomName = atomName.substring (0, pt_);
|
||||
}if (JU.Logger.debuggingHigh) JU.Logger.debug ("SetModulation: " + key + " " + JU.Escape.e (params));
|
||||
var type = key.charAt (0);
|
||||
pt_ = key.indexOf ("#") + 1;
|
||||
var utens = null;
|
||||
switch (type) {
|
||||
case 'U':
|
||||
utens = key.substring (pt_, key.indexOf (";"));
|
||||
case 'O':
|
||||
case 'D':
|
||||
case 'M':
|
||||
if (this.modAverage) break;
|
||||
var axis = key.charAt (pt_);
|
||||
type = this.getModType (key);
|
||||
if (this.htAtomMods == null) this.htAtomMods = new java.util.Hashtable ();
|
||||
var p = Clazz.newDoubleArray (params.length, 0);
|
||||
for (var i = p.length; --i >= 0; ) p[i] = params[i];
|
||||
|
||||
var qcoefs = this.getQCoefs (key);
|
||||
if (qcoefs == null) throw new Exception ("Missing cell wave vector for atom wave vector for " + key + " " + JU.Escape.e (params));
|
||||
this.addAtomModulation (atomName, axis, type, p, utens, qcoefs);
|
||||
this.haveAtomMods = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "fixLegendre",
|
||||
function () {
|
||||
for (var i = this.legendres.size (); --i >= 0; ) {
|
||||
var key = this.legendres.get (i);
|
||||
var pt = this.htModulation.get (key);
|
||||
if (pt != null) {
|
||||
var key1 = "O_0#0" + key.substring (key.indexOf (";"));
|
||||
var pt1 = this.htModulation.get (key1);
|
||||
if (pt1 == null) {
|
||||
JU.Logger.error ("Crenel " + key1 + " not found for legendre modulation " + key);
|
||||
pt[2] = NaN;
|
||||
} else {
|
||||
this.htModulation.put (key, Clazz.newDoubleArray (-1, [pt1[0], pt1[1], pt[0], pt[1]]));
|
||||
}}}
|
||||
});
|
||||
Clazz.defineMethod (c$, "fixDouble",
|
||||
function (pt) {
|
||||
if (this.cr.fixJavaFloat) for (var i = pt.length; --i >= 0; ) pt[i] = JU.PT.fixDouble (pt[i], 100000.0);
|
||||
|
||||
}, "~A");
|
||||
Clazz.overrideMethod (c$, "getQCoefs",
|
||||
function (key) {
|
||||
var fn = Math.max (0, this.cr.parseIntAt (key, 2));
|
||||
if (fn == 0) {
|
||||
if (this.qlist100 == null) {
|
||||
this.qlist100 = Clazz.newDoubleArray (this.modDim, 0);
|
||||
this.qlist100[0] = 1;
|
||||
}return this.qlist100;
|
||||
}return this.getMod ("F_" + fn + "_coefs_");
|
||||
}, "~S");
|
||||
Clazz.overrideMethod (c$, "getModType",
|
||||
function (key) {
|
||||
var type = key.charAt (0);
|
||||
var id = key.charAt (2);
|
||||
return (id == 'S' ? 's' : id == 'T' ? 't' : id == 'L' ? (type == 'D' ? 'l' : 'L') : id == '0' ? 'c' : type == 'D' ? 'f' : type == 'O' ? 'o' : type == 'M' ? 'm' : type == 'U' ? 'u' : '?');
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "calculateQCoefs",
|
||||
function (p) {
|
||||
if (this.qs == null) {
|
||||
this.qs = new Array (this.modDim);
|
||||
for (var i = 0; i < this.modDim; i++) {
|
||||
this.qs[i] = this.toP3 (this.getMod ("W_" + (i + 1)));
|
||||
}
|
||||
}var pt = this.toP3 (p);
|
||||
for (var i = 0; i < this.modDim; i++) if (this.qs[i] != null) {
|
||||
var ifn = this.approxInt (pt.dot (this.qs[i]) / this.qs[i].dot (this.qs[i]));
|
||||
if (ifn != 0) {
|
||||
p = Clazz.newDoubleArray (this.modDim, 0);
|
||||
p[i] = ifn;
|
||||
return p;
|
||||
}}
|
||||
var p3 = this.toP3 (p);
|
||||
var jmin = (this.modDim < 2 ? 0 : -3);
|
||||
var jmax = (this.modDim < 2 ? 0 : 3);
|
||||
var kmin = (this.modDim < 3 ? 0 : -3);
|
||||
var kmax = (this.modDim < 3 ? 0 : 3);
|
||||
for (var i = -3; i <= 3; i++) for (var j = jmin; j <= jmax; j++) for (var k = kmin; k <= kmax; k++) {
|
||||
pt.setT (this.qs[0]);
|
||||
pt.scale (i);
|
||||
if (this.modDim > 1 && this.qs[1] != null) pt.scaleAdd2 (j, this.qs[1], pt);
|
||||
if (this.modDim > 2 && this.qs[2] != null) pt.scaleAdd2 (k, this.qs[2], pt);
|
||||
if (pt.distanceSquared (p3) < 0.0001) {
|
||||
p = Clazz.newDoubleArray (this.modDim, 0);
|
||||
switch (this.modDim) {
|
||||
default:
|
||||
p[2] = k;
|
||||
case 2:
|
||||
p[1] = j;
|
||||
case 1:
|
||||
p[0] = i;
|
||||
break;
|
||||
}
|
||||
return p;
|
||||
}pt.setT (this.qs[0]);
|
||||
pt.scale (1 / i);
|
||||
if (this.modDim > 1 && this.qs[1] != null) pt.scaleAdd2 (1 / j, this.qs[1], pt);
|
||||
if (this.modDim > 2 && this.qs[2] != null) pt.scaleAdd2 (1 / k, this.qs[2], pt);
|
||||
if (pt.distanceSquared (p3) < 0.0001) {
|
||||
p = Clazz.newDoubleArray (this.modDim, 0);
|
||||
switch (this.modDim) {
|
||||
default:
|
||||
p[2] = 1 / k;
|
||||
case 2:
|
||||
p[1] = 1 / j;
|
||||
case 1:
|
||||
p[0] = 1 / i;
|
||||
break;
|
||||
}
|
||||
return p;
|
||||
}}
|
||||
|
||||
|
||||
pt = this.toP3 (p);
|
||||
for (var i = 0; i < this.modDim; i++) if (this.qs[i] != null) {
|
||||
p3 = this.qs[i];
|
||||
var ifn = 0;
|
||||
if (pt.x != 0) ifn = this.approxInt (pt.x / p3.x);
|
||||
if (pt.y != 0) ifn = Math.max (this.approxInt (pt.y / p3.y), ifn);
|
||||
if (ifn == 0 && pt.z != 0) ifn = Math.max (this.approxInt (pt.z / p3.z), ifn);
|
||||
if (ifn == 0) continue;
|
||||
if (p3.x != 0 && this.approxInt (10 + p3.x * ifn - pt.x) == 0 || p3.y != 0 && this.approxInt (10 + p3.y * ifn - pt.y) == 0 || p3.z != 0 && this.approxInt (10 + p3.z * ifn - pt.z) == 0) continue;
|
||||
p = Clazz.newDoubleArray (this.modDim, 0);
|
||||
p[i] = ifn;
|
||||
return p;
|
||||
}
|
||||
return null;
|
||||
}, "~A");
|
||||
Clazz.defineMethod (c$, "approxInt",
|
||||
function (fn) {
|
||||
var ifn = Math.round (fn);
|
||||
return (Math.abs (fn - ifn) < 0.001 ? ifn : 0);
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "toP3",
|
||||
function (x) {
|
||||
return JU.P3.new3 (x[0], x[1], x[2]);
|
||||
}, "~A");
|
||||
Clazz.defineMethod (c$, "addAtomModulation",
|
||||
function (atomName, axis, type, params, utens, qcoefs) {
|
||||
var list = this.htAtomMods.get (atomName);
|
||||
if (list == null) {
|
||||
this.ac++;
|
||||
this.htAtomMods.put (atomName, list = new JU.Lst ());
|
||||
}list.addLast ( new JU.Modulation (axis, type, params, utens, qcoefs));
|
||||
this.modCount++;
|
||||
}, "~S,~S,~S,~A,~S,~A");
|
||||
Clazz.overrideMethod (c$, "addSubsystem",
|
||||
function (code, w) {
|
||||
if (code == null) return;
|
||||
var ss = new J.adapter.readers.cif.Subsystem (this, code, w);
|
||||
this.cr.appendLoadNote ("subsystem " + code + "\n" + w);
|
||||
this.setSubsystem (code, ss);
|
||||
}, "~S,JU.Matrix");
|
||||
Clazz.defineMethod (c$, "addUStr",
|
||||
function (atom, id, val) {
|
||||
var i = Clazz.doubleToInt ("U11U22U33U12U13U23UISO".indexOf (id) / 3);
|
||||
if (JU.Logger.debuggingHigh) JU.Logger.debug ("MOD RDR adding " + id + " " + i + " " + val + " to " + atom.anisoBorU[i]);
|
||||
this.cr.asc.setU (atom, i, val + atom.anisoBorU[i]);
|
||||
}, "J.adapter.smarter.Atom,~S,~N");
|
||||
Clazz.defineMethod (c$, "modulateAtom",
|
||||
function (a) {
|
||||
if (this.modCoord && this.htSubsystems != null) {
|
||||
var ptc = JU.P3.newP (a);
|
||||
var spt = this.getSymmetry (a);
|
||||
spt.toCartesian (ptc, true);
|
||||
}var list = this.htAtomMods.get (a.atomName);
|
||||
if (list == null && a.altLoc != '\0' && this.htSubsystems != null) {
|
||||
list = new JU.Lst ();
|
||||
}if (list == null || this.symmetry == null || a.bsSymmetry == null) return;
|
||||
var iop = Math.max (a.bsSymmetry.nextSetBit (0), 0);
|
||||
if (this.modLast) iop = Math.max ((a.bsSymmetry.length () - 1) % this.nOps, iop);
|
||||
if (JU.Logger.debuggingHigh) JU.Logger.debug ("\nsetModulation: i=" + a.index + " " + a.atomName + " xyz=" + a + " occ=" + a.foccupancy);
|
||||
if (iop != this.iopLast) {
|
||||
this.iopLast = iop;
|
||||
this.gammaE = new JU.M3 ();
|
||||
this.getSymmetry (a).getSpaceGroupOperation (iop).getRotationScale (this.gammaE);
|
||||
}if (JU.Logger.debugging) {
|
||||
JU.Logger.debug ("setModulation iop = " + iop + " " + this.symmetry.getSpaceGroupXyz (iop, false) + " " + a.bsSymmetry);
|
||||
}var ms = new JU.ModulationSet ().setMod (a.index + " " + a.atomName, this.getAtomR0 (this.cr.asc.atoms[a.atomSite]), this.getAtomR0 (a), this.modDim, list, this.gammaE, this.getMatrices (a), this.getSymmetry (a), this.nOps, iop, Clazz.instanceOf (a.vib, JU.Vibration) ? a.vib : null, this.isCommensurate);
|
||||
ms.calculate (this.modTUV, false);
|
||||
if (!Float.isNaN (ms.vOcc)) {
|
||||
a.foccupancy = ms.setOccupancy (this.getMod ("J_O#0;" + a.atomName), a.foccupancy, (a.vib == null ? 0 : a.vib.x));
|
||||
}if (ms.htUij != null) {
|
||||
var t = (a.tensors == null ? null : a.tensors.get (0));
|
||||
if (t != null && t.parBorU != null) {
|
||||
a.anisoBorU = Clazz.newFloatArray (8, 0);
|
||||
for (var i = 0; i < 8; i++) a.anisoBorU[i] = t.parBorU[i];
|
||||
|
||||
t.isUnmodulated = true;
|
||||
}if (a.anisoBorU == null) {
|
||||
JU.Logger.error ("MOD RDR cannot modulate nonexistent atom anisoBorU for atom " + a.atomName);
|
||||
} else {
|
||||
if (JU.Logger.debuggingHigh) {
|
||||
JU.Logger.debug ("setModulation Uij(initial)=" + JU.Escape.eAF (a.anisoBorU));
|
||||
JU.Logger.debug ("setModulation tensor=" + JU.Escape.e ((a.tensors.get (0)).getInfo ("all")));
|
||||
}for (var e, $e = ms.htUij.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) this.addUStr (a, e.getKey (), e.getValue ().floatValue ());
|
||||
|
||||
var sym = this.getAtomSymmetry (a, this.symmetry);
|
||||
t = this.cr.asc.getXSymmetry ().addRotatedTensor (a, sym.getTensor (this.cr.vwr, a.anisoBorU), iop, false, sym);
|
||||
t.isModulated = true;
|
||||
t.id = JU.Escape.e (a.anisoBorU);
|
||||
a.bfactor = a.anisoBorU[7] * 100;
|
||||
a.anisoBorU = null;
|
||||
if (JU.Logger.debuggingHigh) {
|
||||
JU.Logger.debug ("setModulation Uij(final)=" + JU.Escape.eAF (a.anisoBorU) + "\n");
|
||||
JU.Logger.debug ("setModulation tensor=" + JU.Escape.e ((a.tensors.get (1)).getInfo ("all")));
|
||||
}}}if (Float.isNaN (ms.x)) ms.set (0, 0, 0);
|
||||
a.vib = ms;
|
||||
}, "J.adapter.smarter.Atom");
|
||||
Clazz.defineMethod (c$, "getAtomR0",
|
||||
function (atom) {
|
||||
var r0 = JU.P3.newP (atom);
|
||||
if (this.supercellSymmetry != null) {
|
||||
this.supercellSymmetry.toCartesian (r0, true);
|
||||
this.symmetry.toFractional (r0, true);
|
||||
}return r0;
|
||||
}, "J.adapter.smarter.Atom");
|
||||
Clazz.overrideMethod (c$, "getAtomSymmetry",
|
||||
function (a, defaultSymmetry) {
|
||||
var ss;
|
||||
return (this.htSubsystems == null || (ss = this.getSubsystem (a)) == null ? defaultSymmetry : ss.getSymmetry ());
|
||||
}, "J.adapter.smarter.Atom,J.api.SymmetryInterface");
|
||||
Clazz.defineMethod (c$, "setSubsystem",
|
||||
function (code, system) {
|
||||
if (this.htSubsystems == null) this.htSubsystems = new java.util.Hashtable ();
|
||||
this.htSubsystems.put (code, system);
|
||||
this.setSubsystemOptions ();
|
||||
}, "~S,J.adapter.readers.cif.Subsystem");
|
||||
Clazz.defineMethod (c$, "getMatrices",
|
||||
function (a) {
|
||||
var ss = this.getSubsystem (a);
|
||||
return (ss == null ? this.modMatrices : ss.getModMatrices ());
|
||||
}, "J.adapter.smarter.Atom");
|
||||
Clazz.defineMethod (c$, "getSymmetry",
|
||||
function (a) {
|
||||
var ss = this.getSubsystem (a);
|
||||
return (ss == null ? this.symmetry : ss.getSymmetry ());
|
||||
}, "J.adapter.smarter.Atom");
|
||||
Clazz.defineMethod (c$, "getSubsystem",
|
||||
function (a) {
|
||||
return (this.htSubsystems == null ? null : this.htSubsystems.get ("" + a.altLoc));
|
||||
}, "J.adapter.smarter.Atom");
|
||||
Clazz.overrideMethod (c$, "setMinMax0",
|
||||
function (minXYZ, maxXYZ) {
|
||||
if (this.htSubsystems == null) return;
|
||||
var symmetry = this.getDefaultUnitCell ();
|
||||
this.minXYZ0 = JU.P3.newP (minXYZ);
|
||||
this.maxXYZ0 = JU.P3.newP (maxXYZ);
|
||||
var pt0 = JU.P3.newP (minXYZ);
|
||||
var pt1 = JU.P3.newP (maxXYZ);
|
||||
var pt = new JU.P3 ();
|
||||
symmetry.toCartesian (pt0, true);
|
||||
symmetry.toCartesian (pt1, true);
|
||||
var pts = JU.BoxInfo.unitCubePoints;
|
||||
if (this.sigma == null) {
|
||||
JU.Logger.error ("Why are we in MSRdr.setMinMax0 without modulation init?");
|
||||
return;
|
||||
}for (var e, $e = this.htSubsystems.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
|
||||
var sym = e.getValue ().getSymmetry ();
|
||||
for (var i = 8; --i >= 0; ) {
|
||||
pt.x = (pts[i].x == 0 ? pt0.x : pt1.x);
|
||||
pt.y = (pts[i].y == 0 ? pt0.y : pt1.y);
|
||||
pt.z = (pts[i].z == 0 ? pt0.z : pt1.z);
|
||||
this.expandMinMax (pt, sym, minXYZ, maxXYZ);
|
||||
}
|
||||
}
|
||||
}, "JU.P3,JU.P3");
|
||||
Clazz.defineMethod (c$, "expandMinMax",
|
||||
function (pt, sym, minXYZ, maxXYZ) {
|
||||
var pt2 = JU.P3.newP (pt);
|
||||
var slop = 0.0001;
|
||||
sym.toFractional (pt2, false);
|
||||
if (minXYZ.x > pt2.x + slop) minXYZ.x = Clazz.doubleToInt (Math.floor (pt2.x)) - 1;
|
||||
if (minXYZ.y > pt2.y + slop) minXYZ.y = Clazz.doubleToInt (Math.floor (pt2.y)) - 1;
|
||||
if (minXYZ.z > pt2.z + slop) minXYZ.z = Clazz.doubleToInt (Math.floor (pt2.z)) - 1;
|
||||
if (maxXYZ.x < pt2.x - slop) maxXYZ.x = Clazz.doubleToInt (Math.ceil (pt2.x)) + 1;
|
||||
if (maxXYZ.y < pt2.y - slop) maxXYZ.y = Clazz.doubleToInt (Math.ceil (pt2.y)) + 1;
|
||||
if (maxXYZ.z < pt2.z - slop) maxXYZ.z = Clazz.doubleToInt (Math.ceil (pt2.z)) + 1;
|
||||
}, "JU.P3,J.api.SymmetryInterface,JU.P3,JU.P3");
|
||||
Clazz.defineMethod (c$, "trimAtomSet",
|
||||
function () {
|
||||
if (!this.cr.doApplySymmetry) return;
|
||||
var asc = this.cr.asc;
|
||||
var bs = asc.bsAtoms;
|
||||
var sym = this.getDefaultUnitCell ();
|
||||
var atoms = asc.atoms;
|
||||
var pt = new JU.P3 ();
|
||||
if (bs == null) bs = asc.bsAtoms = JU.BSUtil.newBitSet2 (0, asc.ac);
|
||||
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) {
|
||||
var a = atoms[i];
|
||||
var isOK = (!this.isCommensurate || this.modAverage || a.foccupancy >= 0.5);
|
||||
if (isOK) {
|
||||
pt.setT (a);
|
||||
if (a.vib != null) pt.add (a.vib);
|
||||
this.getSymmetry (a).toCartesian (pt, false);
|
||||
sym.toFractional (pt, false);
|
||||
if (this.cr.fixJavaFloat) JU.PT.fixPtFloats (pt, 100000.0);
|
||||
isOK = asc.xtalSymmetry.isWithinCell (3, pt, this.minXYZ0.x, this.maxXYZ0.x, this.minXYZ0.y, this.maxXYZ0.y, this.minXYZ0.z, this.maxXYZ0.z, 0.001);
|
||||
}if (isOK) {
|
||||
if (this.cr.fixJavaFloat) JU.PT.fixPtFloats (a, 100000.0);
|
||||
} else {
|
||||
bs.clear (i);
|
||||
}}
|
||||
});
|
||||
Clazz.defineMethod (c$, "getDefaultUnitCell",
|
||||
function () {
|
||||
return (this.modCell != null && this.htSubsystems.containsKey (this.modCell) ? this.htSubsystems.get (this.modCell).getSymmetry () : this.cr.asc.getSymmetry ());
|
||||
});
|
||||
Clazz.overrideMethod (c$, "getSymmetryFromCode",
|
||||
function (code) {
|
||||
return this.htSubsystems.get (code).getSymmetry ();
|
||||
}, "~S");
|
||||
Clazz.overrideMethod (c$, "addLatticeVector",
|
||||
function (lattvecs, data) {
|
||||
var a = null;
|
||||
var c = data.charAt (0);
|
||||
var dim = this.modDim + 3;
|
||||
switch (c) {
|
||||
case 'P':
|
||||
case 'X':
|
||||
break;
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'I':
|
||||
a = Clazz.newFloatArray (-1, [0.5, 0.5, 0.5]);
|
||||
if (c != 'I') a[c.charCodeAt (0) - 65] = 0;
|
||||
break;
|
||||
case 'F':
|
||||
this.addLatticeVector (lattvecs, "A");
|
||||
this.addLatticeVector (lattvecs, "B");
|
||||
this.addLatticeVector (lattvecs, "C");
|
||||
break;
|
||||
case 'M':
|
||||
dim++;
|
||||
case '0':
|
||||
if (data.indexOf (".") >= 0) a = J.adapter.smarter.AtomSetCollectionReader.getTokensFloat (data, null, dim);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
if (a != null) lattvecs.addLast (a);
|
||||
return true;
|
||||
}, "JU.Lst,~S");
|
||||
Clazz.defineStatics (c$,
|
||||
"U_LIST", "U11U22U33U12U13U23UISO");
|
||||
});
|
||||
@@ -0,0 +1,105 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.cif");
|
||||
Clazz.load (null, "J.adapter.readers.cif.Subsystem", ["JU.Lst", "$.Matrix", "$.V3", "JU.Logger", "$.SimpleUnitCell"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.msRdr = null;
|
||||
this.code = null;
|
||||
this.d = 0;
|
||||
this.w = null;
|
||||
this.symmetry = null;
|
||||
this.modMatrices = null;
|
||||
this.isFinalized = false;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.cif, "Subsystem");
|
||||
Clazz.makeConstructor (c$,
|
||||
function (msRdr, code, w) {
|
||||
this.msRdr = msRdr;
|
||||
this.code = code;
|
||||
this.w = w;
|
||||
this.d = w.getArray ().length - 3;
|
||||
}, "J.adapter.readers.cif.MSRdr,~S,JU.Matrix");
|
||||
Clazz.defineMethod (c$, "getSymmetry",
|
||||
function () {
|
||||
if (!this.isFinalized) this.setSymmetry (true);
|
||||
return this.symmetry;
|
||||
});
|
||||
Clazz.defineMethod (c$, "getModMatrices",
|
||||
function () {
|
||||
if (!this.isFinalized) this.setSymmetry (true);
|
||||
return this.modMatrices;
|
||||
});
|
||||
Clazz.defineMethod (c$, "setSymmetry",
|
||||
function (setOperators) {
|
||||
var a;
|
||||
JU.Logger.info ("[subsystem " + this.code + "]");
|
||||
var winv = this.w.inverse ();
|
||||
JU.Logger.info ("w=" + this.w);
|
||||
JU.Logger.info ("w_inv=" + winv);
|
||||
var w33 = this.w.getSubmatrix (0, 0, 3, 3);
|
||||
var wd3 = this.w.getSubmatrix (3, 0, this.d, 3);
|
||||
var w3d = this.w.getSubmatrix (0, 3, 3, this.d);
|
||||
var wdd = this.w.getSubmatrix (3, 3, this.d, this.d);
|
||||
var sigma = this.msRdr.getSigma ();
|
||||
var sigma_nu = wdd.mul (sigma).add (wd3).mul (w3d.mul (sigma).add (w33).inverse ());
|
||||
var tFactor = wdd.sub (sigma_nu.mul (w3d));
|
||||
JU.Logger.info ("sigma_nu = " + sigma_nu);
|
||||
var s0 = this.msRdr.cr.asc.getSymmetry ();
|
||||
var vu43 = s0.getUnitCellVectors ();
|
||||
var vr43 = JU.SimpleUnitCell.getReciprocal (vu43, null, 1);
|
||||
var mard3 = new JU.Matrix (null, 3 + this.d, 3);
|
||||
var mar3 = new JU.Matrix (null, 3, 3);
|
||||
var mard3a = mard3.getArray ();
|
||||
var mar3a = mar3.getArray ();
|
||||
for (var i = 0; i < 3; i++) mard3a[i] = mar3a[i] = Clazz.newDoubleArray (-1, [vr43[i + 1].x, vr43[i + 1].y, vr43[i + 1].z]);
|
||||
|
||||
var sx = sigma.mul (mar3);
|
||||
a = sx.getArray ();
|
||||
for (var i = 0; i < this.d; i++) mard3a[i + 3] = a[i];
|
||||
|
||||
a = this.w.mul (mard3).getArray ();
|
||||
var uc_nu = new Array (4);
|
||||
uc_nu[0] = vu43[0];
|
||||
for (var i = 0; i < 3; i++) uc_nu[i + 1] = JU.V3.new3 (a[i][0], a[i][1], a[i][2]);
|
||||
|
||||
uc_nu = JU.SimpleUnitCell.getReciprocal (uc_nu, null, 1);
|
||||
this.symmetry = (this.msRdr.cr.getInterface ("JS.Symmetry")).getUnitCell (uc_nu, false, null);
|
||||
this.modMatrices = Clazz.newArray (-1, [sigma_nu, tFactor]);
|
||||
if (!setOperators) return;
|
||||
this.isFinalized = true;
|
||||
JU.Logger.info ("unit cell parameters: " + this.symmetry.getUnitCellInfo ());
|
||||
this.symmetry.createSpaceGroup (-1, "[subsystem " + this.code + "]", new JU.Lst ());
|
||||
var nOps = s0.getSpaceGroupOperationCount ();
|
||||
for (var iop = 0; iop < nOps; iop++) {
|
||||
var rv = s0.getOperationRsVs (iop);
|
||||
var r0 = rv.getRotation ();
|
||||
var v0 = rv.getTranslation ();
|
||||
var r = this.w.mul (r0).mul (winv);
|
||||
var v = this.w.mul (v0);
|
||||
var code = this.code;
|
||||
if (this.isMixed (r)) {
|
||||
for (var e, $e = this.msRdr.htSubsystems.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
|
||||
var ss = e.getValue ();
|
||||
if (ss === this) continue;
|
||||
var rj = ss.w.mul (r0).mul (winv);
|
||||
if (!this.isMixed (rj)) {
|
||||
r = rj;
|
||||
v = ss.w.mul (v0);
|
||||
code = ss.code;
|
||||
break;
|
||||
}}
|
||||
}var jf = this.symmetry.addOp (code, r, v, sigma_nu);
|
||||
JU.Logger.info (this.code + "." + (iop + 1) + (this.code.equals (code) ? " " : ">" + code + " ") + jf);
|
||||
}
|
||||
}, "~B");
|
||||
Clazz.defineMethod (c$, "isMixed",
|
||||
function (r) {
|
||||
var a = r.getArray ();
|
||||
for (var i = 3; --i >= 0; ) for (var j = 3 + this.d; --j >= 3; ) if (a[i][j] != 0) return true;
|
||||
|
||||
|
||||
return false;
|
||||
}, "JU.Matrix");
|
||||
Clazz.overrideMethod (c$, "toString",
|
||||
function () {
|
||||
return "Subsystem " + this.code + "\n" + this.w;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.molxyz");
|
||||
Clazz.load (["J.adapter.readers.molxyz.MolReader"], "J.adapter.readers.molxyz.Mol3DReader", null, function () {
|
||||
c$ = Clazz.declareType (J.adapter.readers.molxyz, "Mol3DReader", J.adapter.readers.molxyz.MolReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.allow2D = false;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,306 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.molxyz");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.molxyz.MolReader", ["java.lang.Exception", "java.util.Hashtable", "JU.PT", "J.adapter.smarter.Atom", "J.api.JmolAdapter", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.optimize2D = false;
|
||||
this.haveAtomSerials = false;
|
||||
this.dimension = null;
|
||||
this.allow2D = true;
|
||||
this.iatom0 = 0;
|
||||
this.vr = null;
|
||||
this.atomCount = 0;
|
||||
this.atomData = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.molxyz, "MolReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.optimize2D = this.checkFilterKey ("2D");
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
var isMDL = (this.line.startsWith ("$MDL"));
|
||||
if (isMDL) {
|
||||
this.discardLinesUntilStartsWith ("$HDR");
|
||||
this.rd ();
|
||||
if (this.line == null) {
|
||||
JU.Logger.warn ("$HDR not found in MDL RG file");
|
||||
this.continuing = false;
|
||||
return false;
|
||||
}} else if (this.line.equals ("M END")) {
|
||||
return true;
|
||||
}if (this.doGetModel (++this.modelNumber, null)) {
|
||||
this.iatom0 = this.asc.ac;
|
||||
this.processMolSdHeader ();
|
||||
this.processCtab (isMDL);
|
||||
this.vr = null;
|
||||
if (this.isLastModel (this.modelNumber)) {
|
||||
this.continuing = false;
|
||||
return false;
|
||||
}}if (this.line != null && this.line.indexOf ("$$$$") < 0) this.discardLinesUntilStartsWith ("$$$$");
|
||||
return true;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
this.finalizeReaderMR ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "finalizeReaderMR",
|
||||
function () {
|
||||
if (this.optimize2D) this.set2D ();
|
||||
this.isTrajectory = false;
|
||||
this.finalizeReaderASCR ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "processMolSdHeader",
|
||||
function () {
|
||||
var header = "";
|
||||
var thisDataSetName = this.line.trim ();
|
||||
this.asc.setCollectionName (thisDataSetName);
|
||||
header += this.line + "\n";
|
||||
this.rd ();
|
||||
if (this.line == null) return;
|
||||
header += this.line + "\n";
|
||||
this.dimension = (this.line.length < 22 ? "3D" : this.line.substring (20, 22));
|
||||
if (this.dimension.equals ("2D")) {
|
||||
if (!this.allow2D) throw new Exception ("File is 2D, not 3D");
|
||||
this.appendLoadNote ("This model is 2D. Its 3D structure has not been generated.");
|
||||
}this.asc.setInfo ("dimension", this.dimension);
|
||||
this.rd ();
|
||||
if (this.line == null) return;
|
||||
this.line = this.line.trim ();
|
||||
header += this.line + "\n";
|
||||
JU.Logger.info (header);
|
||||
this.checkCurrentLineForScript ();
|
||||
this.asc.setInfo ("fileHeader", header);
|
||||
this.newAtomSet (thisDataSetName);
|
||||
});
|
||||
Clazz.defineMethod (c$, "processCtab",
|
||||
function (isMDL) {
|
||||
if (isMDL) this.discardLinesUntilStartsWith ("$CTAB");
|
||||
if (this.rd () == null) return;
|
||||
if (this.line.indexOf ("V3000") >= 0) {
|
||||
this.optimize2D = (this.dimension.equals ("2D"));
|
||||
this.vr = (this.getInterface ("J.adapter.readers.molxyz.V3000Rdr")).set (this);
|
||||
this.discardLinesUntilContains ("COUNTS");
|
||||
this.vr.readAtomsAndBonds (this.getTokens ());
|
||||
} else {
|
||||
this.readAtomsAndBonds (this.parseIntRange (this.line, 0, 3), this.parseIntRange (this.line, 3, 6));
|
||||
}this.applySymmetryAndSetTrajectory ();
|
||||
}, "~B");
|
||||
Clazz.defineMethod (c$, "readAtomsAndBonds",
|
||||
function (ac, bc) {
|
||||
this.atomCount = ac;
|
||||
for (var i = 0; i < ac; ++i) {
|
||||
this.rd ();
|
||||
var len = this.line.length;
|
||||
var elementSymbol;
|
||||
var x;
|
||||
var y;
|
||||
var z;
|
||||
var charge = 0;
|
||||
var isotope = 0;
|
||||
var iAtom = -2147483648;
|
||||
x = this.parseFloatRange (this.line, 0, 10);
|
||||
y = this.parseFloatRange (this.line, 10, 20);
|
||||
z = this.parseFloatRange (this.line, 20, 30);
|
||||
if (len < 34) {
|
||||
elementSymbol = this.line.substring (31).trim ();
|
||||
} else {
|
||||
elementSymbol = this.line.substring (31, 34).trim ();
|
||||
if (elementSymbol.equals ("H1")) {
|
||||
elementSymbol = "H";
|
||||
isotope = 1;
|
||||
}if (len >= 39) {
|
||||
var code = this.parseIntRange (this.line, 36, 39);
|
||||
if (code >= 1 && code <= 7) charge = 4 - code;
|
||||
code = this.parseIntRange (this.line, 34, 36);
|
||||
if (code != 0 && code >= -3 && code <= 4) {
|
||||
isotope = J.api.JmolAdapter.getNaturalIsotope (J.api.JmolAdapter.getElementNumber (elementSymbol)) + code;
|
||||
}if (iAtom == -2147483648 && this.haveAtomSerials) iAtom = i + 1;
|
||||
}}this.addMolAtom (iAtom, isotope, elementSymbol, charge, x, y, z);
|
||||
}
|
||||
this.rd ();
|
||||
if (this.line.startsWith ("V ")) {
|
||||
this.readAtomValues ();
|
||||
}if (bc == 0) this.asc.setNoAutoBond ();
|
||||
for (var i = 0; i < bc; ++i) {
|
||||
if (i > 0) this.rd ();
|
||||
var iAtom1;
|
||||
var iAtom2;
|
||||
var stereo = 0;
|
||||
iAtom1 = this.line.substring (0, 3).trim ();
|
||||
iAtom2 = this.line.substring (3, 6).trim ();
|
||||
var order = this.parseIntRange (this.line, 6, 9);
|
||||
if (this.optimize2D && order == 1 && this.line.length >= 12) stereo = this.parseIntRange (this.line, 9, 12);
|
||||
order = this.fixOrder (order, stereo);
|
||||
if (this.haveAtomSerials) this.asc.addNewBondFromNames (iAtom1, iAtom2, order);
|
||||
else this.asc.addNewBondWithOrder (this.iatom0 + this.parseIntStr (iAtom1) - 1, this.iatom0 + this.parseIntStr (iAtom2) - 1, order);
|
||||
}
|
||||
var molData = new java.util.Hashtable ();
|
||||
this.rd ();
|
||||
while (this.line != null && this.line.indexOf ("$$$$") != 0) {
|
||||
if (this.line.indexOf (">") == 0) {
|
||||
this.readMolData (molData);
|
||||
continue;
|
||||
}if (this.line.startsWith ("M ISO")) {
|
||||
this.readIsotopes ();
|
||||
continue;
|
||||
}this.rd ();
|
||||
}
|
||||
if (this.atomData != null) {
|
||||
var atomValueName = molData.get ("atom_value_name");
|
||||
molData.put (atomValueName == null ? "atom_values" : atomValueName.toString (), this.atomData);
|
||||
}if (!molData.isEmpty ()) this.asc.setCurrentModelInfo ("molData", molData);
|
||||
}, "~N,~N");
|
||||
Clazz.defineMethod (c$, "readAtomValues",
|
||||
function () {
|
||||
this.atomData = new Array (this.atomCount);
|
||||
for (var i = this.atomData.length; --i >= 0; ) this.atomData[i] = "";
|
||||
|
||||
while (this.line.indexOf ("V ") == 0) {
|
||||
var iAtom = this.parseIntAt (this.line, 3);
|
||||
if (iAtom < 1 || iAtom > this.atomCount) {
|
||||
JU.Logger.error ("V nnn does not evalute to a valid atom number: " + iAtom);
|
||||
return;
|
||||
}var s = this.line.substring (6).trim ();
|
||||
this.atomData[iAtom - 1] = s;
|
||||
this.rd ();
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readIsotopes",
|
||||
function () {
|
||||
var n = this.parseIntAt (this.line, 6);
|
||||
try {
|
||||
var i0 = this.asc.getLastAtomSetAtomIndex ();
|
||||
for (var i = 0, pt = 9; i < n; i++) {
|
||||
var ipt = this.parseIntAt (this.line, pt);
|
||||
var atom = this.asc.atoms[ipt + i0 - 1];
|
||||
var iso = this.parseIntAt (this.line, pt + 4);
|
||||
pt += 8;
|
||||
atom.elementSymbol = "" + iso + JU.PT.replaceAllCharacters (atom.elementSymbol, "0123456789", "");
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
this.rd ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolData",
|
||||
function (molData) {
|
||||
var atoms = this.asc.atoms;
|
||||
var dataName = JU.PT.trim (this.line, "> <").toLowerCase ();
|
||||
var data = "";
|
||||
var fdata = null;
|
||||
while (this.rd () != null && !this.line.equals ("$$$$") && this.line.length > 0) data += this.line + "\n";
|
||||
|
||||
data = JU.PT.trim (data, "\n");
|
||||
JU.Logger.info (dataName + ":" + JU.PT.esc (data));
|
||||
molData.put (dataName, data);
|
||||
var ndata = 0;
|
||||
if (dataName.toUpperCase ().contains ("_PARTIAL_CHARGES")) {
|
||||
try {
|
||||
fdata = JU.PT.parseFloatArray (data);
|
||||
for (var i = this.asc.getLastAtomSetAtomIndex (), n = this.asc.ac; i < n; i++) atoms[i].partialCharge = 0;
|
||||
|
||||
var pt = 0;
|
||||
for (var i = Clazz.floatToInt (fdata[pt++]); --i >= 0; ) {
|
||||
var atomIndex = Clazz.floatToInt (fdata[pt++]) + this.iatom0 - 1;
|
||||
var partialCharge = fdata[pt++];
|
||||
atoms[atomIndex].partialCharge = partialCharge;
|
||||
ndata++;
|
||||
}
|
||||
} catch (e) {
|
||||
for (var i = this.asc.getLastAtomSetAtomIndex (), n = this.asc.ac; i < n; i++) atoms[i].partialCharge = 0;
|
||||
|
||||
JU.Logger.error ("error reading " + dataName + " field -- partial charges cleared");
|
||||
}
|
||||
JU.Logger.info (ndata + " partial charges read");
|
||||
} else if (dataName.toUpperCase ().contains ("ATOM_NAMES")) {
|
||||
ndata = 0;
|
||||
try {
|
||||
var tokens = JU.PT.getTokens (data);
|
||||
var pt = 0;
|
||||
for (var i = this.parseIntStr (tokens[pt++]); --i >= 0; ) {
|
||||
var iatom;
|
||||
while ((iatom = this.parseIntStr (tokens[pt++])) == -2147483648) {
|
||||
}
|
||||
var atomIndex = iatom + this.iatom0 - 1;
|
||||
var name = tokens[pt++];
|
||||
if (!name.equals (".")) atoms[atomIndex].atomName = name;
|
||||
ndata++;
|
||||
}
|
||||
} catch (e) {
|
||||
JU.Logger.error ("error reading " + dataName + " field");
|
||||
}
|
||||
JU.Logger.info (ndata + " atom names read");
|
||||
}}, "java.util.Map");
|
||||
Clazz.defineMethod (c$, "addMolAtom",
|
||||
function (iAtom, isotope, elementSymbol, charge, x, y, z) {
|
||||
switch (isotope) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
elementSymbol = "1H";
|
||||
break;
|
||||
case 2:
|
||||
elementSymbol = "2H";
|
||||
break;
|
||||
case 3:
|
||||
elementSymbol = "3H";
|
||||
break;
|
||||
default:
|
||||
elementSymbol = isotope + elementSymbol;
|
||||
}
|
||||
if (this.optimize2D && z != 0) this.optimize2D = false;
|
||||
var atom = new J.adapter.smarter.Atom ();
|
||||
atom.elementSymbol = elementSymbol;
|
||||
atom.formalCharge = charge;
|
||||
this.setAtomCoordXYZ (atom, x, y, z);
|
||||
if (iAtom == -2147483648) {
|
||||
this.asc.addAtom (atom);
|
||||
} else {
|
||||
this.haveAtomSerials = true;
|
||||
atom.atomSerial = iAtom;
|
||||
this.asc.addAtomWithMappedSerialNumber (atom);
|
||||
}}, "~N,~N,~S,~N,~N,~N,~N");
|
||||
Clazz.defineMethod (c$, "fixOrder",
|
||||
function (order, stereo) {
|
||||
switch (order) {
|
||||
default:
|
||||
case 0:
|
||||
case -10:
|
||||
return 1;
|
||||
case 1:
|
||||
switch (stereo) {
|
||||
case 1:
|
||||
return 1025;
|
||||
case 3:
|
||||
case 6:
|
||||
return 1041;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
return 515;
|
||||
case 5:
|
||||
return 66;
|
||||
case 6:
|
||||
return 513;
|
||||
case 7:
|
||||
return 514;
|
||||
case 8:
|
||||
case 9:
|
||||
return 33;
|
||||
case 14:
|
||||
return 4;
|
||||
case 15:
|
||||
return 5;
|
||||
case 16:
|
||||
return 6;
|
||||
}
|
||||
return order;
|
||||
}, "~N,~N");
|
||||
Clazz.defineMethod (c$, "addMolBond",
|
||||
function (iAtom1, iAtom2, order, stereo) {
|
||||
order = this.fixOrder (order, stereo);
|
||||
if (this.haveAtomSerials) this.asc.addNewBondFromNames (iAtom1, iAtom2, order);
|
||||
else this.asc.addNewBondWithOrder (this.iatom0 + this.parseIntStr (iAtom1) - 1, this.iatom0 + this.parseIntStr (iAtom2) - 1, order);
|
||||
}, "~S,~S,~N,~N");
|
||||
});
|
||||
@@ -0,0 +1,158 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.molxyz");
|
||||
Clazz.load (null, "J.adapter.readers.molxyz.V3000Rdr", ["java.util.Hashtable", "JU.PT"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.mr = null;
|
||||
this.line = null;
|
||||
this.userData = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.molxyz, "V3000Rdr");
|
||||
Clazz.makeConstructor (c$,
|
||||
function () {
|
||||
});
|
||||
Clazz.defineMethod (c$, "set",
|
||||
function (mr) {
|
||||
this.mr = mr;
|
||||
return this;
|
||||
}, "J.adapter.smarter.AtomSetCollectionReader");
|
||||
Clazz.defineMethod (c$, "readAtomsAndBonds",
|
||||
function (tokens) {
|
||||
var ac = this.mr.parseIntStr (tokens[3]);
|
||||
this.readAtoms (ac);
|
||||
this.readBonds (this.mr.parseIntStr (tokens[4]));
|
||||
this.readUserData (ac);
|
||||
}, "~A");
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function (ac) {
|
||||
this.mr.discardLinesUntilContains ("BEGIN ATOM");
|
||||
for (var i = 0; i < ac; ++i) {
|
||||
this.rd ();
|
||||
this.checkLineContinuation ();
|
||||
var tokens = this.mr.getTokens ();
|
||||
var iAtom = this.mr.parseIntStr (tokens[2]);
|
||||
var elementSymbol = tokens[3];
|
||||
if (elementSymbol.equals ("*")) continue;
|
||||
var x = this.mr.parseFloatStr (tokens[4]);
|
||||
var y = this.mr.parseFloatStr (tokens[5]);
|
||||
var z = this.mr.parseFloatStr (tokens[6]);
|
||||
var charge = 0;
|
||||
var isotope = 0;
|
||||
for (var j = 7; j < tokens.length; j++) {
|
||||
var s = tokens[j].toUpperCase ();
|
||||
if (s.startsWith ("CHG=")) charge = this.mr.parseIntAt (tokens[j], 4);
|
||||
else if (s.startsWith ("MASS=")) isotope = this.mr.parseIntAt (tokens[j], 5);
|
||||
}
|
||||
if (isotope > 1 && elementSymbol.equals ("H")) isotope = 1 - isotope;
|
||||
this.mr.addMolAtom (iAtom, isotope, elementSymbol, charge, x, y, z);
|
||||
}
|
||||
this.mr.discardLinesUntilContains ("END ATOM");
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "readBonds",
|
||||
function (bondCount) {
|
||||
this.mr.discardLinesUntilContains ("BEGIN BOND");
|
||||
if (bondCount == 0) this.mr.asc.setNoAutoBond ();
|
||||
for (var i = 0; i < bondCount; ++i) {
|
||||
this.rd ();
|
||||
var stereo = 0;
|
||||
this.checkLineContinuation ();
|
||||
var tokens = this.mr.getTokens ();
|
||||
var order = this.mr.parseIntStr (tokens[3]);
|
||||
var iAtom1 = tokens[4];
|
||||
var iAtom2 = tokens[5];
|
||||
var cfg = this.getField ("CFG");
|
||||
if (cfg == null) {
|
||||
var endpts = this.getField ("ENDPTS");
|
||||
if (endpts != null && this.line.indexOf ("ATTACH=ALL") >= 0) {
|
||||
tokens = JU.PT.getTokens (endpts);
|
||||
var n = this.mr.parseIntStr (tokens[0]);
|
||||
var o = this.mr.fixOrder (order, 0);
|
||||
for (var k = 1; k <= n; k++) this.mr.asc.addNewBondFromNames (iAtom1, tokens[k], o);
|
||||
|
||||
}} else {
|
||||
stereo = this.mr.parseIntStr (cfg);
|
||||
}this.mr.addMolBond (iAtom1, iAtom2, order, stereo);
|
||||
}
|
||||
this.mr.discardLinesUntilContains ("END BOND");
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "readUserData",
|
||||
function (ac) {
|
||||
this.userData = null;
|
||||
var pc = null;
|
||||
while (!this.rd ().contains ("END CTAB")) {
|
||||
if (!this.line.contains ("BEGIN SGROUP")) continue;
|
||||
var atoms;
|
||||
var name;
|
||||
var data;
|
||||
while (!this.rd ().contains ("END SGROUP")) {
|
||||
if (this.userData == null) this.userData = new java.util.Hashtable ();
|
||||
if ((atoms = this.getField ("ATOMS")) == null || (name = this.getField ("FIELDNAME")) == null || (data = this.getField ("FIELDDATA")) == null) continue;
|
||||
name = name.toLowerCase ();
|
||||
var isPartial = (name.indexOf ("partial") >= 0);
|
||||
if (isPartial) {
|
||||
if (pc == null) pc = name;
|
||||
else if (!pc.equals (name)) isPartial = false;
|
||||
}if (isPartial) {
|
||||
var at = this.mr.asc.atoms;
|
||||
for (var i = this.mr.asc.getLastAtomSetAtomIndex (), n = this.mr.asc.ac; i < n; i++) at[i].partialCharge = 0;
|
||||
|
||||
}var a = null;
|
||||
var f = 0;
|
||||
if (isPartial) f = this.mr.parseFloatStr (data);
|
||||
else if ((a = this.userData.get (name)) == null) this.userData.put (name, a = new Array (ac));
|
||||
try {
|
||||
var tokens = JU.PT.getTokens (atoms);
|
||||
for (var i = tokens.length; --i >= 1; ) {
|
||||
var atom = tokens[i];
|
||||
if (isPartial) this.mr.asc.getAtomFromName (atom).partialCharge = f;
|
||||
else a[this.mr.parseIntStr (atom) - 1] = data;
|
||||
}
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.userData == null) return;
|
||||
for (var key, $key = this.userData.keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) {
|
||||
var a = this.userData.get (key);
|
||||
var f = Clazz.newFloatArray (a.length, 0);
|
||||
for (var i = 0; i < a.length; i++) f[i] = (a[i] == null ? 0 : this.mr.parseFloatStr (a[i]));
|
||||
|
||||
this.mr.asc.setAtomProperties (key, f, -1, false);
|
||||
}
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "getField",
|
||||
function (key) {
|
||||
var pt = this.line.indexOf (key + "=");
|
||||
if (pt < 0) return null;
|
||||
pt += key.length + 1;
|
||||
var term = ' ';
|
||||
switch (this.line.charAt (pt)) {
|
||||
case '"':
|
||||
term = '"';
|
||||
break;
|
||||
case '(':
|
||||
term = ')';
|
||||
break;
|
||||
case '+':
|
||||
break;
|
||||
default:
|
||||
pt--;
|
||||
break;
|
||||
}
|
||||
return this.line.substring (pt + 1, (this.line + term).indexOf (term, pt + 1));
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "rd",
|
||||
function () {
|
||||
return (this.line = this.mr.rd ());
|
||||
});
|
||||
Clazz.defineMethod (c$, "checkLineContinuation",
|
||||
function () {
|
||||
while (this.line.endsWith ("-")) {
|
||||
var s = this.line;
|
||||
this.rd ();
|
||||
this.line = s + this.line;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.molxyz");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.molxyz.XyzReader", ["java.lang.Float", "JU.Logger"], function () {
|
||||
c$ = Clazz.declareType (J.adapter.readers.molxyz, "XyzReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
var modelAtomCount = this.parseIntStr (this.line);
|
||||
if (modelAtomCount == -2147483648) {
|
||||
this.continuing = false;
|
||||
return false;
|
||||
}this.vibrationNumber = ++this.modelNumber;
|
||||
if (this.desiredVibrationNumber <= 0 ? this.doGetModel (this.modelNumber, null) : this.doGetVibration (this.vibrationNumber)) {
|
||||
this.rd ();
|
||||
this.checkCurrentLineForScript ();
|
||||
this.asc.newAtomSet ();
|
||||
var name = this.line.trim ();
|
||||
this.readAtoms (modelAtomCount);
|
||||
this.applySymmetryAndSetTrajectory ();
|
||||
this.asc.setAtomSetName (name);
|
||||
if (this.isLastModel (this.modelNumber)) {
|
||||
this.continuing = false;
|
||||
return false;
|
||||
}} else {
|
||||
this.skipAtomSet (modelAtomCount);
|
||||
}this.discardLinesUntilNonBlank ();
|
||||
return false;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
this.isTrajectory = false;
|
||||
this.finalizeReaderASCR ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "skipAtomSet",
|
||||
function (modelAtomCount) {
|
||||
this.rd ();
|
||||
for (var i = modelAtomCount; --i >= 0; ) this.rd ();
|
||||
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function (modelAtomCount) {
|
||||
for (var i = 0; i < modelAtomCount; ++i) {
|
||||
this.rd ();
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length < 4) {
|
||||
JU.Logger.warn ("line cannot be read for XYZ atom data: " + this.line);
|
||||
continue;
|
||||
}var atom = this.addAtomXYZSymName (tokens, 1, null, null);
|
||||
this.setElementAndIsotope (atom, tokens[0]);
|
||||
var vpt = 4;
|
||||
switch (tokens.length) {
|
||||
case 4:
|
||||
continue;
|
||||
case 5:
|
||||
case 6:
|
||||
case 8:
|
||||
case 9:
|
||||
if (tokens[4].indexOf (".") >= 0) {
|
||||
atom.partialCharge = this.parseFloatStr (tokens[4]);
|
||||
} else {
|
||||
var charge = this.parseIntStr (tokens[4]);
|
||||
if (charge != -2147483648) atom.formalCharge = charge;
|
||||
}switch (tokens.length) {
|
||||
case 5:
|
||||
continue;
|
||||
case 6:
|
||||
atom.radius = this.parseFloatStr (tokens[5]);
|
||||
continue;
|
||||
case 9:
|
||||
atom.atomSerial = this.parseIntStr (tokens[8]);
|
||||
}
|
||||
vpt++;
|
||||
default:
|
||||
var vx = this.parseFloatStr (tokens[vpt++]);
|
||||
var vy = this.parseFloatStr (tokens[vpt++]);
|
||||
var vz = this.parseFloatStr (tokens[vpt++]);
|
||||
if (Float.isNaN (vx) || Float.isNaN (vy) || Float.isNaN (vz)) continue;
|
||||
this.asc.addVibrationVector (atom.index, vx, vy, vz);
|
||||
}
|
||||
}
|
||||
}, "~N");
|
||||
});
|
||||
@@ -0,0 +1,152 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.more");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.more.BinaryDcdReader", ["java.lang.Boolean", "JU.BS", "$.P3", "$.SB", "JU.Escape", "$.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.nModels = 0;
|
||||
this.nAtoms = 0;
|
||||
this.nFree = 0;
|
||||
this.bsFree = null;
|
||||
this.xAll = null;
|
||||
this.yAll = null;
|
||||
this.zAll = null;
|
||||
this.crystGroup = 0;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.more, "BinaryDcdReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.overrideMethod (c$, "setup",
|
||||
function (fullPath, htParams, reader) {
|
||||
this.isBinary = true;
|
||||
this.requiresBSFilter = true;
|
||||
this.setupASCR (fullPath, htParams, reader);
|
||||
}, "~S,java.util.Map,~O");
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.initializeTrajectoryFile ();
|
||||
this.asc.setInfo ("ignoreUnitCell", Boolean.TRUE);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "processBinaryDocument",
|
||||
function () {
|
||||
var bytes = Clazz.newByteArray (40, 0);
|
||||
this.binaryDoc.setStream (null, this.binaryDoc.readInt () == 0x54);
|
||||
this.binaryDoc.readInt ();
|
||||
this.nModels = this.binaryDoc.readInt ();
|
||||
var nPriv = this.binaryDoc.readInt ();
|
||||
var nSaveC = this.binaryDoc.readInt ();
|
||||
var nStep = this.binaryDoc.readInt ();
|
||||
this.binaryDoc.readInt ();
|
||||
this.binaryDoc.readInt ();
|
||||
this.binaryDoc.readInt ();
|
||||
var ndegf = this.binaryDoc.readInt ();
|
||||
this.nFree = Clazz.doubleToInt (ndegf / 3);
|
||||
var nFixed = this.binaryDoc.readInt ();
|
||||
var delta4 = this.binaryDoc.readInt ();
|
||||
this.crystGroup = this.binaryDoc.readInt ();
|
||||
this.binaryDoc.readByteArray (bytes, 0, 32);
|
||||
this.binaryDoc.readInt ();
|
||||
this.binaryDoc.readInt ();
|
||||
this.binaryDoc.readInt ();
|
||||
var sb = new JU.SB ();
|
||||
for (var i = 0, n = this.binaryDoc.readInt (); i < n; i++) sb.append (this.trimString (this.binaryDoc.readString (80))).appendC ('\n');
|
||||
|
||||
this.binaryDoc.readInt ();
|
||||
JU.Logger.info ("BinaryDcdReadaer:\n" + sb);
|
||||
this.binaryDoc.readInt ();
|
||||
this.nAtoms = this.binaryDoc.readInt ();
|
||||
this.binaryDoc.readInt ();
|
||||
this.nFree = this.nAtoms - nFixed;
|
||||
if (nFixed != 0) {
|
||||
this.binaryDoc.readInt ();
|
||||
this.bsFree = JU.BS.newN (this.nFree);
|
||||
for (var i = 0; i < this.nFree; i++) this.bsFree.set (this.binaryDoc.readInt () - 1);
|
||||
|
||||
this.binaryDoc.readInt ();
|
||||
JU.Logger.info ("free: " + this.bsFree.cardinality () + " " + JU.Escape.eBS (this.bsFree));
|
||||
}this.readCoordinates ();
|
||||
JU.Logger.info ("Total number of trajectory steps=" + this.trajectorySteps.size ());
|
||||
});
|
||||
Clazz.defineMethod (c$, "trimString",
|
||||
function (s) {
|
||||
var pt = s.indexOf ('\0');
|
||||
if (pt >= 0) s = s.substring (0, pt);
|
||||
return s.trim ();
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "readFloatArray",
|
||||
function () {
|
||||
var n = Clazz.doubleToInt (this.binaryDoc.readInt () / 4);
|
||||
var data = Clazz.newFloatArray (n, 0);
|
||||
for (var i = 0; i < n; i++) data[i] = this.binaryDoc.readFloat ();
|
||||
|
||||
this.binaryDoc.readInt ();
|
||||
return data;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readDoubleArray",
|
||||
function () {
|
||||
var n = Clazz.doubleToInt (this.binaryDoc.readInt () / 8);
|
||||
var data = Clazz.newDoubleArray (n, 0);
|
||||
for (var i = 0; i < n; i++) data[i] = this.binaryDoc.readDouble ();
|
||||
|
||||
this.binaryDoc.readInt ();
|
||||
return data;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readCoordinates",
|
||||
function () {
|
||||
var ac = (this.bsFilter == null ? this.templateAtomCount : (this.htParams.get ("filteredAtomCount")).intValue ());
|
||||
for (var i = 0; i < this.nModels; i++) if (this.doGetModel (++this.modelNumber, null)) {
|
||||
var trajectoryStep = new Array (ac);
|
||||
if (!this.getTrajectoryStep (trajectoryStep)) return;
|
||||
this.trajectorySteps.addLast (trajectoryStep);
|
||||
if (this.isLastModel (this.modelNumber)) return;
|
||||
} else {
|
||||
if (this.crystGroup > 0) this.readDoubleArray ();
|
||||
this.readFloatArray ();
|
||||
this.readFloatArray ();
|
||||
this.readFloatArray ();
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "getTrajectoryStep",
|
||||
function (trajectoryStep) {
|
||||
try {
|
||||
var ac = trajectoryStep.length;
|
||||
var n = -1;
|
||||
if (this.crystGroup > 0) this.calcUnitCell (this.readDoubleArray ());
|
||||
var x = this.readFloatArray ();
|
||||
var y = this.readFloatArray ();
|
||||
var z = this.readFloatArray ();
|
||||
var bs = (this.xAll == null ? null : this.bsFree);
|
||||
if (bs == null) {
|
||||
this.xAll = x;
|
||||
this.yAll = y;
|
||||
this.zAll = z;
|
||||
}for (var i = 0, vpt = 0; i < this.nAtoms; i++) {
|
||||
var pt = new JU.P3 ();
|
||||
if (bs == null || bs.get (i)) {
|
||||
pt.set (x[vpt], y[vpt], z[vpt]);
|
||||
vpt++;
|
||||
} else {
|
||||
pt.set (this.xAll[i], this.yAll[i], this.zAll[i]);
|
||||
}if (this.bsFilter == null || this.bsFilter.get (i)) {
|
||||
if (++n == ac) return true;
|
||||
trajectoryStep[n] = pt;
|
||||
}}
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
return false;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}, "~A");
|
||||
Clazz.defineMethod (c$, "calcUnitCell",
|
||||
function (abc) {
|
||||
var a = abc[0];
|
||||
var angle1 = abc[1];
|
||||
var b = abc[2];
|
||||
var angle2 = abc[3];
|
||||
var angle3 = abc[4];
|
||||
var c = abc[5];
|
||||
var alpha = (1.5707963267948966 - Math.asin (angle3)) * 180 / 3.141592653589793;
|
||||
var beta = (1.5707963267948966 - Math.asin (angle2)) * 180 / 3.141592653589793;
|
||||
var gamma = (1.5707963267948966 - Math.asin (angle1)) * 180 / 3.141592653589793;
|
||||
System.out.println ("unitcell:[" + a + " " + b + " " + c + " " + alpha + " " + beta + " " + gamma + "]");
|
||||
return Clazz.newFloatArray (-1, [a, b, c, alpha, beta, gamma]);
|
||||
}, "~A");
|
||||
});
|
||||
@@ -0,0 +1,93 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.more");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader", "java.util.Properties"], "J.adapter.readers.more.ForceFieldReader", ["java.lang.Character", "JU.PT", "J.adapter.smarter.Atom"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.userAtomTypes = null;
|
||||
this.atomTypes = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.more, "ForceFieldReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.atomTypes = new java.util.Properties ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "setUserAtomTypes",
|
||||
function () {
|
||||
this.userAtomTypes = this.htParams.get ("atomTypes");
|
||||
if (this.userAtomTypes != null) this.userAtomTypes = ";" + this.userAtomTypes + ";";
|
||||
});
|
||||
Clazz.defineMethod (c$, "getElementSymbol",
|
||||
function (atom, atomType) {
|
||||
var elementSymbol = this.atomTypes.get (atomType);
|
||||
if (elementSymbol != null) {
|
||||
atom.elementSymbol = elementSymbol;
|
||||
return true;
|
||||
}var nChar = atomType.length;
|
||||
var haveSymbol = (nChar < 2);
|
||||
var ptType;
|
||||
if (this.userAtomTypes != null && (ptType = this.userAtomTypes.indexOf (";" + atomType + "=>")) >= 0) {
|
||||
ptType += nChar + 3;
|
||||
elementSymbol = this.userAtomTypes.substring (ptType, this.userAtomTypes.indexOf (";", ptType)).trim ();
|
||||
haveSymbol = true;
|
||||
} else if (nChar == 1) {
|
||||
elementSymbol = atomType.toUpperCase ();
|
||||
haveSymbol = true;
|
||||
} else {
|
||||
var ch0 = atomType.charAt (0);
|
||||
var ch1 = atomType.charAt (1);
|
||||
var isXx = (JU.PT.isUpperCase (ch0) && JU.PT.isLowerCase (ch1));
|
||||
if (" IM IP sz az sy ay ayt ".indexOf (atomType) >= 0) {
|
||||
if (ch0 == 'I') {
|
||||
elementSymbol = atom.atomName.substring (0, 2);
|
||||
if (!JU.PT.isLowerCase (elementSymbol.charAt (1))) elementSymbol = elementSymbol.substring (0, 1);
|
||||
} else {
|
||||
elementSymbol = (ch0 == 's' ? "Si" : "Al");
|
||||
}} else if (nChar == 2 && isXx) {
|
||||
} else if (JU.PT.isLetter (ch0) && !JU.PT.isLetter (ch1)) {
|
||||
elementSymbol = "" + Character.toUpperCase (ch0);
|
||||
} else if (nChar > 2 && isXx && !JU.PT.isLetter (atomType.charAt (2))) {
|
||||
elementSymbol = "" + ch0 + ch1;
|
||||
} else {
|
||||
ch0 = Character.toUpperCase (ch0);
|
||||
var check = " " + atomType + " ";
|
||||
if (" CA CB CC CD CE CF CG CH CI CJ CK CM CN CP CQ CR CT CV CW HA HP HC HO HS HW LP NA NB NC NT OH OS OW SH AH BH HT HY AC BC CS OA OB OE OT dw hc hi hn ho hp hs hw hscp htip ca cg ci cn co coh cp cr cs ct c3h c3m c4h c4m na nb nh nho nh+ ni nn np npc nr nt nz oc oe oh op oscp otip sc sh sp br cl ca+ ar si lp nu sz oz az pz ga ge tioc titd li+ na+ rb+ cs+ mg2+ ca2+ ba2+ cu2+ cl- br- so4 sy oy ay ayt nac+ mg2c fe2c mn4c mn3c co2c ni2c lic+ pd2+ ti4c sr2c ca2c cly- hocl py vy nh4+ so4y lioh naoh koh foh cloh beoh al CE1 CF1 CF2 CF3 CG CD2 CH1E CH2E CH3E CM CP3 CPH1 CPH2 CQ66 CR55 CR56 CR66 CS66 CT CT3 CT4 CUA1 CUA2 CUA3 CUY1 CUY2 HA HC HMU HO HT LP NC NC2 NO2 NP NR1 NR2 NR3 NR55 NR56 NR66 NT NX OA OAC OC OE OH2 OK OM OS OSH OSI OT OW PO3 PO4 PT PUA1 PUY1 SE SH1E SK SO1 SO2 SO3 SO4 ST ST2 ST2 br br- br1 cl cl- cl1 cl12 cl13 cl14 cl1p ca+ cu+2 fe+2 mg+2 zn+2 cs+ li+ na+ rb+ al4z si si4 si4c si4z ar he kr ne xe dw hi hw ca cg ci co coh cp cr cs ct ct3 na nb nh nho ni no np nt nt2 nz oa oc oh op os ot sp bt cl\' si4l si5l si5t si6 si6o si\' br ca cc cd ce cf cl cp cq cu cv cx cy ha hc hn ho hp hs na nb nc nd nh oh os pb pc pd pe pf px py sh ss sx sy hn2 ho2 cz oo oz si sio hsi osi ".indexOf (check) < 0) {
|
||||
} else if (" AH BH AC BC ".indexOf (check) >= 0) {
|
||||
elementSymbol = "" + ch1;
|
||||
} else if (" al al4z ar ba2+ beoh br br- br1 ca+ ca2+ ca2c cl cl\' cl- cl1 cl12 cl13 cl14 cl1p cloh cly- co2c cs+ cu+2 cu2+ fe+2 fe2c ga ge he kr li+ lic+ lioh lp LP mg+2 mg2+ mg2c mn3c mn4c na+ nac+ naoh ne ni2c nu pd2+ rb+ si si\' si4 si4c si4l si4z si5l si5t si6 si6o sio sr2c ti4c tioc titd xe zn+2 ".indexOf (check) >= 0) {
|
||||
elementSymbol = "" + ch0 + ch1;
|
||||
} else {
|
||||
elementSymbol = "" + ch0;
|
||||
}}if (elementSymbol == null) {
|
||||
elementSymbol = "" + ch0 + Character.toLowerCase (ch1);
|
||||
} else {
|
||||
haveSymbol = true;
|
||||
}}atom.elementSymbol = elementSymbol;
|
||||
if (haveSymbol) this.atomTypes.put (atomType, elementSymbol);
|
||||
return haveSymbol;
|
||||
}, "J.adapter.smarter.Atom,~S");
|
||||
c$.deducePdbElementSymbol = Clazz.defineMethod (c$, "deducePdbElementSymbol",
|
||||
function (isHetero, XX, group3) {
|
||||
var i = XX.indexOf ('\0');
|
||||
var atomType = null;
|
||||
if (i >= 0) {
|
||||
atomType = XX.substring (i + 1);
|
||||
XX = XX.substring (0, i);
|
||||
if (atomType != null && atomType.length == 1) return atomType;
|
||||
}if (XX.equalsIgnoreCase (group3)) return XX;
|
||||
var len = XX.length;
|
||||
var ch1 = ' ';
|
||||
i = 0;
|
||||
while (i < len && (ch1 = XX.charAt (i++)) <= '9') {
|
||||
}
|
||||
var ch2 = (i < len ? XX.charAt (i) : ' ');
|
||||
var full = group3 + "." + ch1 + ch2;
|
||||
if (("OEC.CA ICA.CA OC1.CA OC2.CA OC4.CA").indexOf (full) >= 0) return "Ca";
|
||||
if (XX.indexOf ("'") > 0 || XX.indexOf ("*") >= 0 || "HCNO".indexOf (ch1) >= 0 && ch2 <= 'H' || XX.startsWith ("CM")) return "" + ch1;
|
||||
if (isHetero && J.adapter.smarter.Atom.isValidSymNoCase (ch1, ch2)) return ("" + ch1 + ch2).trim ();
|
||||
if (J.adapter.smarter.Atom.isValidSym1 (ch1)) return "" + ch1;
|
||||
if (J.adapter.smarter.Atom.isValidSym1 (ch2)) return "" + ch2;
|
||||
return "Xx";
|
||||
}, "~B,~S,~S");
|
||||
Clazz.defineStatics (c$,
|
||||
"ffTypes", " CA CB CC CD CE CF CG CH CI CJ CK CM CN CP CQ CR CT CV CW HA HP HC HO HS HW LP NA NB NC NT OH OS OW SH AH BH HT HY AC BC CS OA OB OE OT dw hc hi hn ho hp hs hw hscp htip ca cg ci cn co coh cp cr cs ct c3h c3m c4h c4m na nb nh nho nh+ ni nn np npc nr nt nz oc oe oh op oscp otip sc sh sp br cl ca+ ar si lp nu sz oz az pz ga ge tioc titd li+ na+ rb+ cs+ mg2+ ca2+ ba2+ cu2+ cl- br- so4 sy oy ay ayt nac+ mg2c fe2c mn4c mn3c co2c ni2c lic+ pd2+ ti4c sr2c ca2c cly- hocl py vy nh4+ so4y lioh naoh koh foh cloh beoh al CE1 CF1 CF2 CF3 CG CD2 CH1E CH2E CH3E CM CP3 CPH1 CPH2 CQ66 CR55 CR56 CR66 CS66 CT CT3 CT4 CUA1 CUA2 CUA3 CUY1 CUY2 HA HC HMU HO HT LP NC NC2 NO2 NP NR1 NR2 NR3 NR55 NR56 NR66 NT NX OA OAC OC OE OH2 OK OM OS OSH OSI OT OW PO3 PO4 PT PUA1 PUY1 SE SH1E SK SO1 SO2 SO3 SO4 ST ST2 ST2 br br- br1 cl cl- cl1 cl12 cl13 cl14 cl1p ca+ cu+2 fe+2 mg+2 zn+2 cs+ li+ na+ rb+ al4z si si4 si4c si4z ar he kr ne xe dw hi hw ca cg ci co coh cp cr cs ct ct3 na nb nh nho ni no np nt nt2 nz oa oc oh op os ot sp bt cl\' si4l si5l si5t si6 si6o si\' br ca cc cd ce cf cl cp cq cu cv cx cy ha hc hn ho hp hs na nb nc nd nh oh os pb pc pd pe pf px py sh ss sx sy hn2 ho2 cz oo oz si sio hsi osi ",
|
||||
"twoChar", " al al4z ar ba2+ beoh br br- br1 ca+ ca2+ ca2c cl cl' cl- cl1 cl12 cl13 cl14 cl1p cloh cly- co2c cs+ cu+2 cu2+ fe+2 fe2c ga ge he kr li+ lic+ lioh lp LP mg+2 mg2+ mg2c mn3c mn4c na+ nac+ naoh ne ni2c nu pd2+ rb+ si si' si4 si4c si4l si4z si5l si5t si6 si6o sio sr2c ti4c tioc titd xe zn+2 ",
|
||||
"specialTypes", " IM IP sz az sy ay ayt ",
|
||||
"secondCharOnly", " AH BH AC BC ");
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.more");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.more.GromacsReader", ["java.lang.Float", "JU.P3", "J.adapter.smarter.Atom", "JU.Logger"], function () {
|
||||
c$ = Clazz.declareType (J.adapter.readers.more, "GromacsReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.setIsPDB ();
|
||||
this.asc.newAtomSet ();
|
||||
this.setModelPDB (true);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
this.checkCurrentLineForScript ();
|
||||
this.asc.setAtomSetName (this.line.trim ());
|
||||
this.readAtoms ();
|
||||
this.readUnitCell ();
|
||||
this.continuing = false;
|
||||
return false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function () {
|
||||
var modelAtomCount = this.parseIntStr (this.rd ());
|
||||
for (var i = 0; i < modelAtomCount; ++i) {
|
||||
this.rd ();
|
||||
var len = this.line.length;
|
||||
if (len != 44 && len != 68) {
|
||||
JU.Logger.warn ("line cannot be read for GROMACS atom data: " + this.line);
|
||||
continue;
|
||||
}var atom = new J.adapter.smarter.Atom ();
|
||||
atom.sequenceNumber = this.parseIntRange (this.line, 0, 5);
|
||||
this.setAtomName (atom, this.parseTokenRange (this.line, 5, 9).trim (), this.line.substring (11, 15).trim ());
|
||||
atom.atomSerial = this.parseIntRange (this.line, 15, 20);
|
||||
atom.x = this.parseFloatRange (this.line, 20, 28) * 10;
|
||||
atom.y = this.parseFloatRange (this.line, 28, 36) * 10;
|
||||
atom.z = this.parseFloatRange (this.line, 36, 44) * 10;
|
||||
if (Float.isNaN (atom.x) || Float.isNaN (atom.y) || Float.isNaN (atom.z)) {
|
||||
JU.Logger.warn ("line cannot be read for GROMACS atom data: " + this.line);
|
||||
atom.set (0, 0, 0);
|
||||
}this.setAtomCoord (atom);
|
||||
atom.elementSymbol = this.deduceElementSymbol (atom.group3, atom.atomName);
|
||||
if (!this.filterAtom (atom, i)) continue;
|
||||
atom.isHetero = false;
|
||||
this.asc.addAtom (atom);
|
||||
if (len < 69) continue;
|
||||
var vx = this.parseFloatRange (this.line, 44, 52) * 10;
|
||||
var vy = this.parseFloatRange (this.line, 52, 60) * 10;
|
||||
var vz = this.parseFloatRange (this.line, 60, 68) * 10;
|
||||
if (Float.isNaN (vx) || Float.isNaN (vy) || Float.isNaN (vz)) continue;
|
||||
this.asc.addVibrationVector (atom.index, vx, vy, vz);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "setAtomName",
|
||||
function (atom, gname, aname) {
|
||||
atom.atomName = aname;
|
||||
if (gname.equals ("SOL") && aname.length == 3 && "OW1;HW2;HW3".indexOf (aname) >= 0) gname = "WAT";
|
||||
atom.group3 = gname;
|
||||
}, "J.adapter.smarter.Atom,~S,~S");
|
||||
Clazz.defineMethod (c$, "deduceElementSymbol",
|
||||
function (group3, atomName) {
|
||||
if (atomName.length <= 2 && group3.equals (atomName)) return atomName;
|
||||
var ch1 = (atomName.length == 4 ? atomName.charAt (0) : '\0');
|
||||
var ch2 = atomName.charAt (atomName.length == 4 ? 1 : 0);
|
||||
var isHetero = this.vwr.getJBR ().isHetero (group3);
|
||||
if (J.adapter.smarter.Atom.isValidSymNoCase (ch1, ch2)) return (isHetero || ch1 != 'H' ? "" + ch1 + ch2 : "H");
|
||||
if (J.adapter.smarter.Atom.isValidSym1 (ch2)) return "" + ch2;
|
||||
if (J.adapter.smarter.Atom.isValidSym1 (ch1)) return "" + ch1;
|
||||
return "Xx";
|
||||
}, "~S,~S");
|
||||
Clazz.defineMethod (c$, "readUnitCell",
|
||||
function () {
|
||||
if (this.rd () == null) return;
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length < 3 || !this.doApplySymmetry) return;
|
||||
var a = 10 * this.parseFloatStr (tokens[0]);
|
||||
var b = 10 * this.parseFloatStr (tokens[1]);
|
||||
var c = 10 * this.parseFloatStr (tokens[2]);
|
||||
this.setUnitCell (a, b, c, 90, 90, 90);
|
||||
this.setSpaceGroupName ("P1");
|
||||
var atoms = this.asc.atoms;
|
||||
var pt = JU.P3.new3 (0.5, 0.5, 0.5);
|
||||
for (var i = this.asc.ac; --i >= 0; ) {
|
||||
this.setAtomCoord (atoms[i]);
|
||||
atoms[i].add (pt);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,287 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.more");
|
||||
Clazz.load (["J.adapter.readers.molxyz.MolReader", "J.api.JmolJDXMOLReader", "JU.Lst"], "J.adapter.readers.more.JcampdxReader", ["java.lang.Float", "JU.BS", "$.PT", "$.Rdr", "J.adapter.smarter.SmarterJmolAdapter", "J.api.Interface", "JU.BSUtil", "$.Logger", "JV.JC"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.selectedModel = 0;
|
||||
this.mpr = null;
|
||||
this.acdMolFile = null;
|
||||
this.nPeaks = 0;
|
||||
this.acdAssignments = null;
|
||||
this.title = null;
|
||||
this.nucleus = "";
|
||||
this.type = null;
|
||||
this.peakData = null;
|
||||
this.allTypes = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.more, "JcampdxReader", J.adapter.readers.molxyz.MolReader, J.api.JmolJDXMOLReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.peakData = new JU.Lst ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.vwr.setBooleanProperty ("_JSpecView".toLowerCase (), true);
|
||||
if (this.isTrajectory) {
|
||||
JU.Logger.warn ("TRAJECTORY keyword ignored");
|
||||
this.isTrajectory = false;
|
||||
}if (this.reverseModels) {
|
||||
JU.Logger.warn ("REVERSE keyword ignored");
|
||||
this.reverseModels = false;
|
||||
}this.selectedModel = this.desiredModelNumber;
|
||||
this.desiredModelNumber = -2147483648;
|
||||
if (!this.checkFilterKey ("NOSYNC")) this.addJmolScript ("sync on");
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
var i = this.line.indexOf ("=");
|
||||
if (i < 0 || !this.line.startsWith ("##")) return true;
|
||||
var label = JU.PT.replaceAllCharacters (this.line.substring (0, i).trim (), " ", "").toUpperCase ();
|
||||
if (label.length > 12) label = label.substring (0, 12);
|
||||
var pt = ("##$MODELS ##$PEAKS ##$SIGNALS ##$MOLFILE ##NPOINTS ##TITLE ##PEAKASSIGN##$UVIR_ASSI##$MS_FRAGME##.OBSERVENU##DATATYPE ").indexOf (label);
|
||||
if (pt < 0) return true;
|
||||
if (this.mpr == null) this.mpr = (J.api.Interface.getOption ("jsv.JDXMOLParser", this.vwr, "file")).set (this, this.filePath, this.htParams);
|
||||
var value = this.line.substring (i + 1).trim ();
|
||||
this.mpr.setLine (value);
|
||||
switch (pt) {
|
||||
case 0:
|
||||
this.mpr.readModels ();
|
||||
break;
|
||||
case 12:
|
||||
case 24:
|
||||
this.mpr.readPeaks (pt == 24, -1);
|
||||
break;
|
||||
case 36:
|
||||
this.acdMolFile = this.mpr.readACDMolFile ();
|
||||
this.processModelData (this.acdMolFile, this.title + " (assigned)", "MOL", "mol", "", 0.01, NaN, true);
|
||||
if (this.asc.errorMessage != null) {
|
||||
this.continuing = false;
|
||||
return false;
|
||||
}break;
|
||||
case 48:
|
||||
this.nPeaks = JU.PT.parseInt (value);
|
||||
break;
|
||||
case 60:
|
||||
this.title = JU.PT.split (value, "$$")[0].trim ();
|
||||
break;
|
||||
case 72:
|
||||
case 84:
|
||||
case 96:
|
||||
this.acdAssignments = this.mpr.readACDAssignments (this.nPeaks, pt == 72);
|
||||
break;
|
||||
case 108:
|
||||
this.nucleus = value.substring (1);
|
||||
break;
|
||||
case 120:
|
||||
this.type = value;
|
||||
if ((pt = this.type.indexOf (" ")) >= 0) this.type = this.type.substring (0, pt);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
if (this.mpr != null) this.processPeakData ();
|
||||
this.finalizeReaderMR ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "processModelData",
|
||||
function (data, id, type, base, last, modelScale, vibScale, isFirst) {
|
||||
var model0 = this.asc.iSet;
|
||||
var model = null;
|
||||
while (true) {
|
||||
var ret = J.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollectionReader (this.filePath, type, JU.Rdr.getBR (data), this.htParams);
|
||||
if (Clazz.instanceOf (ret, String)) {
|
||||
JU.Logger.warn ("" + ret);
|
||||
if ((ret).startsWith (JV.JC.READER_NOT_FOUND)) this.asc.errorMessage = ret;
|
||||
break;
|
||||
}ret = J.adapter.smarter.SmarterJmolAdapter.staticGetAtomSetCollection (ret);
|
||||
if (Clazz.instanceOf (ret, String)) {
|
||||
JU.Logger.warn ("" + ret);
|
||||
break;
|
||||
}model = ret;
|
||||
var baseModel = base;
|
||||
if (baseModel.length == 0) baseModel = last;
|
||||
if (baseModel.length != 0) {
|
||||
var ibase = this.findModelById (baseModel);
|
||||
if (ibase >= 0) {
|
||||
this.asc.setModelInfoForSet ("jdxModelID", baseModel, ibase);
|
||||
for (var i = model.atomSetCount; --i >= 0; ) model.setModelInfoForSet ("jdxBaseModel", baseModel, i);
|
||||
|
||||
if (model.bondCount == 0) this.setBonding (model, ibase);
|
||||
}}if (!Float.isNaN (vibScale)) {
|
||||
JU.Logger.info ("JcampdxReader applying vibration scaling of " + vibScale + " to " + model.ac + " atoms");
|
||||
var atoms = model.atoms;
|
||||
for (var i = model.ac; --i >= 0; ) {
|
||||
if (atoms[i].vib != null && !Float.isNaN (atoms[i].vib.z)) atoms[i].vib.scale (vibScale);
|
||||
}
|
||||
}if (!Float.isNaN (modelScale)) {
|
||||
JU.Logger.info ("JcampdxReader applying model scaling of " + modelScale + " to " + model.ac + " atoms");
|
||||
var atoms = model.atoms;
|
||||
for (var i = model.ac; --i >= 0; ) atoms[i].scale (modelScale);
|
||||
|
||||
}JU.Logger.info ("jdx model=" + id + " type=" + model.fileTypeName);
|
||||
this.asc.appendAtomSetCollection (-1, model);
|
||||
break;
|
||||
}
|
||||
this.updateModelIDs (id, model0, isFirst);
|
||||
}, "~S,~S,~S,~S,~S,~N,~N,~B");
|
||||
Clazz.defineMethod (c$, "setBonding",
|
||||
function (a, ibase) {
|
||||
var n0 = this.asc.getAtomSetAtomCount (ibase);
|
||||
var n = a.ac;
|
||||
if (n % n0 != 0) {
|
||||
JU.Logger.warn ("atom count in secondary model (" + n + ") is not a multiple of " + n0 + " -- bonding ignored");
|
||||
return;
|
||||
}var bonds = this.asc.bonds;
|
||||
var b0 = 0;
|
||||
for (var i = 0; i < ibase; i++) b0 += this.asc.getAtomSetBondCount (i);
|
||||
|
||||
var b1 = b0 + this.asc.getAtomSetBondCount (ibase);
|
||||
var ii0 = this.asc.getAtomSetAtomIndex (ibase);
|
||||
var nModels = a.atomSetCount;
|
||||
for (var j = 0; j < nModels; j++) {
|
||||
var i0 = a.getAtomSetAtomIndex (j) - ii0;
|
||||
if (a.getAtomSetAtomCount (j) != n0) {
|
||||
JU.Logger.warn ("atom set atom count in secondary model (" + a.getAtomSetAtomCount (j) + ") is not equal to " + n0 + " -- bonding ignored");
|
||||
return;
|
||||
}for (var i = b0; i < b1; i++) a.addNewBondWithOrder (bonds[i].atomIndex1 + i0, bonds[i].atomIndex2 + i0, bonds[i].order);
|
||||
|
||||
}
|
||||
}, "J.adapter.smarter.AtomSetCollection,~N");
|
||||
Clazz.defineMethod (c$, "updateModelIDs",
|
||||
function (id, model0, isFirst) {
|
||||
var n = this.asc.atomSetCount;
|
||||
if (isFirst && n == model0 + 2) {
|
||||
this.asc.setCurrentModelInfo ("modelID", id);
|
||||
return;
|
||||
}for (var pt = 0, i = model0; ++i < n; ) this.asc.setModelInfoForSet ("modelID", id + "." + (++pt), i);
|
||||
|
||||
}, "~S,~N,~B");
|
||||
Clazz.overrideMethod (c$, "addPeakData",
|
||||
function (info) {
|
||||
this.peakData.addLast (info);
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "processPeakData",
|
||||
function () {
|
||||
if (this.acdAssignments != null) {
|
||||
try {
|
||||
this.mpr.setACDAssignments (this.title, this.nucleus + this.type, 0, this.acdAssignments, this.acdMolFile);
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}var n = this.peakData.size ();
|
||||
if (n == 0) return;
|
||||
var bsModels = new JU.BS ();
|
||||
var havePeaks = (n > 0);
|
||||
for (var p = 0; p < n; p++) {
|
||||
this.line = this.peakData.get (p);
|
||||
var type = this.mpr.getAttribute (this.line, "type");
|
||||
var id = this.mpr.getAttribute (this.line, "model");
|
||||
var i = this.findModelById (id);
|
||||
if (i < 0) {
|
||||
JU.Logger.warn ("cannot find model " + id + " required for " + this.line);
|
||||
continue;
|
||||
}this.addType (i, type);
|
||||
var title = type + ": " + this.mpr.getAttribute (this.line, "title");
|
||||
var key = "jdxAtomSelect_" + this.mpr.getAttribute (this.line, "type");
|
||||
bsModels.set (i);
|
||||
var s;
|
||||
if (this.mpr.getAttribute (this.line, "atoms").length != 0) {
|
||||
this.processPeakSelectAtom (i, key, this.line);
|
||||
s = type + ": ";
|
||||
} else if (this.processPeakSelectModel (i, title)) {
|
||||
s = "model: ";
|
||||
} else {
|
||||
s = "ignored: ";
|
||||
}JU.Logger.info (s + this.line);
|
||||
}
|
||||
n = this.asc.atomSetCount;
|
||||
for (var i = n; --i >= 0; ) {
|
||||
var id = this.asc.getAtomSetAuxiliaryInfoValue (i, "modelID");
|
||||
if (havePeaks && !bsModels.get (i) && id.indexOf (".") >= 0) {
|
||||
this.removeAtomSet (i);
|
||||
n--;
|
||||
}}
|
||||
if (this.selectedModel == -2147483648) {
|
||||
if (this.allTypes != null) this.appendLoadNote (this.allTypes);
|
||||
} else {
|
||||
if (this.selectedModel == 0) this.selectedModel = n - 1;
|
||||
for (var i = this.asc.atomSetCount; --i >= 0; ) if (i + 1 != this.selectedModel) this.removeAtomSet (i);
|
||||
|
||||
if (n > 0) this.appendLoadNote (this.asc.getAtomSetAuxiliaryInfoValue (0, "name"));
|
||||
}for (var i = this.asc.atomSetCount; --i >= 0; ) this.asc.setAtomSetNumber (i, i + 1);
|
||||
|
||||
this.asc.centralize ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "findModelById",
|
||||
function (modelID) {
|
||||
for (var i = this.asc.atomSetCount; --i >= 0; ) {
|
||||
var id = this.asc.getAtomSetAuxiliaryInfoValue (i, "modelID");
|
||||
if (modelID.equals (id)) return i;
|
||||
}
|
||||
return -1;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "addType",
|
||||
function (imodel, type) {
|
||||
var types = this.addTypeStr (this.asc.getAtomSetAuxiliaryInfoValue (imodel, "spectrumTypes"), type);
|
||||
if (types == null) return;
|
||||
this.asc.setModelInfoForSet ("spectrumTypes", types, imodel);
|
||||
var s = this.addTypeStr (this.allTypes, type);
|
||||
if (s != null) this.allTypes = s;
|
||||
}, "~N,~S");
|
||||
Clazz.defineMethod (c$, "addTypeStr",
|
||||
function (types, type) {
|
||||
if (types != null && types.contains (type)) return null;
|
||||
if (types == null) types = "";
|
||||
else types += ",";
|
||||
return types + type;
|
||||
}, "~S,~S");
|
||||
Clazz.defineMethod (c$, "processPeakSelectAtom",
|
||||
function (i, key, data) {
|
||||
var peaks = this.asc.getAtomSetAuxiliaryInfoValue (i, key);
|
||||
if (peaks == null) this.asc.setModelInfoForSet (key, peaks = new JU.Lst (), i);
|
||||
peaks.addLast (data);
|
||||
}, "~N,~S,~S");
|
||||
Clazz.defineMethod (c$, "processPeakSelectModel",
|
||||
function (i, title) {
|
||||
if (this.asc.getAtomSetAuxiliaryInfoValue (i, "jdxModelSelect") != null) return false;
|
||||
this.asc.setModelInfoForSet ("name", title, i);
|
||||
this.asc.setModelInfoForSet ("jdxModelSelect", this.line, i);
|
||||
return true;
|
||||
}, "~N,~S");
|
||||
Clazz.overrideMethod (c$, "setSpectrumPeaks",
|
||||
function (nH, piUnitsX, piUnitsY) {
|
||||
}, "~N,~S,~S");
|
||||
Clazz.defineMethod (c$, "removeAtomSet",
|
||||
function (imodel) {
|
||||
if (this.asc.bsAtoms == null) this.asc.bsAtoms = JU.BSUtil.newBitSet2 (0, this.asc.ac);
|
||||
var i0 = this.asc.atomSetAtomIndexes[imodel];
|
||||
var nAtoms = this.asc.atomSetAtomCounts[imodel];
|
||||
var i1 = i0 + nAtoms;
|
||||
this.asc.bsAtoms.clearBits (i0, i1);
|
||||
for (var i = i1; i < this.asc.ac; i++) this.asc.atoms[i].atomSetIndex--;
|
||||
|
||||
for (var i = imodel + 1; i < this.asc.atomSetCount; i++) {
|
||||
this.asc.atomSetAuxiliaryInfo[i - 1] = this.asc.atomSetAuxiliaryInfo[i];
|
||||
this.asc.atomSetAtomIndexes[i - 1] = this.asc.atomSetAtomIndexes[i];
|
||||
this.asc.atomSetBondCounts[i - 1] = this.asc.atomSetBondCounts[i];
|
||||
this.asc.atomSetAtomCounts[i - 1] = this.asc.atomSetAtomCounts[i];
|
||||
this.asc.atomSetNumbers[i - 1] = this.asc.atomSetNumbers[i];
|
||||
}
|
||||
for (var i = 0; i < this.asc.bondCount; i++) this.asc.bonds[i].atomSetIndex = this.asc.atoms[this.asc.bonds[i].atomIndex1].atomSetIndex;
|
||||
|
||||
this.asc.atomSetAuxiliaryInfo[--this.asc.atomSetCount] = null;
|
||||
var n = 0;
|
||||
for (var i = 0; i < this.asc.structureCount; i++) {
|
||||
var s = this.asc.structures[i];
|
||||
if (s.modelStartEnd[0] == imodel && s.modelStartEnd[1] == imodel) {
|
||||
this.asc.structures[i] = null;
|
||||
n++;
|
||||
}}
|
||||
if (n > 0) {
|
||||
var ss = new Array (this.asc.structureCount - n);
|
||||
for (var i = 0, pt = 0; i < this.asc.structureCount; i++) if (this.asc.structures[i] != null) ss[pt++] = this.asc.structures[i];
|
||||
|
||||
this.asc.structures = ss;
|
||||
}}, "~N");
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.more");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.more.MdCrdReader", ["java.lang.Float", "JU.P3", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.ptFloat = 0;
|
||||
this.lenLine = 0;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.more, "MdCrdReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.overrideMethod (c$, "setup",
|
||||
function (fullPath, htParams, readerOrDocument) {
|
||||
this.requiresBSFilter = true;
|
||||
this.setupASCR (fullPath, htParams, readerOrDocument);
|
||||
}, "~S,java.util.Map,~O");
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.initializeTrajectoryFile ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
this.readCoordinates ();
|
||||
JU.Logger.info ("Total number of trajectory steps=" + this.trajectorySteps.size ());
|
||||
this.continuing = false;
|
||||
return false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readCoordinates",
|
||||
function () {
|
||||
this.line = null;
|
||||
var ac = (this.bsFilter == null ? this.templateAtomCount : (this.htParams.get ("filteredAtomCount")).intValue ());
|
||||
var isPeriodic = this.htParams.containsKey ("isPeriodic");
|
||||
var floatCount = this.templateAtomCount * 3 + (isPeriodic ? 3 : 0);
|
||||
while (true) if (this.doGetModel (++this.modelNumber, null)) {
|
||||
var trajectoryStep = new Array (ac);
|
||||
if (!this.getTrajectoryStep (trajectoryStep, isPeriodic)) return;
|
||||
this.trajectorySteps.addLast (trajectoryStep);
|
||||
if (this.isLastModel (this.modelNumber)) return;
|
||||
} else {
|
||||
if (!this.skipFloats (floatCount)) return;
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "getFloat",
|
||||
function () {
|
||||
while (this.line == null || this.ptFloat >= this.lenLine) {
|
||||
if (this.rd () == null) return NaN;
|
||||
this.ptFloat = 0;
|
||||
this.lenLine = this.line.length;
|
||||
}
|
||||
this.ptFloat += 8;
|
||||
return this.parseFloatRange (this.line, this.ptFloat - 8, this.ptFloat);
|
||||
});
|
||||
Clazz.defineMethod (c$, "getPoint",
|
||||
function () {
|
||||
var x = this.getFloat ();
|
||||
var y = this.getFloat ();
|
||||
var z = this.getFloat ();
|
||||
return (Float.isNaN (z) ? null : JU.P3.new3 (x, y, z));
|
||||
});
|
||||
Clazz.defineMethod (c$, "getTrajectoryStep",
|
||||
function (trajectoryStep, isPeriodic) {
|
||||
var ac = trajectoryStep.length;
|
||||
var n = -1;
|
||||
for (var i = 0; i < this.templateAtomCount; i++) {
|
||||
var pt = this.getPoint ();
|
||||
if (pt == null) return false;
|
||||
if (this.bsFilter == null || this.bsFilter.get (i)) {
|
||||
if (++n == ac) return false;
|
||||
trajectoryStep[n] = pt;
|
||||
}}
|
||||
if (isPeriodic) this.getPoint ();
|
||||
return (this.line != null);
|
||||
}, "~A,~B");
|
||||
Clazz.defineMethod (c$, "skipFloats",
|
||||
function (n) {
|
||||
var i = 0;
|
||||
while (i < n && this.rd () != null) i += this.getTokens ().length;
|
||||
|
||||
return (this.line != null);
|
||||
}, "~N");
|
||||
});
|
||||
@@ -0,0 +1,133 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.more");
|
||||
Clazz.load (["J.adapter.readers.more.ForceFieldReader"], "J.adapter.readers.more.MdTopReader", ["java.lang.Boolean", "JU.Lst", "J.adapter.smarter.Atom", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.nAtoms = 0;
|
||||
this.ac = 0;
|
||||
this.$atomTypes = null;
|
||||
this.group3s = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.more, "MdTopReader", J.adapter.readers.more.ForceFieldReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.setIsPDB ();
|
||||
this.setUserAtomTypes ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.indexOf ("%FLAG ") != 0) return true;
|
||||
this.line = this.line.substring (6).trim ();
|
||||
if (this.line.equals ("POINTERS")) this.getPointers ();
|
||||
else if (this.line.equals ("ATOM_NAME")) this.getAtomNames ();
|
||||
else if (this.line.equals ("CHARGE")) this.getCharges ();
|
||||
else if (this.line.equals ("RESIDUE_LABEL")) this.getResidueLabels ();
|
||||
else if (this.line.equals ("RESIDUE_POINTER")) this.getResiduePointers ();
|
||||
else if (this.line.equals ("AMBER_ATOM_TYPE")) this.getAtomTypes ();
|
||||
else if (this.line.equals ("MASS")) this.getMasses ();
|
||||
return false;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
this.finalizeReaderASCR ();
|
||||
var atoms = this.asc.atoms;
|
||||
var atom;
|
||||
for (var i = 0; i < this.ac; i++) {
|
||||
atom = atoms[i];
|
||||
atom.isHetero = this.vwr.getJBR ().isHetero (atom.group3);
|
||||
var atomType = this.$atomTypes[i];
|
||||
if (!this.getElementSymbol (atom, atomType)) atom.elementSymbol = J.adapter.readers.more.ForceFieldReader.deducePdbElementSymbol (atom.isHetero, atom.atomName, atom.group3);
|
||||
}
|
||||
var atoms2 = null;
|
||||
if (this.filter == null) {
|
||||
this.nAtoms = this.ac;
|
||||
} else {
|
||||
atoms2 = new Array (atoms.length);
|
||||
this.nAtoms = 0;
|
||||
for (var i = 0; i < this.ac; i++) if (this.filterAtom (atoms[i], i)) atoms2[this.nAtoms++] = atoms[i];
|
||||
|
||||
}for (var i = 0, j = 0, k = 0; i < this.ac; i++) {
|
||||
if (this.filter == null || this.bsFilter.get (i)) {
|
||||
if (k % 100 == 0) j++;
|
||||
this.setAtomCoordXYZ (atoms[i], (i % 100) * 2, j * 2, 0);
|
||||
}}
|
||||
if (atoms2 != null) {
|
||||
this.discardPreviousAtoms ();
|
||||
for (var i = 0; i < this.nAtoms; i++) this.asc.addAtom (atoms2[i]);
|
||||
|
||||
}JU.Logger.info ("Total number of atoms used=" + this.nAtoms);
|
||||
this.setModelPDB (true);
|
||||
this.htParams.put ("defaultType", "mdcrd");
|
||||
});
|
||||
Clazz.defineMethod (c$, "getDataBlock",
|
||||
function () {
|
||||
var vdata = new JU.Lst ();
|
||||
this.discardLinesUntilContains ("FORMAT");
|
||||
var n = J.adapter.smarter.AtomSetCollectionReader.getFortranFormatLengths (this.line.substring (this.line.indexOf ("("))).get (0).intValue ();
|
||||
var i = 0;
|
||||
var len = 0;
|
||||
while (true) {
|
||||
if (i >= len) {
|
||||
if (this.rd () == null) break;
|
||||
i = 0;
|
||||
len = this.line.length;
|
||||
if (len == 0 || this.line.indexOf ("FLAG") >= 0) break;
|
||||
}vdata.addLast (this.line.substring (i, i + n).trim ());
|
||||
i += n;
|
||||
}
|
||||
return vdata.toArray ( new Array (vdata.size ()));
|
||||
});
|
||||
Clazz.defineMethod (c$, "getPointers",
|
||||
function () {
|
||||
var tokens = this.getDataBlock ();
|
||||
this.ac = this.parseIntStr (tokens[0]);
|
||||
var isPeriodic = (tokens[27].charAt (0) != '0');
|
||||
if (isPeriodic) {
|
||||
JU.Logger.info ("Periodic type: " + tokens[27]);
|
||||
this.htParams.put ("isPeriodic", Boolean.TRUE);
|
||||
}JU.Logger.info ("Total number of atoms read=" + this.ac);
|
||||
this.htParams.put ("templateAtomCount", Integer.$valueOf (this.ac));
|
||||
for (var i = 0; i < this.ac; i++) this.asc.addAtom ( new J.adapter.smarter.Atom ());
|
||||
|
||||
});
|
||||
Clazz.defineMethod (c$, "getAtomTypes",
|
||||
function () {
|
||||
this.$atomTypes = this.getDataBlock ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "getCharges",
|
||||
function () {
|
||||
var data = this.getDataBlock ();
|
||||
if (data.length != this.ac) return;
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = this.ac; --i >= 0; ) atoms[i].partialCharge = this.parseFloatStr (data[i]);
|
||||
|
||||
});
|
||||
Clazz.defineMethod (c$, "getResiduePointers",
|
||||
function () {
|
||||
var resPtrs = this.getDataBlock ();
|
||||
JU.Logger.info ("Total number of residues=" + resPtrs.length);
|
||||
var pt1 = this.ac;
|
||||
var pt2;
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = resPtrs.length; --i >= 0; ) {
|
||||
var ptr = pt2 = this.parseIntStr (resPtrs[i]) - 1;
|
||||
while (ptr < pt1) {
|
||||
if (this.group3s != null) atoms[ptr].group3 = this.group3s[i];
|
||||
atoms[ptr++].sequenceNumber = i + 1;
|
||||
}
|
||||
pt1 = pt2;
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "getResidueLabels",
|
||||
function () {
|
||||
this.group3s = this.getDataBlock ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "getAtomNames",
|
||||
function () {
|
||||
var names = this.getDataBlock ();
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = 0; i < this.ac; i++) atoms[i].atomName = names[i];
|
||||
|
||||
});
|
||||
Clazz.defineMethod (c$, "getMasses",
|
||||
function () {
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,171 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.more");
|
||||
Clazz.load (["J.adapter.readers.more.ForceFieldReader"], "J.adapter.readers.more.Mol2Reader", ["java.lang.Character", "JU.PT", "J.adapter.smarter.Bond"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.nAtoms = 0;
|
||||
this.ac = 0;
|
||||
this.isPDB = false;
|
||||
this.lastSequenceNumber = 2147483647;
|
||||
this.chainID = 64;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.more, "Mol2Reader", J.adapter.readers.more.ForceFieldReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.setUserAtomTypes ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.equals ("@<TRIPOS>MOLECULE")) {
|
||||
if (!this.processMolecule ()) {
|
||||
return true;
|
||||
}this.continuing = !this.isLastModel (this.modelNumber);
|
||||
return false;
|
||||
}if (this.line.length != 0 && this.line.charAt (0) == '#') {
|
||||
this.checkCurrentLineForScript ();
|
||||
}return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "processMolecule",
|
||||
function () {
|
||||
this.isPDB = false;
|
||||
var thisDataSetName = this.rd ().trim ();
|
||||
if (!this.doGetModel (++this.modelNumber, thisDataSetName)) {
|
||||
return false;
|
||||
}this.lastSequenceNumber = 2147483647;
|
||||
this.chainID = 64;
|
||||
this.rd ();
|
||||
this.line += " 0 0 0 0 0 0";
|
||||
this.ac = this.parseIntStr (this.line);
|
||||
var bondCount = this.parseInt ();
|
||||
if (bondCount == 0) this.asc.setNoAutoBond ();
|
||||
var resCount = this.parseInt ();
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
if (this.rd () != null && (this.line.length == 0 || this.line.charAt (0) != '@')) {
|
||||
if (this.rd () != null && this.line.length != 0 && this.line.charAt (0) != '@') {
|
||||
if (this.line.indexOf ("jmolscript:") >= 0) {
|
||||
this.checkCurrentLineForScript ();
|
||||
if (this.line.equals ("#")) {
|
||||
this.line = "";
|
||||
}}if (this.line.length != 0) {
|
||||
thisDataSetName += ": " + this.line.trim ();
|
||||
}}}this.newAtomSet (thisDataSetName);
|
||||
while (this.line != null && !this.line.equals ("@<TRIPOS>MOLECULE")) {
|
||||
if (this.line.equals ("@<TRIPOS>ATOM")) {
|
||||
this.readAtoms (this.ac);
|
||||
this.asc.setAtomSetName (thisDataSetName);
|
||||
} else if (this.line.equals ("@<TRIPOS>BOND")) {
|
||||
this.readBonds (bondCount);
|
||||
} else if (this.line.equals ("@<TRIPOS>SUBSTRUCTURE")) {
|
||||
this.readResInfo (resCount);
|
||||
} else if (this.line.equals ("@<TRIPOS>CRYSIN")) {
|
||||
this.readCrystalInfo ();
|
||||
}this.rd ();
|
||||
}
|
||||
this.nAtoms += this.ac;
|
||||
if (this.isPDB) {
|
||||
this.setIsPDB ();
|
||||
this.setModelPDB (true);
|
||||
}this.applySymmetryAndSetTrajectory ();
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function (ac) {
|
||||
if (ac == 0) return;
|
||||
var i0 = this.asc.ac;
|
||||
for (var i = 0; i < ac; ++i) {
|
||||
var atom = this.asc.addNewAtom ();
|
||||
var tokens = JU.PT.getTokens (this.rd ());
|
||||
var atomType = tokens[5];
|
||||
var name = tokens[1];
|
||||
var pt = atomType.indexOf (".");
|
||||
if (pt >= 0) {
|
||||
atom.elementSymbol = atomType.substring (0, pt);
|
||||
} else {
|
||||
atom.atomName = name;
|
||||
atom.elementSymbol = atom.getElementSymbol ();
|
||||
}atom.atomName = name + '\0' + atomType;
|
||||
atom.set (this.parseFloatStr (tokens[2]), this.parseFloatStr (tokens[3]), this.parseFloatStr (tokens[4]));
|
||||
if (tokens.length > 6) {
|
||||
atom.sequenceNumber = this.parseIntStr (tokens[6]);
|
||||
if (atom.sequenceNumber < this.lastSequenceNumber) {
|
||||
if (this.chainID == 90) this.chainID = 96;
|
||||
this.chainID++;
|
||||
}this.lastSequenceNumber = atom.sequenceNumber;
|
||||
this.setChainID (atom, "" + String.fromCharCode (this.chainID));
|
||||
}if (tokens.length > 7) atom.group3 = tokens[7];
|
||||
if (tokens.length > 8) {
|
||||
atom.partialCharge = this.parseFloatStr (tokens[8]);
|
||||
if (atom.partialCharge == Clazz.floatToInt (atom.partialCharge)) atom.formalCharge = Clazz.floatToInt (atom.partialCharge);
|
||||
}}
|
||||
var atoms = this.asc.atoms;
|
||||
var g3 = atoms[i0].group3;
|
||||
if (g3 == null) return;
|
||||
var isPDB = false;
|
||||
if (!g3.equals ("UNK") && !g3.startsWith ("RES")) {
|
||||
for (var i = this.asc.ac; --i >= i0; ) if (!g3.equals (atoms[this.asc.ac - 1].group3)) {
|
||||
isPDB = true;
|
||||
break;
|
||||
}
|
||||
if (isPDB) {
|
||||
isPDB = false;
|
||||
for (var i = this.asc.ac; --i >= i0; ) {
|
||||
var pt = this.getPDBGroupLength (atoms[i].group3);
|
||||
if (pt == 0 || pt > 3) break;
|
||||
if (this.vwr.getJBR ().isKnownPDBGroup (g3.substring (0, pt), 2147483647)) {
|
||||
isPDB = this.isPDB = true;
|
||||
break;
|
||||
}}
|
||||
}}for (var i = this.asc.ac; --i >= i0; ) {
|
||||
if (isPDB) {
|
||||
g3 = atoms[i].group3;
|
||||
g3 = g3.substring (0, this.getPDBGroupLength (g3));
|
||||
atoms[i].isHetero = this.vwr.getJBR ().isHetero (g3);
|
||||
} else {
|
||||
g3 = null;
|
||||
}atoms[i].group3 = g3;
|
||||
}
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "getPDBGroupLength",
|
||||
function (g3) {
|
||||
var pt0 = g3.length;
|
||||
var pt = pt0;
|
||||
while (--pt > 0 && Character.isDigit (g3.charAt (pt))) {
|
||||
}
|
||||
return ++pt;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "readBonds",
|
||||
function (bondCount) {
|
||||
for (var i = 0; i < bondCount; ++i) {
|
||||
var tokens = JU.PT.getTokens (this.rd ());
|
||||
var atomIndex1 = this.parseIntStr (tokens[1]);
|
||||
var atomIndex2 = this.parseIntStr (tokens[2]);
|
||||
var order = this.parseIntStr (tokens[3]);
|
||||
if (order == -2147483648) order = (tokens[3].equals ("ar") ? 515 : tokens[3].equals ("am") ? 1 : 17);
|
||||
this.asc.addBond ( new J.adapter.smarter.Bond (this.nAtoms + atomIndex1 - 1, this.nAtoms + atomIndex2 - 1, order));
|
||||
}
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "readResInfo",
|
||||
function (resCount) {
|
||||
for (var i = 0; i < resCount; ++i) {
|
||||
this.rd ();
|
||||
}
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "readCrystalInfo",
|
||||
function () {
|
||||
this.rd ();
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length < 6) return;
|
||||
var name = "";
|
||||
for (var i = 6; i < tokens.length; i++) name += " " + tokens[i];
|
||||
|
||||
if (name === "") name = " P1";
|
||||
else name += " *";
|
||||
name = name.substring (1);
|
||||
this.setSpaceGroupName (name);
|
||||
if (this.ignoreFileUnitCell) return;
|
||||
for (var i = 0; i < 6; i++) this.setUnitCellItem (i, this.parseFloatStr (tokens[i]));
|
||||
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = 0; i < this.ac; ++i) this.setAtomCoord (atoms[this.nAtoms + i]);
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.more");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.more.TlsDataOnlyReader", ["java.lang.Float", "java.util.Hashtable", "JU.Lst", "$.P3", "$.PT", "$.SB", "JU.Escape", "$.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.vTlsModels = null;
|
||||
this.sbTlsErrors = null;
|
||||
this.tlsGroupID = 0;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.more, "TlsDataOnlyReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.readTlsData ();
|
||||
this.continuing = false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readTlsData",
|
||||
function () {
|
||||
this.vTlsModels = new JU.Lst ();
|
||||
var tlsGroups;
|
||||
var tlsGroup = null;
|
||||
var ranges = null;
|
||||
var range = null;
|
||||
tlsGroups = new JU.Lst ();
|
||||
while (this.rd () != null) {
|
||||
var tokens = JU.PT.getTokens (this.line.$replace ('\'', ' '));
|
||||
if (tokens.length == 0) continue;
|
||||
if (tokens[0].equals ("TLS")) {
|
||||
tlsGroup = new java.util.Hashtable ();
|
||||
ranges = new JU.Lst ();
|
||||
tlsGroup.put ("ranges", ranges);
|
||||
tlsGroups.addLast (tlsGroup);
|
||||
tlsGroup.put ("id", Integer.$valueOf (++this.tlsGroupID));
|
||||
} else if (tokens[0].equals ("RANGE")) {
|
||||
range = new java.util.Hashtable ();
|
||||
var chain1 = tokens[1].charAt (0);
|
||||
var chain2 = tokens[3].charAt (0);
|
||||
var res1 = JU.PT.parseInt (tokens[2]);
|
||||
var res2 = JU.PT.parseInt (tokens[4]);
|
||||
if (chain1 == chain2) {
|
||||
range.put ("chains", "" + chain1 + chain2);
|
||||
if (res1 <= res2) {
|
||||
range.put ("residues", Clazz.newIntArray (-1, [res1, res2]));
|
||||
ranges.addLast (range);
|
||||
} else {
|
||||
this.tlsAddError (" TLS group residues are not in order (range ignored)");
|
||||
}} else {
|
||||
this.tlsAddError (" TLS group chains are different (range ignored)");
|
||||
}} else if (tokens[0].equals ("ORIGIN")) {
|
||||
var origin = new JU.P3 ();
|
||||
tlsGroup.put ("origin", origin);
|
||||
origin.set (this.parseFloatStr (tokens[1]), this.parseFloatStr (tokens[2]), this.parseFloatStr (tokens[3]));
|
||||
if (Float.isNaN (origin.x) || Float.isNaN (origin.y) || Float.isNaN (origin.z)) {
|
||||
origin.set (NaN, NaN, NaN);
|
||||
this.tlsAddError ("invalid origin: " + this.line);
|
||||
}} else if (tokens[0].equals ("T") || tokens[0].equals ("L") || tokens[0].equals ("S")) {
|
||||
var tensorType = tokens[0].charAt (0);
|
||||
var nn = (tensorType == 'S' ? J.adapter.readers.more.TlsDataOnlyReader.Snn : J.adapter.readers.more.TlsDataOnlyReader.TLnn);
|
||||
var tensor = Clazz.newFloatArray (3, 3, 0);
|
||||
tlsGroup.put ("t" + tensorType, tensor);
|
||||
for (var i = 1; i < tokens.length; i++) {
|
||||
var ti = nn[i].charCodeAt (0) - 49;
|
||||
var tj = nn[i].charCodeAt (1) - 49;
|
||||
tensor[ti][tj] = this.parseFloatStr (tokens[++i]);
|
||||
if (ti < tj) tensor[tj][ti] = tensor[ti][tj];
|
||||
}
|
||||
if (tensorType == 'S') tensor[0][0] = -tensor[0][0];
|
||||
for (var i = 0; i < 3; i++) for (var j = 0; j < 3; j++) if (Float.isNaN (tensor[i][j])) {
|
||||
this.tlsAddError ("invalid tensor: " + JU.Escape.escapeFloatAA (tensor, false));
|
||||
}
|
||||
|
||||
}}
|
||||
JU.Logger.info (this.tlsGroupID + " TLS groups read");
|
||||
var groups = new java.util.Hashtable ();
|
||||
groups.put ("groupCount", Integer.$valueOf (this.tlsGroupID));
|
||||
groups.put ("groups", tlsGroups);
|
||||
this.vTlsModels.addLast (groups);
|
||||
this.htParams.put ("vTlsModels", this.vTlsModels);
|
||||
});
|
||||
Clazz.defineMethod (c$, "tlsAddError",
|
||||
function (error) {
|
||||
if (this.sbTlsErrors == null) this.sbTlsErrors = new JU.SB ();
|
||||
this.sbTlsErrors.append (this.fileName).appendC ('\t').append ("TLS group ").appendI (this.tlsGroupID).appendC ('\t').append (error).appendC ('\n');
|
||||
}, "~S");
|
||||
c$.TLnn = c$.prototype.TLnn = Clazz.newArray (-1, ["11", "22", "33", "12", "13", "23"]);
|
||||
c$.Snn = c$.prototype.Snn = Clazz.newArray (-1, ["22", "11", "12", "13", "23", "21", "31", "32"]);
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.pdb");
|
||||
Clazz.load (["J.adapter.readers.pdb.PdbReader"], "J.adapter.readers.pdb.JmolDataReader", ["java.util.Hashtable", "JU.P3", "JU.Logger", "$.Parser"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.props = null;
|
||||
this.residueNames = null;
|
||||
this.atomNames = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.pdb, "JmolDataReader", J.adapter.readers.pdb.PdbReader);
|
||||
Clazz.overrideMethod (c$, "checkRemark",
|
||||
function () {
|
||||
while (true) {
|
||||
if (this.line.length < 30 || this.line.indexOf ("Jmol") != 11) break;
|
||||
switch ("Ppard".indexOf (this.line.substring (16, 17))) {
|
||||
case 0:
|
||||
this.props = new java.util.Hashtable ();
|
||||
this.asc.setInfo ("jmolData", this.line);
|
||||
if (!this.line.endsWith ("#noautobond")) this.line += "#noautobond";
|
||||
break;
|
||||
case 1:
|
||||
var pt1 = this.line.indexOf ("[");
|
||||
var pt2 = this.line.indexOf ("]");
|
||||
if (pt1 < 25 || pt2 <= pt1) return;
|
||||
var name = this.line.substring (25, pt1).trim ();
|
||||
this.line = this.line.substring (pt1 + 1, pt2).$replace (',', ' ');
|
||||
var tokens = this.getTokens ();
|
||||
JU.Logger.info ("reading " + name + " " + tokens.length);
|
||||
var prop = Clazz.newFloatArray (tokens.length, 0);
|
||||
for (var i = prop.length; --i >= 0; ) prop[i] = this.parseFloatStr (tokens[i]);
|
||||
|
||||
this.props.put (name, prop);
|
||||
break;
|
||||
case 2:
|
||||
this.line = this.line.substring (27);
|
||||
this.atomNames = this.getTokens ();
|
||||
JU.Logger.info ("reading atom names " + this.atomNames.length);
|
||||
break;
|
||||
case 3:
|
||||
this.line = this.line.substring (30);
|
||||
this.residueNames = this.getTokens ();
|
||||
JU.Logger.info ("reading residue names " + this.residueNames.length);
|
||||
break;
|
||||
case 4:
|
||||
JU.Logger.info (this.line);
|
||||
var data = Clazz.newFloatArray (15, 0);
|
||||
JU.Parser.parseStringInfestedFloatArray (this.line.substring (10).$replace ('=', ' ').$replace ('{', ' ').$replace ('}', ' '), null, data);
|
||||
var minXYZ = JU.P3.new3 (data[0], data[1], data[2]);
|
||||
var maxXYZ = JU.P3.new3 (data[3], data[4], data[5]);
|
||||
this.fileScaling = JU.P3.new3 (data[6], data[7], data[8]);
|
||||
this.fileOffset = JU.P3.new3 (data[9], data[10], data[11]);
|
||||
var plotScale = JU.P3.new3 (data[12], data[13], data[14]);
|
||||
if (plotScale.x <= 0) plotScale.x = 100;
|
||||
if (plotScale.y <= 0) plotScale.y = 100;
|
||||
if (plotScale.z <= 0) plotScale.z = 100;
|
||||
if (this.fileScaling.y == 0) this.fileScaling.y = 1;
|
||||
if (this.fileScaling.z == 0) this.fileScaling.z = 1;
|
||||
this.setFractionalCoordinates (true);
|
||||
this.latticeCells = Clazz.newIntArray (3, 0);
|
||||
this.asc.xtalSymmetry = null;
|
||||
this.setUnitCell (plotScale.x * 2 / (maxXYZ.x - minXYZ.x), plotScale.y * 2 / (maxXYZ.y - minXYZ.y), plotScale.z * 2 / (maxXYZ.z == minXYZ.z ? 1 : maxXYZ.z - minXYZ.z), 90, 90, 90);
|
||||
this.unitCellOffset = JU.P3.newP (plotScale);
|
||||
this.unitCellOffset.scale (-1);
|
||||
this.getSymmetry ();
|
||||
this.symmetry.toFractional (this.unitCellOffset, false);
|
||||
this.unitCellOffset.scaleAdd2 (-1.0, minXYZ, this.unitCellOffset);
|
||||
this.symmetry.setOffsetPt (this.unitCellOffset);
|
||||
this.asc.setInfo ("jmolDataScaling", Clazz.newArray (-1, [minXYZ, maxXYZ, plotScale]));
|
||||
this.doApplySymmetry = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.checkCurrentLineForScript ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "setAdditionalAtomParameters",
|
||||
function (atom) {
|
||||
if (this.residueNames != null && atom.index < this.residueNames.length) atom.group3 = this.residueNames[atom.index];
|
||||
if (this.atomNames != null && atom.index < this.atomNames.length) atom.atomName = this.atomNames[atom.index];
|
||||
}, "J.adapter.smarter.Atom");
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
this.asc.setCurrentModelInfo ("jmolDataProperties", this.props);
|
||||
this.finalizeReaderPDB ();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.pdb");
|
||||
Clazz.load (["J.adapter.readers.pdb.PdbReader", "JU.Lst"], "J.adapter.readers.pdb.P2nReader", null, function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.altNames = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.pdb, "P2nReader", J.adapter.readers.pdb.PdbReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.altNames = new JU.Lst ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "setAdditionalAtomParameters",
|
||||
function (atom) {
|
||||
var altName = this.line.substring (69, 72).trim ();
|
||||
if (altName.length == 0) altName = atom.atomName;
|
||||
if (this.useAltNames) atom.atomName = altName;
|
||||
else this.altNames.addLast (altName);
|
||||
}, "J.adapter.smarter.Atom");
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
this.finalizeReaderPDB ();
|
||||
if (!this.useAltNames) this.asc.setCurrentModelInfo ("altName", this.altNames.toArray ( new Array (this.altNames.size ())));
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,15 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.pdb");
|
||||
Clazz.load (["J.adapter.readers.pdb.PdbReader"], "J.adapter.readers.pdb.PqrReader", null, function () {
|
||||
c$ = Clazz.declareType (J.adapter.readers.pdb, "PqrReader", J.adapter.readers.pdb.PdbReader);
|
||||
Clazz.overrideMethod (c$, "setAdditionalAtomParameters",
|
||||
function (atom) {
|
||||
if (this.gromacsWideFormat) {
|
||||
atom.partialCharge = this.parseFloatRange (this.line, 60, 68);
|
||||
atom.radius = J.adapter.readers.pdb.PdbReader.fixRadius (this.parseFloatRange (this.line, 68, 76));
|
||||
} else {
|
||||
var tokens = this.getTokens ();
|
||||
var pt = tokens.length - 2 - (this.line.length > 75 ? 1 : 0);
|
||||
atom.partialCharge = this.parseFloatStr (tokens[pt++]);
|
||||
atom.radius = J.adapter.readers.pdb.PdbReader.fixRadius (this.parseFloatStr (tokens[pt]));
|
||||
}}, "J.adapter.smarter.Atom");
|
||||
});
|
||||
@@ -0,0 +1,259 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.pymol");
|
||||
Clazz.load (null, "J.adapter.readers.pymol.JmolObject", ["java.lang.Float", "JU.P3", "$.PT", "$.SB", "J.adapter.readers.pymol.PyMOLReader", "JU.BSUtil", "$.Escape"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.id = 0;
|
||||
this.bsAtoms = null;
|
||||
this.info = null;
|
||||
this.size = -1;
|
||||
this.colors = null;
|
||||
this.modelIndex = -2147483648;
|
||||
this.jmolName = null;
|
||||
this.argb = 0;
|
||||
this.translucency = 0;
|
||||
this.visible = true;
|
||||
this.rd = null;
|
||||
this.cacheID = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.pymol, "JmolObject");
|
||||
Clazz.makeConstructor (c$,
|
||||
function (id, branchNameID, bsAtoms, info) {
|
||||
this.id = id;
|
||||
this.bsAtoms = bsAtoms;
|
||||
this.info = info;
|
||||
this.jmolName = branchNameID;
|
||||
}, "~N,~S,JU.BS,~O");
|
||||
Clazz.defineMethod (c$, "offset",
|
||||
function (modelOffset, atomOffset) {
|
||||
if (modelOffset > 0) {
|
||||
if (this.modelIndex != -2147483648) this.modelIndex += modelOffset;
|
||||
switch (this.id) {
|
||||
case 1610625028:
|
||||
case 12294:
|
||||
return;
|
||||
case 4115:
|
||||
var i = (this.info).intValue ();
|
||||
if (i >= 0) this.info = Integer.$valueOf (modelOffset + i);
|
||||
return;
|
||||
case 1073742031:
|
||||
var movie = this.info;
|
||||
var frames = movie.get ("frames");
|
||||
for (var j = frames.length; --j >= 0; ) frames[j] += modelOffset;
|
||||
|
||||
return;
|
||||
}
|
||||
}if (atomOffset <= 0) return;
|
||||
if (this.id == 12290) {
|
||||
var map = (this.info).values ();
|
||||
for (var o, $o = map.iterator (); $o.hasNext () && ((o = $o.next ()) || true);) JU.BSUtil.offset (o, 0, atomOffset);
|
||||
|
||||
return;
|
||||
}if (this.bsAtoms != null) JU.BSUtil.offset (this.bsAtoms, 0, atomOffset);
|
||||
if (this.colors != null) {
|
||||
var colixes = this.colors[0];
|
||||
var c = Clazz.newShortArray (colixes.length + atomOffset, 0);
|
||||
System.arraycopy (colixes, 0, c, atomOffset, colixes.length);
|
||||
this.colors[0] = c;
|
||||
}}, "~N,~N");
|
||||
Clazz.defineMethod (c$, "finalizeObject",
|
||||
function (pymolScene, m, mepList, doCache) {
|
||||
var sm = m.sm;
|
||||
var color = "color";
|
||||
var sID;
|
||||
var sb = null;
|
||||
if (this.bsAtoms != null) this.modelIndex = this.getModelIndex (m);
|
||||
switch (this.id) {
|
||||
case 2097194:
|
||||
sm.vwr.displayAtoms (this.bsAtoms, false, false, 1275069441, true);
|
||||
return;
|
||||
case 12295:
|
||||
var bs = sm.vwr.getModelUndeletedAtomsBitSet (this.argb);
|
||||
JU.BSUtil.invertInPlace (bs, sm.vwr.ms.ac);
|
||||
sm.vwr.select (bs, false, 0, true);
|
||||
sm.restrictSelected (false, true);
|
||||
return;
|
||||
case 1610625028:
|
||||
case 12294:
|
||||
if (this.bsAtoms == null) {
|
||||
if (this.info == null) {
|
||||
sm.vwr.displayAtoms (null, true, false, 0, true);
|
||||
}sm.vwr.setObjectProp (this.info, this.id);
|
||||
} else {
|
||||
sm.vwr.displayAtoms (this.bsAtoms, this.id == 1610625028, false, 1275069441, true);
|
||||
}return;
|
||||
case 12290:
|
||||
sm.vwr.defineAtomSets (this.info);
|
||||
return;
|
||||
case 1073742031:
|
||||
sm.vwr.am.setMovie (this.info);
|
||||
return;
|
||||
case 4115:
|
||||
var frame = (this.info).intValue ();
|
||||
if (frame >= 0) {
|
||||
sm.vwr.setCurrentModelIndex (frame);
|
||||
} else {
|
||||
sm.vwr.setAnimationRange (-1, -1);
|
||||
sm.vwr.setCurrentModelIndex (-1);
|
||||
}return;
|
||||
case 1073742139:
|
||||
sm.vwr.stm.saveScene (this.jmolName, this.info);
|
||||
sm.vwr.stm.saveOrientation (this.jmolName, (this.info).get ("pymolView"));
|
||||
return;
|
||||
case 5:
|
||||
sm.loadShape (this.id);
|
||||
sm.setShapePropertyBs (this.id, "pymolLabels", this.info, this.bsAtoms);
|
||||
return;
|
||||
case 1677721602:
|
||||
break;
|
||||
case 659488:
|
||||
case 1:
|
||||
if (this.size != -1) {
|
||||
sm.setShapeSizeBs (1, this.size, null, this.bsAtoms);
|
||||
var bsBonds = (sm.getShapePropertyIndex (1, "sets", 0))[1];
|
||||
pymolScene.setUniqueBonds (bsBonds, this.id == 1);
|
||||
this.size = -1;
|
||||
}this.id = 1;
|
||||
break;
|
||||
case 1140850689:
|
||||
this.id = 0;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
case 10:
|
||||
case 9:
|
||||
sm.loadShape (this.id);
|
||||
var bsCarb = m.getAtoms (2097188, null);
|
||||
JU.BSUtil.andNot (this.bsAtoms, bsCarb);
|
||||
break;
|
||||
case 16:
|
||||
sm.loadShape (this.id);
|
||||
sm.setShapePropertyBs (this.id, "ignore", JU.BSUtil.copyInvert (this.bsAtoms, sm.vwr.ms.ac), null);
|
||||
break;
|
||||
default:
|
||||
if (!this.visible) return;
|
||||
break;
|
||||
}
|
||||
switch (this.id) {
|
||||
case 23:
|
||||
sm.vwr.setCGO (this.info);
|
||||
break;
|
||||
case 16:
|
||||
case 0:
|
||||
case 7:
|
||||
case 20:
|
||||
case 11:
|
||||
case 9:
|
||||
case 10:
|
||||
case 24:
|
||||
if (Clazz.instanceOf (this.info, Array)) {
|
||||
sm.loadShape (this.id);
|
||||
sm.setShapePropertyBs (this.id, "params", this.info, this.bsAtoms);
|
||||
}break;
|
||||
case 6:
|
||||
if (this.modelIndex < 0) return;
|
||||
sm.loadShape (this.id);
|
||||
var md = this.info;
|
||||
md.setModelSet (m);
|
||||
var points = md.points;
|
||||
for (var i = points.size (); --i >= 0; ) (points.get (i)).mi = this.modelIndex;
|
||||
|
||||
sm.setShapePropertyBs (this.id, "measure", md, this.bsAtoms);
|
||||
return;
|
||||
case 135180:
|
||||
sID = (this.bsAtoms == null ? this.info : this.jmolName);
|
||||
if (sm.getShapeIdFromObjectName (sID) >= 0) {
|
||||
sm.vwr.setObjectProp (sID, 1610625028);
|
||||
return;
|
||||
}sb = new JU.SB ();
|
||||
sb.append ("isosurface ID ").append (JU.PT.esc (sID));
|
||||
if (this.modelIndex < 0) this.modelIndex = sm.vwr.am.cmi;
|
||||
if (this.bsAtoms == null) {
|
||||
sb.append (" model ").append (m.getModelNumberDotted (this.modelIndex)).append (" color density sigma 1.0 ").append (JU.PT.esc (this.cacheID)).append (" ").append (JU.PT.esc (sID));
|
||||
if (doCache) sb.append (";isosurface cache");
|
||||
} else {
|
||||
var lighting = (this.info)[0];
|
||||
var only = (this.info)[1];
|
||||
only = " only";
|
||||
var bsCarve = (this.info)[2];
|
||||
var carveDistance = ((this.info)[3]).floatValue ();
|
||||
var resolution = "";
|
||||
if (lighting == null) {
|
||||
lighting = "mesh nofill";
|
||||
resolution = " resolution 1.5";
|
||||
}var haveMep = JU.PT.isOneOf (sID, mepList);
|
||||
var model = m.getModelNumberDotted (this.modelIndex);
|
||||
var ignore = "";
|
||||
var type = (this.size < 0 ? " sasurface " : " solvent ");
|
||||
sb.append (" model ").append (model).append (resolution).append (" select ").append (JU.Escape.eBS (this.bsAtoms)).append (only).append (ignore).append (type).appendF (Math.abs (this.size / 1000));
|
||||
if (!haveMep) {
|
||||
if (this.argb == 0) sb.append (" map property color");
|
||||
else sb.append (";color isosurface ").append (JU.Escape.escapeColor (this.argb));
|
||||
}sb.append (";isosurface frontOnly ").append (lighting);
|
||||
if (this.translucency > 0) sb.append (";color isosurface translucent " + this.translucency);
|
||||
if (bsCarve != null && !bsCarve.isEmpty ()) sb.append (";isosurface slab within " + carveDistance + " {" + model + " and " + JU.Escape.eBS (bsCarve) + "}");
|
||||
if (doCache && !haveMep) sb.append (";isosurface cache");
|
||||
}break;
|
||||
case 1073742016:
|
||||
var mep = this.info;
|
||||
sID = mep.get (mep.size () - 2).toString ();
|
||||
var mapID = mep.get (mep.size () - 1).toString ();
|
||||
var min = J.adapter.readers.pymol.PyMOLReader.floatAt (J.adapter.readers.pymol.PyMOLReader.listAt (mep, 3), 0);
|
||||
var max = J.adapter.readers.pymol.PyMOLReader.floatAt (J.adapter.readers.pymol.PyMOLReader.listAt (mep, 3), 2);
|
||||
sb = new JU.SB ();
|
||||
sb.append (";isosurface ID ").append (JU.PT.esc (sID)).append (" map ").append (JU.PT.esc (this.cacheID)).append (" ").append (JU.PT.esc (mapID)).append (";color isosurface range " + min + " " + max + ";isosurface colorscheme rwb;set isosurfacekey true");
|
||||
if (this.translucency > 0) sb.append (";color isosurface translucent " + this.translucency);
|
||||
if (doCache) sb.append (";isosurface cache");
|
||||
break;
|
||||
case 1073742018:
|
||||
this.modelIndex = sm.vwr.am.cmi;
|
||||
var mesh = this.info;
|
||||
sID = mesh.get (mesh.size () - 2).toString ();
|
||||
sb = new JU.SB ();
|
||||
sb.append ("isosurface ID ").append (JU.PT.esc (sID)).append (" model ").append (m.getModelNumberDotted (this.modelIndex)).append (" color ").append (JU.Escape.escapeColor (this.argb)).append (" ").append (JU.PT.esc (this.cacheID)).append (" ").append (JU.PT.esc (sID)).append (" mesh nofill frontonly");
|
||||
var list = J.adapter.readers.pymol.PyMOLReader.sublistAt (mesh, [2, 0]);
|
||||
var within = J.adapter.readers.pymol.PyMOLReader.floatAt (list, 11);
|
||||
list = J.adapter.readers.pymol.PyMOLReader.listAt (list, 12);
|
||||
if (within > 0) {
|
||||
var pt = new JU.P3 ();
|
||||
sb.append (";isosurface slab within ").appendF (within).append (" [ ");
|
||||
for (var j = list.size () - 3; j >= 0; j -= 3) {
|
||||
J.adapter.readers.pymol.PyMOLReader.pointAt (list, j, pt);
|
||||
sb.append (JU.Escape.eP (pt));
|
||||
}
|
||||
sb.append (" ]");
|
||||
}if (doCache && !JU.PT.isOneOf (sID, mepList)) sb.append (";isosurface cache");
|
||||
sb.append (";set meshScale ").appendI (Clazz.doubleToInt (this.size / 500));
|
||||
break;
|
||||
case 134222850:
|
||||
sb = this.info;
|
||||
break;
|
||||
case 1112152078:
|
||||
sm.loadShape (this.id = 10);
|
||||
sm.setShapePropertyBs (this.id, "putty", this.info, this.bsAtoms);
|
||||
break;
|
||||
}
|
||||
if (sb != null) {
|
||||
sm.vwr.runScriptCautiously (sb.toString ());
|
||||
return;
|
||||
}if (this.size != -1 || this.rd != null) sm.setShapeSizeBs (this.id, this.size, this.rd, this.bsAtoms);
|
||||
if (this.argb != 0) sm.setShapePropertyBs (this.id, color, Integer.$valueOf (this.argb), this.bsAtoms);
|
||||
if (this.translucency > 0) {
|
||||
sm.setShapePropertyBs (this.id, "translucentLevel", Float.$valueOf (this.translucency), this.bsAtoms);
|
||||
sm.setShapePropertyBs (this.id, "translucency", "translucent", this.bsAtoms);
|
||||
} else if (this.colors != null) sm.setShapePropertyBs (this.id, "colors", this.colors, this.bsAtoms);
|
||||
}, "J.adapter.readers.pymol.PyMOLScene,JM.ModelSet,~S,~B");
|
||||
Clazz.defineMethod (c$, "getModelIndex",
|
||||
function (m) {
|
||||
if (this.bsAtoms == null) return -1;
|
||||
var iAtom = this.bsAtoms.nextSetBit (0);
|
||||
if (iAtom >= m.at.length) System.out.println ("PyMOL LOADING ERROR IN MERGE");
|
||||
return (iAtom < 0 ? -1 : m.at[iAtom].mi);
|
||||
}, "JM.ModelSet");
|
||||
Clazz.defineMethod (c$, "setColors",
|
||||
function (colixes, translucency) {
|
||||
this.colors = Clazz.newArray (-1, [colixes, Float.$valueOf (translucency)]);
|
||||
}, "~A,~N");
|
||||
Clazz.defineMethod (c$, "setSize",
|
||||
function (size) {
|
||||
this.size = Clazz.floatToInt (size * 1000);
|
||||
}, "~N");
|
||||
});
|
||||
@@ -0,0 +1,318 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.pymol");
|
||||
Clazz.load (["java.util.Hashtable", "JU.Lst"], "J.adapter.readers.pymol.PickleReader", ["java.lang.Double", "$.Long", "JU.AU", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.vwr = null;
|
||||
this.binaryDoc = null;
|
||||
this.stack = null;
|
||||
this.marks = null;
|
||||
this.build = null;
|
||||
this.memo = null;
|
||||
this.logging = false;
|
||||
this.id = 0;
|
||||
this.markCount = 0;
|
||||
this.filePt = 0;
|
||||
this.emptyListPt = 0;
|
||||
this.thisSection = null;
|
||||
this.inMovie = false;
|
||||
this.inNames = false;
|
||||
this.thisName = null;
|
||||
this.lastMark = 0;
|
||||
this.retrieveCount = 0;
|
||||
this.ipt = 0;
|
||||
this.aTemp = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.pymol, "PickleReader");
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.stack = new JU.Lst ();
|
||||
this.marks = new JU.Lst ();
|
||||
this.build = new JU.Lst ();
|
||||
this.memo = new java.util.Hashtable ();
|
||||
this.aTemp = Clazz.newByteArray (16, 0);
|
||||
});
|
||||
Clazz.makeConstructor (c$,
|
||||
function (doc, vwr) {
|
||||
this.binaryDoc = doc;
|
||||
this.vwr = vwr;
|
||||
this.stack.ensureCapacity (1000);
|
||||
}, "javajs.api.GenericBinaryDocument,JV.Viewer");
|
||||
Clazz.defineMethod (c$, "log",
|
||||
function (s) {
|
||||
this.vwr.log (s + "\0");
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "getMap",
|
||||
function (logging) {
|
||||
this.logging = logging;
|
||||
var b;
|
||||
var i;
|
||||
var mark;
|
||||
var d;
|
||||
var o;
|
||||
var a;
|
||||
var map;
|
||||
var l;
|
||||
this.ipt = 0;
|
||||
var going = true;
|
||||
while (going) {
|
||||
b = this.binaryDoc.readByte ();
|
||||
this.ipt++;
|
||||
switch (b) {
|
||||
case 125:
|
||||
this.push ( new java.util.Hashtable ());
|
||||
break;
|
||||
case 97:
|
||||
o = this.pop ();
|
||||
(this.peek ()).addLast (o);
|
||||
break;
|
||||
case 101:
|
||||
l = this.getObjects (this.getMark ());
|
||||
if (this.inNames && this.markCount == 2) {
|
||||
var pt = this.binaryDoc.getPosition ();
|
||||
var l2 = new JU.Lst ();
|
||||
l2.addLast (Integer.$valueOf (this.filePt));
|
||||
l2.addLast (Integer.$valueOf (pt - this.filePt));
|
||||
l.addLast (l2);
|
||||
}(this.peek ()).addAll (l);
|
||||
break;
|
||||
case 71:
|
||||
d = this.binaryDoc.readDouble ();
|
||||
this.push (Double.$valueOf (d));
|
||||
break;
|
||||
case 74:
|
||||
i = this.binaryDoc.readIntLE ();
|
||||
this.push (Integer.$valueOf (i));
|
||||
break;
|
||||
case 75:
|
||||
i = this.binaryDoc.readByte () & 0xff;
|
||||
this.push (Integer.$valueOf (i));
|
||||
break;
|
||||
case 77:
|
||||
i = (this.binaryDoc.readByte () & 0xff | ((this.binaryDoc.readByte () & 0xff) << 8)) & 0xffff;
|
||||
this.push (Integer.$valueOf (i));
|
||||
break;
|
||||
case 113:
|
||||
i = this.binaryDoc.readByte ();
|
||||
this.putMemo (i, false);
|
||||
break;
|
||||
case 114:
|
||||
i = this.binaryDoc.readIntLE ();
|
||||
this.putMemo (i, true);
|
||||
break;
|
||||
case 104:
|
||||
i = this.binaryDoc.readByte ();
|
||||
o = this.getMemo (i);
|
||||
this.push (o == null ? "BINGET" + (++this.id) : o);
|
||||
break;
|
||||
case 106:
|
||||
i = this.binaryDoc.readIntLE ();
|
||||
o = this.getMemo (i);
|
||||
this.push (o == null ? "LONG_BINGET" + (++this.id) : o);
|
||||
break;
|
||||
case 85:
|
||||
i = this.binaryDoc.readByte () & 0xff;
|
||||
a = Clazz.newByteArray (i, 0);
|
||||
this.binaryDoc.readByteArray (a, 0, i);
|
||||
if (this.inNames && this.markCount == 3 && this.lastMark == this.stack.size ()) {
|
||||
this.thisName = this.bytesToString (a);
|
||||
this.filePt = this.emptyListPt;
|
||||
}this.push (a);
|
||||
break;
|
||||
case 84:
|
||||
i = this.binaryDoc.readIntLE ();
|
||||
a = Clazz.newByteArray (i, 0);
|
||||
this.binaryDoc.readByteArray (a, 0, i);
|
||||
this.push (a);
|
||||
break;
|
||||
case 87:
|
||||
i = this.binaryDoc.readIntLE ();
|
||||
a = Clazz.newByteArray (i, 0);
|
||||
this.binaryDoc.readByteArray (a, 0, i);
|
||||
this.push (a);
|
||||
break;
|
||||
case 93:
|
||||
this.emptyListPt = this.binaryDoc.getPosition () - 1;
|
||||
this.push ( new JU.Lst ());
|
||||
break;
|
||||
case 99:
|
||||
l = new JU.Lst ();
|
||||
l.addLast ("global");
|
||||
l.addLast (this.readStringAsBytes ());
|
||||
l.addLast (this.readStringAsBytes ());
|
||||
this.push (l);
|
||||
break;
|
||||
case 98:
|
||||
o = this.pop ();
|
||||
this.build.addLast (o);
|
||||
break;
|
||||
case 40:
|
||||
this.putMark (this.stack.size ());
|
||||
break;
|
||||
case 78:
|
||||
this.push (null);
|
||||
break;
|
||||
case 111:
|
||||
this.push (this.getObjects (this.getMark ()));
|
||||
break;
|
||||
case 115:
|
||||
o = this.pop ();
|
||||
var s = this.bytesToString (this.pop ());
|
||||
(this.peek ()).put (s, o);
|
||||
break;
|
||||
case 117:
|
||||
mark = this.getMark ();
|
||||
l = this.getObjects (mark);
|
||||
o = this.peek ();
|
||||
if (Clazz.instanceOf (o, JU.Lst)) {
|
||||
for (i = 0; i < l.size (); i++) (o).addLast (l.get (i));
|
||||
|
||||
} else {
|
||||
map = o;
|
||||
for (i = l.size (); --i >= 0; ) {
|
||||
o = l.get (i);
|
||||
map.put (this.bytesToString (l.get (--i)), o);
|
||||
}
|
||||
}break;
|
||||
case 46:
|
||||
going = false;
|
||||
break;
|
||||
case 116:
|
||||
this.push (this.getObjects (this.getMark ()));
|
||||
break;
|
||||
case 73:
|
||||
s = this.bytesToString (this.readStringAsBytes ());
|
||||
try {
|
||||
this.push (Integer.$valueOf (Integer.parseInt (s)));
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
var ll = Long.parseLong (s);
|
||||
this.push (Integer.$valueOf ((ll & 0xFFFFFFFF)));
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
JU.Logger.error ("Pickle reader error: " + b + " " + this.binaryDoc.getPosition ());
|
||||
}
|
||||
}
|
||||
if (logging) this.log ("");
|
||||
JU.Logger.info ("PyMOL Pickle reader cached " + this.memo.size () + " tokens; retrieved " + this.retrieveCount);
|
||||
map = this.stack.removeItemAt (0);
|
||||
if (map.size () == 0) for (i = this.stack.size (); --i >= 0; ) {
|
||||
o = this.stack.get (i--);
|
||||
a = this.stack.get (i);
|
||||
map.put (this.bytesToString (a), o);
|
||||
}
|
||||
this.memo = null;
|
||||
return map;
|
||||
}, "~B");
|
||||
Clazz.defineMethod (c$, "bytesToString",
|
||||
function (o) {
|
||||
try {
|
||||
return (JU.AU.isAB (o) ? String.instantialize (o, "UTF-8") : o.toString ());
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, java.io.UnsupportedEncodingException)) {
|
||||
return "";
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}, "~O");
|
||||
Clazz.defineMethod (c$, "putMemo",
|
||||
function (i, doCheck) {
|
||||
var o = this.peek ();
|
||||
if (JU.AU.isAB (o)) o = this.bytesToString (o);
|
||||
if (Clazz.instanceOf (o, String)) {
|
||||
if (doCheck && this.markCount >= 6 || this.markCount == 3 && this.inMovie) return;
|
||||
this.memo.put (Integer.$valueOf (i), o);
|
||||
}}, "~N,~B");
|
||||
Clazz.defineMethod (c$, "getMemo",
|
||||
function (i) {
|
||||
var o = this.memo.get (Integer.$valueOf (i));
|
||||
if (o == null) return o;
|
||||
this.retrieveCount++;
|
||||
return o;
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "getObjects",
|
||||
function (mark) {
|
||||
var n = this.stack.size () - mark;
|
||||
var args = new JU.Lst ();
|
||||
args.ensureCapacity (n);
|
||||
for (var i = mark; i < this.stack.size (); ++i) args.addLast (this.stack.get (i));
|
||||
|
||||
for (var i = this.stack.size (); --i >= mark; ) this.stack.removeItemAt (i);
|
||||
|
||||
return args;
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "readStringAsBytes",
|
||||
function () {
|
||||
var n = 0;
|
||||
var a = this.aTemp;
|
||||
while (true) {
|
||||
var b = this.binaryDoc.readByte ();
|
||||
if (b == 0xA) break;
|
||||
if (n >= a.length) a = this.aTemp = JU.AU.arrayCopyByte (a, a.length * 2);
|
||||
a[n++] = b;
|
||||
}
|
||||
return JU.AU.arrayCopyByte (a, n);
|
||||
});
|
||||
Clazz.defineMethod (c$, "putMark",
|
||||
function (i) {
|
||||
if (this.logging) this.log ("\n " + Integer.toHexString (this.binaryDoc.getPosition ()) + " [");
|
||||
this.marks.addLast (Integer.$valueOf (this.lastMark = i));
|
||||
this.markCount++;
|
||||
switch (this.markCount) {
|
||||
case 2:
|
||||
var o = this.stack.get (i - 2);
|
||||
if (JU.AU.isAB (o)) {
|
||||
this.thisSection = this.bytesToString (o);
|
||||
this.inMovie = "movie".equals (this.thisSection);
|
||||
this.inNames = "names".equals (this.thisSection);
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "getMark",
|
||||
function () {
|
||||
return this.marks.removeItemAt (--this.markCount).intValue ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "push",
|
||||
function (o) {
|
||||
if (this.logging && (Clazz.instanceOf (o, String) || Clazz.instanceOf (o, Double) || Clazz.instanceOf (o, Integer))) this.log ((Clazz.instanceOf (o, String) ? "'" + o + "'" : o) + ", ");
|
||||
this.stack.addLast (o);
|
||||
}, "~O");
|
||||
Clazz.defineMethod (c$, "peek",
|
||||
function () {
|
||||
return this.stack.get (this.stack.size () - 1);
|
||||
});
|
||||
Clazz.defineMethod (c$, "pop",
|
||||
function () {
|
||||
return this.stack.removeItemAt (this.stack.size () - 1);
|
||||
});
|
||||
Clazz.defineStatics (c$,
|
||||
"APPEND", 97,
|
||||
"APPENDS", 101,
|
||||
"BINFLOAT", 71,
|
||||
"BININT", 74,
|
||||
"BININT1", 75,
|
||||
"BININT2", 77,
|
||||
"BINPUT", 113,
|
||||
"BINSTRING", 84,
|
||||
"BINUNICODE", 87,
|
||||
"BUILD", 98,
|
||||
"EMPTY_DICT", 125,
|
||||
"EMPTY_LIST", 93,
|
||||
"GLOBAL", 99,
|
||||
"LONG_BINPUT", 114,
|
||||
"MARK", 40,
|
||||
"NONE", 78,
|
||||
"OBJ", 111,
|
||||
"SETITEM", 115,
|
||||
"SETITEMS", 117,
|
||||
"SHORT_BINSTRING", 85,
|
||||
"STOP", 46,
|
||||
"BINGET", 104,
|
||||
"LONG_BINGET", 106,
|
||||
"TUPLE", 116,
|
||||
"INT", 73);
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,44 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.pymol");
|
||||
Clazz.load (["java.util.Hashtable", "JU.BS"], "J.adapter.readers.pymol.PyMOLGroup", null, function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.name = null;
|
||||
this.objectNameID = null;
|
||||
this.list = null;
|
||||
this.object = null;
|
||||
this.visible = true;
|
||||
this.occluded = false;
|
||||
this.bsAtoms = null;
|
||||
this.firstAtom = 0;
|
||||
this.type = 0;
|
||||
this.parent = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.pymol, "PyMOLGroup");
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.list = new java.util.Hashtable ();
|
||||
this.bsAtoms = new JU.BS ();
|
||||
});
|
||||
Clazz.makeConstructor (c$,
|
||||
function (name) {
|
||||
this.name = name;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "addList",
|
||||
function (child) {
|
||||
var group = this.list.get (child.name);
|
||||
if (group != null) return;
|
||||
this.list.put (child.name, child);
|
||||
child.parent = this;
|
||||
}, "J.adapter.readers.pymol.PyMOLGroup");
|
||||
Clazz.defineMethod (c$, "set",
|
||||
function () {
|
||||
if (this.parent != null) return;
|
||||
});
|
||||
Clazz.defineMethod (c$, "addGroupAtoms",
|
||||
function (bs) {
|
||||
this.bsAtoms.or (bs);
|
||||
if (this.parent != null) this.parent.addGroupAtoms (this.bsAtoms);
|
||||
}, "JU.BS");
|
||||
Clazz.overrideMethod (c$, "toString",
|
||||
function () {
|
||||
return this.name;
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,250 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.SlaterReader"], "J.adapter.readers.quantum.AdfReader", ["java.lang.Float", "java.util.Hashtable", "JU.AU", "$.Lst", "$.PT", "J.api.JmolAdapter", "J.quantum.SlaterData", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.htSymmetries = null;
|
||||
this.vSymmetries = null;
|
||||
this.energy = null;
|
||||
this.nXX = 0;
|
||||
this.symLine = null;
|
||||
if (!Clazz.isClassDefined ("J.adapter.readers.quantum.AdfReader.SymmetryData")) {
|
||||
J.adapter.readers.quantum.AdfReader.$AdfReader$SymmetryData$ ();
|
||||
}
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "AdfReader", J.adapter.readers.quantum.SlaterReader);
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.indexOf ("Irreducible Representations, including subspecies") >= 0) {
|
||||
this.readSymmetries ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("S F O s *** (Symmetrized Fragment Orbitals) ***") >= 0) {
|
||||
this.readSlaterBasis ();
|
||||
return true;
|
||||
}if (this.line.indexOf (" Coordinates (Cartesian, in Input Orientation)") >= 0 || this.line.indexOf ("G E O M E T R Y ***") >= 0) {
|
||||
if (!this.doGetModel (++this.modelNumber, null)) return this.checkLastModel ();
|
||||
this.readCoordinates ();
|
||||
return true;
|
||||
}if (this.line.indexOf (" ====== Eigenvectors (rows) in BAS representation") >= 0) {
|
||||
if (this.doReadMolecularOrbitals) this.readMolecularOrbitals (JU.PT.getTokens (this.symLine)[1]);
|
||||
return true;
|
||||
}if (!this.doProcessLines) return true;
|
||||
if (this.line.indexOf ("Energy:") >= 0) {
|
||||
var tokens = JU.PT.getTokens (this.line.substring (this.line.indexOf ("Energy:")));
|
||||
this.energy = tokens[1];
|
||||
return true;
|
||||
}if (this.line.indexOf ("Vibrations") >= 0) {
|
||||
this.readFrequencies ();
|
||||
return true;
|
||||
}if (this.line.indexOf (" === ") >= 0) {
|
||||
this.symLine = this.line;
|
||||
return true;
|
||||
}if (this.line.indexOf (" ====== Eigenvectors (rows) in BAS representation") >= 0) {
|
||||
this.readMolecularOrbitals (JU.PT.getTokens (this.symLine)[1]);
|
||||
return true;
|
||||
}return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readCoordinates",
|
||||
function () {
|
||||
var isGeometry = (this.line.indexOf ("G E O M E T R Y") >= 0);
|
||||
this.asc.newAtomSet ();
|
||||
this.asc.setAtomSetName ("" + this.energy);
|
||||
this.discardLinesUntilContains ("----");
|
||||
var pt0 = (isGeometry ? 2 : 5);
|
||||
this.nXX = 0;
|
||||
var tokens;
|
||||
while (this.rd () != null && !this.line.startsWith (" -----")) {
|
||||
tokens = this.getTokens ();
|
||||
if (tokens.length < 5) break;
|
||||
var symbol = tokens[1];
|
||||
var name = null;
|
||||
if (symbol.indexOf (".") >= 0) {
|
||||
name = symbol;
|
||||
symbol = symbol.substring (0, symbol.indexOf ("."));
|
||||
}if (J.api.JmolAdapter.getElementNumber (symbol) < 1) this.nXX++;
|
||||
else this.addAtomXYZSymName (tokens, pt0, symbol, name);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readFrequencies",
|
||||
function () {
|
||||
this.rd ();
|
||||
while (this.rd () != null) {
|
||||
while (this.rd () != null && this.line.indexOf (".") < 0 && this.line.indexOf ("====") < 0) {
|
||||
}
|
||||
if (this.line == null || this.line.indexOf (".") < 0) return;
|
||||
var frequencies = this.getTokens ();
|
||||
this.rd ();
|
||||
var iAtom0 = this.asc.ac;
|
||||
var ac = this.asc.getLastAtomSetAtomCount ();
|
||||
var frequencyCount = frequencies.length;
|
||||
var ignore = Clazz.newBooleanArray (frequencyCount, false);
|
||||
for (var i = 0; i < frequencyCount; ++i) {
|
||||
ignore[i] = !this.doGetVibration (++this.vibrationNumber);
|
||||
if (ignore[i]) continue;
|
||||
this.asc.cloneLastAtomSet ();
|
||||
this.asc.setAtomSetFrequency (null, null, frequencies[i], null);
|
||||
}
|
||||
this.readLines (this.nXX);
|
||||
this.fillFrequencyData (iAtom0, ac, ac, ignore, true, 0, 0, null, 0);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readSymmetries",
|
||||
function () {
|
||||
this.vSymmetries = new JU.Lst ();
|
||||
this.htSymmetries = new java.util.Hashtable ();
|
||||
this.rd ();
|
||||
var index = 0;
|
||||
var syms = "";
|
||||
while (this.rd () != null && this.line.length > 1) syms += this.line;
|
||||
|
||||
var tokens = JU.PT.getTokens (syms);
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var sd = Clazz.innerTypeInstance (J.adapter.readers.quantum.AdfReader.SymmetryData, this, null, index++, tokens[i]);
|
||||
this.htSymmetries.put (tokens[i], sd);
|
||||
this.vSymmetries.addLast (sd);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readSlaterBasis",
|
||||
function () {
|
||||
if (this.vSymmetries == null) return;
|
||||
var nBF = 0;
|
||||
for (var i = 0; i < this.vSymmetries.size (); i++) {
|
||||
var sd = this.vSymmetries.get (i);
|
||||
JU.Logger.info (sd.sym);
|
||||
this.discardLinesUntilContains ("=== " + sd.sym + " ===");
|
||||
if (this.line == null) {
|
||||
JU.Logger.error ("Symmetry slater basis section not found: " + sd.sym);
|
||||
return;
|
||||
}sd.nSFO = this.parseIntAt (this.rd (), 15);
|
||||
sd.nBF = this.parseIntAt (this.rd (), 75);
|
||||
var funcList = "";
|
||||
while (this.rd () != null && this.line.length > 1) funcList += this.line;
|
||||
|
||||
var tokens = JU.PT.getTokens (funcList);
|
||||
if (tokens.length != sd.nBF) return;
|
||||
sd.basisFunctions = Clazz.newIntArray (tokens.length, 0);
|
||||
for (var j = tokens.length; --j >= 0; ) {
|
||||
var n = this.parseIntStr (tokens[j]);
|
||||
if (n > nBF) nBF = n;
|
||||
sd.basisFunctions[j] = n - 1;
|
||||
}
|
||||
}
|
||||
this.slaterArray = new Array (nBF);
|
||||
this.discardLinesUntilContains ("(power of)");
|
||||
this.readLines (2);
|
||||
while (this.rd () != null && this.line.length > 3 && this.line.charAt (3) == ' ') {
|
||||
var data = this.line;
|
||||
while (this.rd ().indexOf ("---") < 0) data += this.line;
|
||||
|
||||
var tokens = JU.PT.getTokens (data);
|
||||
var nAtoms = tokens.length - 1;
|
||||
var atomList = Clazz.newIntArray (nAtoms, 0);
|
||||
for (var i = 1; i <= nAtoms; i++) atomList[i - 1] = this.parseIntStr (tokens[i]) - 1;
|
||||
|
||||
this.rd ();
|
||||
while (this.line.length >= 10) {
|
||||
data = this.line;
|
||||
while (this.rd ().length > 35 && this.line.substring (0, 35).trim ().length == 0) data += this.line;
|
||||
|
||||
tokens = JU.PT.getTokens (data);
|
||||
var isCore = tokens[0].equals ("Core");
|
||||
var pt = (isCore ? 1 : 0);
|
||||
var x = this.parseIntStr (tokens[pt++]);
|
||||
var y = this.parseIntStr (tokens[pt++]);
|
||||
var z = this.parseIntStr (tokens[pt++]);
|
||||
var r = this.parseIntStr (tokens[pt++]);
|
||||
var zeta = this.parseFloatStr (tokens[pt++]);
|
||||
for (var i = 0; i < nAtoms; i++) {
|
||||
var ptBF = this.parseIntStr (tokens[pt++]) - 1;
|
||||
this.slaterArray[ptBF] = new J.quantum.SlaterData (atomList[i], x, y, z, r, zeta, 1);
|
||||
this.slaterArray[ptBF].index = ptBF;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolecularOrbitals",
|
||||
function (sym) {
|
||||
var sd = this.htSymmetries.get (sym);
|
||||
if (sd == null) return;
|
||||
var ptSym = sd.index;
|
||||
var isLast = (ptSym == this.vSymmetries.size () - 1);
|
||||
var n = 0;
|
||||
var nBF = this.slaterArray.length;
|
||||
sd.coefs = Clazz.newFloatArray (sd.nSFO, nBF, 0);
|
||||
while (n < sd.nBF) {
|
||||
this.rd ();
|
||||
var nLine = JU.PT.getTokens (this.rd ()).length;
|
||||
this.rd ();
|
||||
sd.mos = JU.AU.createArrayOfHashtable (sd.nSFO);
|
||||
var data = new Array (sd.nSFO);
|
||||
this.fillDataBlock (data, 0);
|
||||
for (var j = 1; j < nLine; j++) {
|
||||
var pt = sd.basisFunctions[n++];
|
||||
for (var i = 0; i < sd.nSFO; i++) sd.coefs[i][pt] = this.parseFloatStr (data[i][j]);
|
||||
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < sd.nSFO; i++) {
|
||||
var mo = new java.util.Hashtable ();
|
||||
mo.put ("coefficients", sd.coefs[i]);
|
||||
mo.put ("id", sym + " " + (i + 1));
|
||||
sd.mos[i] = mo;
|
||||
}
|
||||
if (!isLast) return;
|
||||
var nSym = this.htSymmetries.size ();
|
||||
this.discardLinesUntilContains (nSym == 1 ? "Orbital Energies, per Irrep" : "Orbital Energies, all Irreps");
|
||||
this.readLines (4);
|
||||
var pt = (nSym == 1 ? 0 : 1);
|
||||
if (nSym == 1) sym = this.rd ().trim ();
|
||||
while (this.rd () != null && this.line.length > 10) {
|
||||
this.line = this.line.$replace ('(', ' ').$replace (')', ' ');
|
||||
var tokens = this.getTokens ();
|
||||
var len = tokens.length;
|
||||
if (nSym > 1) sym = tokens[0];
|
||||
var moPt = this.parseIntStr (tokens[pt]);
|
||||
var occ = this.parseFloatStr (tokens[len - 4 + pt]);
|
||||
var energy = this.parseFloatStr (tokens[len - 2 + pt]);
|
||||
this.addMo (sym, moPt, occ, energy);
|
||||
}
|
||||
var iAtom0 = this.asc.getLastAtomSetAtomIndex ();
|
||||
for (var i = 0; i < nBF; i++) this.slaterArray[i].atomNo += iAtom0 + 1;
|
||||
|
||||
this.setSlaters (true, true);
|
||||
this.sortOrbitals ();
|
||||
this.setMOs ("eV");
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "addMo",
|
||||
function (sym, moPt, occ, energy) {
|
||||
var sd = this.htSymmetries.get (sym);
|
||||
if (sd == null) {
|
||||
for (var entry, $entry = this.htSymmetries.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) if (entry.getKey ().startsWith (sym + ":")) {
|
||||
sd = entry.getValue ();
|
||||
break;
|
||||
}
|
||||
if (sd == null) return;
|
||||
}var mo = sd.mos[moPt - 1];
|
||||
mo.put ("occupancy", Float.$valueOf (occ > 2 ? 2 : occ));
|
||||
mo.put ("energy", Float.$valueOf (energy));
|
||||
mo.put ("symmetry", sd.sym + "_" + moPt);
|
||||
this.setMO (mo);
|
||||
}, "~S,~N,~N,~N");
|
||||
c$.$AdfReader$SymmetryData$ = function () {
|
||||
Clazz.pu$h(self.c$);
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
Clazz.prepareCallback (this, arguments);
|
||||
this.index = 0;
|
||||
this.sym = null;
|
||||
this.nSFO = 0;
|
||||
this.nBF = 0;
|
||||
this.coefs = null;
|
||||
this.mos = null;
|
||||
this.basisFunctions = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum.AdfReader, "SymmetryData");
|
||||
Clazz.makeConstructor (c$,
|
||||
function (a, b) {
|
||||
JU.Logger.info ("ADF reader creating SymmetryData " + b + " " + a);
|
||||
this.index = a;
|
||||
this.sym = b;
|
||||
}, "~N,~S");
|
||||
c$ = Clazz.p0p ();
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,130 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader", "java.util.Hashtable", "JU.Lst"], "J.adapter.readers.quantum.BasisFunctionReader", ["java.util.Arrays", "JU.PT", "J.quantum.QS", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.shells = null;
|
||||
this.moData = null;
|
||||
this.orbitals = null;
|
||||
this.nOrbitals = 0;
|
||||
this.ignoreMOs = false;
|
||||
this.alphaBeta = "";
|
||||
this.dfCoefMaps = null;
|
||||
this.filterTokens = null;
|
||||
this.filterIsNot = false;
|
||||
this.spin = null;
|
||||
if (!Clazz.isClassDefined ("J.adapter.readers.quantum.BasisFunctionReader.MOEnergySorter")) {
|
||||
J.adapter.readers.quantum.BasisFunctionReader.$BasisFunctionReader$MOEnergySorter$ ();
|
||||
}
|
||||
this.orbitalMaps = null;
|
||||
this.nCoef = 0;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "BasisFunctionReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.moData = new java.util.Hashtable ();
|
||||
this.orbitals = new JU.Lst ();
|
||||
this.orbitalMaps = new java.util.Hashtable ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "filterMO",
|
||||
function () {
|
||||
var isHeader = (this.line.indexOf ('\n') == 0);
|
||||
if (!isHeader && !this.doReadMolecularOrbitals) return false;
|
||||
var isOK = true;
|
||||
this.line += " " + this.alphaBeta;
|
||||
var ucline = this.line.toUpperCase ();
|
||||
if (this.filter != null) {
|
||||
var nOK = 0;
|
||||
if (this.filterTokens == null) {
|
||||
this.filterIsNot = (this.filter.indexOf ("!") >= 0);
|
||||
this.filterTokens = JU.PT.getTokens (this.filter.$replace ('!', ' ').$replace (',', ' ').$replace (';', ' '));
|
||||
}for (var i = 0; i < this.filterTokens.length; i++) if (ucline.indexOf (this.filterTokens[i]) >= 0) {
|
||||
if (!this.filterIsNot) {
|
||||
nOK = this.filterTokens.length;
|
||||
break;
|
||||
}} else if (this.filterIsNot) {
|
||||
nOK++;
|
||||
}
|
||||
isOK = (nOK == this.filterTokens.length);
|
||||
if (!isHeader) JU.Logger.info ("filter MOs: " + isOK + " for \"" + this.line + "\"");
|
||||
}this.spin = (ucline.indexOf ("ALPHA") >= 0 ? "alpha" : ucline.indexOf ("BETA") >= 0 ? "beta" : null);
|
||||
return isOK;
|
||||
});
|
||||
Clazz.defineMethod (c$, "setMO",
|
||||
function (mo) {
|
||||
if (this.dfCoefMaps != null) mo.put ("dfCoefMaps", this.dfCoefMaps);
|
||||
this.orbitals.addLast (mo);
|
||||
mo.put ("index", Integer.$valueOf (this.orbitals.size ()));
|
||||
if (this.spin != null) mo.put ("spin", this.spin);
|
||||
}, "java.util.Map");
|
||||
Clazz.defineMethod (c$, "getDFMap",
|
||||
function (shell, fileList, shellType, jmolList, minLength) {
|
||||
this.orbitalMaps.put (shell, fileList);
|
||||
this.moData.put ("orbitalMaps", this.orbitalMaps);
|
||||
if (fileList.equals (jmolList)) return true;
|
||||
this.getDfCoefMaps ();
|
||||
var isOK = J.quantum.QS.createDFMap (this.dfCoefMaps[shellType], fileList, jmolList, minLength);
|
||||
if (!isOK) JU.Logger.error ("Disabling orbitals of type " + shellType + " -- Cannot read orbital order for: " + fileList + "\n expecting: " + jmolList);
|
||||
return isOK;
|
||||
}, "~S,~S,~N,~S,~N");
|
||||
Clazz.defineMethod (c$, "getDfCoefMaps",
|
||||
function () {
|
||||
return (this.dfCoefMaps == null ? (this.dfCoefMaps = J.quantum.QS.getNewDfCoefMap ()) : this.dfCoefMaps);
|
||||
});
|
||||
c$.canonicalizeQuantumSubshellTag = Clazz.defineMethod (c$, "canonicalizeQuantumSubshellTag",
|
||||
function (tag) {
|
||||
var firstChar = tag.charAt (0);
|
||||
if (firstChar == 'X' || firstChar == 'Y' || firstChar == 'Z') {
|
||||
var sorted = tag.toCharArray ();
|
||||
java.util.Arrays.sort (sorted);
|
||||
return String.instantialize (sorted);
|
||||
}return tag;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "fixSlaterTypes",
|
||||
function (typeOld, typeNew) {
|
||||
if (this.shells == null) return 0;
|
||||
this.nCoef = 0;
|
||||
for (var i = this.shells.size (); --i >= 0; ) {
|
||||
var slater = this.shells.get (i);
|
||||
if (slater[1] == typeOld) slater[1] = typeNew;
|
||||
var m = this.getDfCoefMaps ()[slater[1]].length;
|
||||
this.nCoef += m;
|
||||
}
|
||||
return this.nCoef;
|
||||
}, "~N,~N");
|
||||
c$.getQuantumShellTagIDSpherical = Clazz.defineMethod (c$, "getQuantumShellTagIDSpherical",
|
||||
function (tag) {
|
||||
return J.quantum.QS.getQuantumShellTagIDSpherical (tag);
|
||||
}, "~S");
|
||||
c$.getQuantumShellTagID = Clazz.defineMethod (c$, "getQuantumShellTagID",
|
||||
function (tag) {
|
||||
return J.quantum.QS.getQuantumShellTagID (tag);
|
||||
}, "~S");
|
||||
c$.getQuantumShellTag = Clazz.defineMethod (c$, "getQuantumShellTag",
|
||||
function (id) {
|
||||
return J.quantum.QS.getQuantumShellTag (id);
|
||||
}, "~N");
|
||||
Clazz.overrideMethod (c$, "discardPreviousAtoms",
|
||||
function () {
|
||||
this.asc.discardPreviousAtoms ();
|
||||
this.moData.remove ("mos");
|
||||
this.orbitals.clear ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "clearOrbitals",
|
||||
function () {
|
||||
this.orbitals = new JU.Lst ();
|
||||
this.moData = new java.util.Hashtable ();
|
||||
this.alphaBeta = "";
|
||||
});
|
||||
c$.$BasisFunctionReader$MOEnergySorter$ = function () {
|
||||
Clazz.pu$h(self.c$);
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
Clazz.prepareCallback (this, arguments);
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum.BasisFunctionReader, "MOEnergySorter", null, java.util.Comparator);
|
||||
Clazz.overrideMethod (c$, "compare",
|
||||
function (a, b) {
|
||||
var c = ((a).get ("energy")).floatValue ();
|
||||
var d = ((b).get ("energy")).floatValue ();
|
||||
return (c < d ? -1 : c > d ? 1 : 0);
|
||||
}, "~O,~O");
|
||||
c$ = Clazz.p0p ();
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,437 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.MopacSlaterReader", "java.util.Hashtable"], "J.adapter.readers.quantum.CsfReader", ["java.lang.Float", "JU.AU", "$.Lst", "$.PT", "J.adapter.readers.quantum.BasisFunctionReader", "J.adapter.smarter.Atom", "$.Bond", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.nAtoms = 0;
|
||||
this.strAtomicNumbers = "";
|
||||
this.fieldCount = 0;
|
||||
this.nVibrations = 0;
|
||||
this.nGaussians = 0;
|
||||
this.nSlaters = 0;
|
||||
this.htBonds = null;
|
||||
this.propertyItemCounts = null;
|
||||
this.fieldTypes = null;
|
||||
this.connectors = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "CsfReader", J.adapter.readers.quantum.MopacSlaterReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.propertyItemCounts = new java.util.Hashtable ();
|
||||
this.fieldTypes = Clazz.newIntArray (100, 0);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.equals ("local_transform")) {
|
||||
this.processLocalTransform ();
|
||||
return true;
|
||||
}if (this.line.startsWith ("object_class")) {
|
||||
if (this.line.equals ("object_class connector")) {
|
||||
this.processConnectorObject ();
|
||||
return false;
|
||||
}if (this.line.equals ("object_class atom")) {
|
||||
this.processAtomObject ();
|
||||
return false;
|
||||
}if (this.line.equals ("object_class bond")) {
|
||||
this.processBondObject ();
|
||||
return false;
|
||||
}if (this.line.equals ("object_class vibrational_level")) {
|
||||
this.processVibrationObject ();
|
||||
return false;
|
||||
}if (this.line.equals ("object_class mol_orbital")) {
|
||||
this.processMolecularOrbitalObject ();
|
||||
return false;
|
||||
}if (this.line.equals ("object_class sto_basis_fxn")) {
|
||||
this.processBasisObject ("sto");
|
||||
return false;
|
||||
}if (this.line.equals ("object_class gto_basis_fxn")) {
|
||||
this.processBasisObject ("gto");
|
||||
return false;
|
||||
}}return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "processLocalTransform",
|
||||
function () {
|
||||
var tokens = JU.PT.getTokens (this.rd () + " " + this.rd () + " " + this.rd () + " " + this.rd ());
|
||||
this.setTransform (this.parseFloatStr (tokens[0]), this.parseFloatStr (tokens[1]), this.parseFloatStr (tokens[2]), this.parseFloatStr (tokens[4]), this.parseFloatStr (tokens[5]), this.parseFloatStr (tokens[6]), this.parseFloatStr (tokens[8]), this.parseFloatStr (tokens[9]), this.parseFloatStr (tokens[10]));
|
||||
});
|
||||
Clazz.defineMethod (c$, "getPropertyCount",
|
||||
function (what) {
|
||||
var count = this.propertyItemCounts.get (what);
|
||||
return (what.equals ("ID") ? 1 : count == null ? 0 : count.intValue ());
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "parseLineParameters",
|
||||
function (fields, fieldMap) {
|
||||
for (var i = 0; i < this.fieldCount; i++) this.fieldTypes[i] = 0;
|
||||
|
||||
this.fieldCount = -1;
|
||||
if (this.line == null || this.line.startsWith ("property_flags:")) this.rd ();
|
||||
if (this.line == null || this.line.startsWith ("object_class")) return this.fieldCount;
|
||||
var tokens = new Array (0);
|
||||
while (this.line != null) {
|
||||
tokens = this.getTokens ();
|
||||
if (this.line.indexOf ("property ") == 0) this.propertyItemCounts.put (tokens[1], Integer.$valueOf ((tokens[6].equals ("STRING") ? 1 : this.parseIntStr (tokens[5]))));
|
||||
else if (this.line.indexOf ("ID") == 0) break;
|
||||
this.rd ();
|
||||
}
|
||||
for (var ipt = 0, fpt = 0; ipt < tokens.length; ipt++) {
|
||||
var field = tokens[ipt];
|
||||
for (var i = fields.length; --i >= 0; ) if (field.equals (fields[i])) {
|
||||
this.fieldTypes[fpt] = fieldMap[i];
|
||||
this.fieldCount = fpt + 1;
|
||||
break;
|
||||
}
|
||||
fpt += this.getPropertyCount (field);
|
||||
}
|
||||
return this.fieldCount;
|
||||
}, "~A,~A");
|
||||
Clazz.defineMethod (c$, "fillCsfArray",
|
||||
function (property, tokens, i0, f, isInteger) {
|
||||
var n = this.getPropertyCount (property);
|
||||
var ioffset = i0;
|
||||
for (var i = 0; i < n; i++) {
|
||||
var ipt = ioffset + i;
|
||||
if (ipt == tokens.length) {
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
ioffset -= ipt - i0;
|
||||
ipt = i0;
|
||||
}if (isInteger) (f)[i] = this.parseIntStr (tokens[ipt]);
|
||||
else (f)[i] = this.parseFloatStr (tokens[ipt]);
|
||||
}
|
||||
}, "~S,~A,~N,~O,~B");
|
||||
Clazz.defineMethod (c$, "processConnectorObject",
|
||||
function () {
|
||||
this.connectors = new java.util.Hashtable ();
|
||||
this.rd ();
|
||||
this.parseLineParameters (J.adapter.readers.quantum.CsfReader.connectorFields, J.adapter.readers.quantum.CsfReader.connectorFieldMap);
|
||||
out : for (; this.rd () != null; ) {
|
||||
if (this.line.startsWith ("property_flags:")) break;
|
||||
var thisAtomID = null;
|
||||
var thisBondID = null;
|
||||
var tokens = this.getTokens ();
|
||||
var field2 = "";
|
||||
var isVibration = false;
|
||||
for (var i = 0; i < this.fieldCount; ++i) {
|
||||
var field = tokens[i];
|
||||
switch (this.fieldTypes[i]) {
|
||||
case 1:
|
||||
if (!field.equals ("atom")) continue out;
|
||||
break;
|
||||
case 3:
|
||||
field2 = field;
|
||||
if (field.equals ("sto_basis_fxn")) this.nSlaters++;
|
||||
else if (field.equals ("gto_basis_fxn")) this.nGaussians++;
|
||||
else if (field.equals ("vibrational_level")) isVibration = true;
|
||||
else if (!field.equals ("bond")) continue out;
|
||||
break;
|
||||
case 2:
|
||||
thisAtomID = field;
|
||||
break;
|
||||
case 4:
|
||||
thisBondID = field2 + field;
|
||||
if (isVibration) this.nVibrations = Math.max (this.nVibrations, this.parseIntStr (field));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
if (thisAtomID != null && thisBondID != null) {
|
||||
if (this.connectors.containsKey (thisBondID)) {
|
||||
var connect = this.connectors.get (thisBondID);
|
||||
connect[1] = thisAtomID;
|
||||
if (this.htBonds != null) this.setBond (this.htBonds.get (thisBondID), connect);
|
||||
} else {
|
||||
var connect = new Array (2);
|
||||
connect[0] = thisAtomID;
|
||||
this.connectors.put (thisBondID, connect);
|
||||
}}}
|
||||
});
|
||||
Clazz.defineMethod (c$, "setBond",
|
||||
function (bond, connect) {
|
||||
bond.atomIndex1 = this.asc.getAtomIndex (connect[0]);
|
||||
bond.atomIndex2 = this.asc.getAtomIndex (connect[1]);
|
||||
this.asc.addBond (bond);
|
||||
}, "J.adapter.smarter.Bond,~A");
|
||||
Clazz.defineMethod (c$, "processAtomObject",
|
||||
function () {
|
||||
this.rd ();
|
||||
this.parseLineParameters (J.adapter.readers.quantum.CsfReader.atomFields, J.adapter.readers.quantum.CsfReader.atomFieldMap);
|
||||
this.nAtoms = 0;
|
||||
for (; this.rd () != null; ) {
|
||||
if (this.line.startsWith ("property_flags:")) break;
|
||||
var tokens = this.getTokens ();
|
||||
var atom = new J.adapter.smarter.Atom ();
|
||||
var field;
|
||||
for (var i = 0; i < this.fieldCount; i++) {
|
||||
var type = this.fieldTypes[i];
|
||||
if (type == 0) continue;
|
||||
if ((field = tokens[i]) == null) JU.Logger.warn ("field == null in " + this.line);
|
||||
switch (type) {
|
||||
case -1:
|
||||
atom.atomSerial = JU.PT.parseInt (field);
|
||||
break;
|
||||
case 1:
|
||||
atom.elementSymbol = field;
|
||||
atom.atomName = field + atom.atomSerial;
|
||||
break;
|
||||
case 2:
|
||||
this.strAtomicNumbers += field + " ";
|
||||
break;
|
||||
case 3:
|
||||
atom.formalCharge = this.parseIntStr (field);
|
||||
break;
|
||||
case 5:
|
||||
atom.partialCharge = this.parseFloatStr (field);
|
||||
break;
|
||||
case 4:
|
||||
this.setAtomCoordTokens (atom, tokens, i);
|
||||
i += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Float.isNaN (atom.x) || Float.isNaN (atom.y) || Float.isNaN (atom.z)) {
|
||||
JU.Logger.warn ("atom " + atom.atomName + " has invalid/unknown coordinates");
|
||||
} else {
|
||||
this.nAtoms++;
|
||||
this.asc.addAtomWithMappedSerialNumber (atom);
|
||||
}}
|
||||
});
|
||||
Clazz.defineMethod (c$, "processBondObject",
|
||||
function () {
|
||||
this.rd ();
|
||||
this.parseLineParameters (J.adapter.readers.quantum.CsfReader.bondFields, J.adapter.readers.quantum.CsfReader.bondFieldMap);
|
||||
for (; this.rd () != null; ) {
|
||||
if (this.line.startsWith ("property_flags:")) break;
|
||||
var thisBondID = null;
|
||||
var tokens = this.getTokens ();
|
||||
for (var i = 0; i < this.fieldCount; ++i) {
|
||||
var field = tokens[i];
|
||||
switch (this.fieldTypes[i]) {
|
||||
case -1:
|
||||
thisBondID = "bond" + field;
|
||||
break;
|
||||
case 1:
|
||||
var order = 1;
|
||||
if (field.equals ("single")) order = 1;
|
||||
else if (field.equals ("double")) order = 2;
|
||||
else if (field.equals ("triple")) order = 3;
|
||||
else JU.Logger.warn ("unknown CSF bond order: " + field);
|
||||
var bond = new J.adapter.smarter.Bond (-1, -1, 1);
|
||||
bond.order = order;
|
||||
if (this.connectors == null) {
|
||||
if (this.htBonds == null) this.htBonds = new java.util.Hashtable ();
|
||||
this.htBonds.put (thisBondID, bond);
|
||||
} else {
|
||||
this.setBond (bond, this.connectors.get (thisBondID));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "processVibrationObject",
|
||||
function () {
|
||||
var vibData = Clazz.newFloatArray (this.nVibrations, this.nAtoms * 3, 0);
|
||||
var energies = new Array (this.nVibrations);
|
||||
this.rd ();
|
||||
while (this.line != null && this.parseLineParameters (J.adapter.readers.quantum.CsfReader.vibFields, J.adapter.readers.quantum.CsfReader.vibFieldMap) > 0) {
|
||||
while (this.rd () != null && !this.line.startsWith ("property_flags:")) {
|
||||
var tokens = this.getTokens ();
|
||||
var thisvib = -1;
|
||||
for (var i = 0; i < this.fieldCount; ++i) {
|
||||
var field = tokens[i];
|
||||
switch (this.fieldTypes[i]) {
|
||||
case -1:
|
||||
thisvib = this.parseIntStr (field) - 1;
|
||||
break;
|
||||
case 1:
|
||||
this.fillCsfArray ("normalMode", tokens, i, vibData[thisvib], false);
|
||||
break;
|
||||
case 2:
|
||||
energies[thisvib] = field;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < this.nVibrations; i++) {
|
||||
if (!this.doGetVibration (i + 1)) continue;
|
||||
this.asc.cloneAtomSetWithBonds (false);
|
||||
this.asc.setAtomSetFrequency (null, null, energies[i], null);
|
||||
var ipt = 0;
|
||||
var baseAtom = this.nAtoms * (i + 1);
|
||||
for (var iAtom = 0; iAtom < this.nAtoms; iAtom++) this.asc.addVibrationVector (baseAtom + iAtom, vibData[i][ipt++], vibData[i][ipt++], vibData[i][ipt++]);
|
||||
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "processMolecularOrbitalObject",
|
||||
function () {
|
||||
if (this.nSlaters == 0 && this.nGaussians == 0 || !this.doReadMolecularOrbitals) {
|
||||
this.rd ();
|
||||
return;
|
||||
}this.nOrbitals = (this.nSlaters + this.nGaussians);
|
||||
JU.Logger.info ("Reading CSF data for " + this.nOrbitals + " molecular orbitals");
|
||||
var energy = Clazz.newFloatArray (this.nOrbitals, 0);
|
||||
var occupancy = Clazz.newFloatArray (this.nOrbitals, 0);
|
||||
var list = Clazz.newFloatArray (this.nOrbitals, this.nOrbitals, 0);
|
||||
var listCompressed = null;
|
||||
var coefIndices = null;
|
||||
var ipt = 0;
|
||||
var isCompressed = false;
|
||||
this.rd ();
|
||||
while (this.line != null && this.parseLineParameters (J.adapter.readers.quantum.CsfReader.moFields, J.adapter.readers.quantum.CsfReader.moFieldMap) > 0) while (this.rd () != null && !this.line.startsWith ("property_flags:")) {
|
||||
var tokens = this.getTokens ();
|
||||
for (var i = 0; i < this.fieldCount; ++i) {
|
||||
switch (this.fieldTypes[i]) {
|
||||
case -1:
|
||||
ipt = this.parseIntStr (tokens[i]) - 1;
|
||||
break;
|
||||
case 1:
|
||||
energy[ipt] = this.parseFloatStr (tokens[i]);
|
||||
break;
|
||||
case 2:
|
||||
occupancy[ipt] = this.parseFloatStr (tokens[i]);
|
||||
break;
|
||||
case 3:
|
||||
this.fillCsfArray ("eig_vec", tokens, i, list[ipt], false);
|
||||
break;
|
||||
case 4:
|
||||
isCompressed = true;
|
||||
if (listCompressed == null) listCompressed = Clazz.newFloatArray (this.nOrbitals, this.nOrbitals, 0);
|
||||
this.fillCsfArray ("eig_vec_compressed", tokens, i, listCompressed[ipt], false);
|
||||
break;
|
||||
case 5:
|
||||
if (coefIndices == null) coefIndices = Clazz.newIntArray (this.nOrbitals, this.nOrbitals, 0);
|
||||
this.fillCsfArray ("coef_indices", tokens, i, coefIndices[ipt], true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var iMo = 0; iMo < this.nOrbitals; iMo++) {
|
||||
if (isCompressed) {
|
||||
for (var i = 0; i < coefIndices[iMo].length; i++) {
|
||||
var pt = coefIndices[iMo][i] - 1;
|
||||
if (pt < 0) break;
|
||||
list[iMo][pt] = listCompressed[iMo][i];
|
||||
}
|
||||
}for (var i = 0; i < this.nOrbitals; i++) if (Math.abs (list[iMo][i]) < 1.0E-4) list[iMo][i] = 0;
|
||||
|
||||
var mo = new java.util.Hashtable ();
|
||||
mo.put ("energy", Float.$valueOf (energy[iMo]));
|
||||
mo.put ("occupancy", Float.$valueOf (occupancy[iMo]));
|
||||
mo.put ("coefficients", list[iMo]);
|
||||
this.setMO (mo);
|
||||
}
|
||||
this.setMOs ("eV");
|
||||
});
|
||||
Clazz.defineMethod (c$, "processBasisObject",
|
||||
function (sto_gto) {
|
||||
var atomNos = JU.PT.getTokens (this.strAtomicNumbers);
|
||||
this.atomicNumbers = Clazz.newIntArray (atomNos.length, 0);
|
||||
for (var i = 0; i < this.atomicNumbers.length; i++) this.atomicNumbers[i] = this.parseIntStr (atomNos[i]);
|
||||
|
||||
this.nOrbitals = (this.nSlaters + this.nGaussians);
|
||||
var isGaussian = (sto_gto.equals ("gto"));
|
||||
var zetas = JU.AU.newFloat2 (this.nOrbitals);
|
||||
var contractionCoefs = null;
|
||||
var types = new Array (this.nOrbitals);
|
||||
var shells = Clazz.newIntArray (this.nOrbitals, 0);
|
||||
var nZetas = 0;
|
||||
this.rd ();
|
||||
while (this.line != null && this.parseLineParameters (J.adapter.readers.quantum.CsfReader.moFields, J.adapter.readers.quantum.CsfReader.moFieldMap) > 0) {
|
||||
if (nZetas == 0) nZetas = this.getPropertyCount (sto_gto + "_exp");
|
||||
var ipt = 0;
|
||||
while (this.rd () != null && !this.line.startsWith ("property_flags:")) {
|
||||
var tokens = this.getTokens ();
|
||||
for (var i = 0; i < this.fieldCount; ++i) {
|
||||
var field = tokens[i];
|
||||
switch (this.fieldTypes[i]) {
|
||||
case -1:
|
||||
ipt = this.parseIntStr (field) - 1;
|
||||
break;
|
||||
case 6:
|
||||
types[ipt] = field;
|
||||
break;
|
||||
case 7:
|
||||
case 9:
|
||||
zetas[ipt] = Clazz.newFloatArray (nZetas, 0);
|
||||
this.fillCsfArray (sto_gto + "_exp", tokens, i, zetas[ipt], false);
|
||||
break;
|
||||
case 10:
|
||||
shells[ipt] = this.parseIntStr (field);
|
||||
break;
|
||||
case 8:
|
||||
if (contractionCoefs == null) contractionCoefs = Clazz.newFloatArray (this.nOrbitals, nZetas, 0);
|
||||
this.fillCsfArray ("contractions", tokens, i, contractionCoefs[ipt], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isGaussian) {
|
||||
var sdata = new JU.Lst ();
|
||||
var gdata = new JU.Lst ();
|
||||
var iShell = 0;
|
||||
var gaussianCount = 0;
|
||||
for (var ipt = 0; ipt < this.nGaussians; ipt++) {
|
||||
if (shells[ipt] != iShell) {
|
||||
iShell = shells[ipt];
|
||||
var slater = Clazz.newIntArray (4, 0);
|
||||
var iAtom = this.asc.getAtomIndex (this.connectors.get (sto_gto + "_basis_fxn" + (ipt + 1))[0]);
|
||||
slater[0] = iAtom + 1;
|
||||
slater[1] = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagID (types[ipt].substring (0, 1));
|
||||
var nZ = 0;
|
||||
while (++nZ < nZetas && zetas[ipt][nZ] != 0) {
|
||||
}
|
||||
slater[2] = gaussianCount;
|
||||
slater[3] = nZ;
|
||||
sdata.addLast (slater);
|
||||
gaussianCount += nZ;
|
||||
for (var i = 0; i < nZ; i++) gdata.addLast ( Clazz.newFloatArray (-1, [zetas[ipt][i], contractionCoefs[ipt][i]]));
|
||||
|
||||
}}
|
||||
var garray = JU.AU.newFloat2 (gaussianCount);
|
||||
for (var i = 0; i < gaussianCount; i++) garray[i] = gdata.get (i);
|
||||
|
||||
this.moData.put ("shells", sdata);
|
||||
this.moData.put ("gaussians", garray);
|
||||
} else {
|
||||
for (var ipt = 0; ipt < this.nSlaters; ipt++) {
|
||||
var iAtom = this.asc.getAtomIndex (this.connectors.get (sto_gto + "_basis_fxn" + (ipt + 1))[0]);
|
||||
for (var i = 0; i < nZetas; i++) {
|
||||
if (zetas[ipt][i] == 0) break;
|
||||
this.createSphericalSlaterByType (iAtom, this.atomicNumbers[iAtom], types[ipt], zetas[ipt][i] * (i == 0 ? 1 : -1), contractionCoefs == null ? 1 : contractionCoefs[ipt][i]);
|
||||
}
|
||||
}
|
||||
this.setSlaters (true, false);
|
||||
}}, "~S");
|
||||
Clazz.defineStatics (c$,
|
||||
"objCls1", 1,
|
||||
"objID1", 2,
|
||||
"objCls2", 3,
|
||||
"objID2", 4,
|
||||
"connectorFields", Clazz.newArray (-1, ["objCls1", "objID1", "objCls2", "objID2"]),
|
||||
"connectorFieldMap", Clazz.newByteArray (-1, [1, 2, 3, 4]),
|
||||
"ID", -1,
|
||||
"SYM", 1,
|
||||
"ANUM", 2,
|
||||
"CHRG", 3,
|
||||
"XYZ", 4,
|
||||
"PCHRG", 5,
|
||||
"atomFields", Clazz.newArray (-1, ["ID", "sym", "anum", "chrg", "xyz_coordinates", "pchrg"]),
|
||||
"atomFieldMap", Clazz.newByteArray (-1, [-1, 1, 2, 3, 4, 5]),
|
||||
"BTYPE", 1,
|
||||
"bondFields", Clazz.newArray (-1, ["ID", "type"]),
|
||||
"bondFieldMap", Clazz.newByteArray (-1, [-1, 1]),
|
||||
"NORMAL_MODE", 1,
|
||||
"VIB_ENERGY", 2,
|
||||
"DIPOLE", 3,
|
||||
"vibFields", Clazz.newArray (-1, ["ID", "normalMode", "Energy", "transitionDipole"]),
|
||||
"vibFieldMap", Clazz.newByteArray (-1, [-1, 1, 2, 3]),
|
||||
"EIG_VAL", 1,
|
||||
"MO_OCC", 2,
|
||||
"EIG_VEC", 3,
|
||||
"EIG_VEC_COMPRESSED", 4,
|
||||
"COEF_INDICES", 5,
|
||||
"BFXN_ANGL", 6,
|
||||
"STO_EXP", 7,
|
||||
"CONTRACTIONS", 8,
|
||||
"GTO_EXP", 9,
|
||||
"SHELL", 10,
|
||||
"moFields", Clazz.newArray (-1, ["ID", "eig_val", "mo_occ", "eig_vec", "eig_vec_compressed", "coef_indices", "bfxn_ang", "sto_exp", "contractions", "gto_exp", "shell"]),
|
||||
"moFieldMap", Clazz.newByteArray (-1, [-1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]));
|
||||
});
|
||||
@@ -0,0 +1,172 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.SlaterReader", "java.util.Hashtable"], "J.adapter.readers.quantum.DgridReader", ["java.lang.Float", "JU.PT", "$.SB", "J.quantum.SlaterData", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.title = null;
|
||||
this.htExponents = null;
|
||||
this.htFuncMap = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "DgridReader", J.adapter.readers.quantum.SlaterReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.htExponents = new java.util.Hashtable ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.indexOf (":title") == 0) {
|
||||
this.title = this.rd ().substring (2);
|
||||
return true;
|
||||
}if (this.line.indexOf ("basis: CARTESIAN STO") >= 0) {
|
||||
this.readSlaterBasis ();
|
||||
return true;
|
||||
}if (this.line.indexOf (":atom") == 0) {
|
||||
this.readCoordinates ();
|
||||
return true;
|
||||
}if (this.line.indexOf (" MO DATA ") >= 0) {
|
||||
if (this.doReadMolecularOrbitals) this.readMolecularOrbitals ();
|
||||
return true;
|
||||
}return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readCoordinates",
|
||||
function () {
|
||||
this.asc.newAtomSet ();
|
||||
this.asc.setAtomSetName (this.title);
|
||||
this.discardLinesUntilContains ("----");
|
||||
while (this.rd () != null && !this.line.startsWith (":-----")) {
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length < 5) break;
|
||||
this.setAtomCoordScaled (null, tokens, 2, 0.5291772).elementSymbol = tokens[0];
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readSlaterBasis",
|
||||
function () {
|
||||
this.discardLinesUntilContains (":-");
|
||||
var ch = 'a';
|
||||
while (this.rd () != null && this.line.indexOf (":-") < 0) {
|
||||
var atomSymbol = this.line.substring (3, 6).trim ();
|
||||
var xyz = this.line.substring (19, 21);
|
||||
var code = atomSymbol + xyz;
|
||||
if (this.htExponents.get (code) == null) {
|
||||
ch = 'a';
|
||||
} else {
|
||||
code += "_" + ($c$ = ch, ch = String.fromCharCode (ch.charCodeAt (0) + 1), $c$);
|
||||
}var exp = this.line.substring (34);
|
||||
this.htExponents.put (code, Float.$valueOf (this.parseFloatStr (exp)));
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolecularOrbitals",
|
||||
function () {
|
||||
this.htFuncMap = new java.util.Hashtable ();
|
||||
this.readLines (3);
|
||||
while (this.line != null && this.line.indexOf (":") != 0) {
|
||||
this.discardLinesUntilContains ("sym: ");
|
||||
var symmetry = this.line.substring (4, 10).trim ();
|
||||
if (symmetry.indexOf ("_FC") >= 0) break;
|
||||
var data = new JU.SB ();
|
||||
data.append (this.line.substring (15));
|
||||
while (this.rd () != null && this.line.length >= 15) data.append (this.line);
|
||||
|
||||
var tokens = JU.PT.getTokens (data.toString ());
|
||||
var nFuncs = Clazz.doubleToInt (tokens.length / 2);
|
||||
var ptSlater = Clazz.newIntArray (nFuncs, 0);
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = 0, pt = 0; i < tokens.length; ) {
|
||||
var iAtom = this.parseIntStr (tokens[i++]) - 1;
|
||||
var code = tokens[i++];
|
||||
var key = iAtom + "_" + code;
|
||||
if (this.htFuncMap.containsKey (key)) {
|
||||
ptSlater[pt++] = this.htFuncMap.get (key).intValue ();
|
||||
} else {
|
||||
var n = this.slaters.size ();
|
||||
ptSlater[pt++] = n;
|
||||
this.htFuncMap.put (key, Integer.$valueOf (n));
|
||||
this.addSlater (this.createSlaterData (iAtom + 1, atoms[iAtom].elementSymbol, code), n);
|
||||
}}
|
||||
this.discardLinesUntilContains (":-");
|
||||
this.rd ();
|
||||
while (this.line != null && this.line.length >= 20) {
|
||||
var iOrb = this.parseIntRange (this.line, 0, 10);
|
||||
var energy = this.parseFloatRange (this.line, 10, 20);
|
||||
var cData = new JU.SB ();
|
||||
cData.append (this.line.substring (20));
|
||||
while (this.rd () != null && this.line.length >= 10) {
|
||||
if (this.line.charAt (3) != ' ') break;
|
||||
cData.append (this.line);
|
||||
}
|
||||
var list = Clazz.newFloatArray (this.slaters.size (), 0);
|
||||
tokens = JU.PT.getTokens (cData.toString ());
|
||||
if (tokens.length != nFuncs) JU.Logger.error ("DgridReader: number of coefficients (" + tokens.length + ") does not equal number of functions (" + nFuncs + ")");
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var pt = ptSlater[i];
|
||||
list[pt] = this.parseFloatStr (tokens[i]);
|
||||
}
|
||||
var mo = new java.util.Hashtable ();
|
||||
mo.put ("energy", Float.$valueOf (energy));
|
||||
mo.put ("coefficients", list);
|
||||
mo.put ("symmetry", symmetry + "_" + iOrb);
|
||||
this.setMO (mo);
|
||||
}
|
||||
}
|
||||
this.discardLinesUntilContains (": # symmetry");
|
||||
this.rd ();
|
||||
for (var i = 0; i < this.orbitals.size (); i++) {
|
||||
this.rd ();
|
||||
var occupancy = this.parseFloatRange (this.line, 31, 45) + this.parseFloatRange (this.line, 47, 61);
|
||||
this.orbitals.get (i).put ("occupancy", Float.$valueOf (occupancy));
|
||||
}
|
||||
this.sortOrbitals ();
|
||||
this.setSlaters (true, true);
|
||||
this.setMOs ("eV");
|
||||
});
|
||||
Clazz.defineMethod (c$, "createSlaterData",
|
||||
function (iAtom, atomSymbol, xyz) {
|
||||
var ch;
|
||||
var abc = ' ';
|
||||
var type = ' ';
|
||||
var exp = 1;
|
||||
var el = 0;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
var z = 0;
|
||||
for (var i = xyz.length; --i >= 0; ) {
|
||||
switch (ch = xyz.charAt (i)) {
|
||||
case '_':
|
||||
type = abc;
|
||||
break;
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
exp = ch.charCodeAt (0) - 48;
|
||||
break;
|
||||
case 'x':
|
||||
x = exp;
|
||||
el += exp;
|
||||
exp = 1;
|
||||
break;
|
||||
case 'y':
|
||||
y = exp;
|
||||
el += exp;
|
||||
exp = 1;
|
||||
break;
|
||||
case 'z':
|
||||
z = exp;
|
||||
el += exp;
|
||||
exp = 1;
|
||||
break;
|
||||
case 's':
|
||||
case 'p':
|
||||
case 'd':
|
||||
case 'f':
|
||||
default:
|
||||
abc = ch;
|
||||
}
|
||||
}
|
||||
var r = (exp - el - 1);
|
||||
var code = atomSymbol + xyz.substring (0, 2);
|
||||
if (type != ' ') code += "_" + type;
|
||||
var f = this.htExponents.get (code);
|
||||
var zeta = 0;
|
||||
if (f == null) JU.Logger.error ("Exponent for " + code + " not found");
|
||||
else zeta = f.floatValue ();
|
||||
return new J.quantum.SlaterData (iAtom, x, y, z, r, zeta, 1);
|
||||
}, "~N,~S,~S");
|
||||
});
|
||||
@@ -0,0 +1,254 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.MOReader"], "J.adapter.readers.quantum.GamessReader", ["java.lang.Float", "java.util.Hashtable", "JU.AU", "$.Lst", "$.PT", "J.adapter.readers.quantum.BasisFunctionReader", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.atomNames = null;
|
||||
this.calcOptions = null;
|
||||
this.isTypeSet = false;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "GamessReader", J.adapter.readers.quantum.MOReader);
|
||||
Clazz.defineMethod (c$, "readEnergy",
|
||||
function () {
|
||||
var tokens = JU.PT.getTokens (this.line.substring (this.line.indexOf ("ENERGY")));
|
||||
if (tokens.length < 3) return;
|
||||
var strEnergy = tokens[2];
|
||||
var e = this.parseFloatStr (strEnergy);
|
||||
if (!Float.isNaN (e)) this.asc.setAtomSetEnergy (strEnergy, e);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readGaussianBasis",
|
||||
function (initiator, terminator) {
|
||||
var gdata = new JU.Lst ();
|
||||
this.gaussianCount = 0;
|
||||
var nGaussians = 0;
|
||||
this.shellCount = 0;
|
||||
var thisShell = "0";
|
||||
var tokens;
|
||||
this.discardLinesUntilContains (initiator);
|
||||
this.rd ();
|
||||
var slater = null;
|
||||
var shellsByAtomType = new java.util.Hashtable ();
|
||||
var slatersByAtomType = new JU.Lst ();
|
||||
var atomType = null;
|
||||
while (this.rd () != null && this.line.indexOf (terminator) < 0) {
|
||||
if (this.line.indexOf ("(") >= 0) this.line = J.adapter.readers.quantum.GamessReader.fixBasisLine (this.line);
|
||||
tokens = this.getTokens ();
|
||||
switch (tokens.length) {
|
||||
case 1:
|
||||
if (atomType != null) {
|
||||
if (slater != null) {
|
||||
slater[2] = nGaussians;
|
||||
slatersByAtomType.addLast (slater);
|
||||
slater = null;
|
||||
}shellsByAtomType.put (atomType, slatersByAtomType);
|
||||
}slatersByAtomType = new JU.Lst ();
|
||||
atomType = tokens[0];
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
if (!tokens[0].equals (thisShell)) {
|
||||
if (slater != null) {
|
||||
slater[2] = nGaussians;
|
||||
slatersByAtomType.addLast (slater);
|
||||
}thisShell = tokens[0];
|
||||
this.shellCount++;
|
||||
slater = Clazz.newIntArray (-1, [J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagID (this.fixShellTag (tokens[1])), this.gaussianCount, 0]);
|
||||
nGaussians = 0;
|
||||
}++nGaussians;
|
||||
++this.gaussianCount;
|
||||
gdata.addLast (tokens);
|
||||
}
|
||||
}
|
||||
if (slater != null) {
|
||||
slater[2] = nGaussians;
|
||||
slatersByAtomType.addLast (slater);
|
||||
}if (atomType != null) shellsByAtomType.put (atomType, slatersByAtomType);
|
||||
this.gaussians = JU.AU.newFloat2 (this.gaussianCount);
|
||||
for (var i = 0; i < this.gaussianCount; i++) {
|
||||
tokens = gdata.get (i);
|
||||
this.gaussians[i] = Clazz.newFloatArray (tokens.length - 3, 0);
|
||||
for (var j = 3; j < tokens.length; j++) this.gaussians[i][j - 3] = this.parseFloatStr (tokens[j]);
|
||||
|
||||
}
|
||||
var ac = this.atomNames.size ();
|
||||
if (this.shells == null && ac > 0) {
|
||||
this.shells = new JU.Lst ();
|
||||
for (var i = 0; i < ac; i++) {
|
||||
atomType = this.atomNames.get (i);
|
||||
var slaters = shellsByAtomType.get (atomType);
|
||||
if (slaters == null) {
|
||||
JU.Logger.error ("slater for atom " + i + " atomType " + atomType + " was not found in listing. Ignoring molecular orbitals");
|
||||
return;
|
||||
}for (var j = 0; j < slaters.size (); j++) {
|
||||
slater = slaters.get (j);
|
||||
this.shells.addLast ( Clazz.newIntArray (-1, [i + 1, slater[0], slater[1] + 1, slater[2]]));
|
||||
}
|
||||
}
|
||||
}if (this.debugging) {
|
||||
JU.Logger.debug (this.shellCount + " slater shells read");
|
||||
JU.Logger.debug (this.gaussianCount + " gaussian primitives read");
|
||||
}}, "~S,~S");
|
||||
Clazz.defineMethod (c$, "readFrequencies",
|
||||
function () {
|
||||
this.discardLinesUntilContains ("FREQUENCY:");
|
||||
var haveFreq = false;
|
||||
while (this.line != null && this.line.indexOf ("FREQUENCY:") >= 0) {
|
||||
var frequencyCount = 0;
|
||||
var tokens = this.getTokens ();
|
||||
var frequencies = Clazz.newFloatArray (tokens.length, 0);
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var frequency = this.parseFloatStr (tokens[i]);
|
||||
if (tokens[i].equals ("I")) frequencies[frequencyCount - 1] = -frequencies[frequencyCount - 1];
|
||||
if (Float.isNaN (frequency)) continue;
|
||||
frequencies[frequencyCount++] = frequency;
|
||||
if (this.debugging) {
|
||||
JU.Logger.debug ((this.vibrationNumber + 1) + " frequency=" + frequency);
|
||||
}}
|
||||
var red_masses = null;
|
||||
var intensities = null;
|
||||
this.rd ();
|
||||
if (this.line.indexOf ("MASS") >= 0) {
|
||||
red_masses = this.getTokens ();
|
||||
this.rd ();
|
||||
}if (this.line.indexOf ("INTENS") >= 0) {
|
||||
intensities = this.getTokens ();
|
||||
}var ac = this.asc.getLastAtomSetAtomCount ();
|
||||
var iAtom0 = this.asc.ac;
|
||||
var ignore = Clazz.newBooleanArray (frequencyCount, false);
|
||||
for (var i = 0; i < frequencyCount; i++) {
|
||||
ignore[i] = !this.doGetVibration (++this.vibrationNumber);
|
||||
if (ignore[i]) continue;
|
||||
if (haveFreq) {
|
||||
this.asc.cloneLastAtomSet ();
|
||||
} else {
|
||||
haveFreq = true;
|
||||
iAtom0 -= ac;
|
||||
}this.asc.setAtomSetFrequency (null, null, "" + frequencies[i], null);
|
||||
if (red_masses != null) this.asc.setAtomSetModelProperty ("ReducedMass", red_masses[red_masses.length - frequencyCount + i] + " AMU");
|
||||
if (intensities != null) this.asc.setAtomSetModelProperty ("IRIntensity", intensities[intensities.length - frequencyCount + i] + " D^2/AMU-Angstrom^2");
|
||||
}
|
||||
this.discardLinesUntilBlank ();
|
||||
this.fillFrequencyData (iAtom0, ac, ac, ignore, false, 20, 12, null, 0);
|
||||
this.readLines (13);
|
||||
}
|
||||
});
|
||||
c$.fixBasisLine = Clazz.defineMethod (c$, "fixBasisLine",
|
||||
function (line) {
|
||||
var pt;
|
||||
var pt1;
|
||||
line = line.$replace (')', ' ');
|
||||
while ((pt = line.indexOf ("(")) >= 0) {
|
||||
pt1 = pt;
|
||||
while (line.charAt (--pt1) == ' ') {
|
||||
}
|
||||
while (line.charAt (--pt1) != ' ') {
|
||||
}
|
||||
line = line.substring (0, ++pt1) + line.substring (pt + 1);
|
||||
}
|
||||
return line;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "setCalculationType",
|
||||
function () {
|
||||
if (this.calcOptions == null || this.isTypeSet) return;
|
||||
this.isTypeSet = true;
|
||||
var SCFtype = this.calcOptions.get ("contrl_options_SCFTYP");
|
||||
var Runtype = this.calcOptions.get ("contrl_options_RUNTYP");
|
||||
var igauss = this.calcOptions.get ("basis_options_IGAUSS");
|
||||
var gbasis = this.calcOptions.get ("basis_options_GBASIS");
|
||||
var DFunc = !"0".equals (this.calcOptions.get ("basis_options_NDFUNC"));
|
||||
var PFunc = !"0".equals (this.calcOptions.get ("basis_options_NPFUNC"));
|
||||
var FFunc = !"0".equals (this.calcOptions.get ("basis_options_NFFUNC"));
|
||||
var DFTtype = this.calcOptions.get ("contrl_options_DFTTYP");
|
||||
var perturb = this.parseIntStr (this.calcOptions.get ("contrl_options_MPLEVL"));
|
||||
var CItype = this.calcOptions.get ("contrl_options_CITYP");
|
||||
var CCtype = this.calcOptions.get ("contrl_options_CCTYP");
|
||||
if (igauss == null && SCFtype == null) return;
|
||||
if (this.calculationType.equals ("?")) this.calculationType = "";
|
||||
if (igauss != null) {
|
||||
if ("0".equals (igauss)) {
|
||||
var recognized = false;
|
||||
if (this.calculationType.length > 0) this.calculationType += " ";
|
||||
if (gbasis.startsWith ("ACC")) this.calculationType += "aug-cc-p";
|
||||
if (gbasis.startsWith ("CC")) this.calculationType += "cc-p";
|
||||
if ((gbasis.startsWith ("ACC") || gbasis.startsWith ("CC")) && gbasis.endsWith ("C")) this.calculationType += "C";
|
||||
if (gbasis.indexOf ("CCD") >= 0) {
|
||||
this.calculationType += "VDZ";
|
||||
recognized = true;
|
||||
}if (gbasis.indexOf ("CCT") >= 0) {
|
||||
this.calculationType += "VTZ";
|
||||
recognized = true;
|
||||
}if (gbasis.indexOf ("CCQ") >= 0) {
|
||||
this.calculationType += "VQZ";
|
||||
recognized = true;
|
||||
}if (gbasis.indexOf ("CC5") >= 0) {
|
||||
this.calculationType += "V5Z";
|
||||
recognized = true;
|
||||
}if (gbasis.indexOf ("CC6") >= 0) {
|
||||
this.calculationType += "V6Z";
|
||||
recognized = true;
|
||||
}if (!recognized) this.calculationType += gbasis;
|
||||
} else {
|
||||
if (this.calculationType.length > 0) this.calculationType += " ";
|
||||
this.calculationType += igauss + "-" + JU.PT.rep (gbasis, "N", "");
|
||||
if ("T".equals (this.calcOptions.get ("basis_options_DIFFSP"))) {
|
||||
if ("T".equals (this.calcOptions.get ("basis_options_DIFFS"))) this.calculationType += "+";
|
||||
this.calculationType += "+";
|
||||
}this.calculationType += "G";
|
||||
if (DFunc || PFunc || FFunc) {
|
||||
this.calculationType += "(";
|
||||
if (FFunc) {
|
||||
this.calculationType += "f";
|
||||
if (DFunc || PFunc) this.calculationType += ",";
|
||||
}if (DFunc) {
|
||||
this.calculationType += "d";
|
||||
if (PFunc) this.calculationType += ",";
|
||||
}if (PFunc) this.calculationType += "p";
|
||||
this.calculationType += ")";
|
||||
}}if (DFTtype != null && DFTtype.indexOf ("NONE") < 0) {
|
||||
if (this.calculationType.length > 0) this.calculationType += " ";
|
||||
this.calculationType += DFTtype;
|
||||
}if (CItype != null && CItype.indexOf ("NONE") < 0) {
|
||||
if (this.calculationType.length > 0) this.calculationType += " ";
|
||||
this.calculationType += CItype;
|
||||
}if (CCtype != null && CCtype.indexOf ("NONE") < 0) {
|
||||
if (this.calculationType.length > 0) this.calculationType += " ";
|
||||
this.calculationType += CCtype;
|
||||
}if (perturb > 0) {
|
||||
if (this.calculationType.length > 0) this.calculationType += " ";
|
||||
this.calculationType += "MP" + perturb;
|
||||
}if (SCFtype != null) {
|
||||
if (this.calculationType.length > 0) this.calculationType += " ";
|
||||
this.calculationType += SCFtype + " " + Runtype;
|
||||
}}});
|
||||
Clazz.defineMethod (c$, "readControlInfo",
|
||||
function () {
|
||||
this.readCalculationInfo ("contrl_options_");
|
||||
});
|
||||
Clazz.defineMethod (c$, "readBasisInfo",
|
||||
function () {
|
||||
this.readCalculationInfo ("basis_options_");
|
||||
});
|
||||
Clazz.defineMethod (c$, "readCalculationInfo",
|
||||
function (type) {
|
||||
if (this.calcOptions == null) {
|
||||
this.calcOptions = new java.util.Hashtable ();
|
||||
this.asc.setInfo ("calculationOptions", this.calcOptions);
|
||||
}while (this.rd () != null && (this.line = this.line.trim ()).length > 0) {
|
||||
if (this.line.indexOf ("=") < 0) continue;
|
||||
var tokens = JU.PT.getTokens (JU.PT.rep (this.line, "=", " = ") + " ?");
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
if (!tokens[i].equals ("=")) continue;
|
||||
try {
|
||||
var key = type + tokens[i - 1];
|
||||
var value = (key.equals ("basis_options_SPLIT3") ? tokens[++i] + " " + tokens[++i] + " " + tokens[++i] : tokens[++i]);
|
||||
if (this.debugging) JU.Logger.debug (key + " = " + value);
|
||||
this.calcOptions.put (key, value);
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "~S");
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.GamessReader"], "J.adapter.readers.quantum.GamessUKReader", ["java.lang.Float", "JU.Lst", "$.PT"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.symmetries = null;
|
||||
this.occupancies = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "GamessUKReader", J.adapter.readers.quantum.GamessReader);
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.indexOf ("BASIS OPTIONS") >= 0) {
|
||||
this.readBasisInfo ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("$CONTRL OPTIONS") >= 0) {
|
||||
this.readControlInfo ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("contracted primitive functions") >= 0) {
|
||||
this.readGaussianBasis ("======================================================", "======");
|
||||
return false;
|
||||
}if (this.line.indexOf ("molecular geometry") >= 0) {
|
||||
if (!this.doGetModel (++this.modelNumber, null)) return this.checkLastModel ();
|
||||
this.atomNames = new JU.Lst ();
|
||||
this.readAtomsInBohrCoordinates ();
|
||||
return true;
|
||||
}if (!this.doProcessLines) return true;
|
||||
if (this.line.indexOf ("FREQUENCY_INFO_WOULD_BE_HERE") >= 0) {
|
||||
return true;
|
||||
}if (this.line.indexOf ("SYMMETRY ASSIGNMENT") >= 0) {
|
||||
this.readOrbitalSymmetryAndOccupancy ();
|
||||
return false;
|
||||
}if (this.line.indexOf ("- ALPHA SET -") >= 0) this.alphaBeta = "alpha";
|
||||
else if (this.line.indexOf ("- BETA SET -") >= 0) this.alphaBeta = "beta";
|
||||
else if (this.line.indexOf ("eigenvectors") >= 0) {
|
||||
this.readMolecularOrbitals (3);
|
||||
this.setOrbitalSymmetryAndOccupancy ();
|
||||
return false;
|
||||
}return this.checkNboLine ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "readAtomsInBohrCoordinates",
|
||||
function () {
|
||||
this.discardLinesUntilContains ("*****");
|
||||
this.discardLinesUntilContains ("atom");
|
||||
this.discardLinesUntilContains ("*****");
|
||||
this.asc.newAtomSet ();
|
||||
while (this.rd () != null && this.line.indexOf ("*****") < 0) {
|
||||
if (this.line.charAt (14) == ' ') continue;
|
||||
var tokens = this.getTokens ();
|
||||
var atomicNumber = Clazz.floatToInt (this.parseFloatStr (tokens[2]));
|
||||
var atom = this.setAtomCoordScaled (null, tokens, 3, 0.5291772);
|
||||
atom.elementSymbol = J.adapter.smarter.AtomSetCollectionReader.getElementSymbol (atomicNumber);
|
||||
this.atomNames.addLast (atom.atomName = tokens[1]);
|
||||
}
|
||||
});
|
||||
Clazz.overrideMethod (c$, "fixShellTag",
|
||||
function (tag) {
|
||||
return tag.substring (1).toUpperCase ();
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "readOrbitalSymmetryAndOccupancy",
|
||||
function () {
|
||||
this.readLines (4);
|
||||
this.symmetries = new JU.Lst ();
|
||||
this.occupancies = new JU.Lst ();
|
||||
while (this.rd () != null && this.line.indexOf ("====") < 0) {
|
||||
var tokens = JU.PT.getTokens (this.line.substring (20));
|
||||
this.symmetries.addLast (tokens[0] + " " + tokens[1]);
|
||||
this.occupancies.addLast (Float.$valueOf (this.parseFloatStr (tokens[5])));
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "setOrbitalSymmetryAndOccupancy",
|
||||
function () {
|
||||
if (this.symmetries.size () < this.orbitals.size ()) return;
|
||||
for (var i = this.orbitals.size (); --i >= 0; ) {
|
||||
var mo = this.orbitals.get (i);
|
||||
mo.put ("symmetry", this.symmetries.get (i));
|
||||
mo.put ("occupancy", this.occupancies.get (i));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,187 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.GamessReader"], "J.adapter.readers.quantum.GamessUSReader", ["java.lang.Float", "JU.Lst", "$.PT", "$.V3", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.lowdenCharges = false;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "GamessUSReader", J.adapter.readers.quantum.GamessReader);
|
||||
Clazz.defineMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.lowdenCharges = this.checkAndRemoveFilterKey ("CHARGE=LOW");
|
||||
Clazz.superCall (this, J.adapter.readers.quantum.GamessUSReader, "initializeReader", []);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.startsWith (" $DATA")) return this.readInputDeck ();
|
||||
if (this.line.indexOf ("***************") >= 0) JU.Logger.info (this.rd ());
|
||||
var isBohr;
|
||||
if (this.line.indexOf ("FINAL ENERGY IS") >= 0 || this.line.indexOf ("TOTAL ENERGY = ") >= 0 || this.line.indexOf ("FINAL RHF ENERGY IS") >= 0) this.readEnergy ();
|
||||
if (this.line.indexOf ("BASIS OPTIONS") >= 0) {
|
||||
this.readBasisInfo ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("$CONTRL OPTIONS") >= 0) {
|
||||
this.readControlInfo ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("ATOMIC BASIS SET") >= 0) {
|
||||
this.readGaussianBasis ("SHELL TYPE", "TOTAL");
|
||||
return false;
|
||||
}if ((isBohr = this.line.indexOf ("COORDINATES (BOHR)") >= 0) || this.line.indexOf ("COORDINATES OF ALL ATOMS ARE (ANGS)") >= 0) {
|
||||
if (!this.doGetModel (++this.modelNumber, null)) return this.checkLastModel ();
|
||||
this.atomNames = new JU.Lst ();
|
||||
if (isBohr) this.readAtomsInBohrCoordinates ();
|
||||
else this.readAtomsInAngstromCoordinates ();
|
||||
return true;
|
||||
}if (!this.doProcessLines) return true;
|
||||
if (this.line.indexOf ("FREQUENCIES IN CM") >= 0) {
|
||||
this.readFrequencies ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("SUMMARY OF THE EFFECTIVE FRAGMENT") >= 0) {
|
||||
this.readEFPInBohrCoordinates ();
|
||||
return false;
|
||||
}if (this.line.indexOf (" TOTAL MULLIKEN AND LOWDIN ATOMIC POPULATIONS") >= 0) {
|
||||
this.readPartialCharges ();
|
||||
return false;
|
||||
}if (this.line.indexOf ("ELECTROSTATIC MOMENTS") >= 0) {
|
||||
this.readDipoleMoment ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("- ALPHA SET -") >= 0) this.alphaBeta = "alpha";
|
||||
else if (this.line.indexOf ("- BETA SET -") >= 0) this.alphaBeta = "beta";
|
||||
else if (this.line.indexOf (" EIGENVECTORS") >= 0 || this.line.indexOf (" INITIAL GUESS ORBITALS") >= 0 || this.line.indexOf (" MCSCF OPTIMIZED ORBITALS") >= 0 || this.line.indexOf (" MCSCF NATURAL ORBITALS") >= 0 || this.line.indexOf (" MOLECULAR ORBITALS") >= 0 && this.line.indexOf (" MOLECULAR ORBITALS LOCALIZED BY THE POPULATION METHOD") < 0) {
|
||||
if (!this.filterMO ()) return true;
|
||||
this.readMolecularOrbitals (1);
|
||||
return false;
|
||||
}if (this.line.indexOf ("EDMISTON-RUEDENBERG ENERGY LOCALIZED ORBITALS") >= 0 || this.line.indexOf (" THE PIPEK-MEZEY POPULATION LOCALIZED ORBITALS ARE") >= 0) {
|
||||
if (!this.filterMO ()) return true;
|
||||
this.readMolecularOrbitals (0);
|
||||
return false;
|
||||
}if (this.line.indexOf (" NATURAL ORBITALS IN ATOMIC ORBITAL BASIS") >= 0) {
|
||||
if (!this.filterMO ()) return true;
|
||||
this.readMolecularOrbitals (2);
|
||||
return false;
|
||||
}return this.checkNboLine ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "readInputDeck",
|
||||
function () {
|
||||
this.readLines (2);
|
||||
this.asc.newAtomSet ();
|
||||
while (this.rd ().indexOf ("$END") < 0) {
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length > 4) this.addAtomXYZSymName (tokens, 2, tokens[0], null).elementNumber = this.parseIntStr (tokens[1]);
|
||||
}
|
||||
return (this.continuing = false);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolecularOrbitals",
|
||||
function (headerType) {
|
||||
this.setCalculationType ();
|
||||
Clazz.superCall (this, J.adapter.readers.quantum.GamessUSReader, "readMolecularOrbitals", [headerType]);
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "readEFPInBohrCoordinates",
|
||||
function () {
|
||||
var acInFirstModel = this.asc.ac;
|
||||
this.discardLinesUntilContains ("MULTIPOLE COORDINATES");
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
while (this.rd () != null && this.line.length >= 72) {
|
||||
var atomName = this.line.substring (1, 2);
|
||||
if (atomName.charAt (0) == 'Z') atomName = this.line.substring (2, 3);
|
||||
else if (this.parseFloatRange (this.line, 67, 73) == 0) continue;
|
||||
var x = this.parseFloatRange (this.line, 8, 25);
|
||||
var y = this.parseFloatRange (this.line, 25, 40);
|
||||
var z = this.parseFloatRange (this.line, 40, 56);
|
||||
if (Float.isNaN (x) || Float.isNaN (y) || Float.isNaN (z)) break;
|
||||
var atom = this.asc.addNewAtom ();
|
||||
atom.atomName = atomName + (++acInFirstModel);
|
||||
this.setAtomCoordXYZ (atom, x * 0.5291772, y * 0.5291772, z * 0.5291772);
|
||||
this.atomNames.addLast (atomName);
|
||||
}
|
||||
});
|
||||
Clazz.overrideMethod (c$, "readAtomsInBohrCoordinates",
|
||||
function () {
|
||||
this.rd ();
|
||||
var atomName;
|
||||
this.asc.newAtomSet ();
|
||||
var n = 0;
|
||||
while (this.rd () != null && (atomName = this.parseTokenRange (this.line, 1, 11)) != null) {
|
||||
var x = this.parseFloatRange (this.line, 17, 37);
|
||||
var y = this.parseFloatRange (this.line, 37, 57);
|
||||
var z = this.parseFloatRange (this.line, 57, 77);
|
||||
if (Float.isNaN (x) || Float.isNaN (y) || Float.isNaN (z)) break;
|
||||
var atom = this.asc.addNewAtom ();
|
||||
atom.elementSymbol = J.adapter.smarter.AtomSetCollectionReader.getElementSymbol (this.parseIntRange (this.line, 11, 14));
|
||||
atom.atomName = atom.elementSymbol + (++n);
|
||||
this.setAtomCoordXYZ (atom, x * 0.5291772, y * 0.5291772, z * 0.5291772);
|
||||
this.atomNames.addLast (atomName);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readAtomsInAngstromCoordinates",
|
||||
function () {
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
var atomName;
|
||||
this.asc.newAtomSet ();
|
||||
var n = 0;
|
||||
while (this.rd () != null && (atomName = this.parseTokenRange (this.line, 1, 11)) != null) {
|
||||
var x = this.parseFloatRange (this.line, 16, 31);
|
||||
var y = this.parseFloatRange (this.line, 31, 46);
|
||||
var z = this.parseFloatRange (this.line, 46, 61);
|
||||
if (Float.isNaN (x) || Float.isNaN (y) || Float.isNaN (z)) break;
|
||||
var atom = this.asc.addNewAtom ();
|
||||
this.setAtomCoordXYZ (atom, x, y, z);
|
||||
atom.elementSymbol = J.adapter.smarter.AtomSetCollectionReader.getElementSymbol (this.parseIntRange (this.line, 11, 14));
|
||||
atom.atomName = atom.elementSymbol + (++n);
|
||||
this.atomNames.addLast (atomName);
|
||||
}
|
||||
if (this.line.indexOf ("COORDINATES OF FRAGMENT MULTIPOLE CENTERS (ANGS)") >= 0) {
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
while (this.rd () != null && (atomName = this.parseTokenRange (this.line, 1, 2)) != null) {
|
||||
if (this.parseTokenRange (this.line, 1, 2).equals ("Z")) atomName = this.parseTokenRange (this.line, 2, 3);
|
||||
else if (this.parseTokenRange (this.line, 1, 9).equals ("FRAGNAME")) continue;
|
||||
else atomName = this.parseTokenRange (this.line, 1, 2);
|
||||
var x = this.parseFloatRange (this.line, 16, 31);
|
||||
var y = this.parseFloatRange (this.line, 31, 46);
|
||||
var z = this.parseFloatRange (this.line, 46, 61);
|
||||
if (Float.isNaN (x) || Float.isNaN (y) || Float.isNaN (z)) break;
|
||||
var atom = this.asc.addNewAtom ();
|
||||
atom.atomName = atomName + (++n);
|
||||
this.setAtomCoordXYZ (atom, x, y, z);
|
||||
this.atomNames.addLast (atomName);
|
||||
}
|
||||
}});
|
||||
Clazz.overrideMethod (c$, "fixShellTag",
|
||||
function (tag) {
|
||||
return tag;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "readPartialCharges",
|
||||
function () {
|
||||
var tokens = null;
|
||||
var searchstr = (this.lowdenCharges ? "LOW.POP." : "MULL.POP.");
|
||||
while (this.rd () != null && ("".equals (this.line.trim ()) || this.line.indexOf ("ATOM") >= 0)) {
|
||||
tokens = this.getTokens ();
|
||||
}
|
||||
var poploc = 0;
|
||||
for (; ++poploc < tokens.length; ) if (searchstr.equals (tokens[poploc])) break;
|
||||
|
||||
if (++poploc >= tokens.length || !"CHARGE".equals (tokens[poploc++])) return;
|
||||
var atoms = this.asc.atoms;
|
||||
var startAtom = this.asc.getLastAtomSetAtomIndex ();
|
||||
var endAtom = this.asc.ac;
|
||||
for (var i = startAtom; i < endAtom && this.rd () != null; ++i) atoms[i].partialCharge = this.parseFloatStr (JU.PT.getTokens (this.prevline)[poploc]);
|
||||
|
||||
});
|
||||
Clazz.defineMethod (c$, "readDipoleMoment",
|
||||
function () {
|
||||
var tokens = null;
|
||||
this.rd ();
|
||||
while (this.line != null && ("".equals (this.line.trim ()) || this.line.indexOf ("DX") < 0)) {
|
||||
this.rd ();
|
||||
}
|
||||
tokens = this.getTokens ();
|
||||
if (tokens.length != 5) return;
|
||||
if ("DX".equals (tokens[0]) && "DY".equals (tokens[1]) && "DZ".equals (tokens[2])) {
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
var dipole = JU.V3.new3 (this.parseFloatStr (tokens[0]), this.parseFloatStr (tokens[1]), this.parseFloatStr (tokens[2]));
|
||||
JU.Logger.info ("Molecular dipole for model " + this.asc.atomSetCount + " = " + dipole);
|
||||
this.asc.setCurrentModelInfo ("dipole", dipole);
|
||||
}});
|
||||
});
|
||||
@@ -0,0 +1,256 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.GaussianReader"], "J.adapter.readers.quantum.GaussianFchkReader", ["java.lang.Double", "$.Float", "java.util.Hashtable", "JU.AU", "$.Lst", "$.PT", "$.V3", "J.adapter.readers.quantum.BasisFunctionReader", "J.adapter.smarter.Bond", "JU.Escape", "$.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.fileData = null;
|
||||
this.atomCount = 0;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "GaussianFchkReader", J.adapter.readers.quantum.GaussianReader);
|
||||
Clazz.defineMethod (c$, "initializeReader",
|
||||
function () {
|
||||
Clazz.superCall (this, J.adapter.readers.quantum.GaussianFchkReader, "initializeReader", []);
|
||||
this.energyUnits = "";
|
||||
this.fileData = new java.util.Hashtable ();
|
||||
this.fileData.put ("title", this.rd ().trim ());
|
||||
this.calculationType = JU.PT.rep (this.rd (), " ", " ");
|
||||
this.asc.newAtomSet ();
|
||||
this.asc.setCurrentModelInfo ("fileData", this.fileData);
|
||||
this.readAllData ();
|
||||
this.readAtoms ();
|
||||
this.readBonds ();
|
||||
this.readDipoleMoment ();
|
||||
this.readPartialCharges ();
|
||||
this.readBasis ();
|
||||
this.readMolecularObitals ();
|
||||
this.checkForFreq ();
|
||||
this.continuing = false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "checkForFreq",
|
||||
function () {
|
||||
var n = this.fileData.get ("Vib-NDim");
|
||||
if (n == null) {
|
||||
this.readFrequencies ("NumFreq", false);
|
||||
return;
|
||||
}try {
|
||||
var nModes = n.intValue ();
|
||||
var vibE2 = this.fileData.get ("Vib-E2");
|
||||
var modes = this.fileData.get ("Vib-Modes");
|
||||
var frequencies = this.fillFloat (vibE2, 0, nModes);
|
||||
var red_masses = this.fillFloat (vibE2, nModes, nModes);
|
||||
var frc_consts = this.fillFloat (vibE2, nModes * 2, nModes);
|
||||
var intensities = this.fillFloat (vibE2, nModes * 3, nModes);
|
||||
var ac = this.asc.getLastAtomSetAtomCount ();
|
||||
var ignore = Clazz.newBooleanArray (nModes, false);
|
||||
var fpt = 0;
|
||||
for (var i = 0; i < nModes; ++i) {
|
||||
ignore[i] = !this.doGetVibration (++this.vibrationNumber);
|
||||
if (ignore[i]) continue;
|
||||
var iAtom0 = this.asc.ac;
|
||||
this.asc.cloneAtomSetWithBonds (true);
|
||||
var name = this.asc.setAtomSetFrequency ("Calculation " + this.calculationNumber, null, "" + frequencies[i], null);
|
||||
this.appendLoadNote ("model " + this.asc.atomSetCount + ": " + name);
|
||||
this.namedSets.set (this.asc.iSet);
|
||||
this.asc.setAtomSetModelProperty ("ReducedMass", red_masses[i] + " AMU");
|
||||
this.asc.setAtomSetModelProperty ("ForceConstant", frc_consts[i] + " mDyne/A");
|
||||
this.asc.setAtomSetModelProperty ("IRIntensity", intensities[i] + " KM/Mole");
|
||||
for (var iAtom = 0; iAtom < ac; iAtom++) {
|
||||
this.asc.addVibrationVectorWithSymmetry (iAtom0 + iAtom, modes[fpt++], modes[fpt++], modes[fpt++], false);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
JU.Logger.error ("Could not read Vib-E2 section: " + e.getMessage ());
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "fillFloat",
|
||||
function (f0, i, n) {
|
||||
var f = Clazz.newFloatArray (n, 0);
|
||||
for (var i1 = 0, ilast = i + n; i < ilast; i++, i1++) f[i1] = f0[i];
|
||||
|
||||
return f;
|
||||
}, "~A,~N,~N");
|
||||
Clazz.defineMethod (c$, "readAllData",
|
||||
function () {
|
||||
while ((this.line == null ? this.rd () : this.line) != null) {
|
||||
if (this.line.length < 40) {
|
||||
if (this.line.indexOf ("NumAtom") == 0) {
|
||||
return;
|
||||
}continue;
|
||||
}var name = JU.PT.rep (this.line.substring (0, 40).trim (), " ", "");
|
||||
var type = this.line.charAt (43);
|
||||
var isArray = (this.line.indexOf ("N=") >= 0);
|
||||
var v = this.line.substring (50).trim ();
|
||||
JU.Logger.info (name + " = " + v + " " + isArray);
|
||||
var o = null;
|
||||
if (isArray) {
|
||||
switch (type) {
|
||||
case 'I':
|
||||
case 'R':
|
||||
o = this.fillFloatArray (null, 0, Clazz.newFloatArray (this.parseIntStr (v), 0));
|
||||
this.line = null;
|
||||
break;
|
||||
default:
|
||||
v = this.rd ().trim ();
|
||||
while (this.rd () != null && this.line.indexOf (" N= ") < 0) v += " " + this.line.trim ();
|
||||
|
||||
o = v;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (type) {
|
||||
case 'I':
|
||||
o = Integer.$valueOf (this.parseIntStr (v));
|
||||
break;
|
||||
case 'R':
|
||||
o = Double.$valueOf (Double.parseDouble (v));
|
||||
break;
|
||||
case 'C':
|
||||
case 'L':
|
||||
o = v;
|
||||
break;
|
||||
}
|
||||
this.line = null;
|
||||
}if (o != null) this.fileData.put (name, o);
|
||||
}
|
||||
});
|
||||
Clazz.overrideMethod (c$, "readAtoms",
|
||||
function () {
|
||||
var atomNumbers = this.fileData.get ("Atomicnumbers");
|
||||
var data = this.fileData.get ("Currentcartesiancoordinates");
|
||||
var e = "" + this.fileData.get ("TotalEnergy");
|
||||
this.asc.setAtomSetEnergy (e, this.parseFloatStr (e));
|
||||
this.atomCount = atomNumbers.length;
|
||||
var f = 0.5291772;
|
||||
for (var i = 0, pt = 0; i < this.atomCount; i++) {
|
||||
var atom = this.asc.addNewAtom ();
|
||||
atom.elementNumber = Clazz.floatToShort (atomNumbers[i]);
|
||||
if (atom.elementNumber < 0) atom.elementNumber = 0;
|
||||
this.setAtomCoordXYZ (atom, data[pt++] * f, data[pt++] * f, data[pt++] * f);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readBonds",
|
||||
function () {
|
||||
try {
|
||||
var nBond = this.fileData.get ("NBond");
|
||||
var iBond = this.fileData.get ("IBond");
|
||||
if (nBond.length == 0) return;
|
||||
var rBond = this.fileData.get ("RBond");
|
||||
var mxBond = Clazz.doubleToInt (rBond.length / nBond.length);
|
||||
for (var ia = 0, pt = 0; ia < this.atomCount; ia++) for (var j = 0; j < mxBond; j++, pt++) {
|
||||
var ib = Clazz.floatToInt (iBond[pt]) - 1;
|
||||
if (ib <= ia) continue;
|
||||
var order = rBond[pt];
|
||||
var iorder = (order == 1.5 ? 515 : Clazz.floatToInt (order));
|
||||
this.asc.addBond ( new J.adapter.smarter.Bond (ia, ib, iorder));
|
||||
}
|
||||
|
||||
this.addJmolScript ("connect 1.1 {_H} {*} ");
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
JU.Logger.info ("GaussianFchkReader -- bonding ignored");
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
Clazz.overrideMethod (c$, "readDipoleMoment",
|
||||
function () {
|
||||
var data = this.fileData.get ("DipoleMoment");
|
||||
if (data == null) return;
|
||||
var dipole = JU.V3.new3 (data[0], data[1], data[2]);
|
||||
JU.Logger.info ("Molecular dipole for model " + this.asc.atomSetCount + " = " + dipole);
|
||||
this.asc.setCurrentModelInfo ("dipole", dipole);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "readPartialCharges",
|
||||
function () {
|
||||
var data = this.fileData.get ("Mulliken Charges");
|
||||
if (data == null) return;
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = 0; i < this.atomCount; ++i) {
|
||||
var c = data[i];
|
||||
atoms[i].partialCharge = c;
|
||||
if (Math.abs (c) > 0.8) atoms[i].formalCharge = Math.round (c);
|
||||
}
|
||||
JU.Logger.info ("Mulliken charges found for Model " + this.asc.atomSetCount);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "readBasis",
|
||||
function () {
|
||||
var types = this.fileData.get ("Shelltypes");
|
||||
this.gaussianCount = 0;
|
||||
this.shellCount = 0;
|
||||
if (types == null) return;
|
||||
this.shellCount = types.length;
|
||||
this.shells = new JU.Lst ();
|
||||
var pps = this.fileData.get ("Numberofprimitivespershell");
|
||||
var atomMap = this.fileData.get ("Shelltoatommap");
|
||||
var exps = this.fileData.get ("Primitiveexponents");
|
||||
var coefs = this.fileData.get ("Contractioncoefficients");
|
||||
var spcoefs = this.fileData.get ("P(S=P)Contractioncoefficients");
|
||||
this.gaussians = JU.AU.newFloat2 (exps.length);
|
||||
for (var i = 0; i < this.shellCount; i++) {
|
||||
var oType = J.adapter.readers.quantum.GaussianFchkReader.AO_TYPES[Clazz.floatToInt (types[i]) + 3];
|
||||
var nGaussians = Clazz.floatToInt (pps[i]);
|
||||
var iatom = Clazz.floatToInt (atomMap[i]);
|
||||
var slater = Clazz.newIntArray (4, 0);
|
||||
slater[0] = iatom;
|
||||
if (oType.equals ("F7") || oType.equals ("D5")) slater[1] = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagIDSpherical (oType.substring (0, 1));
|
||||
else slater[1] = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagID (oType);
|
||||
slater[2] = this.gaussianCount + 1;
|
||||
slater[3] = nGaussians;
|
||||
if (this.debugging) JU.Logger.debug ("Slater " + this.shells.size () + " " + JU.Escape.eAI (slater));
|
||||
this.shells.addLast (slater);
|
||||
for (var j = 0; j < nGaussians; j++) {
|
||||
var g = this.gaussians[this.gaussianCount] = Clazz.newFloatArray (3, 0);
|
||||
g[0] = exps[this.gaussianCount];
|
||||
g[1] = coefs[this.gaussianCount];
|
||||
if (spcoefs != null) g[2] = spcoefs[this.gaussianCount];
|
||||
this.gaussianCount++;
|
||||
}
|
||||
}
|
||||
JU.Logger.info (this.shellCount + " slater shells read");
|
||||
JU.Logger.info (this.gaussianCount + " gaussian primitives read");
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolecularObitals",
|
||||
function () {
|
||||
if (this.shells == null) return;
|
||||
var nElec = (this.fileData.get ("Numberofelectrons")).intValue ();
|
||||
var nAlpha = (this.fileData.get ("Numberofalphaelectrons")).intValue ();
|
||||
var nBeta = (this.fileData.get ("Numberofbetaelectrons")).intValue ();
|
||||
var aenergies = this.fileData.get ("AlphaOrbitalEnergies");
|
||||
var benergies = this.fileData.get ("BetaOrbitalEnergies");
|
||||
var acoefs = this.fileData.get ("AlphaMOcoefficients");
|
||||
var bcoefs = this.fileData.get ("BetaMOcoefficients");
|
||||
if (acoefs == null) return;
|
||||
var occ = (bcoefs == null ? 2 : 1);
|
||||
var n = (bcoefs == null ? nElec : nAlpha);
|
||||
this.getOrbitals (aenergies, acoefs, occ, n);
|
||||
if (bcoefs != null) this.getOrbitals (benergies, bcoefs, occ, nBeta);
|
||||
this.setMOData (false);
|
||||
});
|
||||
Clazz.defineMethod (c$, "getOrbitals",
|
||||
function (e, c, occ, nElec) {
|
||||
var nOrb = e.length;
|
||||
var nCoef = c.length;
|
||||
nCoef /= nOrb;
|
||||
this.alphaBeta = (occ == 2 ? "" : this.alphaBeta.equals ("alpha") ? "beta" : "alpha");
|
||||
var pt = 0;
|
||||
var n = 0;
|
||||
for (var i = 0; i < nOrb; i++) {
|
||||
var coefs = Clazz.newFloatArray (nCoef, 0);
|
||||
for (var j = 0; j < nCoef; j++) coefs[j] = c[pt++];
|
||||
|
||||
var mo = new java.util.Hashtable ();
|
||||
mo.put ("coefficients", coefs);
|
||||
mo.put ("occupancy", Float.$valueOf (occ));
|
||||
n += occ;
|
||||
if (n >= nElec) occ = 0;
|
||||
mo.put ("energy", Float.$valueOf (e[i]));
|
||||
mo.put ("type", this.alphaBeta);
|
||||
this.setMO (mo);
|
||||
}
|
||||
}, "~A,~A,~N,~N");
|
||||
Clazz.defineStatics (c$,
|
||||
"AO_TYPES", Clazz.newArray (-1, ["F7", "D5", "L", "S", "P", "D", "F", "G", "H"]));
|
||||
});
|
||||
@@ -0,0 +1,345 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.MOReader", "JU.BS"], "J.adapter.readers.quantum.GaussianReader", ["java.lang.Exception", "$.Float", "java.util.Hashtable", "JU.AU", "$.Lst", "$.PT", "$.V3", "J.adapter.readers.quantum.BasisFunctionReader", "J.adapter.smarter.SmarterJmolAdapter", "J.quantum.QS", "JU.Escape", "$.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.energyString = "";
|
||||
this.energyKey = "";
|
||||
this.calculationNumber = 1;
|
||||
this.scanPoint = -1;
|
||||
this.equivalentAtomSets = 0;
|
||||
this.stepNumber = 0;
|
||||
this.moModelSet = -1;
|
||||
this.namedSets = null;
|
||||
this.isHighPrecision = false;
|
||||
this.haveHighPrecision = false;
|
||||
this.allowHighPrecision = false;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "GaussianReader", J.adapter.readers.quantum.MOReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.namedSets = new JU.BS ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.allowHighPrecision = !this.checkAndRemoveFilterKey ("NOHP");
|
||||
Clazz.superCall (this, J.adapter.readers.quantum.GaussianReader, "initializeReader", []);
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.startsWith (" Step number")) {
|
||||
this.equivalentAtomSets = 0;
|
||||
this.stepNumber++;
|
||||
var scanPointIndex = this.line.indexOf ("scan point");
|
||||
if (scanPointIndex > 0) {
|
||||
this.scanPoint = this.parseIntAt (this.line, scanPointIndex + 10);
|
||||
} else {
|
||||
this.scanPoint = -1;
|
||||
}return true;
|
||||
}if (this.line.indexOf ("-- Stationary point found") > 0) {
|
||||
if (this.scanPoint >= 0) this.scanPoint++;
|
||||
return true;
|
||||
}if (this.line.indexOf ("Input orientation:") >= 0 || this.line.indexOf ("Z-Matrix orientation:") >= 0 || this.line.indexOf ("Standard orientation:") >= 0) {
|
||||
if (!this.doGetModel (++this.modelNumber, null)) {
|
||||
return this.checkLastModel ();
|
||||
}this.equivalentAtomSets++;
|
||||
JU.Logger.info (this.asc.atomSetCount + " model " + this.modelNumber + " step " + this.stepNumber + " equivalentAtomSet " + this.equivalentAtomSets + " calculation " + this.calculationNumber + " scan point " + this.scanPoint + this.line);
|
||||
this.readAtoms ();
|
||||
return false;
|
||||
}if (!this.doProcessLines) return true;
|
||||
if (this.line.startsWith (" Energy=")) {
|
||||
this.setEnergy ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" SCF Done:")) {
|
||||
this.readSCFDone ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" Harmonic frequencies")) {
|
||||
this.readFrequencies (":", true);
|
||||
return true;
|
||||
}if (this.line.startsWith (" Total atomic charges:") || this.line.startsWith (" Mulliken atomic charges:")) {
|
||||
this.readPartialCharges ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" Dipole moment")) {
|
||||
this.readDipoleMoment ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" Standard basis:") || this.line.startsWith (" General basis read from")) {
|
||||
this.energyUnits = "";
|
||||
this.calculationType = this.line.substring (this.line.indexOf (":") + 1).trim ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" AO basis set")) {
|
||||
this.readBasis ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("Molecular Orbital Coefficients") >= 0 || this.line.indexOf ("Natural Orbital Coefficients") >= 0 || this.line.indexOf ("Natural Transition Orbitals") >= 0) {
|
||||
if (!this.filterMO ()) return true;
|
||||
this.readMolecularOrbitals ();
|
||||
JU.Logger.info (this.orbitals.size () + " molecular orbitals read");
|
||||
return true;
|
||||
}if (this.line.startsWith (" Normal termination of Gaussian")) {
|
||||
++this.calculationNumber;
|
||||
this.equivalentAtomSets = 0;
|
||||
return true;
|
||||
}if (this.line.startsWith (" Mulliken atomic spin densities:")) {
|
||||
this.getSpinDensities (11);
|
||||
return true;
|
||||
}if (this.line.startsWith (" Mulliken charges and spin densities:")) {
|
||||
this.getSpinDensities (21);
|
||||
return true;
|
||||
}return this.checkNboLine ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "getSpinDensities",
|
||||
function (pt) {
|
||||
this.rd ();
|
||||
var data = Clazz.newFloatArray (this.asc.getLastAtomSetAtomCount (), 0);
|
||||
for (var i = 0; i < data.length; i++) data[i] = this.parseFloatStr (this.rd ().substring (pt, pt + 10));
|
||||
|
||||
this.asc.setAtomProperties ("spin", data, -1, false);
|
||||
this.appendLoadNote (data.length + " spin densities loaded into model " + (this.asc.iSet + 1));
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "readSCFDone",
|
||||
function () {
|
||||
var tokens = JU.PT.getTokensAt (this.line, 11);
|
||||
if (tokens.length < 4) return;
|
||||
this.energyKey = tokens[0];
|
||||
this.asc.setAtomSetEnergy (tokens[2], this.parseFloatStr (tokens[2]));
|
||||
this.energyString = tokens[2] + " " + tokens[3];
|
||||
this.setNames (this.energyKey + " = " + this.energyString, this.namedSets, this.equivalentAtomSets);
|
||||
this.setProps (this.energyKey, this.energyString, this.equivalentAtomSets);
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
if (tokens.length > 2) {
|
||||
this.setProps (tokens[0], tokens[2], this.equivalentAtomSets);
|
||||
if (tokens.length > 5) this.setProps (tokens[3], tokens[5], this.equivalentAtomSets);
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
}if (tokens.length > 2) this.setProps (tokens[0], tokens[2], this.equivalentAtomSets);
|
||||
});
|
||||
Clazz.defineMethod (c$, "setProps",
|
||||
function (key, value, n) {
|
||||
for (var i = this.asc.iSet; --n >= 0 && i >= 0; --i) this.asc.setAtomSetModelPropertyForSet (key, value, i);
|
||||
|
||||
}, "~S,~S,~N");
|
||||
Clazz.defineMethod (c$, "setNames",
|
||||
function (atomSetName, namedSets, n) {
|
||||
for (var i = this.asc.iSet; --n >= 0 && i >= 0; --i) if (namedSets == null || !namedSets.get (i)) this.asc.setModelInfoForSet ("name", atomSetName, i);
|
||||
|
||||
}, "~S,JU.BS,~N");
|
||||
Clazz.defineMethod (c$, "setEnergy",
|
||||
function () {
|
||||
var tokens = this.getTokens ();
|
||||
this.energyKey = "Energy";
|
||||
this.energyString = tokens[1];
|
||||
this.setNames ("Energy = " + tokens[1], this.namedSets, this.equivalentAtomSets);
|
||||
this.asc.setAtomSetEnergy (this.energyString, this.parseFloatStr (this.energyString));
|
||||
});
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function () {
|
||||
this.asc.newAtomSet ();
|
||||
this.haveHighPrecision = false;
|
||||
if (this.energyKey.length != 0) this.asc.setAtomSetName (this.energyKey + " = " + this.energyString);
|
||||
this.asc.setAtomSetEnergy (this.energyString, this.parseFloatStr (this.energyString));
|
||||
var path = this.getTokens ()[0];
|
||||
this.readLines (4);
|
||||
var tokens;
|
||||
while (this.rd () != null && !this.line.startsWith (" --")) {
|
||||
tokens = this.getTokens ();
|
||||
var atom = this.asc.addNewAtom ();
|
||||
atom.elementNumber = this.parseIntStr (tokens[1]);
|
||||
if (atom.elementNumber < 0) atom.elementNumber = 0;
|
||||
this.setAtomCoordTokens (atom, tokens, tokens.length - 3);
|
||||
}
|
||||
this.asc.setAtomSetModelProperty (".PATH", "Calculation " + this.calculationNumber + (this.scanPoint >= 0 ? (J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR + "Scan Point " + this.scanPoint) : "") + J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR + path);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readBasis",
|
||||
function () {
|
||||
this.shells = new JU.Lst ();
|
||||
var gdata = new JU.Lst ();
|
||||
var ac = 0;
|
||||
this.gaussianCount = 0;
|
||||
this.shellCount = 0;
|
||||
var lastAtom = "";
|
||||
var tokens;
|
||||
var doSphericalD = (this.calculationType != null && (this.calculationType.indexOf ("5D") > 0));
|
||||
var doSphericalF = (this.calculationType != null && (this.calculationType.indexOf ("7F") > 0));
|
||||
var isGeneral = (this.line.indexOf ("general basis input") >= 0);
|
||||
if (isGeneral) {
|
||||
while (this.rd () != null && this.line.length > 0) {
|
||||
this.shellCount++;
|
||||
tokens = this.getTokens ();
|
||||
ac++;
|
||||
while (this.rd ().indexOf ("****") < 0) {
|
||||
var slater = Clazz.newIntArray (4, 0);
|
||||
slater[0] = ac;
|
||||
tokens = this.getTokens ();
|
||||
var oType = tokens[0];
|
||||
if (doSphericalF && oType.indexOf ("F") >= 0 || doSphericalD && oType.indexOf ("D") >= 0) slater[1] = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagIDSpherical (oType);
|
||||
else slater[1] = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagID (oType);
|
||||
var nGaussians = this.parseIntStr (tokens[1]);
|
||||
slater[2] = this.gaussianCount + 1;
|
||||
slater[3] = nGaussians;
|
||||
if (this.debugging) JU.Logger.debug ("Slater " + this.shells.size () + " " + JU.Escape.eAI (slater));
|
||||
this.shells.addLast (slater);
|
||||
this.gaussianCount += nGaussians;
|
||||
for (var i = 0; i < nGaussians; i++) {
|
||||
this.rd ();
|
||||
this.line = JU.PT.rep (this.line, "D ", "D+");
|
||||
tokens = this.getTokens ();
|
||||
if (this.debugging) JU.Logger.debug ("Gaussians " + (i + 1) + " " + JU.Escape.eAS (tokens, true));
|
||||
gdata.addLast (tokens);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (this.rd () != null && this.line.startsWith (" Atom")) {
|
||||
this.shellCount++;
|
||||
tokens = this.getTokens ();
|
||||
var slater = Clazz.newIntArray (4, 0);
|
||||
if (!tokens[1].equals (lastAtom)) ac++;
|
||||
lastAtom = tokens[1];
|
||||
slater[0] = ac;
|
||||
var oType = tokens[4];
|
||||
if (doSphericalF && oType.indexOf ("F") >= 0 || doSphericalD && oType.indexOf ("D") >= 0) slater[1] = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagIDSpherical (oType);
|
||||
else slater[1] = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagID (oType);
|
||||
var nGaussians = this.parseIntStr (tokens[5]);
|
||||
slater[2] = this.gaussianCount + 1;
|
||||
slater[3] = nGaussians;
|
||||
this.shells.addLast (slater);
|
||||
this.gaussianCount += nGaussians;
|
||||
for (var i = 0; i < nGaussians; i++) {
|
||||
gdata.addLast (JU.PT.getTokens (this.rd ()));
|
||||
}
|
||||
}
|
||||
}if (ac == 0) ac = 1;
|
||||
this.gaussians = JU.AU.newFloat2 (this.gaussianCount);
|
||||
for (var i = 0; i < this.gaussianCount; i++) {
|
||||
tokens = gdata.get (i);
|
||||
this.gaussians[i] = Clazz.newFloatArray (tokens.length, 0);
|
||||
for (var j = 0; j < tokens.length; j++) this.gaussians[i][j] = this.parseFloatStr (tokens[j]);
|
||||
|
||||
}
|
||||
JU.Logger.info (this.shellCount + " slater shells read");
|
||||
JU.Logger.info (this.gaussianCount + " gaussian primitives read");
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolecularOrbitals",
|
||||
function () {
|
||||
if (this.shells == null) return;
|
||||
var mos = JU.AU.createArrayOfHashtable (5);
|
||||
var data = JU.AU.createArrayOfArrayList (5);
|
||||
var nThisLine = 0;
|
||||
var isNOtype = this.line.contains ("Natural Orbital");
|
||||
while (this.rd () != null && this.line.toUpperCase ().indexOf ("DENS") < 0) {
|
||||
var tokens;
|
||||
if (this.line.indexOf ("eta Molecular Orbital Coefficients") >= 0) {
|
||||
this.addMOData (nThisLine, data, mos);
|
||||
nThisLine = 0;
|
||||
if (!this.filterMO ()) break;
|
||||
}if (this.line.indexOf (" ") == 0) {
|
||||
this.addMOData (nThisLine, data, mos);
|
||||
if (isNOtype) {
|
||||
tokens = this.getTokens ();
|
||||
nThisLine = tokens.length;
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
} else {
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
nThisLine = tokens.length;
|
||||
}for (var i = 0; i < nThisLine; i++) {
|
||||
mos[i] = new java.util.Hashtable ();
|
||||
data[i] = new JU.Lst ();
|
||||
var sym;
|
||||
if (isNOtype) {
|
||||
mos[i].put ("occupancy", Float.$valueOf (JU.PT.parseFloat (tokens[i + 2])));
|
||||
} else {
|
||||
sym = tokens[i];
|
||||
mos[i].put ("symmetry", sym);
|
||||
if (sym.indexOf ("O") >= 0) mos[i].put ("occupancy", Float.$valueOf (2));
|
||||
else if (sym.indexOf ("V") >= 0) mos[i].put ("occupancy", Float.$valueOf (0));
|
||||
}}
|
||||
if (isNOtype) continue;
|
||||
this.line = this.rd ().substring (21);
|
||||
tokens = this.getTokens ();
|
||||
if (tokens.length != nThisLine) tokens = J.adapter.smarter.AtomSetCollectionReader.getStrings (this.line, nThisLine, 10);
|
||||
for (var i = 0; i < nThisLine; i++) {
|
||||
mos[i].put ("energy", Float.$valueOf (JU.PT.fVal (tokens[i])));
|
||||
}
|
||||
continue;
|
||||
} else if (this.line.length < 21 || (this.line.charAt (5) != ' ' && !JU.PT.isDigit (this.line.charAt (5)))) {
|
||||
continue;
|
||||
}try {
|
||||
this.line = JU.PT.rep (this.line, " 0 ", "0 ");
|
||||
tokens = this.getTokens ();
|
||||
var type = tokens[tokens.length - nThisLine - 1].substring (1);
|
||||
if (JU.PT.isDigit (type.charAt (0))) type = type.substring (1);
|
||||
if (!J.quantum.QS.isQuantumBasisSupported (type.charAt (0)) && "XYZ".indexOf (type.charAt (0)) >= 0) type = (type.length == 2 ? "D" : "F") + type;
|
||||
if (!J.quantum.QS.isQuantumBasisSupported (type.charAt (0))) continue;
|
||||
tokens = J.adapter.smarter.AtomSetCollectionReader.getStrings (this.line.substring (this.line.length - 10 * nThisLine), nThisLine, 10);
|
||||
for (var i = 0; i < nThisLine; i++) data[i].addLast (tokens[i]);
|
||||
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
JU.Logger.error ("Error reading Gaussian file Molecular Orbitals at line: " + this.line);
|
||||
break;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.addMOData (nThisLine, data, mos);
|
||||
this.setMOData (this.moModelSet != this.asc.atomSetCount);
|
||||
this.moModelSet = this.asc.atomSetCount;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readFrequencies",
|
||||
function (key, mustHave) {
|
||||
this.discardLinesUntilContains2 (key, ":");
|
||||
if (this.line == null && mustHave) throw ( new Exception ("No frequencies encountered"));
|
||||
while ((this.line = this.rd ()) != null && this.line.length > 15) {
|
||||
var symmetries = JU.PT.getTokens (this.rd ());
|
||||
this.discardLinesUntilContains (" Frequencies");
|
||||
this.isHighPrecision = (this.line.indexOf ("---") > 0);
|
||||
if (this.isHighPrecision ? !this.allowHighPrecision : this.haveHighPrecision) return;
|
||||
if (this.isHighPrecision && !this.haveHighPrecision) {
|
||||
this.appendLoadNote ("high precision vibrational modes enabled. Use filter 'NOHP' to disable.");
|
||||
this.haveHighPrecision = true;
|
||||
}var width = (this.isHighPrecision ? 22 : 15);
|
||||
var frequencies = JU.PT.getTokensAt (this.line, width);
|
||||
var red_masses = JU.PT.getTokensAt (this.discardLinesUntilContains (this.isHighPrecision ? "Reduced masses" : "Red. masses"), width);
|
||||
var frc_consts = JU.PT.getTokensAt (this.discardLinesUntilContains (this.isHighPrecision ? "Force constants" : "Frc consts"), width);
|
||||
var intensities = JU.PT.getTokensAt (this.discardLinesUntilContains (this.isHighPrecision ? "IR Intensities" : "IR Inten"), width);
|
||||
var iAtom0 = this.asc.ac;
|
||||
var ac = this.asc.getLastAtomSetAtomCount ();
|
||||
var frequencyCount = frequencies.length;
|
||||
var ignore = Clazz.newBooleanArray (frequencyCount, false);
|
||||
for (var i = 0; i < frequencyCount; ++i) {
|
||||
ignore[i] = !this.doGetVibration (++this.vibrationNumber);
|
||||
if (ignore[i]) continue;
|
||||
this.asc.cloneAtomSetWithBonds (true);
|
||||
var name = this.asc.setAtomSetFrequency ("Calculation " + this.calculationNumber, symmetries[i], frequencies[i], null);
|
||||
this.appendLoadNote ("model " + this.asc.atomSetCount + ": " + name);
|
||||
this.namedSets.set (this.asc.iSet);
|
||||
this.asc.setAtomSetModelProperty ("ReducedMass", red_masses[i] + " AMU");
|
||||
this.asc.setAtomSetModelProperty ("ForceConstant", frc_consts[i] + " mDyne/A");
|
||||
this.asc.setAtomSetModelProperty ("IRIntensity", intensities[i] + " KM/Mole");
|
||||
}
|
||||
this.discardLinesUntilContains (" Atom ");
|
||||
if (this.isHighPrecision) this.fillFrequencyData (iAtom0, ac, ac, ignore, false, 23, 10, null, 0);
|
||||
else this.fillFrequencyData (iAtom0, ac, ac, ignore, true, 0, 0, null, 0);
|
||||
}
|
||||
}, "~S,~B");
|
||||
Clazz.defineMethod (c$, "readDipoleMoment",
|
||||
function () {
|
||||
var tokens = JU.PT.getTokens (this.rd ());
|
||||
if (tokens.length != 8) return;
|
||||
var dipole = JU.V3.new3 (this.parseFloatStr (tokens[1]), this.parseFloatStr (tokens[3]), this.parseFloatStr (tokens[5]));
|
||||
JU.Logger.info ("Molecular dipole for model " + this.asc.atomSetCount + " = " + dipole);
|
||||
this.asc.setCurrentModelInfo ("dipole", dipole);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readPartialCharges",
|
||||
function () {
|
||||
this.rd ();
|
||||
var ac = this.asc.ac;
|
||||
var i0 = this.asc.getLastAtomSetAtomIndex ();
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = i0; i < ac; ++i) {
|
||||
while (atoms[i].elementNumber == 0) ++i;
|
||||
|
||||
var charge = this.parseFloatStr (JU.PT.getTokens (this.rd ())[2]);
|
||||
atoms[i].partialCharge = charge;
|
||||
}
|
||||
JU.Logger.info ("Mulliken charges found for Model " + this.asc.atomSetCount);
|
||||
});
|
||||
Clazz.defineStatics (c$,
|
||||
"STD_ORIENTATION_ATOMIC_NUMBER_OFFSET", 1);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.smarter.AtomSetCollectionReader"], "J.adapter.readers.quantum.GaussianWfnReader", null, function () {
|
||||
c$ = Clazz.declareType (J.adapter.readers.quantum, "GaussianWfnReader", J.adapter.smarter.AtomSetCollectionReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.continuing = false;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,396 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.MOReader"], "J.adapter.readers.quantum.GenNBOReader", ["java.lang.Boolean", "$.Exception", "$.Float", "java.util.Hashtable", "JU.AU", "$.Lst", "$.PT", "$.Rdr", "$.SB", "J.adapter.readers.quantum.NBOParser", "J.quantum.QS", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.isOutputFile = false;
|
||||
this.nboType = "";
|
||||
this.nOrbitals0 = 0;
|
||||
this.is47File = false;
|
||||
this.isOpenShell = false;
|
||||
this.alphaOnly = false;
|
||||
this.betaOnly = false;
|
||||
this.nAOs = 0;
|
||||
this.topoType = "A";
|
||||
this.nStructures = 0;
|
||||
this.nboParser = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "GenNBOReader", J.adapter.readers.quantum.MOReader);
|
||||
Clazz.defineMethod (c$, "initializeReader",
|
||||
function () {
|
||||
var line1 = this.rd ().trim ();
|
||||
this.is47File = (line1.indexOf ("$GENNBO") >= 0 || line1.indexOf ("$NBO") >= 0);
|
||||
this.alphaOnly = this.is47File || this.checkFilterKey ("ALPHA");
|
||||
this.betaOnly = !this.is47File && this.checkFilterKey ("BETA");
|
||||
if (this.is47File) {
|
||||
this.readData47 ();
|
||||
return;
|
||||
}var isOK;
|
||||
var line2 = this.rd ();
|
||||
this.line = line1 + line2;
|
||||
this.isOutputFile = (line2.indexOf ("****") >= 0);
|
||||
if (this.isOutputFile) {
|
||||
isOK = this.getFile31 ();
|
||||
Clazz.superCall (this, J.adapter.readers.quantum.GenNBOReader, "initializeReader", []);
|
||||
this.moData.put ("isNormalized", Boolean.TRUE);
|
||||
} else if (line2.indexOf ("s in the AO basis:") >= 0) {
|
||||
this.nboType = line2.substring (1, line2.indexOf ("s"));
|
||||
this.asc.setCollectionName (line1 + ": " + this.nboType + "s");
|
||||
isOK = this.getFile31 ();
|
||||
} else {
|
||||
this.nboType = "AO";
|
||||
this.asc.setCollectionName (line1 + ": " + this.nboType + "s");
|
||||
isOK = this.readData31 (line1);
|
||||
}if (!isOK) JU.Logger.error ("Unimplemented shell type -- no orbitals available: " + this.line);
|
||||
if (this.isOutputFile) return;
|
||||
if (isOK) this.readMOs ();
|
||||
this.continuing = false;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
this.appendLoadNote ("NBO type " + this.nboType);
|
||||
if (this.isOpenShell) this.asc.setCurrentModelInfo ("isOpenShell", Boolean.TRUE);
|
||||
this.finalizeReaderASCR ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMOs",
|
||||
function () {
|
||||
this.nOrbitals0 = this.orbitals.size ();
|
||||
this.getFile46 ();
|
||||
if (this.betaOnly) {
|
||||
this.discardLinesUntilContains ("BETA");
|
||||
this.filterMO ();
|
||||
}var isAO = this.nboType.equals ("AO");
|
||||
var isNBO = !isAO && !this.nboType.equals ("MO");
|
||||
this.nOrbitals = this.orbitals.size ();
|
||||
if (this.nOrbitals == 0) return;
|
||||
this.line = null;
|
||||
if (!isNBO) this.nOrbitals = this.nOrbitals0 + this.nAOs;
|
||||
for (var i = this.nOrbitals0; i < this.nOrbitals; i++) {
|
||||
var mo = this.orbitals.get (i);
|
||||
var coefs = Clazz.newFloatArray (this.nAOs, 0);
|
||||
mo.put ("coefficients", coefs);
|
||||
if (!isAO) {
|
||||
if (this.line == null) {
|
||||
while (this.rd () != null && Float.isNaN (this.parseFloatStr (this.line))) {
|
||||
this.filterMO ();
|
||||
}
|
||||
} else {
|
||||
this.line = null;
|
||||
}this.fillFloatArray (this.line, 0, coefs);
|
||||
if (Float.isNaN (coefs[0])) System.out.println ("testing gennboreader");
|
||||
this.line = null;
|
||||
} else {
|
||||
coefs[i] = 1;
|
||||
}}
|
||||
if (this.nboType.equals ("NBO")) {
|
||||
var occupancies = Clazz.newFloatArray (this.nOrbitals - this.nOrbitals0, 0);
|
||||
this.fillFloatArray (null, 0, occupancies);
|
||||
for (var i = this.nOrbitals0; i < this.nOrbitals; i++) {
|
||||
var mo = this.orbitals.get (i);
|
||||
mo.put ("occupancy", Float.$valueOf (occupancies[i - this.nOrbitals0]));
|
||||
}
|
||||
}this.moData.put (this.nboType + "_coefs", this.orbitals);
|
||||
this.setMOData (false);
|
||||
this.moData.put ("isNormalized", Boolean.TRUE);
|
||||
this.moData.put ("nboType", this.nboType);
|
||||
JU.Logger.info ((this.orbitals.size () - this.nOrbitals0) + " orbitals read");
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.indexOf ("SECOND ORDER PERTURBATION THEORY ANALYSIS") >= 0 && !this.orbitalsRead) {
|
||||
this.nboType = "NBO";
|
||||
var data = this.getFileData (".37");
|
||||
if (data == null) return true;
|
||||
var readerSave = this.reader;
|
||||
this.reader = JU.Rdr.getBR (data);
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
this.readMOs ();
|
||||
this.reader = readerSave;
|
||||
this.orbitalsRead = false;
|
||||
return true;
|
||||
}if (this.line.indexOf ("$NRTSTRA") >= 0) {
|
||||
this.getStructures ("NRTSTRA");
|
||||
return true;
|
||||
}if (this.line.indexOf ("$NRTSTRB") >= 0) {
|
||||
this.getStructures ("NRTSTRB");
|
||||
return true;
|
||||
}if (this.line.indexOf ("$NRTSTR") >= 0) {
|
||||
this.getStructures ("NRTSTR");
|
||||
return true;
|
||||
}if (this.line.indexOf (" TOPO ") >= 0) {
|
||||
this.getStructures ("TOPO" + this.topoType);
|
||||
this.topoType = "B";
|
||||
return true;
|
||||
}if (this.line.indexOf ("$CHOOSE") >= 0) {
|
||||
this.getStructures ("CHOOSE");
|
||||
return true;
|
||||
}return this.checkNboLine ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "getStructures",
|
||||
function (type) {
|
||||
if (this.nboParser == null) this.nboParser = new J.adapter.readers.quantum.NBOParser ();
|
||||
var structures = this.getStructureList ();
|
||||
var sb = new JU.SB ();
|
||||
while (!this.rd ().trim ().equals ("$END")) sb.append (this.line).append ("\n");
|
||||
|
||||
this.nStructures = this.nboParser.getStructures (sb.toString (), type, structures);
|
||||
this.appendLoadNote (this.nStructures + " NBO " + type + " resonance structures");
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "getStructureList",
|
||||
function () {
|
||||
var structures = this.asc.getAtomSetAuxiliaryInfo (this.asc.iSet).get ("nboStructures");
|
||||
if (structures == null) this.asc.setCurrentModelInfo ("nboStructures", structures = new JU.Lst ());
|
||||
return structures;
|
||||
});
|
||||
Clazz.defineMethod (c$, "getFileData",
|
||||
function (ext) {
|
||||
var fileName = this.htParams.get ("fullPathName");
|
||||
var pt = fileName.lastIndexOf (".");
|
||||
if (pt < 0) pt = fileName.length;
|
||||
fileName = fileName.substring (0, pt);
|
||||
this.moData.put ("nboRoot", fileName);
|
||||
fileName += ext;
|
||||
var data = this.vwr.getFileAsString3 (fileName, false, null);
|
||||
JU.Logger.info (data.length + " bytes read from " + fileName);
|
||||
if (data.length == 0 || data.indexOf ("java.io.FileNotFound") >= 0 && this.nboType !== "AO") throw new Exception (" supplemental file " + fileName + " was not found");
|
||||
return data;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "getFile31",
|
||||
function () {
|
||||
var data = this.getFileData (".31");
|
||||
var readerSave = this.reader;
|
||||
this.reader = JU.Rdr.getBR (data);
|
||||
return (this.readData31 (null) && (this.reader = readerSave) != null);
|
||||
});
|
||||
Clazz.defineMethod (c$, "getFile46",
|
||||
function () {
|
||||
var data = this.getFileData (".46");
|
||||
var readerSave = this.reader;
|
||||
this.reader = JU.Rdr.getBR (data);
|
||||
this.readData46 ();
|
||||
this.reader = readerSave;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readData47",
|
||||
function () {
|
||||
this.allowNoOrbitals = true;
|
||||
this.discardLinesUntilContains ("$COORD");
|
||||
this.asc.newAtomSet ();
|
||||
this.asc.setAtomSetName (this.rd ().trim ());
|
||||
while (this.rd ().indexOf ("$END") < 0) {
|
||||
var tokens = this.getTokens ();
|
||||
this.addAtomXYZSymName (tokens, 2, null, null).elementNumber = this.parseIntStr (tokens[0]);
|
||||
}
|
||||
this.discardLinesUntilContains ("$BASIS");
|
||||
var centers = this.getIntData ();
|
||||
var labels = this.getIntData ();
|
||||
this.discardLinesUntilContains ("NSHELL =");
|
||||
this.shellCount = this.parseIntAt (this.line, 10);
|
||||
this.gaussianCount = this.parseIntAt (this.rd (), 10);
|
||||
this.rd ();
|
||||
var ncomp = this.getIntData ();
|
||||
var nprim = this.getIntData ();
|
||||
var nptr = this.getIntData ();
|
||||
this.shells = new JU.Lst ();
|
||||
this.gaussians = JU.AU.newFloat2 (this.gaussianCount);
|
||||
for (var i = 0; i < this.gaussianCount; i++) this.gaussians[i] = Clazz.newFloatArray (6, 0);
|
||||
|
||||
this.nOrbitals = 0;
|
||||
var ptCenter = 0;
|
||||
var l = this.line;
|
||||
for (var i = 0; i < this.shellCount; i++) {
|
||||
var slater = Clazz.newIntArray (4, 0);
|
||||
var nc = ncomp[i];
|
||||
slater[0] = centers[ptCenter];
|
||||
this.line = "";
|
||||
for (var ii = 0; ii < nc; ii++) this.line += labels[ptCenter++] + " ";
|
||||
|
||||
if (!this.fillSlater (slater, nc, nptr[i] - 1, nprim[i])) return;
|
||||
}
|
||||
this.line = l;
|
||||
this.getAlphasAndExponents ();
|
||||
this.nboType = "AO";
|
||||
this.readMOs ();
|
||||
this.continuing = false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "getIntData",
|
||||
function () {
|
||||
while (this.line.indexOf ("=") < 0) this.rd ();
|
||||
|
||||
var s = this.line.substring (this.line.indexOf ("=") + 1);
|
||||
this.line = "";
|
||||
while (this.rd ().indexOf ("=") < 0 && this.line.indexOf ("$") < 0) s += this.line;
|
||||
|
||||
var tokens = JU.PT.getTokens (s);
|
||||
var f = Clazz.newIntArray (tokens.length, 0);
|
||||
for (var i = f.length; --i >= 0; ) f[i] = this.parseIntStr (tokens[i]);
|
||||
|
||||
return f;
|
||||
});
|
||||
Clazz.defineMethod (c$, "fillSlater",
|
||||
function (slater, n, pt, ng) {
|
||||
this.nOrbitals += n;
|
||||
switch (n) {
|
||||
case 1:
|
||||
slater[1] = 0;
|
||||
break;
|
||||
case 3:
|
||||
if (!this.getDFMap ("P", this.line, 1, J.adapter.readers.quantum.GenNBOReader.$P_LIST, 3)) return false;
|
||||
slater[1] = 1;
|
||||
break;
|
||||
case 4:
|
||||
if (!this.getDFMap ("SP", this.line, 2, J.adapter.readers.quantum.GenNBOReader.SP_LIST, 1)) return false;
|
||||
slater[1] = 2;
|
||||
break;
|
||||
case 5:
|
||||
if (!this.getDFMap ("DS", this.line, 3, J.adapter.readers.quantum.GenNBOReader.$DS_LIST, 3)) return false;
|
||||
slater[1] = 3;
|
||||
break;
|
||||
case 6:
|
||||
if (!this.getDFMap ("DC", this.line, 4, J.adapter.readers.quantum.GenNBOReader.$DC_LIST, 3)) return false;
|
||||
slater[1] = 4;
|
||||
break;
|
||||
case 7:
|
||||
if (!this.getDFMap ("FS", this.line, 5, J.adapter.readers.quantum.GenNBOReader.$FS_LIST, 3)) return false;
|
||||
slater[1] = 5;
|
||||
break;
|
||||
case 10:
|
||||
if (!this.getDFMap ("FC", this.line, 6, J.adapter.readers.quantum.GenNBOReader.$FC_LIST, 3)) return false;
|
||||
slater[1] = 6;
|
||||
break;
|
||||
}
|
||||
slater[2] = pt + 1;
|
||||
slater[3] = ng;
|
||||
this.shells.addLast (slater);
|
||||
return true;
|
||||
}, "~A,~N,~N,~N");
|
||||
Clazz.defineMethod (c$, "getAlphasAndExponents",
|
||||
function () {
|
||||
for (var j = 0; j < 5; j++) {
|
||||
if (this.line.indexOf ("=") < 0) this.rd ();
|
||||
if (this.line.indexOf ("$END") >= 0) break;
|
||||
this.line = this.line.substring (this.line.indexOf ("=") + 1);
|
||||
var temp = this.fillFloatArray (this.line, 0, Clazz.newFloatArray (this.gaussianCount, 0));
|
||||
for (var i = 0; i < this.gaussianCount; i++) {
|
||||
this.gaussians[i][j] = temp[i];
|
||||
if (j > 1) this.gaussians[i][5] += temp[i];
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < this.gaussianCount; i++) {
|
||||
if (this.gaussians[i][1] == 0) this.gaussians[i][1] = this.gaussians[i][5];
|
||||
}
|
||||
if (this.debugging) {
|
||||
JU.Logger.debug (this.shells.size () + " slater shells read");
|
||||
JU.Logger.debug (this.gaussians.length + " gaussian primitives read");
|
||||
}});
|
||||
Clazz.defineMethod (c$, "readData31",
|
||||
function (line1) {
|
||||
if (line1 == null) {
|
||||
line1 = this.rd ();
|
||||
this.rd ();
|
||||
}this.rd ();
|
||||
var tokens = JU.PT.getTokens (this.rd ());
|
||||
var ac = this.parseIntStr (tokens[0]);
|
||||
this.shellCount = this.parseIntStr (tokens[1]);
|
||||
this.gaussianCount = this.parseIntStr (tokens[2]);
|
||||
this.rd ();
|
||||
this.asc.newAtomSet ();
|
||||
this.asc.setAtomSetName (this.nboType + "s: " + line1.trim ());
|
||||
this.asc.setCurrentModelInfo ("nboType", this.nboType);
|
||||
for (var i = 0; i < ac; i++) {
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
var z = this.parseIntStr (tokens[0]);
|
||||
if (z < 0) continue;
|
||||
var atom = this.asc.addNewAtom ();
|
||||
atom.elementNumber = z;
|
||||
this.setAtomCoordTokens (atom, tokens, 1);
|
||||
}
|
||||
this.shells = new JU.Lst ();
|
||||
this.gaussians = JU.AU.newFloat2 (this.gaussianCount);
|
||||
for (var i = 0; i < this.gaussianCount; i++) this.gaussians[i] = Clazz.newFloatArray (6, 0);
|
||||
|
||||
this.rd ();
|
||||
this.nOrbitals = 0;
|
||||
for (var i = 0; i < this.shellCount; i++) {
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
var slater = Clazz.newIntArray (4, 0);
|
||||
slater[0] = this.parseIntStr (tokens[0]);
|
||||
var n = this.parseIntStr (tokens[1]);
|
||||
var pt = this.parseIntStr (tokens[2]) - 1;
|
||||
var ng = this.parseIntStr (tokens[3]);
|
||||
this.line = this.rd ().trim ();
|
||||
if (!this.fillSlater (slater, n, pt, ng)) return false;
|
||||
}
|
||||
this.rd ();
|
||||
this.getAlphasAndExponents ();
|
||||
return true;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "readData46",
|
||||
function () {
|
||||
var map = new java.util.Hashtable ();
|
||||
var tokens = new Array (0);
|
||||
this.rd ();
|
||||
this.nAOs = this.nOrbitals;
|
||||
while (this.line != null && this.line.length > 0) {
|
||||
tokens = JU.PT.getTokens (this.line);
|
||||
var type = tokens[0];
|
||||
this.isOpenShell = (tokens.length == 3);
|
||||
var ab = (this.isOpenShell ? tokens[1] : "");
|
||||
var count = tokens[tokens.length - 1];
|
||||
var key = (ab.equals ("BETA") ? "beta_" : "") + type;
|
||||
if (this.parseIntStr (count) != this.nOrbitals) {
|
||||
JU.Logger.error ("file 46 number of orbitals (" + count + ") does not match nOrbitals: " + this.nOrbitals);
|
||||
return;
|
||||
}var sb = new JU.SB ();
|
||||
while (this.rd () != null && this.line.length > 4 && " NA NB AO NH".indexOf (this.line.substring (1, 4)) < 0) sb.append (this.line);
|
||||
|
||||
sb.appendC (' ');
|
||||
var data = JU.PT.rep (sb.toString (), " )", ")");
|
||||
sb = new JU.SB ();
|
||||
for (var i = 0, n = data.length - 1; i < n; i++) {
|
||||
var c = data.charAt (i);
|
||||
switch (c) {
|
||||
case '(':
|
||||
case '-':
|
||||
if (data.charAt (i + 1) == ' ') i++;
|
||||
break;
|
||||
case ' ':
|
||||
if (JU.PT.isDigit (data.charAt (i + 1)) || data.charAt (i + 1) == '(') continue;
|
||||
break;
|
||||
}
|
||||
sb.appendC (c);
|
||||
}
|
||||
tokens = JU.PT.getTokens (sb.toString ());
|
||||
map.put (key, tokens);
|
||||
}
|
||||
var type = this.nboType;
|
||||
if (type.charAt (0) == 'P') type = type.substring (1);
|
||||
if (type.equals ("NLMO")) type = "NBO";
|
||||
tokens = map.get ((this.betaOnly ? "beta_" : "") + type);
|
||||
this.moData.put ("nboLabelMap", map);
|
||||
if (tokens == null) {
|
||||
tokens = new Array (this.nAOs);
|
||||
for (var i = 0; i < this.nAOs; i++) tokens[i] = this.nboType + (i + 1);
|
||||
|
||||
map.put (this.nboType, tokens);
|
||||
if (this.isOpenShell) map.put ("beta_" + this.nboType, tokens);
|
||||
}this.moData.put ("nboLabels", tokens);
|
||||
var addBetaSet = (this.isOpenShell && !this.betaOnly && !this.is47File);
|
||||
if (addBetaSet) this.nOrbitals *= 2;
|
||||
for (var i = 0; i < this.nOrbitals; i++) this.setMO ( new java.util.Hashtable ());
|
||||
|
||||
var qs = new J.quantum.QS ();
|
||||
qs.setNboLabels (tokens, this.nAOs, this.orbitals, this.nOrbitals0, this.nboType);
|
||||
if (addBetaSet) {
|
||||
this.moData.put ("firstBeta", Integer.$valueOf (this.nAOs));
|
||||
qs.setNboLabels (map.get ("beta_" + type), this.nAOs, this.orbitals, this.nOrbitals0 + this.nAOs, this.nboType);
|
||||
}var structures = this.getStructureList ();
|
||||
J.adapter.readers.quantum.NBOParser.getStructures46 (map.get ("NBO"), "alpha", structures, this.asc.ac);
|
||||
J.adapter.readers.quantum.NBOParser.getStructures46 (map.get ("beta_NBO"), "beta", structures, this.asc.ac);
|
||||
});
|
||||
Clazz.defineStatics (c$,
|
||||
"$P_LIST", "101 102 103",
|
||||
"SP_LIST", "1 101 102 103",
|
||||
"$DS_LIST", "255 252 253 254 251",
|
||||
"$DC_LIST", "201 204 206 202 203 205",
|
||||
"$FS_LIST", "351 352 353 354 355 356 357",
|
||||
"$FC_LIST", "301 307 310 304 302 303 306 309 308 305");
|
||||
});
|
||||
@@ -0,0 +1,249 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.MOReader"], "J.adapter.readers.quantum.JaguarReader", ["java.lang.Boolean", "$.Float", "java.util.Hashtable", "JU.AU", "$.Lst", "$.PT", "J.adapter.readers.quantum.BasisFunctionReader", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.moCount = 0;
|
||||
this.lumoEnergy = 3.4028235E38;
|
||||
this.haveLine = false;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "JaguarReader", J.adapter.readers.quantum.MOReader);
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.startsWith (" Input geometry:") || this.line.startsWith (" Symmetrized geometry:") || this.line.startsWith (" final geometry:")) {
|
||||
this.readAtoms ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" Atomic charges from electrostatic potential:")) {
|
||||
this.readCharges ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" number of basis functions....")) {
|
||||
this.moCount = this.parseIntAt (this.line, 32);
|
||||
return true;
|
||||
}if (this.line.startsWith (" basis set:")) {
|
||||
this.moData.put ("energyUnits", "");
|
||||
this.moData.put ("calculationType", this.calculationType = this.line.substring (13).trim ());
|
||||
if ("sto-3g".equals (this.calculationType)) {
|
||||
JU.Logger.error ("STO-3G not supported for Jaguar -- unusual SP basis definition.");
|
||||
}return true;
|
||||
}if (this.line.indexOf ("XXXXXShell information") >= 0) {
|
||||
this.readUnnormalizedBasis ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("Normalized coefficients") >= 0) {
|
||||
if (!"sto-3g".equals (this.calculationType)) this.readBasisNormalized ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" LUMO energy:")) {
|
||||
this.lumoEnergy = this.parseFloatStr (this.line.substring (13));
|
||||
return true;
|
||||
}if (this.line.indexOf ("final wvfn") >= 0) {
|
||||
if (this.shells != null) this.readJaguarMolecularOrbitals ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" harmonic frequencies in")) {
|
||||
this.readFrequencies ();
|
||||
this.continuing = false;
|
||||
return false;
|
||||
}return this.checkNboLine ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function () {
|
||||
this.discardPreviousAtoms ();
|
||||
this.readLines (2);
|
||||
while (this.rd () != null && this.line.length >= 60 && this.line.charAt (2) != ' ') {
|
||||
var tokens = this.getTokens ();
|
||||
var atomName = tokens[0];
|
||||
if (atomName.length < 2) return;
|
||||
var ch2 = atomName.charAt (1);
|
||||
var elementSymbol = (ch2 >= 'a' && ch2 <= 'z' ? atomName.substring (0, 2) : atomName.substring (0, 1));
|
||||
this.addAtomXYZSymName (tokens, 1, elementSymbol, atomName);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readCharges",
|
||||
function () {
|
||||
var iAtom = 0;
|
||||
while (this.rd () != null && this.line.indexOf ("sum") < 0) {
|
||||
if (this.line.indexOf ("Charge") < 0) continue;
|
||||
var tokens = this.getTokens ();
|
||||
for (var i = 1; i < tokens.length; i++) this.asc.atoms[iAtom++].partialCharge = this.parseFloatStr (tokens[i]);
|
||||
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readUnnormalizedBasis",
|
||||
function () {
|
||||
var lastAtom = "";
|
||||
var iAtom = 0;
|
||||
var sdata = Clazz.newIntArray (this.moCount, 4, 0);
|
||||
var sgdata = JU.AU.createArrayOfArrayList (this.moCount);
|
||||
var tokens;
|
||||
this.gaussianCount = 0;
|
||||
this.discardLinesUntilContains ("--------");
|
||||
while (this.rd () != null && (tokens = this.getTokens ()).length == 9) {
|
||||
var jCont = this.parseIntStr (tokens[2]);
|
||||
if (jCont > 0) {
|
||||
if (!tokens[0].equals (lastAtom)) iAtom++;
|
||||
lastAtom = tokens[0];
|
||||
var iFunc = this.parseIntStr (tokens[5]);
|
||||
var iType = this.parseIntStr (tokens[4]);
|
||||
if (iType <= 2) iType--;
|
||||
if (sgdata[iFunc] == null) {
|
||||
sdata[iFunc][0] = iAtom;
|
||||
sdata[iFunc][1] = iType;
|
||||
sdata[iFunc][2] = 0;
|
||||
sdata[iFunc][3] = 0;
|
||||
sgdata[iFunc] = new JU.Lst ();
|
||||
}var factor = 1;
|
||||
sgdata[iFunc].addLast ( Clazz.newFloatArray (-1, [this.parseFloatStr (tokens[6]), this.parseFloatStr (tokens[8]) * factor]));
|
||||
this.gaussianCount += jCont;
|
||||
for (var i = jCont - 1; --i >= 0; ) {
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
sgdata[iFunc].addLast ( Clazz.newFloatArray (-1, [this.parseFloatStr (tokens[6]), this.parseFloatStr (tokens[8]) * factor]));
|
||||
}
|
||||
}}
|
||||
var garray = JU.AU.newFloat2 (this.gaussianCount);
|
||||
var sarray = new JU.Lst ();
|
||||
this.gaussianCount = 0;
|
||||
for (var i = 0; i < this.moCount; i++) if (sgdata[i] != null) {
|
||||
var n = sgdata[i].size ();
|
||||
sdata[i][2] = this.gaussianCount;
|
||||
sdata[i][3] = n;
|
||||
for (var j = 0; j < n; j++) {
|
||||
garray[this.gaussianCount++] = sgdata[i].get (j);
|
||||
}
|
||||
sarray.addLast (sdata[i]);
|
||||
}
|
||||
this.moData.put ("shells", sarray);
|
||||
this.moData.put ("gaussians", garray);
|
||||
if (this.debugging) {
|
||||
JU.Logger.debug (sarray.size () + " slater shells read");
|
||||
JU.Logger.debug (this.gaussianCount + " gaussian primitives read");
|
||||
}});
|
||||
Clazz.defineMethod (c$, "readBasisNormalized",
|
||||
function () {
|
||||
var lastAtom = "";
|
||||
var iAtom = 0;
|
||||
var id;
|
||||
var iFunc = 0;
|
||||
var iFuncLast = -1;
|
||||
var sarray = new JU.Lst ();
|
||||
var gdata = new JU.Lst ();
|
||||
this.gaussianCount = 0;
|
||||
var sdata = null;
|
||||
this.discardLinesUntilContains ("--------");
|
||||
while (this.rd () != null && this.line.length > 3) {
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length == 4) {
|
||||
id = tokens[0];
|
||||
continue;
|
||||
}if (!tokens[0].equals (lastAtom)) iAtom++;
|
||||
lastAtom = tokens[0];
|
||||
id = tokens[2];
|
||||
var iType = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagID (id);
|
||||
iFunc = this.parseIntStr (tokens[3]) - 1;
|
||||
var gPtr = gdata.size ();
|
||||
if (iFunc == iFuncLast) {
|
||||
sdata[3]++;
|
||||
} else if (iFunc < iFuncLast) {
|
||||
for (var i = gdata.size (); --i >= 0; ) {
|
||||
if (gdata.get (i)[2] == iFunc) {
|
||||
gPtr = i + 1;
|
||||
break;
|
||||
}}
|
||||
for (var i = sarray.size (); --i >= 0; ) {
|
||||
if (sarray.get (i)[4] == iFunc) {
|
||||
sarray.get (i)[3]++;
|
||||
while (++i < sarray.size ()) {
|
||||
sarray.get (i)[2]++;
|
||||
}
|
||||
break;
|
||||
}}
|
||||
} else {
|
||||
sdata = Clazz.newIntArray (-1, [iAtom, iType, this.gaussianCount + 1, 1, iFunc]);
|
||||
sarray.addLast (sdata);
|
||||
iFuncLast = iFunc;
|
||||
}this.gaussianCount++;
|
||||
var z = this.parseFloatStr (tokens[4]);
|
||||
var rCoef = this.parseFloatStr (tokens[5]);
|
||||
if (id.equals ("XX")) rCoef *= 1.7320508;
|
||||
gdata.add (gPtr, Clazz.newFloatArray (-1, [z, rCoef, iFunc]));
|
||||
}
|
||||
var garray = JU.AU.newFloat2 (this.gaussianCount);
|
||||
for (var i = gdata.size (); --i >= 0; ) garray[i] = gdata.get (i);
|
||||
|
||||
this.moData.put ("shells", this.shells = sarray);
|
||||
this.moData.put ("gaussians", garray);
|
||||
if (this.debugging) {
|
||||
JU.Logger.debug (sarray.size () + " slater shells read");
|
||||
JU.Logger.debug (this.gaussianCount + " gaussian primitives read");
|
||||
}this.moData.put ("isNormalized", Boolean.TRUE);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readJaguarMolecularOrbitals",
|
||||
function () {
|
||||
var dataBlock = new Array (this.moCount);
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
var nMo = 0;
|
||||
while (this.line != null) {
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
if (this.line == null || this.line.indexOf ("eigenvalues-") < 0) break;
|
||||
var eigenValues = this.getTokens ();
|
||||
var n = eigenValues.length - 1;
|
||||
this.fillDataBlock (dataBlock, 0);
|
||||
var occ = 2;
|
||||
for (var iOrb = 0; iOrb < n; iOrb++) {
|
||||
var coefs = Clazz.newFloatArray (this.moCount, 0);
|
||||
var mo = new java.util.Hashtable ();
|
||||
var energy = this.parseFloatStr (eigenValues[iOrb + 1]);
|
||||
mo.put ("energy", Float.$valueOf (energy));
|
||||
if (Math.abs (energy - this.lumoEnergy) < 0.0001) {
|
||||
this.moData.put ("HOMO", Integer.$valueOf (nMo));
|
||||
this.lumoEnergy = 3.4028235E38;
|
||||
occ = 0;
|
||||
}mo.put ("occupancy", Float.$valueOf (occ));
|
||||
nMo++;
|
||||
for (var i = 0, pt = 0; i < this.moCount; i++) {
|
||||
coefs[pt++] = this.parseFloatStr (dataBlock[i][iOrb + 3]);
|
||||
}
|
||||
mo.put ("coefficients", coefs);
|
||||
this.setMO (mo);
|
||||
}
|
||||
}
|
||||
this.moData.put ("mos", this.orbitals);
|
||||
this.finalizeMOData (this.moData);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readFrequencies",
|
||||
function () {
|
||||
var ac = this.asc.getLastAtomSetAtomCount ();
|
||||
this.discardLinesUntilStartsWith (" frequencies ");
|
||||
while (this.line != null && this.line.startsWith (" frequencies ")) {
|
||||
var iAtom0 = this.asc.ac;
|
||||
var frequencies = this.getTokens ();
|
||||
var frequencyCount = frequencies.length - 1;
|
||||
var ignore = Clazz.newBooleanArray (frequencyCount, false);
|
||||
var symmetries = null;
|
||||
var intensities = null;
|
||||
while (this.line != null && this.line.charAt (2) != ' ') {
|
||||
if (this.line.indexOf ("symmetries") >= 0) symmetries = this.getTokens ();
|
||||
else if (this.line.indexOf ("intensities") >= 0) intensities = this.getTokens ();
|
||||
this.rd ();
|
||||
}
|
||||
for (var i = 0; i < frequencyCount; i++) {
|
||||
ignore[i] = !this.doGetVibration (++this.vibrationNumber);
|
||||
if (ignore[i]) continue;
|
||||
this.asc.cloneFirstAtomSet (0);
|
||||
this.asc.setAtomSetFrequency (null, symmetries == null ? null : symmetries[i + 1], frequencies[i + 1], null);
|
||||
if (intensities != null) this.asc.setAtomSetModelProperty ("IRIntensity", intensities[i + 1] + " km/mol");
|
||||
}
|
||||
this.haveLine = true;
|
||||
this.fillFrequencyData (iAtom0, ac, ac, ignore, false, 0, 0, null, 0);
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "rd",
|
||||
function () {
|
||||
if (!this.haveLine) return Clazz.superCall (this, J.adapter.readers.quantum.JaguarReader, "rd", []);
|
||||
this.haveLine = false;
|
||||
return this.line;
|
||||
});
|
||||
Clazz.defineStatics (c$,
|
||||
"ROOT3", 1.73205080756887729);
|
||||
});
|
||||
@@ -0,0 +1,316 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.BasisFunctionReader"], "J.adapter.readers.quantum.MOReader", ["java.lang.Float", "java.util.Hashtable", "JU.AU", "$.Lst", "$.PT", "J.quantum.QS", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.shellCount = 0;
|
||||
this.gaussianCount = 0;
|
||||
this.gaussians = null;
|
||||
this.energyUnits = "";
|
||||
this.moTypes = null;
|
||||
this.getNBOs = false;
|
||||
this.getNBOCharges = false;
|
||||
this.haveNboCharges = false;
|
||||
this.haveNboOrbitals = false;
|
||||
this.orbitalsRead = false;
|
||||
this.lastMoData = null;
|
||||
this.allowNoOrbitals = false;
|
||||
this.HEADER_GAMESS_UK_MO = 3;
|
||||
this.HEADER_GAMESS_OCCUPANCIES = 2;
|
||||
this.HEADER_GAMESS_ORIGINAL = 1;
|
||||
this.HEADER_NONE = 0;
|
||||
this.haveCoeffMap = false;
|
||||
this.iMo0 = 1;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "MOReader", J.adapter.readers.quantum.BasisFunctionReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.line = "\nNBOs";
|
||||
this.getNBOs = (this.filter != null && this.filterMO ());
|
||||
this.line = "\nNBOCHARGES";
|
||||
this.getNBOCharges = (this.filter != null && this.filterMO ());
|
||||
this.checkAndRemoveFilterKey ("NBOCHARGES");
|
||||
});
|
||||
Clazz.defineMethod (c$, "checkAndRemoveFilterKey",
|
||||
function (key) {
|
||||
if (!this.checkFilterKey (key)) return false;
|
||||
this.filter = JU.PT.rep (this.filter, key, "");
|
||||
if (this.filter.length < 3) this.filter = null;
|
||||
return true;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "checkNboLine",
|
||||
function () {
|
||||
if (this.getNBOs) {
|
||||
if (this.line.indexOf ("(Occupancy) Bond orbital/ Coefficients/ Hybrids") >= 0) {
|
||||
this.getNboTypes ();
|
||||
return false;
|
||||
}if (this.line.indexOf ("NBOs in the AO basis:") >= 0) {
|
||||
this.readMolecularOrbitals (0);
|
||||
return false;
|
||||
}if (this.line.indexOf (" SECOND ORDER PERTURBATION THEORY ANALYSIS") >= 0) {
|
||||
this.readSecondOrderData ();
|
||||
return false;
|
||||
}}if (this.getNBOCharges && this.line.indexOf ("Summary of Natural Population Analysis:") >= 0) {
|
||||
this.getNboCharges ();
|
||||
return true;
|
||||
}return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "getNboCharges",
|
||||
function () {
|
||||
if (this.haveNboCharges) return;
|
||||
this.discardLinesUntilContains ("----");
|
||||
this.discardLinesUntilContains ("----");
|
||||
this.haveNboCharges = true;
|
||||
var ac = this.asc.ac;
|
||||
var i0 = this.asc.getLastAtomSetAtomIndex ();
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = i0; i < ac; ++i) {
|
||||
while (atoms[i].elementNumber == 0) ++i;
|
||||
|
||||
var tokens = JU.PT.getTokens (this.rd ());
|
||||
var charge;
|
||||
if (tokens == null || tokens.length < 3 || Float.isNaN (charge = this.parseFloatStr (tokens[2]))) {
|
||||
JU.Logger.info ("Error reading NBO charges: " + this.line);
|
||||
return;
|
||||
}atoms[i].partialCharge = charge;
|
||||
if (this.debugging) JU.Logger.debug ("Atom " + i + " using NBOcharge: " + charge);
|
||||
}
|
||||
JU.Logger.info ("Using NBO charges for Model " + this.asc.atomSetCount);
|
||||
});
|
||||
Clazz.defineMethod (c$, "getNboTypes",
|
||||
function () {
|
||||
this.moTypes = new JU.Lst ();
|
||||
this.iMo0 = (this.orbitals == null ? 0 : this.orbitals.size ()) + 1;
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
var n = 0;
|
||||
var pt = 0;
|
||||
while (this.line != null && (pt = this.line.indexOf (".")) >= 0 && pt < 10) {
|
||||
if (this.parseIntRange (this.line, 0, pt) != n + 1) break;
|
||||
this.moTypes.add (n++, this.line.substring (pt + 1, Math.min (40, this.line.length)).trim ());
|
||||
while (this.rd () != null && this.line.startsWith (" ")) {
|
||||
}
|
||||
}
|
||||
JU.Logger.info (n + " natural bond AO basis functions found");
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolecularOrbitals",
|
||||
function (headerType) {
|
||||
if (this.ignoreMOs) {
|
||||
this.rd ();
|
||||
return;
|
||||
}this.dfCoefMaps = null;
|
||||
if (this.haveNboOrbitals) {
|
||||
this.orbitals = new JU.Lst ();
|
||||
this.alphaBeta = "";
|
||||
}this.haveNboOrbitals = true;
|
||||
this.orbitalsRead = true;
|
||||
var mos = null;
|
||||
var data = null;
|
||||
var dCoeffLabels = "";
|
||||
var fCoeffLabels = "";
|
||||
var pCoeffLabels = "";
|
||||
var ptOffset = -1;
|
||||
var fieldSize = 0;
|
||||
var nThisLine = 0;
|
||||
this.rd ();
|
||||
var moCount = 0;
|
||||
var nBlank = 0;
|
||||
var haveMOs = false;
|
||||
if (this.line.indexOf ("---") >= 0) this.rd ();
|
||||
while (this.rd () != null) {
|
||||
var tokens = this.getTokens ();
|
||||
if (this.debugging) {
|
||||
JU.Logger.debug (tokens.length + " --- " + this.line);
|
||||
}if (this.line.indexOf ("end") >= 0) break;
|
||||
if (this.line.indexOf (" ALPHA SET ") >= 0) {
|
||||
this.alphaBeta = "alpha";
|
||||
if (this.rd () == null) break;
|
||||
} else if (this.line.indexOf (" BETA SET ") >= 0) {
|
||||
if (haveMOs) break;
|
||||
this.alphaBeta = "beta";
|
||||
if (this.rd () == null) break;
|
||||
}var str = this.line.toUpperCase ();
|
||||
if (str.length == 0 || str.indexOf ("--") >= 0 || str.indexOf (".....") >= 0 || str.indexOf ("NBO BASIS") >= 0 || str.indexOf ("CI EIGENVECTORS WILL BE LABELED") >= 0 || str.indexOf ("LZ VALUE") >= 0 || str.indexOf (" THIS LOCALIZATION HAD") >= 0) {
|
||||
if (!this.haveCoeffMap) {
|
||||
this.haveCoeffMap = true;
|
||||
var isOK = true;
|
||||
if (pCoeffLabels.length > 0) isOK = this.getDFMap ("P", pCoeffLabels, 1, "(PX) (PY) (PZ)", 4);
|
||||
if (dCoeffLabels.length > 0) {
|
||||
if (dCoeffLabels.indexOf ("X") >= 0) isOK = this.getDFMap ("DC", dCoeffLabels, 4, "DXX DYY DZZ DXY DXZ DYZ", 2);
|
||||
else if (dCoeffLabels.indexOf ("(D6)") >= 0) isOK = this.getDFMap ("DC", dCoeffLabels, 4, "(D1) (D4) (D6) (D2) (D3) (D5)", 4);
|
||||
else isOK = this.getDFMap ("DS", dCoeffLabels, 3, "(D5) (D2) (D3) (D4) (D1)", 4);
|
||||
}if (fCoeffLabels.length > 0) {
|
||||
if (fCoeffLabels.indexOf ("X") >= 0) isOK = this.getDFMap ("FC", fCoeffLabels, 6, "XXX YYY ZZZ XYY XXY XXZ XZZ YZZ YYZ XYZ", 2);
|
||||
else if (fCoeffLabels.indexOf ("(F10)") >= 0) isOK = this.getDFMap ("FC", fCoeffLabels, 6, J.adapter.readers.quantum.MOReader.FC_LIST, 5);
|
||||
else isOK = this.getDFMap ("FS", fCoeffLabels, 5, "(F1) (F2) (F3) (F4) (F5) (F6) (F7)", 4);
|
||||
}if (!isOK) {
|
||||
}}if (str.length == 0) nBlank++;
|
||||
else nBlank = 0;
|
||||
if (nBlank == 2) break;
|
||||
if (str.indexOf ("LZ VALUE") >= 0) this.discardLinesUntilBlank ();
|
||||
for (var iMo = 0; iMo < nThisLine; iMo++) {
|
||||
var coefs = Clazz.newFloatArray (data[iMo].size (), 0);
|
||||
var iCoeff = 0;
|
||||
while (iCoeff < coefs.length) {
|
||||
coefs[iCoeff] = this.parseFloatStr (data[iMo].get (iCoeff));
|
||||
iCoeff++;
|
||||
}
|
||||
haveMOs = true;
|
||||
this.addCoef (mos[iMo], coefs, null, NaN, NaN, moCount++);
|
||||
}
|
||||
nThisLine = 0;
|
||||
if (this.line.length == 0) continue;
|
||||
break;
|
||||
}nBlank = 0;
|
||||
if (nThisLine == 0) {
|
||||
nThisLine = tokens.length;
|
||||
if (tokens[0].equals ("AO")) {
|
||||
nThisLine--;
|
||||
ptOffset = 16;
|
||||
fieldSize = 8;
|
||||
}if (mos == null || nThisLine > mos.length) {
|
||||
mos = JU.AU.createArrayOfHashtable (nThisLine);
|
||||
data = JU.AU.createArrayOfArrayList (nThisLine);
|
||||
}for (var i = 0; i < nThisLine; i++) {
|
||||
mos[i] = new java.util.Hashtable ();
|
||||
data[i] = new JU.Lst ();
|
||||
}
|
||||
this.getMOHeader (headerType, tokens, mos, nThisLine);
|
||||
continue;
|
||||
}var nSkip = tokens.length - nThisLine;
|
||||
var type = tokens[nSkip - 1];
|
||||
var ch;
|
||||
if (type.charAt (0) == '(') {
|
||||
ch = type.charAt (1);
|
||||
if (!this.haveCoeffMap) {
|
||||
switch (ch) {
|
||||
case 'p':
|
||||
pCoeffLabels += " " + type.toUpperCase ();
|
||||
break;
|
||||
case 'd':
|
||||
dCoeffLabels += " " + J.adapter.readers.quantum.BasisFunctionReader.canonicalizeQuantumSubshellTag (type.toUpperCase ());
|
||||
break;
|
||||
case 'f':
|
||||
fCoeffLabels += " " + J.adapter.readers.quantum.BasisFunctionReader.canonicalizeQuantumSubshellTag (type.toUpperCase ());
|
||||
break;
|
||||
case 's':
|
||||
}
|
||||
}} else {
|
||||
var nChar = type.length;
|
||||
ch = (nChar < 4 ? 'S' : nChar == 4 ? 'G' : nChar == 5 ? 'H' : '?');
|
||||
if (!this.haveCoeffMap && nChar == 3) fCoeffLabels += " " + J.adapter.readers.quantum.BasisFunctionReader.canonicalizeQuantumSubshellTag (type.toUpperCase ());
|
||||
else if (!this.haveCoeffMap && nChar == 2) dCoeffLabels += " " + J.adapter.readers.quantum.BasisFunctionReader.canonicalizeQuantumSubshellTag (type.toUpperCase ());
|
||||
}if (J.quantum.QS.isQuantumBasisSupported (ch)) {
|
||||
if (ptOffset < 0) {
|
||||
for (var i = 0; i < nThisLine; i++) data[i].addLast (tokens[i + nSkip]);
|
||||
|
||||
} else {
|
||||
var pt = ptOffset;
|
||||
for (var i = 0; i < nThisLine; i++, pt += fieldSize) data[i].addLast (this.line.substring (pt, pt + fieldSize).trim ());
|
||||
|
||||
}}this.line = "";
|
||||
}
|
||||
this.energyUnits = "a.u.";
|
||||
this.setMOData (!this.alphaBeta.equals ("alpha"));
|
||||
this.haveCoeffMap = false;
|
||||
this.dfCoefMaps = null;
|
||||
}, "~N");
|
||||
Clazz.defineMethod (c$, "addCoef",
|
||||
function (mo, coefs, type, energy, occ, moCount) {
|
||||
mo.put ("coefficients", coefs);
|
||||
if (this.moTypes != null) {
|
||||
type = this.moTypes.get (moCount % this.moTypes.size ());
|
||||
occ = (type.indexOf ("*") >= 0 ? 0 : 2);
|
||||
} else if (this.alphaBeta.length > 0) {
|
||||
type = this.alphaBeta;
|
||||
}if (type != null) mo.put ("type", type);
|
||||
if (!Float.isNaN (energy)) mo.put ("energy", Float.$valueOf (energy));
|
||||
if (!Float.isNaN (occ)) mo.put ("occupancy", Float.$valueOf (occ));
|
||||
this.setMO (mo);
|
||||
}, "java.util.Map,~A,~S,~N,~N,~N");
|
||||
Clazz.defineMethod (c$, "getMOHeader",
|
||||
function (headerType, tokens, mos, nThisLine) {
|
||||
this.rd ();
|
||||
switch (headerType) {
|
||||
default:
|
||||
case 0:
|
||||
return;
|
||||
case 3:
|
||||
for (var i = 0; i < nThisLine; i++) mos[i].put ("energy", Float.$valueOf (JU.PT.fVal (tokens[i])));
|
||||
|
||||
this.readLines (5);
|
||||
return;
|
||||
case 1:
|
||||
tokens = this.getTokens ();
|
||||
if (tokens.length == 0) tokens = JU.PT.getTokens (this.rd ());
|
||||
for (var i = 0; i < nThisLine; i++) {
|
||||
mos[i].put ("energy", Float.$valueOf (JU.PT.fVal (tokens[i])));
|
||||
}
|
||||
this.rd ();
|
||||
break;
|
||||
case 2:
|
||||
var haveSymmetry = (this.line.length > 0 || this.rd () != null);
|
||||
tokens = this.getTokens ();
|
||||
for (var i = 0; i < nThisLine; i++) mos[i].put ("occupancy", Float.$valueOf (tokens[i].charAt (0) == '-' ? 2.0 : this.parseFloatStr (tokens[i])));
|
||||
|
||||
this.rd ();
|
||||
if (!haveSymmetry) return;
|
||||
}
|
||||
if (this.line.length > 0) {
|
||||
tokens = this.getTokens ();
|
||||
for (var i = 0; i < nThisLine; i++) mos[i].put ("symmetry", tokens[i]);
|
||||
|
||||
}}, "~N,~A,~A,~N");
|
||||
Clazz.defineMethod (c$, "addMOData",
|
||||
function (nColumns, data, mos) {
|
||||
for (var i = 0; i < nColumns; i++) {
|
||||
var coefs = Clazz.newFloatArray (data[i].size (), 0);
|
||||
for (var j = coefs.length; --j >= 0; ) coefs[j] = this.parseFloatStr (data[i].get (j));
|
||||
|
||||
mos[i].put ("coefficients", coefs);
|
||||
this.setMO (mos[i]);
|
||||
}
|
||||
}, "~N,~A,~A");
|
||||
Clazz.defineMethod (c$, "setMOData",
|
||||
function (clearOrbitals) {
|
||||
if (this.shells != null && this.gaussians != null && (this.allowNoOrbitals || this.orbitals.size () != 0)) {
|
||||
this.moData.put ("calculationType", this.calculationType);
|
||||
this.moData.put ("energyUnits", this.energyUnits);
|
||||
this.moData.put ("shells", this.shells);
|
||||
this.moData.put ("gaussians", this.gaussians);
|
||||
this.moData.put ("mos", this.orbitals);
|
||||
this.finalizeMOData (this.lastMoData = this.moData);
|
||||
}if (clearOrbitals) {
|
||||
this.clearOrbitals ();
|
||||
}}, "~B");
|
||||
Clazz.defineMethod (c$, "readSecondOrderData",
|
||||
function () {
|
||||
this.readLines (5);
|
||||
if (this.lastMoData == null || this.moTypes == null) return;
|
||||
var ht = new java.util.Hashtable ();
|
||||
for (var i = this.moTypes.size (); --i >= 0; ) ht.put (JU.PT.rep (this.moTypes.get (i).substring (10), " ", ""), Integer.$valueOf (i + this.iMo0));
|
||||
|
||||
var strSecondOrderData = new JU.Lst ();
|
||||
while (this.rd () != null && this.line.indexOf ("NBO") < 0) {
|
||||
if (this.line.length < 5 || this.line.charAt (4) != '.') continue;
|
||||
strSecondOrderData.addLast ( Clazz.newArray (-1, [JU.PT.rep (this.line.substring (5, 27).trim (), " ", ""), JU.PT.rep (this.line.substring (32, 54).trim (), " ", ""), this.line.substring (55, 62).trim (), this.line.substring (71).trim ()]));
|
||||
}
|
||||
var secondOrderData = Clazz.newFloatArray (strSecondOrderData.size (), 4, 0);
|
||||
this.lastMoData.put ("secondOrderData", secondOrderData);
|
||||
this.lastMoData = null;
|
||||
var IMO;
|
||||
for (var i = strSecondOrderData.size (); --i >= 0; ) {
|
||||
var a = strSecondOrderData.get (i);
|
||||
IMO = ht.get (a[0]);
|
||||
if (IMO != null) secondOrderData[i][0] = IMO.intValue ();
|
||||
IMO = ht.get (a[1]);
|
||||
if (IMO != null) secondOrderData[i][1] = IMO.intValue ();
|
||||
secondOrderData[i][2] = this.parseFloatStr (a[2]);
|
||||
secondOrderData[i][3] = this.parseFloatStr (a[3]);
|
||||
}
|
||||
});
|
||||
Clazz.defineStatics (c$,
|
||||
"P_LIST", "(PX) (PY) (PZ)",
|
||||
"DS_LIST", "(D5) (D2) (D3) (D4) (D1)",
|
||||
"DC_LIST", "(D1) (D4) (D6) (D2) (D3) (D5)",
|
||||
"FS_LIST", "(F1) (F2) (F3) (F4) (F5) (F6) (F7)",
|
||||
"FC_LIST", "(F1) (F2) (F10) (F4) (F2) (F3) (F6) (F9) (F8) (F5)");
|
||||
});
|
||||
@@ -0,0 +1,372 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.MopacSlaterReader", "JU.BS"], "J.adapter.readers.quantum.MoldenReader", ["java.lang.Exception", "$.Float", "java.util.Arrays", "$.Hashtable", "JU.AU", "$.Lst", "$.PT", "J.adapter.readers.quantum.BasisFunctionReader", "JU.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.loadGeometries = false;
|
||||
this.loadVibrations = false;
|
||||
this.vibOnly = false;
|
||||
this.optOnly = false;
|
||||
this.doSort = true;
|
||||
this.orbitalType = "";
|
||||
this.modelAtomCount = 0;
|
||||
this.bsAtomOK = null;
|
||||
this.bsBadIndex = null;
|
||||
this.nSPDF = null;
|
||||
this.haveEnergy = true;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "MoldenReader", J.adapter.readers.quantum.MopacSlaterReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.bsAtomOK = new JU.BS ();
|
||||
this.bsBadIndex = new JU.BS ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.vibOnly = this.checkFilterKey ("VIBONLY");
|
||||
this.optOnly = this.checkFilterKey ("OPTONLY");
|
||||
this.doSort = !this.checkFilterKey ("NOSORT");
|
||||
this.loadGeometries = !this.vibOnly && this.desiredVibrationNumber < 0 && !this.checkFilterKey ("NOOPT");
|
||||
this.loadVibrations = !this.optOnly && this.desiredModelNumber < 0 && !this.checkFilterKey ("NOVIB");
|
||||
if (this.checkFilterKey ("ALPHA")) this.filter = "alpha";
|
||||
else if (this.checkFilterKey ("BETA")) this.filter = "beta";
|
||||
else this.filter = this.getFilter ("SYM=");
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (!this.line.contains ("[")) return true;
|
||||
this.line = this.line.toUpperCase ().trim ();
|
||||
if (!this.line.startsWith ("[")) return true;
|
||||
JU.Logger.info (this.line);
|
||||
if (this.line.indexOf ("[ATOMS]") == 0) {
|
||||
this.readAtoms ();
|
||||
this.modelAtomCount = this.asc.atomSetAtomCounts[0];
|
||||
if (this.asc.atomSetCount == 1 && this.moData != null) this.finalizeMOData (this.moData);
|
||||
return false;
|
||||
}if (this.line.indexOf ("[GTO]") == 0) return this.readGaussianBasis ();
|
||||
if (this.line.indexOf ("[STO]") == 0) return this.readSlaterBasis ();
|
||||
if (this.line.indexOf ("[MO]") == 0) return (!this.doReadMolecularOrbitals || this.readMolecularOrbitals ());
|
||||
if (this.line.indexOf ("[FREQ]") == 0) return (!this.loadVibrations || this.readFreqsAndModes ());
|
||||
if (this.line.indexOf ("[GEOCONV]") == 0) return (!this.loadGeometries || this.readGeometryOptimization ());
|
||||
if (this.checkOrbitalType (this.line)) return true;
|
||||
if (this.checkSymmetry ()) return false;
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "checkSymmetry",
|
||||
function () {
|
||||
if (this.line.startsWith ("[SPACEGROUP]")) {
|
||||
this.setSpaceGroupName (this.rd ());
|
||||
this.rd ();
|
||||
return true;
|
||||
}if (this.line.startsWith ("[OPERATORS]")) {
|
||||
while (this.rd () != null && this.line.indexOf ("[") < 0) if (this.line.length > 0) {
|
||||
JU.Logger.info ("adding operator " + this.line);
|
||||
this.setSymmetryOperator (this.line);
|
||||
}
|
||||
return true;
|
||||
}if (this.line.startsWith ("[CELL]")) {
|
||||
this.rd ();
|
||||
JU.Logger.info ("setting cell dimensions " + this.line);
|
||||
this.next[0] = 0;
|
||||
for (var i = 0; i < 6; i++) this.setUnitCellItem (i, this.parseFloat ());
|
||||
|
||||
this.rd ();
|
||||
return true;
|
||||
}if (this.line.startsWith ("[CELLAXES]")) {
|
||||
var f = Clazz.newFloatArray (9, 0);
|
||||
this.fillFloatArray (null, 0, f);
|
||||
this.addExplicitLatticeVector (0, f, 0);
|
||||
this.addExplicitLatticeVector (1, f, 3);
|
||||
this.addExplicitLatticeVector (2, f, 6);
|
||||
return true;
|
||||
}return false;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
if (!this.bsBadIndex.isEmpty ()) try {
|
||||
var ilast = 0;
|
||||
var atoms = this.asc.atoms;
|
||||
var nAtoms = this.asc.ac;
|
||||
this.bsAtomOK.set (nAtoms);
|
||||
var n = this.shells.size ();
|
||||
for (var i = 0; i < n; i++) {
|
||||
var iatom = this.shells.get (i)[0];
|
||||
if (iatom != 2147483647) {
|
||||
ilast = atoms[iatom - 1].elementNumber;
|
||||
continue;
|
||||
}for (var j = this.bsAtomOK.nextClearBit (0); j >= 0; j = this.bsAtomOK.nextClearBit (j + 1)) {
|
||||
if (atoms[j].elementNumber == ilast) {
|
||||
this.shells.get (i)[0] = j + 1;
|
||||
JU.Logger.info ("MoldenReader assigning shells starting with " + i + " for ** to atom " + (j + 1) + " z " + ilast);
|
||||
for (; ++i < n && !this.bsBadIndex.get (i) && this.shells.get (i)[0] == 2147483647; ) this.shells.get (i)[0] = j + 1;
|
||||
|
||||
i--;
|
||||
this.bsAtomOK.set (j);
|
||||
break;
|
||||
}}
|
||||
}
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
JU.Logger.error ("Molden reader could not assign shells -- abandoning MOs");
|
||||
this.asc.setCurrentModelInfo ("moData", null);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
this.finalizeReaderASCR ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function () {
|
||||
var coordUnit = JU.PT.getTokens (this.line.$replace (']', ' '))[1];
|
||||
var isFractional = (coordUnit.indexOf ("FRACTIONAL") >= 0);
|
||||
var isAU = (!isFractional && coordUnit.indexOf ("ANGS") < 0);
|
||||
if (isAU && coordUnit.indexOf ("AU") < 0) JU.Logger.error ("Molden atom line does not indicate units ANGS, AU, or FRACTIONAL -- AU assumed: " + this.line);
|
||||
this.setFractionalCoordinates (isFractional);
|
||||
var f = (isAU ? 0.5291772 : 1);
|
||||
while (this.rd () != null && this.line.indexOf ('[') < 0) {
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length < 6) continue;
|
||||
var atom = this.setAtomCoordScaled (null, tokens, 3, f);
|
||||
atom.atomName = tokens[0];
|
||||
atom.elementNumber = this.parseIntStr (tokens[2]);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readSlaterBasis",
|
||||
function () {
|
||||
this.nCoef = 0;
|
||||
while (this.rd () != null && this.line.indexOf ("[") < 0) {
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length < 7) continue;
|
||||
this.addSlater (this.parseIntStr (tokens[0]), this.parseIntStr (tokens[1]), this.parseIntStr (tokens[2]), this.parseIntStr (tokens[3]), this.parseIntStr (tokens[4]), this.parseFloatStr (tokens[5]), this.parseFloatStr (tokens[6]));
|
||||
this.nCoef++;
|
||||
}
|
||||
this.setSlaters (false, false);
|
||||
return false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readGaussianBasis",
|
||||
function () {
|
||||
this.shells = new JU.Lst ();
|
||||
var gdata = new JU.Lst ();
|
||||
var atomIndex = 0;
|
||||
var gaussianPtr = 0;
|
||||
this.nCoef = 0;
|
||||
this.nSPDF = Clazz.newIntArray (12, 0);
|
||||
this.discardLinesUntilNonBlank ();
|
||||
while (this.line != null && !((this.line = this.line.trim ()).length == 0 || this.line.charAt (0) == '[')) {
|
||||
var tokens = this.getTokens ();
|
||||
atomIndex = this.parseIntStr (tokens[0]) - 1;
|
||||
if (atomIndex == 2147483647) {
|
||||
this.bsBadIndex.set (this.shells.size ());
|
||||
} else {
|
||||
this.bsAtomOK.set (atomIndex);
|
||||
}while (this.rd () != null && (this.line = this.line.trim ()).length > 0 && this.line.charAt (0) != '[') {
|
||||
tokens = this.getTokens ();
|
||||
var shellLabel = tokens[0].toUpperCase ();
|
||||
var type = J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagID (shellLabel);
|
||||
var nPrimitives = this.parseIntStr (tokens[1]);
|
||||
var slater = Clazz.newIntArray (4, 0);
|
||||
this.nSPDF[type]++;
|
||||
slater[0] = atomIndex + 1;
|
||||
slater[1] = type;
|
||||
slater[2] = gaussianPtr + 1;
|
||||
slater[3] = nPrimitives;
|
||||
var n = this.getDfCoefMaps ()[type].length;
|
||||
this.nCoef += n;
|
||||
for (var ip = nPrimitives; --ip >= 0; ) {
|
||||
var primTokens = JU.PT.getTokens (this.rd ());
|
||||
var nTokens = primTokens.length;
|
||||
var orbData = Clazz.newFloatArray (nTokens, 0);
|
||||
for (var d = 0; d < nTokens; d++) orbData[d] = this.parseFloatStr (primTokens[d]);
|
||||
|
||||
gdata.addLast (orbData);
|
||||
gaussianPtr++;
|
||||
}
|
||||
this.shells.addLast (slater);
|
||||
}
|
||||
if (this.line.length > 0 && this.line.charAt (0) == '[') break;
|
||||
this.rd ();
|
||||
}
|
||||
var garray = JU.AU.newFloat2 (gaussianPtr);
|
||||
for (var i = 0; i < gaussianPtr; i++) {
|
||||
garray[i] = gdata.get (i);
|
||||
}
|
||||
this.moData.put ("shells", this.shells);
|
||||
this.moData.put ("gaussians", garray);
|
||||
JU.Logger.info (this.shells.size () + " slater shells read");
|
||||
JU.Logger.info (garray.length + " gaussian primitives read");
|
||||
JU.Logger.info (this.nCoef + " MO coefficients expected for orbital type " + this.orbitalType);
|
||||
this.asc.setCurrentModelInfo ("moData", this.moData);
|
||||
return false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolecularOrbitals",
|
||||
function () {
|
||||
while (this.checkOrbitalType (this.rd ())) {
|
||||
}
|
||||
this.fixOrbitalType ();
|
||||
var tokens = this.getMoTokens (this.line);
|
||||
while (tokens != null && tokens.length > 0 && tokens[0].indexOf ('[') < 0) {
|
||||
var mo = new java.util.Hashtable ();
|
||||
var data = new JU.Lst ();
|
||||
var energy = NaN;
|
||||
var occupancy = NaN;
|
||||
var symmetry = null;
|
||||
var key;
|
||||
while (this.parseIntStr (key = tokens[0]) == -2147483648) {
|
||||
if (key.startsWith ("Ene")) {
|
||||
energy = this.parseFloatStr (tokens[1]);
|
||||
} else if (key.startsWith ("Occup")) {
|
||||
occupancy = this.parseFloatStr (tokens[1]);
|
||||
} else if (key.startsWith ("Sym")) {
|
||||
symmetry = tokens[1];
|
||||
} else if (key.startsWith ("Spin")) {
|
||||
this.alphaBeta = tokens[1].toLowerCase ();
|
||||
}tokens = this.getMoTokens (null);
|
||||
}
|
||||
var pt = 0;
|
||||
while (tokens != null && tokens.length > 0 && this.parseIntStr (tokens[0]) != -2147483648) {
|
||||
if (tokens.length != 2) throw new Exception ("invalid MO coefficient specification");
|
||||
var i = this.parseIntStr (tokens[0]);
|
||||
while (i > ++pt) data.addLast ("0");
|
||||
|
||||
data.addLast (tokens[1]);
|
||||
tokens = this.getMoTokens (null);
|
||||
}
|
||||
if (this.orbitalType.equals ("") && data.size () < this.nCoef) {
|
||||
JU.Logger.info ("too few orbital coefficients for 6D");
|
||||
this.checkOrbitalType ("[5D]");
|
||||
}while (++pt <= this.nCoef) {
|
||||
data.addLast ("0");
|
||||
}
|
||||
var coefs = Clazz.newFloatArray (this.nCoef, 0);
|
||||
for (var i = data.size (); --i >= 0; ) coefs[i] = this.parseFloatStr (data.get (i));
|
||||
|
||||
var l = this.line;
|
||||
this.line = "" + symmetry;
|
||||
if (this.filterMO ()) {
|
||||
mo.put ("coefficients", coefs);
|
||||
if (Float.isNaN (energy)) {
|
||||
this.haveEnergy = false;
|
||||
} else {
|
||||
mo.put ("energy", Float.$valueOf (energy));
|
||||
}if (!Float.isNaN (occupancy)) mo.put ("occupancy", Float.$valueOf (occupancy));
|
||||
if (symmetry != null) mo.put ("symmetry", symmetry);
|
||||
if (this.alphaBeta.length > 0) mo.put ("type", this.alphaBeta);
|
||||
this.setMO (mo);
|
||||
if (this.debugging) {
|
||||
JU.Logger.debug (coefs.length + " coefficients in MO " + this.orbitals.size ());
|
||||
}}this.line = l;
|
||||
}
|
||||
if (this.debugging) JU.Logger.debug ("read " + this.orbitals.size () + " MOs");
|
||||
this.setMOs ("eV");
|
||||
if (this.haveEnergy && this.doSort) this.sortMOs ();
|
||||
return false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "sortMOs",
|
||||
function () {
|
||||
var list = this.orbitals.toArray ( new Array (this.orbitals.size ()));
|
||||
java.util.Arrays.sort (list, Clazz.innerTypeInstance (J.adapter.readers.quantum.BasisFunctionReader.MOEnergySorter, this, null));
|
||||
this.orbitals.clear ();
|
||||
for (var i = 0; i < list.length; i++) this.orbitals.addLast (list[i]);
|
||||
|
||||
});
|
||||
Clazz.defineMethod (c$, "getMoTokens",
|
||||
function (line) {
|
||||
return (line == null && (line = this.rd ()) == null ? null : JU.PT.getTokens (line.$replace ('=', ' ')));
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "checkOrbitalType",
|
||||
function (line) {
|
||||
if (line.length > 3 && "5D 6D 7F 10 9G 15 11 21".indexOf (line.substring (1, 3)) >= 0) {
|
||||
if (this.orbitalType.indexOf (line) >= 0) return true;
|
||||
if (line.indexOf ("G") >= 0 || line.indexOf ("H") >= 0 || line.indexOf ("I") >= 0) this.appendLoadNote ("Unsupported orbital type ignored: " + line);
|
||||
this.orbitalType += line;
|
||||
JU.Logger.info ("Orbital type set to " + this.orbitalType);
|
||||
this.fixOrbitalType ();
|
||||
return true;
|
||||
}return false;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "fixOrbitalType",
|
||||
function () {
|
||||
if (this.orbitalType.contains ("5D")) {
|
||||
this.fixSlaterTypes (4, 3);
|
||||
this.fixSlaterTypes (6, 5);
|
||||
this.fixSlaterTypes (8, 7);
|
||||
this.fixSlaterTypes (10, 9);
|
||||
}if (this.orbitalType.contains ("10F")) {
|
||||
this.fixSlaterTypes (5, 6);
|
||||
this.fixSlaterTypes (7, 8);
|
||||
this.fixSlaterTypes (9, 10);
|
||||
}if (this.orbitalType.contains ("15G")) {
|
||||
this.fixSlaterTypes (7, 8);
|
||||
this.fixSlaterTypes (9, 10);
|
||||
}});
|
||||
Clazz.defineMethod (c$, "readFreqsAndModes",
|
||||
function () {
|
||||
var tokens;
|
||||
var frequencies = new JU.Lst ();
|
||||
while (this.rd () != null && this.line.indexOf ('[') < 0) {
|
||||
var f = this.getTokens ()[0];
|
||||
frequencies.addLast (f);
|
||||
}
|
||||
var nFreqs = frequencies.size ();
|
||||
this.skipTo ("[FR-COORD]");
|
||||
if (!this.vibOnly) this.readAtomSet ("frequency base geometry", true, true);
|
||||
this.skipTo ("[FR-NORM-COORD]");
|
||||
var haveVib = false;
|
||||
for (var nFreq = 0; nFreq < nFreqs; nFreq++) {
|
||||
this.skipTo ("vibration");
|
||||
this.doGetVibration (++this.vibrationNumber);
|
||||
if (haveVib) this.asc.cloneLastAtomSet ();
|
||||
haveVib = true;
|
||||
this.asc.setAtomSetFrequency (null, null, "" + JU.PT.dVal (frequencies.get (nFreq)), null);
|
||||
var i0 = this.asc.getLastAtomSetAtomIndex ();
|
||||
for (var i = 0; i < this.modelAtomCount; i++) {
|
||||
tokens = JU.PT.getTokens (this.rd ());
|
||||
this.asc.addVibrationVector (i + i0, this.parseFloatStr (tokens[0]) * 0.5291772, this.parseFloatStr (tokens[1]) * 0.5291772, this.parseFloatStr (tokens[2]) * 0.5291772);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readGeometryOptimization",
|
||||
function () {
|
||||
var energies = new JU.Lst ();
|
||||
this.rd ();
|
||||
while (this.rd () != null && this.line.indexOf ("force") < 0) energies.addLast ("" + JU.PT.dVal (this.line.trim ()));
|
||||
|
||||
this.skipTo ("[GEOMETRIES] XYZ");
|
||||
var nGeom = energies.size ();
|
||||
var firstModel = (this.optOnly || this.desiredModelNumber >= 0 ? 0 : 1);
|
||||
this.modelNumber = firstModel;
|
||||
var haveModel = false;
|
||||
if (this.desiredModelNumber == 0 || this.desiredModelNumber == nGeom) this.desiredModelNumber = nGeom;
|
||||
else if (this.asc.atomSetCount > 0) this.finalizeMOData (this.moData);
|
||||
for (var i = 0; i < nGeom; i++) {
|
||||
this.readLines (2);
|
||||
if (this.doGetModel (++this.modelNumber, null)) {
|
||||
this.readAtomSet ("Step " + (this.modelNumber - firstModel) + "/" + nGeom + ": " + energies.get (i), false, !this.optOnly || haveModel);
|
||||
haveModel = true;
|
||||
} else {
|
||||
this.readLines (this.modelAtomCount);
|
||||
}}
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "skipTo",
|
||||
function (key) {
|
||||
key = key.toUpperCase ();
|
||||
if (this.line == null || !this.line.toUpperCase ().contains (key)) while (this.rd () != null && this.line.toUpperCase ().indexOf (key) < 0) {
|
||||
}
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "readAtomSet",
|
||||
function (atomSetName, isBohr, asClone) {
|
||||
if (asClone && this.desiredModelNumber < 0) this.asc.cloneFirstAtomSet (0);
|
||||
var f = (isBohr ? 0.5291772 : 1);
|
||||
this.asc.setAtomSetName (atomSetName);
|
||||
if (this.asc.ac == 0) {
|
||||
while (this.rd () != null && this.line.indexOf ('[') < 0) {
|
||||
var tokens = this.getTokens ();
|
||||
if (tokens.length == 4) this.setAtomCoordScaled (null, tokens, 1, f).atomName = tokens[0];
|
||||
}
|
||||
this.modelAtomCount = this.asc.getLastAtomSetAtomCount ();
|
||||
return;
|
||||
}var atoms = this.asc.atoms;
|
||||
var i0 = this.asc.getLastAtomSetAtomIndex ();
|
||||
for (var i = 0; i < this.modelAtomCount; i++) this.setAtomCoordScaled (atoms[i + i0], JU.PT.getTokens (this.rd ()), 1, f);
|
||||
|
||||
}, "~S,~B,~B");
|
||||
});
|
||||
@@ -0,0 +1,135 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.MopacSlaterReader"], "J.adapter.readers.quantum.MopacGraphfReader", ["java.lang.Float", "java.util.Hashtable", "JU.AU", "$.Lst"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.ac = 0;
|
||||
this.nCoefficients = 0;
|
||||
this.invMatrix = null;
|
||||
this.isNewFormat = false;
|
||||
this.orbitalData = null;
|
||||
this.orbitalInfo = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "MopacGraphfReader", J.adapter.readers.quantum.MopacSlaterReader);
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.alphaBeta = "alpha";
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
this.readAtoms ();
|
||||
if (this.doReadMolecularOrbitals) {
|
||||
this.readSlaterBasis ();
|
||||
this.readMolecularOrbitals (false);
|
||||
if (this.readKeywords ()) this.readMolecularOrbitals (true);
|
||||
}this.continuing = false;
|
||||
return false;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function () {
|
||||
this.asc.newAtomSet ();
|
||||
this.ac = this.parseIntStr (this.line);
|
||||
this.atomicNumbers = Clazz.newIntArray (this.ac, 0);
|
||||
for (var i = 0; i < this.ac; i++) {
|
||||
this.rd ();
|
||||
this.atomicNumbers[i] = this.parseIntRange (this.line, 0, 4);
|
||||
var atom = this.asc.addNewAtom ();
|
||||
this.setAtomCoordXYZ (atom, this.parseFloatRange (this.line, 4, 17), this.parseFloatRange (this.line, 17, 29), this.parseFloatRange (this.line, 29, 41));
|
||||
if (this.line.length > 41) atom.partialCharge = this.parseFloatStr (this.line.substring (41));
|
||||
atom.elementSymbol = J.adapter.smarter.AtomSetCollectionReader.getElementSymbol (this.atomicNumbers[i]);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readSlaterBasis",
|
||||
function () {
|
||||
this.nCoefficients = 0;
|
||||
var values = Clazz.newFloatArray (3, 0);
|
||||
for (var iAtom = 0; iAtom < this.ac; iAtom++) {
|
||||
J.adapter.smarter.AtomSetCollectionReader.getTokensFloat (this.rd (), values, 3);
|
||||
var atomicNumber = this.atomicNumbers[iAtom];
|
||||
var zeta;
|
||||
if ((zeta = values[0]) != 0) {
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "S", zeta, 1);
|
||||
}if ((zeta = values[1]) != 0) {
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "Px", zeta, 1);
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "Py", zeta, 1);
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "Pz", zeta, 1);
|
||||
}if ((zeta = values[2]) != 0) {
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "Dx2-y2", zeta, 1);
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "Dxz", zeta, 1);
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "Dz2", zeta, 1);
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "Dyz", zeta, 1);
|
||||
this.createSphericalSlaterByType (iAtom, atomicNumber, "Dxy", zeta, 1);
|
||||
}}
|
||||
this.nCoefficients = this.slaters.size ();
|
||||
this.setSlaters (true, false);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMolecularOrbitals",
|
||||
function (isBeta) {
|
||||
if (isBeta) this.alphaBeta = "beta";
|
||||
var list = null;
|
||||
if (this.rd () == null) return;
|
||||
this.isNewFormat = (this.line.indexOf ("ORBITAL") >= 0);
|
||||
if (this.isNewFormat) {
|
||||
this.orbitalData = new JU.Lst ();
|
||||
if (this.line.length > 10) this.orbitalInfo = new JU.Lst ();
|
||||
} else {
|
||||
list = Clazz.newFloatArray (this.nCoefficients, this.nCoefficients, 0);
|
||||
}for (var iMo = 0; iMo < this.nCoefficients; iMo++) {
|
||||
if (iMo != 0) this.rd ();
|
||||
var data;
|
||||
if (this.isNewFormat) {
|
||||
if (this.line == null || this.line.indexOf ("ORBITAL") < 0 || this.line.indexOf ("ORBITAL_LIST") >= 0) break;
|
||||
this.orbitalData.addLast (data = Clazz.newFloatArray (this.nCoefficients, 0));
|
||||
if (this.orbitalInfo != null) this.orbitalInfo.addLast (this.line);
|
||||
this.rd ();
|
||||
} else {
|
||||
data = list[iMo];
|
||||
}this.fillFloatArray (this.line, 15, data);
|
||||
}
|
||||
if (this.invMatrix == null) {
|
||||
if (this.isNewFormat && this.line.indexOf ("MATRIX") < 0) this.rd ();
|
||||
this.invMatrix = JU.AU.newFloat2 (this.nCoefficients);
|
||||
for (var iMo = 0; iMo < this.nCoefficients; iMo++) this.fillFloatArray (null, 15, this.invMatrix[iMo] = Clazz.newFloatArray (iMo + 1, 0));
|
||||
|
||||
}this.nOrbitals = (this.orbitalData == null ? this.nCoefficients : this.orbitalData.size ());
|
||||
if (this.orbitalData != null) {
|
||||
list = JU.AU.newFloat2 (this.nOrbitals);
|
||||
for (var i = this.nOrbitals; --i >= 0; ) list[i] = this.orbitalData.get (i);
|
||||
|
||||
}var list2 = Clazz.newFloatArray (this.nOrbitals, this.nCoefficients, 0);
|
||||
for (var i = 0; i < this.nOrbitals; i++) for (var j = 0; j < this.nCoefficients; j++) {
|
||||
for (var k = 0; k < this.nCoefficients; k++) list2[i][j] += (list[i][k] * (k >= j ? this.invMatrix[k][j] : this.invMatrix[j][k]));
|
||||
|
||||
if (Math.abs (list2[i][j]) < 1.0E-4) list2[i][j] = 0;
|
||||
}
|
||||
|
||||
if (this.isNewFormat && this.orbitalInfo == null && this.line != null && this.line.indexOf ("ORBITAL_LIST") < 0) this.rd ();
|
||||
var values = Clazz.newFloatArray (2, 0);
|
||||
for (var iMo = 0; iMo < this.nOrbitals; iMo++) {
|
||||
var mo = new java.util.Hashtable ();
|
||||
if (this.orbitalInfo != null) {
|
||||
this.line = this.orbitalInfo.get (iMo);
|
||||
var tokens = this.getTokens ();
|
||||
mo.put ("energy", Float.$valueOf (this.parseFloatStr (tokens[3])));
|
||||
mo.put ("occupancy", Float.$valueOf (this.parseFloatStr (tokens[1])));
|
||||
} else if (this.rd () != null) {
|
||||
J.adapter.smarter.AtomSetCollectionReader.getTokensFloat (this.line, values, 2);
|
||||
mo.put ("energy", Float.$valueOf (values[0]));
|
||||
mo.put ("occupancy", Float.$valueOf (values[1]));
|
||||
}mo.put ("coefficients", list2[iMo]);
|
||||
if (isBeta) mo.put ("type", "beta");
|
||||
this.line = "\n";
|
||||
if (this.filterMO ()) this.setMO (mo);
|
||||
}
|
||||
this.setMOs ("eV");
|
||||
}, "~B");
|
||||
Clazz.defineMethod (c$, "readKeywords",
|
||||
function () {
|
||||
if (this.rd () == null || this.line.indexOf (" Keywords:") < 0) return false;
|
||||
this.moData.put ("calculationType", this.calculationType = this.line.substring (11).trim ());
|
||||
var isUHF = (this.line.indexOf ("UHF") >= 0);
|
||||
if (isUHF) {
|
||||
for (var i = this.orbitals.size (); --i >= 0; ) {
|
||||
this.orbitals.get (i).put ("type", "alpha");
|
||||
}
|
||||
}return isUHF;
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.SlaterReader"], "J.adapter.readers.quantum.MopacSlaterReader", null, function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.atomicNumbers = null;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "MopacSlaterReader", J.adapter.readers.quantum.SlaterReader);
|
||||
Clazz.defineMethod (c$, "createSphericalSlaterByType",
|
||||
function (iAtom, atomicNumber, type, zeta, coef) {
|
||||
var pt = "S Px Py Pz Dx2-y2Dxz Dz2 Dyz Dxy".indexOf (type);
|
||||
switch (pt) {
|
||||
case 0:
|
||||
this.addSlater (iAtom + 1, 0, 0, 0, J.adapter.readers.quantum.MopacSlaterReader.getNPQs (atomicNumber) - 1, zeta, coef);
|
||||
return;
|
||||
case 2:
|
||||
case 5:
|
||||
case 8:
|
||||
this.addSlater (iAtom + 1, pt == 2 ? 1 : 0, pt == 5 ? 1 : 0, pt == 8 ? 1 : 0, J.adapter.readers.quantum.MopacSlaterReader.getNPQp (atomicNumber) - 2, zeta, coef);
|
||||
return;
|
||||
}
|
||||
pt = (pt >> 2) * 3 - 9;
|
||||
this.addSlater (iAtom + 1, J.adapter.readers.quantum.MopacSlaterReader.sphericalDValues[pt++], J.adapter.readers.quantum.MopacSlaterReader.sphericalDValues[pt++], J.adapter.readers.quantum.MopacSlaterReader.sphericalDValues[pt++], J.adapter.readers.quantum.MopacSlaterReader.getNPQd (atomicNumber) - 3, zeta, coef);
|
||||
}, "~N,~N,~S,~N,~N");
|
||||
Clazz.defineMethod (c$, "scaleSlater",
|
||||
function (ex, ey, ez, er, zeta) {
|
||||
if (ex >= 0 && ey >= 0) {
|
||||
return Clazz.superCall (this, J.adapter.readers.quantum.MopacSlaterReader, "scaleSlater", [ex, ey, ez, er, zeta]);
|
||||
}var el = Math.abs (ex + ey + ez);
|
||||
if (el == 3) {
|
||||
return 0;
|
||||
}return J.adapter.readers.quantum.SlaterReader.getSlaterConstDSpherical (el + er + 1, Math.abs (zeta), ex, ey);
|
||||
}, "~N,~N,~N,~N,~N");
|
||||
c$.getNPQ = Clazz.defineMethod (c$, "getNPQ",
|
||||
function (atomicNumber) {
|
||||
return (atomicNumber < J.adapter.readers.quantum.MopacSlaterReader.principalQuantumNumber.length ? J.adapter.readers.quantum.MopacSlaterReader.principalQuantumNumber[atomicNumber] : 0);
|
||||
}, "~N");
|
||||
c$.getNPQs = Clazz.defineMethod (c$, "getNPQs",
|
||||
function (atomicNumber) {
|
||||
var n = J.adapter.readers.quantum.MopacSlaterReader.getNPQ (atomicNumber);
|
||||
switch (atomicNumber) {
|
||||
case 10:
|
||||
case 18:
|
||||
case 36:
|
||||
case 54:
|
||||
case 86:
|
||||
return n + 1;
|
||||
default:
|
||||
return n;
|
||||
}
|
||||
}, "~N");
|
||||
c$.getNPQp = Clazz.defineMethod (c$, "getNPQp",
|
||||
function (atomicNumber) {
|
||||
var n = J.adapter.readers.quantum.MopacSlaterReader.getNPQ (atomicNumber);
|
||||
switch (atomicNumber) {
|
||||
case 2:
|
||||
return n + 1;
|
||||
default:
|
||||
return n;
|
||||
}
|
||||
}, "~N");
|
||||
c$.getNPQd = Clazz.defineMethod (c$, "getNPQd",
|
||||
function (atomicNumber) {
|
||||
return (atomicNumber < J.adapter.readers.quantum.MopacSlaterReader.npqd.length ? J.adapter.readers.quantum.MopacSlaterReader.npqd[atomicNumber] : 0);
|
||||
}, "~N");
|
||||
Clazz.defineStatics (c$,
|
||||
"MIN_COEF", 0.0001,
|
||||
"sphericalDValues", Clazz.newIntArray (-1, [0, -2, 0, 1, 0, 1, -2, 0, 0, 0, 1, 1, 1, 1, 0]),
|
||||
"principalQuantumNumber", Clazz.newIntArray (-1, [0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]),
|
||||
"npqd", Clazz.newIntArray (-1, [0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7]));
|
||||
});
|
||||
@@ -0,0 +1,392 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (null, "J.adapter.readers.quantum.NBOParser", ["java.util.Hashtable", "JU.Lst", "$.PT"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.vwr = null;
|
||||
this.haveBeta = false;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "NBOParser");
|
||||
Clazz.makeConstructor (c$,
|
||||
function () {
|
||||
});
|
||||
Clazz.defineMethod (c$, "set",
|
||||
function (vwr) {
|
||||
this.vwr = vwr;
|
||||
return this;
|
||||
}, "JV.Viewer");
|
||||
Clazz.defineMethod (c$, "getAllStructures",
|
||||
function (output, list) {
|
||||
if (output == null) return null;
|
||||
if (list == null) list = new JU.Lst ();
|
||||
output = JU.PT.rep (output, "the $CHOOSE", "");
|
||||
this.getStructures (this.getBlock (output, "$CHOOSE"), "CHOOSE", list);
|
||||
this.getStructures (this.getBlock (output, "$NRTSTR"), "NRTSTR", list);
|
||||
this.getStructures (this.getBlock (output, "$NRTSTRA"), "NRTSTRA", list);
|
||||
this.getStructures (this.getBlock (output, "$NRTSTRB"), "NRTSTRB", list);
|
||||
this.getStructuresTOPO (this.getData (output, "TOPO matrix", "* Total *", 1), "RSA", list);
|
||||
this.getStructuresTOPO (this.getData (output, "TOPO matrix", "* Total *", 2), "RSB", list);
|
||||
return list;
|
||||
}, "~S,JU.Lst");
|
||||
Clazz.defineMethod (c$, "getBlock",
|
||||
function (output, key) {
|
||||
var pt = output.indexOf (key);
|
||||
var pt1 = output.indexOf ("$END", pt + 1);
|
||||
return (pt < 0 || pt1 < 0 ? null : output.substring (pt + key.length, pt1));
|
||||
}, "~S,~S");
|
||||
c$.getStructures46 = Clazz.defineMethod (c$, "getStructures46",
|
||||
function (tokens, type, structures, nAtoms) {
|
||||
if (tokens == null) return;
|
||||
var htData = new java.util.Hashtable ();
|
||||
structures.addLast (htData);
|
||||
var matrix = Clazz.newIntArray (nAtoms, nAtoms, 0);
|
||||
htData.put ("matrix", matrix);
|
||||
htData.put ("type", type);
|
||||
htData.put ("spin", type);
|
||||
htData.put ("index", Integer.$valueOf (0));
|
||||
for (var n = tokens.length, i = 0; i < n; i++) {
|
||||
var org = tokens[i];
|
||||
if (org.contains ("(ry)")) break;
|
||||
if (org.contains ("*") || org.contains ("(cr)")) continue;
|
||||
var isLP = org.endsWith ("(lp)");
|
||||
if (isLP || org.endsWith ("(lv)")) {
|
||||
var ia = J.adapter.readers.quantum.NBOParser.getAtomIndex (org.substring (0, org.length - 4));
|
||||
matrix[ia][ia] += (isLP ? 1 : 10);
|
||||
continue;
|
||||
}var names = JU.PT.split (org, "-");
|
||||
if (names.length == 3) {
|
||||
System.out.println ("NBOParser 3-center bonnd " + org + " ignored for Kekule structure");
|
||||
continue;
|
||||
}var ia = J.adapter.readers.quantum.NBOParser.getAtomIndex (names[0]);
|
||||
var ib = J.adapter.readers.quantum.NBOParser.getAtomIndex (names[1]);
|
||||
matrix[ia][ib]++;
|
||||
}
|
||||
J.adapter.readers.quantum.NBOParser.dumpMatrix (type, 0, matrix);
|
||||
}, "~A,~S,JU.Lst,~N");
|
||||
c$.getAtomIndex = Clazz.defineMethod (c$, "getAtomIndex",
|
||||
function (xx99) {
|
||||
for (var n = xx99.length, i = n, val = 0, pow = 1, ch = 0; --i >= 0; ) {
|
||||
if ((ch = xx99.charCodeAt (i)) < 48 || ch > 57) return val - 1;
|
||||
val += (ch - 48) * pow;
|
||||
pow *= 10;
|
||||
}
|
||||
return 0;
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "getStructuresTOPO",
|
||||
function (data, nrtType, list) {
|
||||
if (data == null || data.length == 0) return;
|
||||
var parts = JU.PT.split (data, "Resonance");
|
||||
if (parts.length < 2) return;
|
||||
var pt = parts[0].lastIndexOf (".");
|
||||
var nAtoms = JU.PT.parseInt (parts[0].substring (pt - 3, pt));
|
||||
if (nAtoms < 0) return;
|
||||
var tokens = JU.PT.getTokens (JU.PT.rep (JU.PT.rep (parts[0], ".", ".1"), "Atom", "-1"));
|
||||
var raw = Clazz.newFloatArray (tokens.length, 0);
|
||||
var n = JU.PT.parseFloatArrayInfested (tokens, raw);
|
||||
var table = Clazz.newIntArray (nAtoms, nAtoms, 0);
|
||||
var atom1 = -1;
|
||||
var atom2 = 0;
|
||||
var atom0 = 0;
|
||||
for (var i = 0; i < n; i++) {
|
||||
var f = raw[i];
|
||||
if (f < 0) {
|
||||
atom1 = -1;
|
||||
continue;
|
||||
}if (f % 1 == 0) {
|
||||
if (atom1 == -1) {
|
||||
atom0 = Clazz.floatToInt (f);
|
||||
atom1 = -2;
|
||||
}if (atom1 < 0) continue;
|
||||
table[atom1][atom2++] = Clazz.floatToInt (f);
|
||||
} else {
|
||||
atom1 = Clazz.floatToInt (f - 1);
|
||||
atom2 = atom0 - 1;
|
||||
}}
|
||||
var matrix = null;
|
||||
tokens = parts[1].$plit ("\n");
|
||||
var s = "";
|
||||
for (var i = 3; i < tokens.length; i++) if (tokens[i].indexOf ("--") < 0) s += tokens[i].substring (10) + "\n";
|
||||
|
||||
s = s.$replace ('-', ' ');
|
||||
s = JU.PT.rep (s, ".", ".1");
|
||||
s = JU.PT.rep (s, "(", " -1 ");
|
||||
s = JU.PT.rep (s, ")", " -2 ");
|
||||
s = JU.PT.rep (s, ",", " -3 ");
|
||||
tokens = JU.PT.getTokens (s);
|
||||
raw = Clazz.newFloatArray (tokens.length, 0);
|
||||
n = JU.PT.parseFloatArrayInfested (tokens, raw);
|
||||
var htData = null;
|
||||
var dir = 1;
|
||||
atom1 = atom2 = -1;
|
||||
for (var i = 0, index = 0; i < n; i++) {
|
||||
var f = raw[i];
|
||||
var remain = f % 1;
|
||||
if (remain == 0) {
|
||||
var v = Clazz.floatToInt (f);
|
||||
switch (v) {
|
||||
case -1:
|
||||
dir = -1;
|
||||
atom1 = atom2 = -1;
|
||||
continue;
|
||||
case -2:
|
||||
break;
|
||||
case -3:
|
||||
if (atom1 < 0) continue;
|
||||
break;
|
||||
default:
|
||||
if (atom1 < 0) {
|
||||
atom1 = atom2 = v - 1;
|
||||
} else {
|
||||
atom2 = v - 1;
|
||||
}continue;
|
||||
}
|
||||
matrix[atom1][atom2] += dir;
|
||||
atom1 = atom2 = -1;
|
||||
dir = 1;
|
||||
} else {
|
||||
if (htData == null) matrix = table;
|
||||
J.adapter.readers.quantum.NBOParser.dumpMatrix (nrtType, index, matrix);
|
||||
if (raw[i + 2] == 0) break;
|
||||
list.addLast (htData = new java.util.Hashtable ());
|
||||
s = "" + (Clazz.floatToInt (f) * 100 + Clazz.doubleToInt ((remain - 0.0999999) * 1000));
|
||||
var len = s.length;
|
||||
s = (len == 2 ? "0" : "") + s.substring (0, len - 2) + "." + s.substring (len - 2);
|
||||
htData.put ("weight", s);
|
||||
htData.put ("index", Integer.$valueOf (index++));
|
||||
htData.put ("type", nrtType.toLowerCase ());
|
||||
htData.put ("spin", nrtType.indexOf ("B") >= 0 ? "beta" : "alpha");
|
||||
matrix = Clazz.newIntArray (nAtoms, nAtoms, 0);
|
||||
htData.put ("matrix", matrix);
|
||||
for (var j = 0; j < nAtoms; j++) for (var k = 0; k < nAtoms; k++) matrix[j][k] = table[j][k];
|
||||
|
||||
|
||||
}}
|
||||
}, "~S,~S,JU.Lst");
|
||||
c$.dumpMatrix = Clazz.defineMethod (c$, "dumpMatrix",
|
||||
function (nrtType, index, matrix) {
|
||||
System.out.println ("NBOParser matrix " + nrtType + " " + index);
|
||||
for (var j = 0, nAtoms = matrix.length; j < nAtoms; j++) System.out.println (JU.PT.toJSON (null, matrix[j]));
|
||||
|
||||
System.out.println ("-------------------");
|
||||
}, "~S,~N,~A");
|
||||
Clazz.defineMethod (c$, "getData",
|
||||
function (output, start, end, n) {
|
||||
var pt = 0;
|
||||
var pt1 = 0;
|
||||
for (var i = 0; i < n; i++) {
|
||||
pt = output.indexOf (start, pt1 + 1);
|
||||
pt1 = output.indexOf (end, pt + 1);
|
||||
}
|
||||
return (pt < 0 || pt1 < 0 ? null : output.substring (pt, pt1));
|
||||
}, "~S,~S,~S,~N");
|
||||
Clazz.defineMethod (c$, "getStructures",
|
||||
function (data, nrtType, list) {
|
||||
if (data == null || data.length == 0) return 0;
|
||||
var n = 0;
|
||||
try {
|
||||
var ignoreSTR = (data.indexOf ("ALPHA") >= 0);
|
||||
if (!ignoreSTR && !data.contains ("STR")) data = "STR " + data + " END";
|
||||
nrtType = nrtType.toLowerCase ();
|
||||
var spin = (nrtType.equals ("nrtstrb") ? "beta" : "alpha");
|
||||
if (nrtType.equals ("choose")) nrtType = null;
|
||||
var htData = null;
|
||||
var tokens = JU.PT.getTokens (data.$replace ('\r', ' ').$replace ('\n', ' ').$replace ('\t', ' '));
|
||||
var lastType = "";
|
||||
var index = 0;
|
||||
for (var i = 0, nt = tokens.length; i < nt; i++) {
|
||||
var tok = tokens[i];
|
||||
switch ("STR = ALPHABETA LONE BOND 3C".indexOf (tok)) {
|
||||
case 0:
|
||||
if (ignoreSTR) continue;
|
||||
tok = spin;
|
||||
case 10:
|
||||
case 15:
|
||||
list.addLast (htData = new java.util.Hashtable ());
|
||||
if (!lastType.equals (tok)) {
|
||||
lastType = tok;
|
||||
index = 0;
|
||||
}htData.put ("index", Integer.$valueOf (index++));
|
||||
htData.put ("spin", spin = tok.toLowerCase ());
|
||||
if (spin.equals ("beta")) this.haveBeta = true;
|
||||
htData.put ("type", nrtType == null ? "choose" + spin.substring (0, 1) : nrtType);
|
||||
n++;
|
||||
break;
|
||||
case 5:
|
||||
htData.put ("weight", tokens[++i]);
|
||||
break;
|
||||
case 20:
|
||||
var lone = new JU.Lst ();
|
||||
htData.put ("lone", lone);
|
||||
while (!(tok = tokens[++i]).equals ("END")) {
|
||||
var at1 = Integer.parseInt (tok);
|
||||
var nlp = Integer.parseInt (tokens[++i]);
|
||||
lone.addLast ( Clazz.newIntArray (-1, [nlp, at1]));
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
var bonds = new JU.Lst ();
|
||||
htData.put ("bond", bonds);
|
||||
while (!(tok = tokens[++i]).equals ("END")) {
|
||||
var order = "DTQ".indexOf (tok.charAt (0)) + 2;
|
||||
var at1 = Integer.parseInt (tokens[++i]);
|
||||
var at2 = Integer.parseInt (tokens[++i]);
|
||||
bonds.addLast ( Clazz.newIntArray (-1, [order, at1, at2]));
|
||||
}
|
||||
break;
|
||||
case 30:
|
||||
var threeCenter = new JU.Lst ();
|
||||
htData.put ("3c", threeCenter);
|
||||
while (!(tok = tokens[++i]).equals ("END")) {
|
||||
var order = "DTQ".indexOf (tok.charAt (0)) + 2;
|
||||
var at1 = Integer.parseInt (tokens[++i]);
|
||||
var at2 = Integer.parseInt (tokens[++i]);
|
||||
var at3 = Integer.parseInt (tokens[++i]);
|
||||
threeCenter.addLast ( Clazz.newIntArray (-1, [order, at1, at2, at3]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
e.printStackTrace ();
|
||||
list.clear ();
|
||||
return -1;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}, "~S,~S,JU.Lst");
|
||||
Clazz.defineMethod (c$, "isOpenShell",
|
||||
function () {
|
||||
return this.haveBeta;
|
||||
});
|
||||
c$.getStructureMap = Clazz.defineMethod (c$, "getStructureMap",
|
||||
function (structureList, type, index) {
|
||||
if (type == null || structureList == null) return null;
|
||||
type = type.toLowerCase ();
|
||||
var spin = (type.indexOf ("b") < 0 ? "alpha" : "beta");
|
||||
for (var i = 0; i < structureList.size (); i++) {
|
||||
var map = structureList.get (i);
|
||||
if (spin.equals (map.get ("spin")) && type.equals (map.get ("type")) && (index < 0 || index == (map.get ("index")).intValue ())) {
|
||||
return map;
|
||||
}}
|
||||
return null;
|
||||
}, "JU.Lst,~S,~N");
|
||||
Clazz.defineMethod (c$, "connectNBO",
|
||||
function (modelIndex, type) {
|
||||
try {
|
||||
if (type == null) type = "alpha";
|
||||
type = type.toLowerCase ();
|
||||
if (type.length == 0 || type.equals ("46")) type = "alpha";
|
||||
var map = this.vwr.ms.getModelAuxiliaryInfo (modelIndex);
|
||||
this.haveBeta = map.containsKey ("isOpenShell");
|
||||
var list = map.get ("nboStructures");
|
||||
if (list == null || list.size () == 0) return false;
|
||||
type = type.toLowerCase ();
|
||||
var index = type.indexOf ("_");
|
||||
if (index > 0) {
|
||||
if (list.size () <= 2) {
|
||||
var fname = map.get ("fileName");
|
||||
if (fname != null && !fname.endsWith (".nbo")) {
|
||||
fname = fname.substring (0, fname.lastIndexOf (".")) + ".nbo";
|
||||
this.getAllStructures (this.vwr.getAsciiFileOrNull (fname), list);
|
||||
}}var tokens = JU.PT.split (type, "_");
|
||||
index = JU.PT.parseInt (tokens[1]) - 1;
|
||||
type = tokens[0];
|
||||
} else {
|
||||
index = 0;
|
||||
}var structureMap = J.adapter.readers.quantum.NBOParser.getStructureMap (list, type, index);
|
||||
if (structureMap == null || !this.setJmolLewisStructure (structureMap, modelIndex, index + 1)) {
|
||||
return false;
|
||||
}map.put ("nboStructure", structureMap);
|
||||
} catch (e) {
|
||||
e.printStackTrace ();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}, "~N,~S");
|
||||
Clazz.defineMethod (c$, "setJmolLewisStructure",
|
||||
function (structureMap, modelIndex, resNo) {
|
||||
if (structureMap == null || modelIndex < 0) return false;
|
||||
var type = structureMap.get ("type");
|
||||
System.out.println ("creating structure " + modelIndex + " " + type);
|
||||
var bonds = structureMap.get ("bond");
|
||||
var lonePairs = structureMap.get ("lone");
|
||||
var matrix = structureMap.get ("matrix");
|
||||
var lplv = structureMap.get ("lplv");
|
||||
var bondCounts = structureMap.get ("bondCounts");
|
||||
var needLP = (lplv == null);
|
||||
var bsAtoms = this.vwr.ms.getModelAtomBitSetIncludingDeleted (modelIndex, false);
|
||||
var atomCount = bsAtoms.cardinality ();
|
||||
var iatom0 = bsAtoms.nextSetBit (0);
|
||||
if (matrix != null && atomCount != matrix.length) return false;
|
||||
if (matrix != null) J.adapter.readers.quantum.NBOParser.dumpMatrix (type, resNo, matrix);
|
||||
if (needLP) {
|
||||
structureMap.put ("lplv", lplv = Clazz.newIntArray (atomCount, 0));
|
||||
structureMap.put ("bondCounts", bondCounts = Clazz.newIntArray (atomCount, 0));
|
||||
}if (needLP) {
|
||||
if (lonePairs != null) {
|
||||
for (var i = lonePairs.size (); --i >= 0; ) {
|
||||
var na = lonePairs.get (i);
|
||||
var nlp = na[0];
|
||||
var a1 = na[1] - 1;
|
||||
lplv[a1] = nlp;
|
||||
}
|
||||
} else if (matrix != null) {
|
||||
for (var i = atomCount; --i >= 0; ) {
|
||||
lplv[i] = matrix[i][i];
|
||||
}
|
||||
}}this.vwr.ms.deleteModelBonds (modelIndex);
|
||||
var mad = this.vwr.ms.getDefaultMadFromOrder (1);
|
||||
if (bonds != null) {
|
||||
for (var i = bonds.size (); --i >= 0; ) {
|
||||
var oab = bonds.get (i);
|
||||
var a1 = iatom0 + oab[1] - 1;
|
||||
var a2 = iatom0 + oab[2] - 1;
|
||||
var order = oab[0];
|
||||
if (needLP) {
|
||||
bondCounts[a1] += order;
|
||||
bondCounts[a2] += order;
|
||||
}this.vwr.ms.bondAtoms (this.vwr.ms.at[a1], this.vwr.ms.at[a2], order, mad, bsAtoms, 0, true, true);
|
||||
}
|
||||
} else if (matrix != null) {
|
||||
for (var i = 0; i < atomCount - 1; i++) {
|
||||
var m = matrix[i];
|
||||
for (var j = i + 1; j < atomCount; j++) {
|
||||
var order = m[j];
|
||||
if (order == 0) continue;
|
||||
System.out.println ("adding bond " + this.vwr.ms.at[i + iatom0] + " " + this.vwr.ms.at[j + iatom0]);
|
||||
this.vwr.ms.bondAtoms (this.vwr.ms.at[i + iatom0], this.vwr.ms.at[j + iatom0], order, mad, null, 0, false, true);
|
||||
if (needLP) {
|
||||
bondCounts[i] += order;
|
||||
bondCounts[j] += order;
|
||||
}}
|
||||
}
|
||||
}for (var i = 0, ia = bsAtoms.nextSetBit (0); ia >= 0; ia = bsAtoms.nextSetBit (ia + 1), i++) {
|
||||
var a = this.vwr.ms.at[ia];
|
||||
a.setValence (bondCounts[i]);
|
||||
a.setFormalCharge (0);
|
||||
var nH = this.vwr.ms.getMissingHydrogenCount (a, true);
|
||||
if (a.getElementNumber () == 6 && nH == 1) {
|
||||
if (bondCounts[i] == 3 && lplv[i] % 10 == 0 || bondCounts[i] == 2) nH -= 2;
|
||||
}a.setFormalCharge (-nH);
|
||||
}
|
||||
return true;
|
||||
}, "java.util.Map,~N,~N");
|
||||
Clazz.defineMethod (c$, "getNBOAtomLabel",
|
||||
function (a) {
|
||||
var name = a.getAtomName ();
|
||||
var modelIndex = a.getModelIndex ();
|
||||
var structureMap = this.vwr.ms.getModelAuxiliaryInfo (modelIndex).get ("nboStructure");
|
||||
if (this.vwr == null || structureMap == null) return name;
|
||||
var lplv = structureMap.get ("lplv");
|
||||
var i = a.i - this.vwr.ms.am[modelIndex].firstAtomIndex;
|
||||
var addFormalCharge = this.vwr.getBoolean (603979891);
|
||||
var charge = (addFormalCharge ? this.vwr.ms.at[i].getFormalCharge () : 0);
|
||||
if (lplv[i] == 0 && charge == 0) return name;
|
||||
if (lplv[i] % 10 > 0) name = "<sup>(" + (lplv[i] % 10) + ")</sup>" + name;
|
||||
if (lplv[i] >= 10) name = "*" + name;
|
||||
if (addFormalCharge) {
|
||||
if (charge != 0) name += "<sup>" + Math.abs (charge) + (charge > 0 ? "+" : charge < 0 ? "-" : "") + "</sup>";
|
||||
}return name;
|
||||
}, "JM.Atom");
|
||||
});
|
||||
@@ -0,0 +1,403 @@
|
||||
Clazz.declarePackage ("J.adapter.readers.quantum");
|
||||
Clazz.load (["J.adapter.readers.quantum.MOReader", "java.util.Hashtable"], "J.adapter.readers.quantum.NWChemReader", ["java.lang.Character", "$.Float", "JU.AU", "$.BS", "$.Lst", "$.PT", "J.adapter.readers.quantum.BasisFunctionReader", "J.adapter.smarter.SmarterJmolAdapter", "J.api.JmolAdapter", "JU.Elements", "$.Logger"], function () {
|
||||
c$ = Clazz.decorateAsClass (function () {
|
||||
this.taskNumber = 1;
|
||||
this.equivalentAtomSets = 0;
|
||||
this.energyKey = "";
|
||||
this.energyValue = "";
|
||||
this.converged = false;
|
||||
this.haveEnergy = false;
|
||||
this.haveAt = false;
|
||||
this.inInput = false;
|
||||
this.atomTypes = null;
|
||||
this.htMOs = null;
|
||||
this.nBasisFunctions = 0;
|
||||
this.moCount = 0;
|
||||
this.purging = false;
|
||||
Clazz.instantialize (this, arguments);
|
||||
}, J.adapter.readers.quantum, "NWChemReader", J.adapter.readers.quantum.MOReader);
|
||||
Clazz.prepareFields (c$, function () {
|
||||
this.htMOs = new java.util.Hashtable ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "initializeReader",
|
||||
function () {
|
||||
this.calculationType = "(NWCHEM)";
|
||||
});
|
||||
Clazz.overrideMethod (c$, "checkLine",
|
||||
function () {
|
||||
if (this.line.trim ().startsWith ("NWChem")) {
|
||||
this.inInput = (this.line.indexOf ("NWChem Input Module") >= 0);
|
||||
if (this.inInput) {
|
||||
this.checkMOs ();
|
||||
}}if (this.line.startsWith (" Step")) {
|
||||
this.init ();
|
||||
return true;
|
||||
}if (this.line.indexOf (" wavefunction = ") >= 0) {
|
||||
this.calculationType = this.line.substring (this.line.indexOf ("=") + 1).trim () + "(NWCHEM)";
|
||||
this.moData.put ("calculationType", this.calculationType);
|
||||
return true;
|
||||
}if (this.line.indexOf ("Total") >= 0) {
|
||||
this.readTotal ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("@") >= 0) {
|
||||
this.readAtSign ();
|
||||
return true;
|
||||
}if (this.line.startsWith (" Task times")) {
|
||||
this.init ();
|
||||
this.taskNumber++;
|
||||
return true;
|
||||
}if (this.line.startsWith (" Optimization converged")) {
|
||||
this.converged = true;
|
||||
return true;
|
||||
}if (this.line.startsWith (" Symmetry information")) {
|
||||
this.readSymmetry ();
|
||||
return true;
|
||||
}if (this.line.indexOf ("Output coordinates in ") >= 0) {
|
||||
var thisLine = this.line;
|
||||
if (!this.htMOs.isEmpty ()) this.checkMOs ();
|
||||
if (!this.doGetModel (++this.modelNumber, null)) return this.checkLastModel ();
|
||||
this.equivalentAtomSets++;
|
||||
this.readAtoms (thisLine);
|
||||
return true;
|
||||
}if (this.line.indexOf ("Vibrational analysis") >= 0) {
|
||||
this.readFrequencies ();
|
||||
return true;
|
||||
}if (!this.doProcessLines) return true;
|
||||
if (this.line.startsWith (" Mulliken analysis of the total density")) {
|
||||
if (this.equivalentAtomSets != 0) this.readPartialCharges ();
|
||||
return true;
|
||||
}if (this.line.contains ("Basis \"ao basis\"") && this.doReadMolecularOrbitals) {
|
||||
return this.readBasis ();
|
||||
}if (this.line.contains ("Molecular Orbital Analysis")) {
|
||||
if (this.equivalentAtomSets != 0) this.readMOs ();
|
||||
return true;
|
||||
}return true;
|
||||
});
|
||||
Clazz.overrideMethod (c$, "finalizeSubclassReader",
|
||||
function () {
|
||||
this.checkMOs ();
|
||||
this.finalizeReaderASCR ();
|
||||
});
|
||||
Clazz.defineMethod (c$, "init",
|
||||
function () {
|
||||
this.haveEnergy = false;
|
||||
this.haveAt = false;
|
||||
this.converged = false;
|
||||
this.inInput = false;
|
||||
this.equivalentAtomSets = 0;
|
||||
});
|
||||
Clazz.defineMethod (c$, "setEnergies",
|
||||
function (key, value, nAtomSets) {
|
||||
this.energyKey = key;
|
||||
this.energyValue = value;
|
||||
this.setProps (this.energyKey, this.energyValue, this.equivalentAtomSets);
|
||||
this.setNames (this.energyKey + " = " + this.energyValue, null, this.equivalentAtomSets);
|
||||
this.asc.setAtomSetEnergy (value, this.parseFloatStr (value));
|
||||
this.haveEnergy = true;
|
||||
}, "~S,~S,~N");
|
||||
Clazz.defineMethod (c$, "setEnergy",
|
||||
function (key, value) {
|
||||
this.energyKey = key;
|
||||
this.energyValue = value;
|
||||
this.asc.setAtomSetModelProperty (this.energyKey, this.energyValue);
|
||||
this.asc.setAtomSetName (this.energyKey + " = " + this.energyValue);
|
||||
this.haveEnergy = true;
|
||||
}, "~S,~S");
|
||||
Clazz.defineMethod (c$, "readSymmetry",
|
||||
function () {
|
||||
var tokens = JU.PT.getTokens (this.readLines (3));
|
||||
this.setProps ("Symmetry group name", tokens[tokens.length - 1], this.equivalentAtomSets);
|
||||
});
|
||||
Clazz.defineMethod (c$, "readTotal",
|
||||
function () {
|
||||
var tokens = this.getTokens ();
|
||||
try {
|
||||
if (tokens[2].startsWith ("energy")) {
|
||||
if (!this.haveAt) this.setEnergies ("E(" + tokens[1] + ")", tokens[tokens.length - 1], this.equivalentAtomSets);
|
||||
}} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readAtSign",
|
||||
function () {
|
||||
if (this.line.charAt (2) == 'S') {
|
||||
if (this.readLines (2) == null) return;
|
||||
}var tokens = this.getTokens ();
|
||||
if (!this.haveEnergy) {
|
||||
this.setEnergies ("E", tokens[2], this.equivalentAtomSets);
|
||||
} else {
|
||||
this.setEnergies (this.energyKey, this.energyValue, this.equivalentAtomSets);
|
||||
}this.setProps ("Step", tokens[1], this.equivalentAtomSets);
|
||||
this.haveAt = true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "setProps",
|
||||
function (key, value, n) {
|
||||
for (var i = this.asc.iSet; --n >= 0 && i >= 0; --i) this.asc.setAtomSetModelPropertyForSet (key, value, i);
|
||||
|
||||
}, "~S,~S,~N");
|
||||
Clazz.defineMethod (c$, "setNames",
|
||||
function (atomSetName, namedSets, n) {
|
||||
for (var i = this.asc.iSet; --n >= 0 && i >= 0; --i) if (namedSets == null || !namedSets.get (i)) this.asc.setModelInfoForSet ("name", atomSetName, i);
|
||||
|
||||
}, "~S,JU.BS,~N");
|
||||
Clazz.defineMethod (c$, "readAtoms",
|
||||
function (thisLine) {
|
||||
var scale = (thisLine.indexOf ("angstroms") < 0 ? 0.5291772 : 1);
|
||||
this.readLines (3);
|
||||
var tokens;
|
||||
this.haveEnergy = false;
|
||||
this.asc.newAtomSet ();
|
||||
this.asc.setAtomSetModelProperty (".PATH", "Task " + this.taskNumber + (this.inInput ? J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR + "Input" : J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR + "Geometry"));
|
||||
this.atomTypes = new JU.Lst ();
|
||||
while (this.rd () != null && this.line.length > 0) {
|
||||
tokens = this.getTokens ();
|
||||
if (tokens.length < 6) break;
|
||||
var name = this.fixTag (tokens[1]);
|
||||
this.setAtomCoordScaled (null, tokens, 3, scale).atomName = name;
|
||||
this.atomTypes.addLast (name);
|
||||
}
|
||||
if (this.converged) {
|
||||
this.setEnergy (this.energyKey, this.energyValue);
|
||||
this.asc.setAtomSetModelProperty ("Step", "converged");
|
||||
} else if (this.inInput) {
|
||||
this.asc.setAtomSetName ("Input");
|
||||
}}, "~S");
|
||||
Clazz.defineMethod (c$, "readFrequencies",
|
||||
function () {
|
||||
var firstFrequencyAtomSetIndex = this.asc.atomSetCount;
|
||||
var firstVibrationNumber = this.vibrationNumber;
|
||||
var path = "Task " + this.taskNumber + J.adapter.smarter.SmarterJmolAdapter.PATH_SEPARATOR + "Frequencies";
|
||||
this.discardLinesUntilContains ("Atom information");
|
||||
this.readLines (2);
|
||||
this.asc.newAtomSet ();
|
||||
var tokens;
|
||||
while (this.rd () != null && this.line.indexOf ("---") < 0) {
|
||||
tokens = this.getTokens ();
|
||||
this.setAtomCoordScaled (null, tokens, 2, 0.5291772).atomName = this.fixTag (tokens[0]);
|
||||
}
|
||||
this.discardLinesUntilContains ("(Projected Frequencies expressed in cm-1)");
|
||||
this.readLines (3);
|
||||
var firstTime = true;
|
||||
var bsIgnore = new JU.BS ();
|
||||
while (this.rd () != null && this.line.indexOf ("P.Frequency") >= 0) {
|
||||
tokens = JU.PT.getTokensAt (this.line, 12);
|
||||
var frequencyCount = tokens.length;
|
||||
var iAtom0 = this.asc.ac;
|
||||
var ac = this.asc.getLastAtomSetAtomCount ();
|
||||
if (firstTime) iAtom0 -= ac;
|
||||
var ignore = Clazz.newBooleanArray (frequencyCount, false);
|
||||
for (var i = 0; i < frequencyCount; ++i) {
|
||||
ignore[i] = (tokens[i].equals ("0.00") || !this.doGetVibration (++this.vibrationNumber));
|
||||
if (ignore[i]) {
|
||||
bsIgnore.set (this.vibrationNumber);
|
||||
continue;
|
||||
}if (!firstTime) this.asc.cloneLastAtomSet ();
|
||||
firstTime = false;
|
||||
this.asc.setAtomSetFrequency (path, null, tokens[i], null);
|
||||
}
|
||||
this.readLines (1);
|
||||
this.fillFrequencyData (iAtom0, ac, ac, ignore, false, 0, 0, null, 0);
|
||||
this.readLines (3);
|
||||
}
|
||||
try {
|
||||
this.discardLinesUntilContains ("Infra Red Intensities");
|
||||
this.readLines (2);
|
||||
var idx = firstFrequencyAtomSetIndex;
|
||||
for (var i = firstVibrationNumber; i < this.vibrationNumber; ++i) {
|
||||
if (this.rd () == null) return;
|
||||
if (bsIgnore.get (i)) continue;
|
||||
tokens = this.getTokens ();
|
||||
var iset = this.asc.iSet;
|
||||
this.asc.iSet = idx++;
|
||||
this.asc.setAtomSetModelProperty ("IRIntensity", tokens[3] + " au");
|
||||
this.asc.iSet = iset;
|
||||
}
|
||||
} catch (e) {
|
||||
if (Clazz.exceptionOf (e, Exception)) {
|
||||
System.out.println ("nwchem infra red issue" + e);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "readPartialCharges",
|
||||
function () {
|
||||
var tokens;
|
||||
this.readLines (4);
|
||||
var ac = this.asc.ac;
|
||||
var i0 = this.asc.getLastAtomSetAtomIndex ();
|
||||
var atoms = this.asc.atoms;
|
||||
for (var i = i0; i < ac; ++i) {
|
||||
while (atoms[i].elementNumber == 0) ++i;
|
||||
|
||||
do {
|
||||
if (this.rd () == null || this.line.length < 3) return;
|
||||
tokens = this.getTokens ();
|
||||
} while (tokens[0].indexOf (".") >= 0);
|
||||
atoms[i].partialCharge = this.parseIntStr (tokens[2]) - this.parseFloatStr (tokens[3]);
|
||||
}
|
||||
});
|
||||
Clazz.defineMethod (c$, "fixTag",
|
||||
function (tag) {
|
||||
if (tag.equalsIgnoreCase ("bq")) return "X";
|
||||
if (tag.toLowerCase ().startsWith ("bq")) tag = tag.substring (2) + "-Bq";
|
||||
return "" + Character.toUpperCase (tag.charAt (0)) + (tag.length == 1 ? "" : "" + Character.toLowerCase (tag.charAt (1)));
|
||||
}, "~S");
|
||||
Clazz.defineMethod (c$, "readBasis",
|
||||
function () {
|
||||
this.gaussianCount = 0;
|
||||
this.shellCount = 0;
|
||||
this.nBasisFunctions = 0;
|
||||
var isD6F10 = (this.line.indexOf ("cartesian") >= 0);
|
||||
if (isD6F10) {
|
||||
this.getDFMap ("DC", J.adapter.readers.quantum.NWChemReader.$DC_LIST, 4, "DXX DYY DZZ DXY DXZ DYZ", 3);
|
||||
this.getDFMap ("FC", J.adapter.readers.quantum.NWChemReader.$FC_LIST, 6, "XXX YYY ZZZ XYY XXY XXZ XZZ YZZ YYZ XYZ", 3);
|
||||
} else {
|
||||
this.getDFMap ("DS", J.adapter.readers.quantum.NWChemReader.$DS_LIST, 3, "d0 d1+ d1- d2+ d2-", 2);
|
||||
this.getDFMap ("FS", J.adapter.readers.quantum.NWChemReader.$FS_LIST, 5, "f0 f1+ f1- f2+ f2- f3+ f3-", 2);
|
||||
}this.shells = new JU.Lst ();
|
||||
var atomInfo = new java.util.Hashtable ();
|
||||
var atomSym = null;
|
||||
var atomData = null;
|
||||
var shellData = null;
|
||||
while (this.line != null) {
|
||||
var nBlankLines = 0;
|
||||
while (this.line.length < 3 || this.line.charAt (2) == ' ') {
|
||||
shellData = new JU.Lst ();
|
||||
this.rd ();
|
||||
if (this.line.length < 3) nBlankLines++;
|
||||
}
|
||||
if (nBlankLines >= 2) break;
|
||||
if (this.parseIntStr (this.line) == -2147483648) {
|
||||
atomSym = this.getTokens ()[0];
|
||||
if (atomSym.length > 2) atomSym = J.api.JmolAdapter.getElementSymbol (JU.Elements.elementNumberFromName (atomSym));
|
||||
atomData = new JU.Lst ();
|
||||
atomInfo.put (atomSym, atomData);
|
||||
this.rd ();
|
||||
this.rd ();
|
||||
continue;
|
||||
}while (this.line != null && this.line.length > 3) {
|
||||
var tokens = this.getTokens ();
|
||||
var o = Clazz.newArray (-1, [tokens[1], Clazz.newFloatArray (-1, [this.parseFloatStr (tokens[2]), this.parseFloatStr (tokens[3])])]);
|
||||
shellData.addLast (o);
|
||||
this.rd ();
|
||||
}
|
||||
atomData.addLast (shellData);
|
||||
}
|
||||
var nD = (isD6F10 ? 6 : 5);
|
||||
var nF = (isD6F10 ? 10 : 7);
|
||||
var gdata = new JU.Lst ();
|
||||
for (var i = 0; i < this.atomTypes.size (); i++) {
|
||||
atomData = atomInfo.get (this.atomTypes.get (i));
|
||||
var nShells = atomData.size ();
|
||||
for (var ishell = 0; ishell < nShells; ishell++) {
|
||||
this.shellCount++;
|
||||
shellData = atomData.get (ishell);
|
||||
var nGaussians = shellData.size ();
|
||||
var type = shellData.get (0)[0];
|
||||
switch (type.charAt (0)) {
|
||||
case 'S':
|
||||
this.nBasisFunctions += 1;
|
||||
break;
|
||||
case 'P':
|
||||
this.nBasisFunctions += 3;
|
||||
break;
|
||||
case 'D':
|
||||
this.nBasisFunctions += nD;
|
||||
break;
|
||||
case 'F':
|
||||
this.nBasisFunctions += nF;
|
||||
break;
|
||||
}
|
||||
var slater = Clazz.newIntArray (4, 0);
|
||||
slater[0] = i + 1;
|
||||
slater[1] = (isD6F10 ? J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagID (type) : J.adapter.readers.quantum.BasisFunctionReader.getQuantumShellTagIDSpherical (type));
|
||||
slater[2] = this.gaussianCount + 1;
|
||||
slater[3] = nGaussians;
|
||||
this.shells.addLast (slater);
|
||||
for (var ifunc = 0; ifunc < nGaussians; ifunc++) gdata.addLast (shellData.get (ifunc)[1]);
|
||||
|
||||
this.gaussianCount += nGaussians;
|
||||
}
|
||||
}
|
||||
this.gaussians = JU.AU.newFloat2 (this.gaussianCount);
|
||||
for (var i = 0; i < this.gaussianCount; i++) this.gaussians[i] = gdata.get (i);
|
||||
|
||||
JU.Logger.info (this.gaussianCount + " Gaussians read");
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "readMOs",
|
||||
function () {
|
||||
var lines = new JU.Lst ();
|
||||
this.htMOs.put (this.line, lines);
|
||||
lines.addLast (this.line);
|
||||
var nblank = 0;
|
||||
while (nblank != 2 && this.rd () != null) {
|
||||
lines.addLast (this.line);
|
||||
if (this.line.length < 2) nblank++;
|
||||
else nblank = 0;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Clazz.defineMethod (c$, "checkMOs",
|
||||
function () {
|
||||
if (this.shells == null) return;
|
||||
for (var entry, $entry = this.htMOs.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
|
||||
this.line = entry.getKey ();
|
||||
this.alphaBeta = this.line.substring (0, this.line.indexOf ("Final")).trim () + " ";
|
||||
var moCount = 0;
|
||||
if (!this.filterMO ()) continue;
|
||||
var list = entry.getValue ();
|
||||
var n = list.size ();
|
||||
JU.Logger.info (this.line);
|
||||
for (var i = 3; i < n; i++) {
|
||||
while (i < n && ((this.line = list.get (i)).length < 2 || this.line.charAt (1) != 'V')) i++;
|
||||
|
||||
if (i == n) break;
|
||||
this.line = this.line.$replace ('=', ' ');
|
||||
var tokens = this.getTokens ();
|
||||
var occupancy = this.parseFloatStr (tokens[3]);
|
||||
var energy = this.parseFloatStr (tokens[5]);
|
||||
var symmetry = (tokens.length > 7 ? tokens[7] : null);
|
||||
var mo = new java.util.Hashtable ();
|
||||
mo.put ("occupancy", Float.$valueOf (occupancy));
|
||||
mo.put ("energy", Float.$valueOf (energy));
|
||||
if (symmetry != null) mo.put ("symmetry", symmetry);
|
||||
var coefs = null;
|
||||
this.setMO (mo);
|
||||
mo.put ("type", this.alphaBeta + (++moCount));
|
||||
coefs = Clazz.newFloatArray (this.nBasisFunctions, 0);
|
||||
mo.put ("coefficients", coefs);
|
||||
i += 3;
|
||||
while ((this.line = list.get (++i)) != null && this.line.length > 3) {
|
||||
tokens = this.getTokens ();
|
||||
coefs[this.parseIntStr (tokens[0]) - 1] = this.parseFloatStr (tokens[1]);
|
||||
var pt = Clazz.doubleToInt (tokens.length / 2);
|
||||
if (pt == 5 || pt == 6) coefs[this.parseIntStr (tokens[pt]) - 1] = this.parseFloatStr (tokens[pt + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.energyUnits = "a.u.";
|
||||
this.setMOData (true);
|
||||
this.htMOs.clear ();
|
||||
});
|
||||
Clazz.overrideMethod (c$, "rd",
|
||||
function () {
|
||||
this.RL ();
|
||||
if (!this.purging && this.line != null && this.line.startsWith ("--")) {
|
||||
this.purging = true;
|
||||
this.discardLinesUntilStartsWith ("*");
|
||||
this.rd ();
|
||||
this.purging = false;
|
||||
this.RL ();
|
||||
}return this.line;
|
||||
});
|
||||
Clazz.defineStatics (c$,
|
||||
"$DS_LIST", "d2- d1- d0 d1+ d2+",
|
||||
"$FS_LIST", "f3- f2- f1- f0 f1+ f2+ f3+",
|
||||
"$DC_LIST", "DXX DXY DXZ DYY DYZ DZZ",
|
||||
"$FC_LIST", "XXX XXY XXZ XYY XYZ XZZ YYY YYZ YZZ ZZZ");
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user