EricBoi commited on
Commit
95fa686
·
verified ·
1 Parent(s): fd46c63

Deploy the app

Browse files
assets/{engine.worker-tttrTml4.js → engine.worker-CzhQQePN.js} RENAMED
The diff for this file is too large to render. See raw diff
 
assets/{main-B1y03rfk.js → main-BTNusuw2.js} RENAMED
The diff for this file is too large to render. See raw diff
 
assets/md-BKxiF21f.js DELETED
@@ -1 +0,0 @@
1
- import{A as e,E as t,F as n,I as r,J as i,K as a,P as o,Q as s,S as c,V as l,X as u,Z as d,a as ee,at as f,b as p,c as m,d as h,ft as g,g as _,i as te,j as v,l as y,m as b,n as ne,nt as re,o as ie,r as ae,s as oe,t as se,ut as x,w as ce,x as le,y as ue,z as de}from"./xyz-BRZpSlyC.js";var fe=e=>e[0][0]*(e[1][1]*e[2][2]-e[1][2]*e[2][1])-e[0][1]*(e[1][0]*e[2][2]-e[1][2]*e[2][0])+e[0][2]*(e[1][0]*e[2][1]-e[1][1]*e[2][0]);function pe(e){let t=fe(e),n=(t,n)=>{let r=[0,1,2].filter(e=>e!==t),i=[0,1,2].filter(e=>e!==n);return(e[r[0]][i[0]]*e[r[1]][i[1]]-e[r[0]][i[1]]*e[r[1]][i[0]])*((t+n)%2?-1:1)};return[0,1,2].map(e=>[0,1,2].map(r=>n(r,e)/t))}var me=e=>!!e.cell&&!!e.pbc?.some(Boolean)&&Math.abs(fe(e.cell))>1e-10,he=`#d7dbe4`,S=`#8a93a6`,ge=`#232835`,_e=`#12151c`,ve=4e3;function ye(e,t,n=5){let r=(t-e||Math.abs(t)||1)/n,i=10**Math.floor(Math.log10(r)),a=[1,2,2.5,5,10].map(e=>e*i).find(e=>e>=r),o=[];for(let n=Math.ceil(e/a)*a;n<=t+a*1e-9;n+=a)o.push(Math.abs(n)<a*1e-9?0:n);return{values:o,step:a}}var C=(e,t)=>e.toFixed(Math.max(0,-Math.floor(Math.log10(t)+1e-9))),w=class{el;series;unit;xUnit;canvas=document.createElement(`canvas`);tip=document.createElement(`div`);t=[];y;hover=null;refs=[];constructor(e,t,n,r=`fs`){if(this.el=e,this.series=t,this.unit=n,this.xUnit=r,this.y=t.map(()=>[]),e.classList.add(`chart`),t.length>1){let n=document.createElement(`div`);n.className=`chart-legend`,n.innerHTML=t.map(e=>`<span><i style="background:${e.color}"></i>${e.name}</span>`).join(``),e.appendChild(n)}let i=document.createElement(`div`);i.className=`chart-plot`,this.tip.className=`chart-tip`,this.tip.hidden=!0,i.append(this.canvas,this.tip),e.appendChild(i),new ResizeObserver(()=>this.draw()).observe(i),this.canvas.addEventListener(`pointermove`,e=>{this.hover=e.offsetX,this.draw()}),this.canvas.addEventListener(`pointerleave`,()=>{this.hover=null,this.draw()})}clear(){this.t=[],this.y=this.series.map(()=>[]),this.draw()}push(e,t){if(this.t.push(e),t.forEach((e,t)=>this.y[t].push(e)),this.t.length>ve){let e=e=>e.filter((t,n)=>n%2==0||n===e.length-1);this.t=e(this.t),this.y=this.y.map(e)}}draw(){let e=this.canvas,t=e.parentElement,n=t.clientWidth,r=t.clientHeight,i=Math.min(devicePixelRatio,2);if(!n||!r)return;(e.width!==n*i||e.height!==r*i)&&(e.width=n*i,e.height=r*i,e.style.width=`${n}px`,e.style.height=`${r}px`);let a=e.getContext(`2d`);a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r),a.font=`11px system-ui, -apple-system, sans-serif`;let o=this.t.length,s=1/0,c=-1/0;for(let e of this.y)for(let t of e)t<s&&(s=t),t>c&&(c=t);for(let e of this.refs)s=Math.min(s,e.y),c=Math.max(c,e.y);Number.isFinite(s)||(s=0,c=1);let l=(c-s)*.08||Math.abs(c)*.05||1,u=ye(s-l,c+l),d=ye(0,Math.max(this.t[o-1]??0,1e-6),5),ee=u.values[0]-(u.values[0]>s-l?u.step:0),f=u.values[u.values.length-1]+(u.values[u.values.length-1]<c+l?u.step:0),p=d.values[d.values.length-1]<(this.t[o-1]??0)?d.values[d.values.length-1]+d.step:d.values[d.values.length-1]||1,m=Math.max(...u.values.map(e=>a.measureText(C(e,u.step)).width))+10,h=this.series.length>1?52:12,g=e=>m+(n-m-h)*e/p,_=e=>8+(r-8-22)*(f-e)/(f-ee);a.strokeStyle=ge,a.lineWidth=1,a.fillStyle=S,a.textAlign=`right`,a.textBaseline=`middle`;for(let e of u.values)e<ee||e>f||(a.beginPath(),a.moveTo(m,Math.round(_(e))+.5),a.lineTo(n-h,Math.round(_(e))+.5),a.stroke(),a.fillText(C(e,u.step),m-6,_(e)));a.textAlign=`center`,a.textBaseline=`top`;let te=a.measureText(this.xUnit).width+14;for(let e of d.values)e<=p&&g(e)+a.measureText(C(e,d.step)).width/2<n-h-te&&a.fillText(C(e,d.step),g(e),r-22+6);a.textAlign=`right`,a.fillText(this.xUnit,n-h,r-22+6);for(let e of this.refs)a.setLineDash([4,4]),a.strokeStyle=S,a.beginPath(),a.moveTo(m,_(e.y)),a.lineTo(n-h,_(e.y)),a.stroke(),a.setLineDash([]),a.textAlign=`left`,a.textBaseline=`bottom`,a.fillStyle=S,a.fillText(e.label,m+4,_(e.y)-2);if(a.lineWidth=2,a.lineJoin=`round`,this.series.forEach((e,t)=>{o&&(a.strokeStyle=e.color,a.setLineDash(e.dash??[]),a.beginPath(),this.t.forEach((e,n)=>n?a.lineTo(g(e),_(this.y[t][n])):a.moveTo(g(e),_(this.y[t][n]))),a.stroke())}),a.setLineDash([]),o&&this.series.length>1){let e=this.series.map((e,t)=>({s:e,y:_(this.y[t][o-1])})).sort((e,t)=>e.y-t.y);for(let t=1;t<e.length;t++)e[t].y=Math.max(e[t].y,e[t-1].y+13);a.textAlign=`left`,a.textBaseline=`middle`,a.fillStyle=he;for(let t of e)a.fillText(t.s.name.split(` `)[0],g(this.t[o-1])+6,t.y)}if(this.hover===null||!o||this.hover<m||this.hover>n-h){this.tip.hidden=!0;return}let v=(this.hover-m)/(n-m-h)*p,y=0;for(let e=0,t=o-1;e<=t;){let n=e+t>>1;this.t[n]<v?e=n+1:t=n-1,y=Math.min(e,o-1)}y>0&&Math.abs(this.t[y-1]-v)<Math.abs(this.t[y]-v)&&y--;let b=g(this.t[y]);a.strokeStyle=S,a.lineWidth=1,a.beginPath(),a.moveTo(Math.round(b)+.5,8),a.lineTo(Math.round(b)+.5,r-22),a.stroke(),this.series.forEach((e,t)=>{a.beginPath(),a.arc(b,_(this.y[t][y]),4,0,2*Math.PI),a.fillStyle=e.color,a.fill(),a.lineWidth=2,a.strokeStyle=_e,a.stroke()}),this.tip.hidden=!1,this.tip.innerHTML=`<div class="tt-head">t = ${this.t[y].toFixed(1)} ${this.xUnit}</div>`+this.series.map((e,t)=>`<div><i style="background:${e.color}"></i>${e.name}<b>${C(this.y[t][y],u.step/10)} ${this.unit}</b></div>`).join(``);let ne=this.tip.offsetWidth;this.tip.style.left=`${b+12+ne>n?b-12-ne:b+12}px`,this.tip.style.top=`8px`}},be=8065.543937,xe=.02418884326585747;function Se(e){let t=Math.floor(e.length/2),n=e.length-t;if(n<50)return null;let r=Math.floor(n/10),i=[];for(let n=0;n<10;n++){let a=0;for(let i=0;i<r;i++)a+=e[t+n*r+i];i.push(a/r)}let a=0;for(let n=t;n<e.length;n++)a+=e[n];a/=n;let o=i.reduce((e,t)=>e+t,0)/10,s=Math.sqrt(i.reduce((e,t)=>e+(t-o)**2,0)/90);return{mean:a,err:s}}var Ce=new f(1,24,16),we=new ce(1,1,1,10,1).translate(0,.5,0),Te=new x(0,1,0),Ee=e=>h[e]??1.5,De=(()=>{let e=document.createElement(`canvas`);e.width=e.height=64;let t=e.getContext(`2d`),n=t.createRadialGradient(32,32,0,32,32,32);return n.addColorStop(0,`rgba(255,255,255,1)`),n.addColorStop(.55,`rgba(255,255,255,0.9)`),n.addColorStop(1,`rgba(255,255,255,0)`),t.fillStyle=n,t.fillRect(0,0,64,64),new le(e)})(),Oe=class{el;renderer=new _({antialias:!0,alpha:!0});scene=new re;camera=new i(30,1,.05,1e3);controls;group=new e;atoms=null;bonds=null;cell=null;cloud=null;sys=null;inv=null;dirty=!0;atomScale=1;constructor(e){this.el=e,this.renderer.setPixelRatio(Math.min(devicePixelRatio,2)),this.renderer.setClearColor(0,0),e.appendChild(this.renderer.domElement),this.scene.add(new v(16777215,4212824,1.6));let n=new t(16777215,1.6);n.position.set(3,5,6),this.camera.add(n),this.scene.add(this.camera,this.group),this.controls=new b(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.addEventListener(`change`,()=>this.dirty=!0),new ResizeObserver(()=>this.resize()).observe(e),this.resize();let r=()=>{this.controls.update(),this.dirty&&=(this.renderer.render(this.scene,this.camera),!1),requestAnimationFrame(r)};requestAnimationFrame(r)}resize(){let{clientWidth:e,clientHeight:t}=this.el;e&&t&&(this.renderer.setSize(e,t),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.dirty=!0)}setSystem(e){this.sys=e;let t=e.numbers.length;for(let e of[this.atoms,this.bonds])e&&(this.group.remove(e),e.dispose());if(this.cell&&this.group.remove(this.cell),this.setCloud(null),this.atoms=new o(Ce,new a({roughness:.45,metalness:.05}),t),e.numbers.forEach((e,t)=>this.atoms.setColorAt(t,new c(y[e]??11579568))),this.bonds=new o(we,new a({roughness:.6,color:7041925}),Math.max(t*(t-1)/2,1)),this.group.add(this.atoms,this.bonds),this.cell=null,this.inv=null,me(e)){let[t,i,a]=e.cell.map(e=>new x(...e)),o=[new x,t,i,a,t.clone().add(i),t.clone().add(a),i.clone().add(a),t.clone().add(i).add(a)],s=[[0,1],[0,2],[0,3],[1,4],[1,5],[2,4],[2,6],[3,5],[3,6],[4,7],[5,7],[6,7]];this.cell=new r(new p().setFromPoints(s.flatMap(([e,t])=>[o[e],o[t]])),new n({color:9081766})),this.group.add(this.cell),this.inv=pe(e.cell)}this.update(Float32Array.from(e.positions.flat())),this.fit()}setCloud(e){if(this.cloud&&=(this.group.remove(this.cloud),this.cloud.geometry.dispose(),null),!e||!this.sys)return;let t=this.sys.numbers,n=t.length,r=new p,i=new Float32Array(e.length);for(let r=0;r<e.length/3;r++)new c(y[t[r%n]]??11579568).toArray(i,3*r);r.setAttribute(`position`,new ue(e,3)),r.setAttribute(`color`,new ue(i,3)),this.cloud=new u(r,new d({size:.14,map:De,vertexColors:!0,transparent:!0,opacity:.75,depthWrite:!1,alphaTest:.05})),this.group.add(this.cloud),this.dirty=!0}wrap(e){let{inv:t,sys:n}=this;if(!t||!n)return e;let r=Float32Array.from(e),i=n.cell;for(let a=0;a<e.length/3;a++){let o=[e[3*a],e[3*a+1],e[3*a+2]];for(let e=0;e<3;e++){if(!n.pbc?.[e])continue;let s=Math.floor(o[0]*t[0][e]+o[1]*t[1][e]+o[2]*t[2][e]);for(let t=0;t<3;t++)r[3*a+t]-=s*i[e][t]}}return r}update(e){let{atoms:t,bonds:n,sys:r}=this;if(!t||!n||!r)return;let i=this.wrap(e),a=r.numbers.length,o=new l,c=new s,u=e=>new x(i[3*e],i[3*e+1],i[3*e+2]);for(let e=0;e<a;e++){let n=(.18+.32*Ee(r.numbers[e]))*this.atomScale;t.setMatrixAt(e,o.compose(u(e),c,new x(n,n,n)))}t.instanceMatrix.needsUpdate=!0;let d=0;for(let e=0;e<a;e++)for(let t=e+1;t<a;t++){let i=u(e),a=u(t).sub(i),s=a.length();s>1.2*(Ee(r.numbers[e])+Ee(r.numbers[t]))||(c.setFromUnitVectors(Te,a.clone().normalize()),n.setMatrixAt(d++,o.compose(i,c,new x(.09*this.atomScale,s,.09*this.atomScale))))}n.count=d,n.instanceMatrix.needsUpdate=!0,this.dirty=!0}fit(){let e=this.sys.positions,t=new x,n=[...e,...this.cell?[this.sys.cell.reduce((e,t)=>e.map((e,n)=>e+t[n]/2),[0,0,0])]:[]];n.forEach(e=>t.add(new x(...e))),t.divideScalar(n.length);let r=2;e.forEach(e=>r=Math.max(r,t.distanceTo(new x(...e))+1.5)),this.cell&&this.sys.cell.forEach(e=>r=Math.max(r,new x(...e).length()*.9));let i=r/Math.sin(de.degToRad(this.camera.fov/2));this.controls.target.copy(t);let a=[0,1,2].map(n=>[0,1,2].map(r=>e.reduce((e,i)=>e+(i[n]-t.getComponent(n))*(i[r]-t.getComponent(r)),0))),o=a[0][0]+a[1][1]+a[2][2]+1e-6,c=new x(.3,.2,1).normalize();for(let e=0;e<100;e++){let e=[0,1,2].map(e=>o*c.getComponent(e)-a[e].reduce((e,t,n)=>e+t*c.getComponent(n),0));c=new x(...e).normalize()}this.cell?c.set(.35,.25,1).normalize():c.add(new x(.15,.25,0).applyQuaternion(new s().setFromUnitVectors(new x(0,0,1),c))).normalize(),this.camera.position.copy(t).addScaledVector(c,i),this.camera.up.set(0,1,0),this.camera.near=i/50,this.camera.far=i*10,this.camera.updateProjectionMatrix(),this.dirty=!0}},T=e=>document.getElementById(e),ke=new Worker(new URL(new URL(`md.worker-nvMdrUZd.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),E=(e,t=[])=>ke.postMessage(e,t),D=e=>T(`status`).innerHTML=e,O=new URLSearchParams(location.search),k=e=>{let t=Math.min(Math.max(Math.floor(Math.log10(Math.max(e,1))/3),0),4);return`${(e/1e3**t).toPrecision(3)} ${[``,`k`,`M`,`G`,`T`][t]}`},A=`#3987e5`,Ae=`#d95926`,je=`#199e70`,j=new Oe(T(`traj`)),Me=new w(T(`energy-chart`),[{name:`Total`,color:je},{name:`Potential`,color:A},{name:`Kinetic`,color:Ae}],`eV`),M=new w(T(`temp-chart`),[{name:`Temperature`,color:A}],`K`),N=new w(T(`eref-chart`),[{name:`E_ref`,color:A}],`cm⁻¹`,`a.u.`),P=new w(T(`pop-chart`),[{name:`Walkers`,color:A}],``,`a.u.`),F=O.get(`mode`)===`dmc`?`dmc`:`md`,I=m[F===`dmc`?`water`:`ethanol`],L=``,R=``,z=[],B=!1,V=!0,H=!1,U=0,W=4,G=0,Ne=0,K=0,q=0,J=[],Y=(e,t,n,r)=>{let i=+T(e).value;return Number.isFinite(i)?Math.min(Math.max(i,t),n):r},Pe=()=>Y(`temperature`,0,5e3,300),Fe=()=>Y(`dt`,.05,5,.5),Ie=()=>Math.round(Y(`walkers`,20,2e4,500)),Le=()=>Y(`dtau`,.5,50,10),Re=()=>T(`force-mode`).value,ze={pet:4096,ani:4096,mace:512},Be=`pet`,Ve=()=>Math.max(64,+(O.get(`maxAtoms`)??0)||ze[Be]||1024);function He(e){F=e,document.body.classList.toggle(`mode-md`,e===`md`),document.body.classList.toggle(`mode-dmc`,e===`dmc`),document.querySelectorAll(`#modes button`).forEach(t=>t.classList.toggle(`on`,t.dataset.mode===e));let t=new URL(location.href);e===`dmc`?t.searchParams.set(`mode`,`dmc`):t.searchParams.delete(`mode`),history.replaceState(null,``,t),X()}function X(){if(!z.length)return;let e=I.numbers.filter(e=>!z.includes(e));if(e.length)D(`<b>${R} cannot handle this structure</b> (no parameters for Z = ${[...new Set(e)].join(`, `)})`);else if(F===`dmc`&&me(I))D(`<b>DMC here is for isolated molecules:</b> pick one without a unit cell`),U++;else if(U++,H=!0,W=1,j.atomScale=F===`dmc`?.45:1,j.setSystem(I),F===`md`)[G,Ne,K,q]=[NaN,0,0,0],Me.clear(),M.clear(),M.refs=[{y:Pe(),label:`T₀`},{y:Pe()/2,label:`T₀/2`}],E({type:`start`,run:U,system:I,temperature:Pe(),dt:Fe(),forces:Re()});else{J=[],N.clear(),P.clear(),N.refs=[],P.refs=[{y:Ie(),label:`target`}];for(let e of[`zpe`,`walkers-now`,`samples`,`dmc-flops`])T(e).textContent=`–`;for(let e of[`zpe-detail`,`walkers-detail`,`samples-detail`,`dmc-flops-detail`])T(e).textContent=``;Q.show(`Relaxing the structure`),Q.stage(`DMC measures energies from the minimum of the model’s surface`,0),E({type:`startDMC`,run:U,system:I,walkers:Ie(),dtau:Le(),maxAtoms:Ve()})}}function Ue(){V&&!H&&z.length&&(H=!0,E(F===`md`?{type:`advance`,run:U,steps:W,dt:Fe()}:{type:`advanceDMC`,run:U,steps:W,dtau:Le()}))}function We(e){V=e,T(`run`).textContent=e?`Pause`:`Run`,T(`run`).classList.toggle(`on`,e),Ue()}var Ge=(e,t,n,r,i=``)=>{let a=n.forward+n.backward;T(e).textContent=`${k(a/r*1e3)}FLOP/s`,T(t).textContent=`${k(a)}FLOP per step`+(n.backward?` · forward ${k(n.forward)}, backward ${k(n.backward)}`:``)+i+` · ${(100*n.matmul/(a||1)).toFixed(0)}% matmul`};function Ke(e){let t=I.numbers.length,n=e.potential+e.kinetic;Number.isNaN(G)&&(G=n),j.update(e.positions),Me.push(e.time,[n-G,e.potential-G,e.kinetic]),M.push(e.time,[e.temperature]),Me.draw(),M.draw(),e.step>0&&(Ne+=e.temperature,K++);let r=(n-G)/t*1e3;q=Math.max(q,Math.abs(r)),T(`t-now`).textContent=`${e.temperature.toFixed(0)} K`,T(`t-mean`).textContent=K?`mean ${(Ne/K).toFixed(0)} K`:`T₀ ${Pe()} K`,T(`drift`).textContent=`${r>=0?`+`:`−`}${Math.abs(r).toFixed(2)}`,T(`drift-max`).textContent=`meV/atom · worst ${q.toFixed(2)}`,e.step>0&&(T(`speed`).textContent=`${(Fe()*86.4/e.msPerStep).toPrecision(3)} ns/day`,T(`ms`).textContent=`${e.msPerStep.toFixed(1)} ms per step · ${(1e3/e.msPerStep*Fe()).toFixed(0)} fs/s`,Ge(`flops`,`flops-detail`,e.flops,e.msPerStep),W=Math.min(Math.max(Math.round(60/e.msPerStep),1),50)),T(`clock`).textContent=`t = ${e.time>=1e3?`${(e.time/1e3).toFixed(2)} ps`:`${e.time.toFixed(1)} fs`} · step ${e.step}`,D(`<b>${R}</b> · ${t} atoms · ${Re()===`direct`&&B?`direct`:`conservative`} forces<br>${L}`)}function qe(e){e.steps.length||(Q.hide(),j.update(e.ref)),j.setCloud(e.cloud),e.steps.forEach((t,n)=>{let r=e.tau-(e.steps.length-1-n)*Le();J.push((t.eref-e.vmin)*be),N.push(r,[J[J.length-1]]),P.push(r,[t.n])});let t=Se(J);if(N.refs=t?[{y:t.mean,label:`ZPE`}]:[],N.draw(),P.draw(),T(`zpe`).textContent=t?`${t.mean.toFixed(0)} ± ${t.err.toFixed(0)} cm⁻¹`:`equilibrating…`,T(`zpe-detail`).textContent=t?`${(t.mean/be*1e3).toFixed(1)} meV · mean of the last ${J.length-Math.floor(J.length/2)} steps`:`${J.length} steps so far`,T(`walkers-now`).textContent=`${e.walkers}`,T(`walkers-detail`).textContent=`target ${Ie()} · ${e.holes} lost to holes`,e.steps.length){let t=e.samplesPerStep/e.msPerStep*1e3*86400;T(`samples`).textContent=`${(t/1e9).toPrecision(3)} billion`;let n=Math.ceil(e.samplesPerStep/Math.max(1,Math.floor(e.passAtoms/I.numbers.length)));T(`samples-detail`).textContent=`samples/day · ${e.msPerStep.toFixed(0)} ms per step of ${Math.round(e.samplesPerStep)} walkers in ${n} pass${n>1?`es`:``}`,Ge(`dmc-flops`,`dmc-flops-detail`,e.flops,e.msPerStep,` · ${k(e.flops.forward/(e.samplesPerStep||1))}FLOP per walker`),W=Math.min(Math.max(Math.round(250/e.msPerStep),1),20)}T(`clock`).textContent=`τ = ${e.tau.toFixed(0)} a.u. (${(e.tau*xe).toFixed(1)} fs) · step ${e.step}`,D(`<b>${R}</b> · ${I.numbers.length} atoms · V<sub>min</sub> = ${e.vmin.toFixed(4)} eV<br>${L}`)}var Je=T(`kind`),Ye=T(`model`),Xe=new Set,Z=[],Ze=`models/`,Q={el:T(`md-loading`),show(e){this.el.hidden=!1,this.el.querySelector(`.loader-title`).textContent=e,this.stage(``,0)},stage(e,t){this.el.querySelector(`.loader-stage`).textContent=e,this.el.querySelector(`.loader-bar i`).style.width=`${100*(t??0)}%`},hide(){this.el.hidden=!0}};async function Qe(e){let t=e.label??e.name;z=[],U++,H=!1;try{if(D(`loading ${t}…`),Xe.has(e.name)){E({type:`loadModel`,id:e.name,kind:e.kind,meta:null,weights:null,label:t});return}Q.show(`Loading ${t}`);let n=e.meta?await ie(oe(Ze,e.meta)):{},r=e.weights?await te(oe(Ze,e.weights),(e,t)=>Q.stage(`Downloading the weights: ${t}`,e)):null;Q.stage(`Building ${t}…`,1),E({type:`loadModel`,id:e.name,kind:e.kind,meta:n,weights:r,label:t},r?[r]:[])}catch(e){Q.hide(),D(`<b>Could not load ${t}:</b> ${e.message}`)}}async function $e(){if({entries:Z,base:Ze}=await ee(),Z=Z.filter(ae),!Z.length){D(`<b>No models found</b> locally or on Hugging Face.`);return}Je.innerHTML=ne.filter(e=>Z.some(t=>t.kind===e)).map(e=>`<option value="${e}">${g[e]?.typeName??g[e]?.name??e} · ${g[e]?.family??``}</option>`).join(``);let e=()=>{Ye.innerHTML=Z.filter(e=>e.kind===Je.value).map(e=>`<option value="${e.name}">${e.label??e.name}</option>`).join(``)},t=()=>Z.find(e=>e.name===Ye.value),n=Z.find(e=>e.name===O.get(`model`))??Z.find(e=>e.kind===O.get(`kind`));n&&(Je.value=n.kind),e(),n&&(Ye.value=n.name),Je.onchange=()=>{e(),Qe(t())},Ye.onchange=()=>Qe(t()),Qe(t())}var $=T(`structure`);$.innerHTML=Object.entries(m).map(([e,t])=>`<option value="${e}">${t.label}</option>`).join(``);var et=O.get(`structure`);et&&m[et]&&(I=m[et]),$.value=Object.keys(m).find(e=>m[e]===I),$.onchange=()=>{I=m[$.value],X()},T(`xyz-file`).onchange=async e=>{let t=e.target.files?.[0];if(t)try{I=se(await t.text());let e=document.createElement(`option`);e.textContent=t.name,$.prepend(e),$.selectedIndex=0,X()}catch(e){D(`<b>Could not read ${t.name}:</b> ${e.message}`)}};for(let e of[`force-mode`,`temperature`,`walkers`])T(e).onchange=X;T(`restart`).onclick=X,T(`run`).onclick=()=>We(!V),document.querySelectorAll(`#modes button`).forEach(e=>e.onclick=()=>e.dataset.mode!==F&&He(e.dataset.mode)),document.addEventListener(`keydown`,e=>{e.target.closest(`input, select`)||(e.key===` `&&(e.preventDefault(),We(!V)),(e.key===`r`||e.key===`R`)&&X())}),document.body.classList.toggle(`mode-md`,F===`md`),document.body.classList.toggle(`mode-dmc`,F===`dmc`),document.querySelectorAll(`#modes button`).forEach(e=>e.classList.toggle(`on`,e.dataset.mode===F)),ke.onmessage=e=>{let t=e.data;if(t.type===`ready`)L=t.backend,D(L),$e();else if(t.type===`model`){Xe.add(t.id),Q.hide(),[R,z,B,Be]=[t.label,t.elements,t.hasNC,t.kind],T(`force-mode`).querySelector(`[value=direct]`).disabled=!B,B||(T(`force-mode`).value=`conservative`);let e=e=>e.numbers.every(e=>z.includes(e));if(!e(I)){let t=Object.keys(m).find(t=>e(m[t]));t&&(I=m[t],$.value=t)}X()}else if(t.type===`frame`||t.type===`dmc`){if(t.frame.run!==U)return;H=!1,t.type===`frame`?Ke(t.frame):qe(t.frame),Ue()}else t.type===`progress`?Q.stage(t.text,t.fraction):t.type===`error`&&(H=!1,Q.hide(),D(`<b>Error:</b> ${t.text}`),console.error(t.text))},E({type:`init`,backend:O.get(`backend`)??`auto`});
 
 
assets/md-Cm-2D3-Y.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{$ as e,B as t,C as n,D as r,F as i,H as a,I as o,L as s,M as c,Q as l,S as u,T as d,Y as ee,Z as f,_ as p,a as m,b as h,c as g,dt as _,f as te,h as v,i as y,j as b,l as x,n as ne,o as re,ot as ie,pt as ae,q as oe,r as se,rt as ce,s as le,t as ue,u as de,x as fe}from"./xyz-DJ8uH0hc.js";var pe=e=>e[0][0]*(e[1][1]*e[2][2]-e[1][2]*e[2][1])-e[0][1]*(e[1][0]*e[2][2]-e[1][2]*e[2][0])+e[0][2]*(e[1][0]*e[2][1]-e[1][1]*e[2][0]);function me(e){let t=pe(e),n=(t,n)=>{let r=[0,1,2].filter(e=>e!==t),i=[0,1,2].filter(e=>e!==n);return(e[r[0]][i[0]]*e[r[1]][i[1]]-e[r[0]][i[1]]*e[r[1]][i[0]])*((t+n)%2?-1:1)};return[0,1,2].map(e=>[0,1,2].map(r=>n(r,e)/t))}var he=e=>!!e.cell&&!!e.pbc?.some(Boolean)&&Math.abs(pe(e.cell))>1e-10,ge=`#d7dbe4`,S=`#8a93a6`,_e=`#232835`,ve=`#12151c`,ye=4e3;function be(e,t,n=5){let r=(t-e||Math.abs(t)||1)/n,i=10**Math.floor(Math.log10(r)),a=[1,2,2.5,5,10].map(e=>e*i).find(e=>e>=r),o=[];for(let n=Math.ceil(e/a)*a;n<=t+a*1e-9;n+=a)o.push(Math.abs(n)<a*1e-9?0:n);return{values:o,step:a}}var C=(e,t)=>e.toFixed(Math.max(0,-Math.floor(Math.log10(t)+1e-9))),xe=class{el;series;unit;xUnit;canvas=document.createElement(`canvas`);tip=document.createElement(`div`);t=[];y;hover=null;refs=[];constructor(e,t,n,r=`fs`){if(this.el=e,this.series=t,this.unit=n,this.xUnit=r,this.y=t.map(()=>[]),e.classList.add(`chart`),t.length>1){let n=document.createElement(`div`);n.className=`chart-legend`,n.innerHTML=t.map(e=>`<span><i style="background:${e.color}"></i>${e.name}</span>`).join(``),e.appendChild(n)}let i=document.createElement(`div`);i.className=`chart-plot`,this.tip.className=`chart-tip`,this.tip.hidden=!0,i.append(this.canvas,this.tip),e.appendChild(i),new ResizeObserver(()=>this.draw()).observe(i),this.canvas.addEventListener(`pointermove`,e=>{this.hover=e.offsetX,this.draw()}),this.canvas.addEventListener(`pointerleave`,()=>{this.hover=null,this.draw()})}clear(){this.t=[],this.y=this.series.map(()=>[]),this.draw()}push(e,t){if(this.t.push(e),t.forEach((e,t)=>this.y[t].push(e)),this.t.length>ye){let e=e=>e.filter((t,n)=>n%2==0||n===e.length-1);this.t=e(this.t),this.y=this.y.map(e)}}draw(){let e=this.canvas,t=e.parentElement,n=t.clientWidth,r=t.clientHeight,i=Math.min(devicePixelRatio,2);if(!n||!r)return;(e.width!==n*i||e.height!==r*i)&&(e.width=n*i,e.height=r*i,e.style.width=`${n}px`,e.style.height=`${r}px`);let a=e.getContext(`2d`);a.setTransform(i,0,0,i,0,0),a.clearRect(0,0,n,r),a.font=`11px system-ui, -apple-system, sans-serif`;let o=this.t.length,s=1/0,c=-1/0;for(let e of this.y)for(let t of e)t<s&&(s=t),t>c&&(c=t);for(let e of this.refs)s=Math.min(s,e.y),c=Math.max(c,e.y);Number.isFinite(s)||(s=0,c=1);let l=(c-s)*.08||Math.abs(c)*.05||1,u=be(s-l,c+l),d=be(0,Math.max(this.t[o-1]??0,1e-6),5),ee=u.values[0]-(u.values[0]>s-l?u.step:0),f=u.values[u.values.length-1]+(u.values[u.values.length-1]<c+l?u.step:0),p=d.values[d.values.length-1]<(this.t[o-1]??0)?d.values[d.values.length-1]+d.step:d.values[d.values.length-1]||1,m=Math.max(...u.values.map(e=>a.measureText(C(e,u.step)).width))+10,h=this.series.length>1?52:12,g=e=>m+(n-m-h)*e/p,_=e=>8+(r-8-22)*(f-e)/(f-ee);a.strokeStyle=_e,a.lineWidth=1,a.fillStyle=S,a.textAlign=`right`,a.textBaseline=`middle`;for(let e of u.values)e<ee||e>f||(a.beginPath(),a.moveTo(m,Math.round(_(e))+.5),a.lineTo(n-h,Math.round(_(e))+.5),a.stroke(),a.fillText(C(e,u.step),m-6,_(e)));a.textAlign=`center`,a.textBaseline=`top`;let te=a.measureText(this.xUnit).width+14;for(let e of d.values)e<=p&&g(e)+a.measureText(C(e,d.step)).width/2<n-h-te&&a.fillText(C(e,d.step),g(e),r-22+6);a.textAlign=`right`,a.fillText(this.xUnit,n-h,r-22+6);for(let e of this.refs)a.setLineDash([4,4]),a.strokeStyle=S,a.beginPath(),a.moveTo(m,_(e.y)),a.lineTo(n-h,_(e.y)),a.stroke(),a.setLineDash([]),a.textAlign=`left`,a.textBaseline=`bottom`,a.fillStyle=S,a.fillText(e.label,m+4,_(e.y)-2);if(a.lineWidth=2,a.lineJoin=`round`,this.series.forEach((e,t)=>{o&&(a.strokeStyle=e.color,a.setLineDash(e.dash??[]),a.beginPath(),this.t.forEach((e,n)=>n?a.lineTo(g(e),_(this.y[t][n])):a.moveTo(g(e),_(this.y[t][n]))),a.stroke())}),a.setLineDash([]),o&&this.series.length>1){let e=this.series.map((e,t)=>({s:e,y:_(this.y[t][o-1])})).sort((e,t)=>e.y-t.y);for(let t=1;t<e.length;t++)e[t].y=Math.max(e[t].y,e[t-1].y+13);a.textAlign=`left`,a.textBaseline=`middle`,a.fillStyle=ge;for(let t of e)a.fillText(t.s.name.split(` `)[0],g(this.t[o-1])+6,t.y)}if(this.hover===null||!o||this.hover<m||this.hover>n-h){this.tip.hidden=!0;return}let v=(this.hover-m)/(n-m-h)*p,y=0;for(let e=0,t=o-1;e<=t;){let n=e+t>>1;this.t[n]<v?e=n+1:t=n-1,y=Math.min(e,o-1)}y>0&&Math.abs(this.t[y-1]-v)<Math.abs(this.t[y]-v)&&y--;let b=g(this.t[y]);a.strokeStyle=S,a.lineWidth=1,a.beginPath(),a.moveTo(Math.round(b)+.5,8),a.lineTo(Math.round(b)+.5,r-22),a.stroke(),this.series.forEach((e,t)=>{a.beginPath(),a.arc(b,_(this.y[t][y]),4,0,2*Math.PI),a.fillStyle=e.color,a.fill(),a.lineWidth=2,a.strokeStyle=ve,a.stroke()}),this.tip.hidden=!1,this.tip.innerHTML=`<div class="tt-head">t = ${this.t[y].toFixed(1)} ${this.xUnit}</div>`+this.series.map((e,t)=>`<div><i style="background:${e.color}"></i>${e.name}<b>${C(this.y[t][y],u.step/10)} ${this.unit}</b></div>`).join(``);let x=this.tip.offsetWidth;this.tip.style.left=`${b+12+x>n?b-12-x:b+12}px`,this.tip.style.top=`8px`}},Se=8065.543937,Ce=.02418884326585747;function we(e){let t=Math.floor(e.length/2),n=e.length-t;if(n<50)return null;let r=Math.floor(n/10),i=[];for(let n=0;n<10;n++){let a=0;for(let i=0;i<r;i++)a+=e[t+n*r+i];i.push(a/r)}let a=0;for(let n=t;n<e.length;n++)a+=e[n];a/=n;let o=i.reduce((e,t)=>e+t,0)/10,s=Math.sqrt(i.reduce((e,t)=>e+(t-o)**2,0)/90);return{mean:a,err:s}}var Te=new ie(1,24,16),Ee=new d(1,1,1,10,1).translate(0,.5,0),De=new _(0,1,0),Oe=e=>te[e]??1.5,ke=(()=>{let e=document.createElement(`canvas`);e.width=e.height=64;let t=e.getContext(`2d`),n=t.createRadialGradient(32,32,0,32,32,32);return n.addColorStop(0,`rgba(255,255,255,1)`),n.addColorStop(.55,`rgba(255,255,255,0.9)`),n.addColorStop(1,`rgba(255,255,255,0)`),t.fillStyle=n,t.fillRect(0,0,64,64),new u(e)})(),Ae=class{el;renderer=new p({antialias:!0,alpha:!0});scene=new ce;camera=new ee(30,1,.05,1e3);controls;group=new b;atoms=null;bonds=null;cell=null;cloud=null;sys=null;inv=null;dirty=!0;atomScale=1;constructor(e){this.el=e,this.renderer.setPixelRatio(Math.min(devicePixelRatio,2)),this.renderer.setClearColor(0,0),e.appendChild(this.renderer.domElement),this.scene.add(new c(16777215,4212824,1.6));let t=new r(16777215,1.6);t.position.set(3,5,6),this.camera.add(t),this.scene.add(this.camera,this.group),this.controls=new v(this.camera,this.renderer.domElement),this.controls.enableDamping=!0,this.controls.addEventListener(`change`,()=>this.dirty=!0),new ResizeObserver(()=>this.resize()).observe(e),this.resize();let n=()=>{this.controls.update(),this.dirty&&=(this.renderer.render(this.scene,this.camera),!1),requestAnimationFrame(n)};requestAnimationFrame(n)}resize(){let{clientWidth:e,clientHeight:t}=this.el;e&&t&&(this.renderer.setSize(e,t),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.dirty=!0)}setSystem(e){this.sys=e;let t=e.numbers.length;for(let e of[this.atoms,this.bonds])e&&(this.group.remove(e),e.dispose());if(this.cell&&this.group.remove(this.cell),this.setCloud(null),this.atoms=new i(Te,new oe({roughness:.45,metalness:.05}),t),e.numbers.forEach((e,t)=>this.atoms.setColorAt(t,new n(de[e]??11579568))),this.bonds=new i(Ee,new oe({roughness:.6,color:7041925}),Math.max(t*(t-1)/2,1)),this.group.add(this.atoms,this.bonds),this.cell=null,this.inv=null,he(e)){let[t,n,r]=e.cell.map(e=>new _(...e)),i=[new _,t,n,r,t.clone().add(n),t.clone().add(r),n.clone().add(r),t.clone().add(n).add(r)],a=[[0,1],[0,2],[0,3],[1,4],[1,5],[2,4],[2,6],[3,5],[3,6],[4,7],[5,7],[6,7]];this.cell=new s(new fe().setFromPoints(a.flatMap(([e,t])=>[i[e],i[t]])),new o({color:9081766})),this.group.add(this.cell),this.inv=me(e.cell)}this.update(Float32Array.from(e.positions.flat())),this.fit()}setCloud(e){if(this.cloud&&=(this.group.remove(this.cloud),this.cloud.geometry.dispose(),null),!e||!this.sys)return;let t=this.sys.numbers,r=t.length,i=new fe,a=new Float32Array(e.length);for(let i=0;i<e.length/3;i++)new n(de[t[i%r]]??11579568).toArray(a,3*i);i.setAttribute(`position`,new h(e,3)),i.setAttribute(`color`,new h(a,3)),this.cloud=new f(i,new l({size:.14,map:ke,vertexColors:!0,transparent:!0,opacity:.75,depthWrite:!1,alphaTest:.05})),this.group.add(this.cloud),this.dirty=!0}wrap(e){let{inv:t,sys:n}=this;if(!t||!n)return e;let r=Float32Array.from(e),i=n.cell;for(let a=0;a<e.length/3;a++){let o=[e[3*a],e[3*a+1],e[3*a+2]];for(let e=0;e<3;e++){if(!n.pbc?.[e])continue;let s=Math.floor(o[0]*t[0][e]+o[1]*t[1][e]+o[2]*t[2][e]);for(let t=0;t<3;t++)r[3*a+t]-=s*i[e][t]}}return r}update(t){let{atoms:n,bonds:r,sys:i}=this;if(!n||!r||!i)return;let o=this.wrap(t),s=i.numbers.length,c=new a,l=new e,u=e=>new _(o[3*e],o[3*e+1],o[3*e+2]);for(let e=0;e<s;e++){let t=(.18+.32*Oe(i.numbers[e]))*this.atomScale;n.setMatrixAt(e,c.compose(u(e),l,new _(t,t,t)))}n.instanceMatrix.needsUpdate=!0;let d=0;for(let e=0;e<s;e++)for(let t=e+1;t<s;t++){let n=u(e),a=u(t).sub(n),o=a.length();o>1.2*(Oe(i.numbers[e])+Oe(i.numbers[t]))||(l.setFromUnitVectors(De,a.clone().normalize()),r.setMatrixAt(d++,c.compose(n,l,new _(.09*this.atomScale,o,.09*this.atomScale))))}r.count=d,r.instanceMatrix.needsUpdate=!0,this.dirty=!0}fit(){let n=this.sys.positions,r=new _,i=[...n,...this.cell?[this.sys.cell.reduce((e,t)=>e.map((e,n)=>e+t[n]/2),[0,0,0])]:[]];i.forEach(e=>r.add(new _(...e))),r.divideScalar(i.length);let a=2;n.forEach(e=>a=Math.max(a,r.distanceTo(new _(...e))+1.5)),this.cell&&this.sys.cell.forEach(e=>a=Math.max(a,new _(...e).length()*.9));let o=a/Math.sin(t.degToRad(this.camera.fov/2));this.controls.target.copy(r);let s=[0,1,2].map(e=>[0,1,2].map(t=>n.reduce((n,i)=>n+(i[e]-r.getComponent(e))*(i[t]-r.getComponent(t)),0))),c=s[0][0]+s[1][1]+s[2][2]+1e-6,l=new _(.3,.2,1).normalize();for(let e=0;e<100;e++){let e=[0,1,2].map(e=>c*l.getComponent(e)-s[e].reduce((e,t,n)=>e+t*l.getComponent(n),0));l=new _(...e).normalize()}this.cell?l.set(.35,.25,1).normalize():l.add(new _(.15,.25,0).applyQuaternion(new e().setFromUnitVectors(new _(0,0,1),l))).normalize(),this.camera.position.copy(r).addScaledVector(l,o),this.camera.up.set(0,1,0),this.camera.near=o/50,this.camera.far=o*10,this.camera.updateProjectionMatrix(),this.dirty=!0}},w=e=>document.getElementById(e),je=new Worker(new URL(new URL(`md.worker-C3MDeVbS.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),Me=g(je,()=>w(`status`).innerHTML=`<b>The engine did not start.</b> Reload the page; if that does not help, try another browser.`),T=(e,t=[])=>je.postMessage(e,t),E=e=>w(`status`).innerHTML=e,D=new URLSearchParams(location.search),O=e=>{let t=Math.min(Math.max(Math.floor(Math.log10(Math.max(e,1))/3),0),4);return`${(e/1e3**t).toPrecision(3)} ${[``,`k`,`M`,`G`,`T`][t]}`},k=`#3987e5`,Ne=`#d95926`,Pe=`#199e70`,A=new Ae(w(`traj`)),Fe=new xe(w(`energy-chart`),[{name:`Total`,color:Pe},{name:`Potential`,color:k},{name:`Kinetic`,color:Ne}],`eV`),Ie=new xe(w(`temp-chart`),[{name:`Temperature`,color:k}],`K`),j=new xe(w(`eref-chart`),[{name:`E_ref`,color:k}],`cm⁻¹`,`a.u.`),Le=new xe(w(`pop-chart`),[{name:`Walkers`,color:k}],``,`a.u.`),M=D.get(`mode`)===`dmc`?`dmc`:`md`,N=x[M===`dmc`?`water`:`ethanol`],Re=``,P=``,F=[],I=!1,L=!0,R=!1,z=0,B=4,V=0,ze=0,H=0,U=0,W=[],G=(e,t,n,r)=>{let i=+w(e).value;return Number.isFinite(i)?Math.min(Math.max(i,t),n):r},K=()=>G(`temperature`,0,5e3,300),q=()=>G(`dt`,.05,5,.5),Be=()=>Math.round(G(`walkers`,20,2e4,500)),Ve=()=>G(`dtau`,.5,50,10),He=()=>w(`force-mode`).value,Ue={pet:4096,ani:4096,mace:512},We=`pet`,Ge=()=>Math.max(64,+(D.get(`maxAtoms`)??0)||Ue[We]||1024);function Ke(e){M=e,document.body.classList.toggle(`mode-md`,e===`md`),document.body.classList.toggle(`mode-dmc`,e===`dmc`),document.querySelectorAll(`#modes button`).forEach(t=>t.classList.toggle(`on`,t.dataset.mode===e));let t=new URL(location.href);e===`dmc`?t.searchParams.set(`mode`,`dmc`):t.searchParams.delete(`mode`),history.replaceState(null,``,t),J()}function J(){if(!F.length)return;let e=N.numbers.filter(e=>!F.includes(e));if(e.length)E(`<b>${P} cannot handle this structure</b> (no parameters for Z = ${[...new Set(e)].join(`, `)})`);else if(M===`dmc`&&he(N))E(`<b>DMC here is for isolated molecules:</b> pick one without a unit cell`),z++;else if(z++,R=!0,B=1,A.atomScale=M===`dmc`?.45:1,A.setSystem(N),M===`md`)[V,ze,H,U]=[NaN,0,0,0],Fe.clear(),Ie.clear(),Ie.refs=[{y:K(),label:`T₀`},{y:K()/2,label:`T₀/2`}],T({type:`start`,run:z,system:N,temperature:K(),dt:q(),forces:He()});else{W=[],j.clear(),Le.clear(),j.refs=[],Le.refs=[{y:Be(),label:`target`}];for(let e of[`zpe`,`walkers-now`,`samples`,`dmc-flops`])w(e).textContent=`–`;for(let e of[`zpe-detail`,`walkers-detail`,`samples-detail`,`dmc-flops-detail`])w(e).textContent=``;Q.show(`Relaxing the structure`),Q.stage(`DMC measures energies from the minimum of the model’s surface`,0),T({type:`startDMC`,run:z,system:N,walkers:Be(),dtau:Ve(),maxAtoms:Ge()})}}function qe(){L&&!R&&F.length&&(R=!0,T(M===`md`?{type:`advance`,run:z,steps:B,dt:q()}:{type:`advanceDMC`,run:z,steps:B,dtau:Ve()}))}function Je(e){L=e,w(`run`).textContent=e?`Pause`:`Run`,w(`run`).classList.toggle(`on`,e),qe()}var Ye=(e,t,n,r,i=``)=>{let a=n.forward+n.backward;w(e).textContent=`${O(a/r*1e3)}FLOP/s`,w(t).textContent=`${O(a)}FLOP per step`+(n.backward?` · forward ${O(n.forward)}, backward ${O(n.backward)}`:``)+i+` · ${(100*n.matmul/(a||1)).toFixed(0)}% matmul`};function Xe(e){let t=N.numbers.length,n=e.potential+e.kinetic;Number.isNaN(V)&&(V=n),A.update(e.positions),Fe.push(e.time,[n-V,e.potential-V,e.kinetic]),Ie.push(e.time,[e.temperature]),Fe.draw(),Ie.draw(),e.step>0&&(ze+=e.temperature,H++);let r=(n-V)/t*1e3;U=Math.max(U,Math.abs(r)),w(`t-now`).textContent=`${e.temperature.toFixed(0)} K`,w(`t-mean`).textContent=H?`mean ${(ze/H).toFixed(0)} K`:`T₀ ${K()} K`,w(`drift`).textContent=`${r>=0?`+`:`−`}${Math.abs(r).toFixed(2)}`,w(`drift-max`).textContent=`meV/atom · worst ${U.toFixed(2)}`,e.step>0&&(w(`speed`).textContent=`${(q()*86.4/e.msPerStep).toPrecision(3)} ns/day`,w(`ms`).textContent=`${e.msPerStep.toFixed(1)} ms per step · ${(1e3/e.msPerStep*q()).toFixed(0)} fs/s`,Ye(`flops`,`flops-detail`,e.flops,e.msPerStep),B=Math.min(Math.max(Math.round(60/e.msPerStep),1),50)),w(`clock`).textContent=`t = ${e.time>=1e3?`${(e.time/1e3).toFixed(2)} ps`:`${e.time.toFixed(1)} fs`} · step ${e.step}`,E(`<b>${P}</b> · ${t} atoms · ${He()===`direct`&&I?`direct`:`conservative`} forces<br>${Re}`)}function Ze(e){e.steps.length||(Q.hide(),A.update(e.ref)),A.setCloud(e.cloud),e.steps.forEach((t,n)=>{let r=e.tau-(e.steps.length-1-n)*Ve();W.push((t.eref-e.vmin)*Se),j.push(r,[W[W.length-1]]),Le.push(r,[t.n])});let t=we(W);if(j.refs=t?[{y:t.mean,label:`ZPE`}]:[],j.draw(),Le.draw(),w(`zpe`).textContent=t?`${t.mean.toFixed(0)} ± ${t.err.toFixed(0)} cm⁻¹`:`equilibrating…`,w(`zpe-detail`).textContent=t?`${(t.mean/Se*1e3).toFixed(1)} meV · mean of the last ${W.length-Math.floor(W.length/2)} steps`:`${W.length} steps so far`,w(`walkers-now`).textContent=`${e.walkers}`,w(`walkers-detail`).textContent=`target ${Be()} · ${e.holes} lost to holes`,e.steps.length){let t=e.samplesPerStep/e.msPerStep*1e3*86400;w(`samples`).textContent=`${(t/1e9).toPrecision(3)} billion`;let n=Math.ceil(e.samplesPerStep/Math.max(1,Math.floor(e.passAtoms/N.numbers.length)));w(`samples-detail`).textContent=`samples/day · ${e.msPerStep.toFixed(0)} ms per step of ${Math.round(e.samplesPerStep)} walkers in ${n} pass${n>1?`es`:``}`,Ye(`dmc-flops`,`dmc-flops-detail`,e.flops,e.msPerStep,` · ${O(e.flops.forward/(e.samplesPerStep||1))}FLOP per walker`),B=Math.min(Math.max(Math.round(250/e.msPerStep),1),20)}w(`clock`).textContent=`τ = ${e.tau.toFixed(0)} a.u. (${(e.tau*Ce).toFixed(1)} fs) · step ${e.step}`,E(`<b>${P}</b> · ${N.numbers.length} atoms · V<sub>min</sub> = ${e.vmin.toFixed(4)} eV<br>${Re}`)}var Y=w(`kind`),X=w(`model`),Qe=new Set,Z=[],$e=`models/`,Q={el:w(`md-loading`),show(e){this.el.hidden=!1,this.el.querySelector(`.loader-title`).textContent=e,this.stage(``,0)},stage(e,t){this.el.querySelector(`.loader-stage`).textContent=e,this.el.querySelector(`.loader-bar i`).style.width=`${100*(t??0)}%`},hide(){this.el.hidden=!0}},et=0;async function tt(e){let t=e.label??e.name,n=++et;F=[],z++,R=!1;try{if(E(`loading ${t}…`),Qe.has(e.name)){T({type:`loadModel`,id:e.name,kind:e.kind,meta:null,weights:null,label:t});return}Q.show(`Loading ${t}`);let r=e.meta?await re(le($e,e.meta)):{},i=e.weights?await y(le($e,e.weights),(e,t)=>Q.stage(`Downloading the weights: ${t}`,e)):null;if(n!==et)return;Q.stage(`Building ${t}…`,1),T({type:`loadModel`,id:e.name,kind:e.kind,meta:r,weights:i,label:t},i?[i]:[])}catch(e){if(n!==et)return;Q.hide(),E(`<b>Could not load ${t}:</b> ${e.message}`)}}async function nt(){if({entries:Z,base:$e}=await m(),Z=Z.filter(se),!Z.length){E(`<b>No models found</b> locally or on Hugging Face.`);return}Y.innerHTML=ne.filter(e=>Z.some(t=>t.kind===e)).map(e=>`<option value="${e}">${ae[e]?.typeName??ae[e]?.name??e} · ${ae[e]?.family??``}</option>`).join(``);let e=()=>{X.innerHTML=Z.filter(e=>e.kind===Y.value).map(e=>`<option value="${e.name}">${e.label??e.name}</option>`).join(``)},t=()=>Z.find(e=>e.name===X.value),n=Z.find(e=>e.name===D.get(`model`))??Z.find(e=>e.kind===D.get(`kind`));n&&(Y.value=n.kind),e(),n&&(X.value=n.name),Y.onchange=()=>{e(),tt(t())},X.onchange=()=>tt(t()),tt(t())}var $=w(`structure`);$.innerHTML=Object.entries(x).map(([e,t])=>`<option value="${e}">${t.label}</option>`).join(``);var rt=D.get(`structure`);rt&&x[rt]&&(N=x[rt]),$.value=Object.keys(x).find(e=>x[e]===N),$.onchange=()=>{N=x[$.value],J()},w(`xyz-file`).onchange=async e=>{let t=e.target.files?.[0];if(t)try{N=ue(await t.text());let e=document.createElement(`option`);e.textContent=t.name,$.prepend(e),$.selectedIndex=0,J()}catch(e){E(`<b>Could not read ${t.name}:</b> ${e.message}`)}};for(let e of[`force-mode`,`temperature`,`walkers`])w(e).onchange=J;w(`restart`).onclick=J,w(`run`).onclick=()=>Je(!L),document.querySelectorAll(`#modes button`).forEach(e=>e.onclick=()=>e.dataset.mode!==M&&Ke(e.dataset.mode)),document.addEventListener(`keydown`,e=>{e.target.closest(`input, select`)||(e.key===` `&&(e.preventDefault(),Je(!L)),(e.key===`r`||e.key===`R`)&&J())}),document.body.classList.toggle(`mode-md`,M===`md`),document.body.classList.toggle(`mode-dmc`,M===`dmc`),document.querySelectorAll(`#modes button`).forEach(e=>e.classList.toggle(`on`,e.dataset.mode===M)),je.onmessage=e=>{let t=e.data;if(t.type===`ready`)Re=t.backend,Me();else if(t.type===`model`){Qe.add(t.id),Q.hide(),[P,F,I,We]=[t.label,t.elements,t.hasNC,t.kind],w(`force-mode`).querySelector(`[value=direct]`).disabled=!I,I||(w(`force-mode`).value=`conservative`);let e=e=>e.numbers.every(e=>F.includes(e));if(!e(N)){let t=Object.keys(x).find(t=>e(x[t]));t&&(N=x[t],$.value=t)}J()}else if(t.type===`frame`||t.type===`dmc`){if(t.frame.run!==z)return;R=!1,t.type===`frame`?Xe(t.frame):Ze(t.frame),qe()}else t.type===`progress`?Q.stage(t.text,t.fraction):t.type===`error`&&(R=!1,Q.hide(),E(`<b>Error:</b> ${t.text}`),console.error(t.text))},T({type:`init`,backend:D.get(`backend`)??`auto`}),nt();
assets/{md.worker-nvMdrUZd.js → md.worker-C3MDeVbS.js} RENAMED
The diff for this file is too large to render. See raw diff
 
assets/{xyz-BRZpSlyC.js → xyz-DJ8uH0hc.js} RENAMED
The diff for this file is too large to render. See raw diff
 
index.html CHANGED
@@ -3,10 +3,19 @@
3
  <head>
4
  <meta charset="utf-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
 
 
 
 
 
 
 
 
 
6
  <title>MLIP Visualization</title>
7
  <meta name="description" content="Machine-learning interatomic potentials (PET, ANI-2x, KRR/SOAP, PhysNet) running in your browser, with every forward and backward pass visualised." />
8
- <script type="module" crossorigin src="./assets/main-B1y03rfk.js"></script>
9
- <link rel="modulepreload" crossorigin href="./assets/xyz-BRZpSlyC.js">
10
  <link rel="stylesheet" crossorigin href="./assets/xyz-DgYWMidH.css">
11
  </head>
12
  <body>
 
3
  <head>
4
  <meta charset="utf-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <script>
7
+ // a copy of this page cached from before a deploy asks for bundles the deploy removed: reload once (src/app/boot.ts)
8
+ addEventListener('error', (e) => {
9
+ const u = e.target && (e.target.src || e.target.href);
10
+ if (!u || !/\/assets\//.test(u)) return;
11
+ try { if (sessionStorage.getItem('mlipviz-stale')) return; sessionStorage.setItem('mlipviz-stale', '1'); } catch (_) { return; }
12
+ location.reload();
13
+ }, true);
14
+ </script>
15
  <title>MLIP Visualization</title>
16
  <meta name="description" content="Machine-learning interatomic potentials (PET, ANI-2x, KRR/SOAP, PhysNet) running in your browser, with every forward and backward pass visualised." />
17
+ <script type="module" crossorigin src="./assets/main-BTNusuw2.js"></script>
18
+ <link rel="modulepreload" crossorigin href="./assets/xyz-DJ8uH0hc.js">
19
  <link rel="stylesheet" crossorigin href="./assets/xyz-DgYWMidH.css">
20
  </head>
21
  <body>
md.html CHANGED
@@ -3,10 +3,19 @@
3
  <head>
4
  <meta charset="utf-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
 
 
 
 
 
 
 
 
 
6
  <title>MLIP Dynamics</title>
7
  <meta name="description" content="Molecular dynamics (NVE) and diffusion Monte Carlo with machine-learning interatomic potentials, in your browser." />
8
- <script type="module" crossorigin src="./assets/md-BKxiF21f.js"></script>
9
- <link rel="modulepreload" crossorigin href="./assets/xyz-BRZpSlyC.js">
10
  <link rel="stylesheet" crossorigin href="./assets/xyz-DgYWMidH.css">
11
  <link rel="stylesheet" crossorigin href="./assets/md-mHVDup8I.css">
12
  </head>
 
3
  <head>
4
  <meta charset="utf-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <script>
7
+ // a copy of this page cached from before a deploy asks for bundles the deploy removed: reload once (src/app/boot.ts)
8
+ addEventListener('error', (e) => {
9
+ const u = e.target && (e.target.src || e.target.href);
10
+ if (!u || !/\/assets\//.test(u)) return;
11
+ try { if (sessionStorage.getItem('mlipviz-stale')) return; sessionStorage.setItem('mlipviz-stale', '1'); } catch (_) { return; }
12
+ location.reload();
13
+ }, true);
14
+ </script>
15
  <title>MLIP Dynamics</title>
16
  <meta name="description" content="Molecular dynamics (NVE) and diffusion Monte Carlo with machine-learning interatomic potentials, in your browser." />
17
+ <script type="module" crossorigin src="./assets/md-Cm-2D3-Y.js"></script>
18
+ <link rel="modulepreload" crossorigin href="./assets/xyz-DJ8uH0hc.js">
19
  <link rel="stylesheet" crossorigin href="./assets/xyz-DgYWMidH.css">
20
  <link rel="stylesheet" crossorigin href="./assets/md-mHVDup8I.css">
21
  </head>