Spaces:
Running
Running
Deploy the app
Browse files- assets/{engine.worker-CciWxoOu.js → engine.worker-tttrTml4.js} +0 -0
- assets/{main-ByH4DlLz.js → main-B1y03rfk.js} +0 -0
- assets/md-B7uuImDW.js +0 -1
- assets/md-BKxiF21f.js +1 -0
- assets/md-_ytKdV9O.css +0 -1
- assets/md-mHVDup8I.css +1 -0
- assets/{md.worker-DvY8AHPT.js → md.worker-nvMdrUZd.js} +0 -0
- assets/{xyz-DREixYwO.js → xyz-BRZpSlyC.js} +0 -0
- index.html +3 -3
- md.html +48 -15
assets/{engine.worker-CciWxoOu.js → engine.worker-tttrTml4.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/{main-ByH4DlLz.js → main-B1y03rfk.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/md-B7uuImDW.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{J as e,K as t,L as n,M as r,N as i,O as a,P as o,Q as s,S as c,W as l,a as u,b as d,c as f,ct as p,h as m,i as h,k as g,n as _,o as v,ot as y,p as b,r as x,s as S,t as ee,tt as te,u as ne,w as re,y as ie,z as ae}from"./xyz-DREixYwO.js";var oe=`#d7dbe4`,C=`#8a93a6`,se=`#232835`,ce=`#12151c`,le=4e3;function ue(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 w=(e,t)=>e.toFixed(Math.max(0,-Math.floor(Math.log10(t)+1e-9))),de=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>le){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=ue(s-l,c+l),d=ue(0,Math.max(this.t[o-1]??0,1e-6),5),f=u.values[0]-(u.values[0]>s-l?u.step:0),p=u.values[u.values.length-1]+(u.values[u.values.length-1]<c+l?u.step:0),m=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,h=Math.max(...u.values.map(e=>a.measureText(w(e,u.step)).width))+10,g=this.series.length>1?52:12,_=e=>h+(n-h-g)*e/m,v=e=>8+(r-8-22)*(p-e)/(p-f);a.strokeStyle=se,a.lineWidth=1,a.fillStyle=C,a.textAlign=`right`,a.textBaseline=`middle`;for(let e of u.values)e<f||e>p||(a.beginPath(),a.moveTo(h,Math.round(v(e))+.5),a.lineTo(n-g,Math.round(v(e))+.5),a.stroke(),a.fillText(w(e,u.step),h-6,v(e)));a.textAlign=`center`,a.textBaseline=`top`;for(let e of d.values)e<=m&&a.fillText(w(e,d.step),_(e),r-22+6);a.textAlign=`right`,a.fillText(this.xUnit,n-g,r-22+6);for(let e of this.refs)a.setLineDash([4,4]),a.strokeStyle=C,a.beginPath(),a.moveTo(h,v(e.y)),a.lineTo(n-g,v(e.y)),a.stroke(),a.setLineDash([]),a.textAlign=`left`,a.textBaseline=`bottom`,a.fillStyle=C,a.fillText(e.label,h+4,v(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(_(e),v(this.y[t][n])):a.moveTo(_(e),v(this.y[t][n]))),a.stroke())}),a.setLineDash([]),o&&this.series.length>1){let e=this.series.map((e,t)=>({s:e,y:v(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=oe;for(let t of e)a.fillText(t.s.name.split(` `)[0],_(this.t[o-1])+6,t.y)}if(this.hover===null||!o||this.hover<h||this.hover>n-g){this.tip.hidden=!0;return}let y=(this.hover-h)/(n-h-g)*m,b=0;for(let e=0,t=o-1;e<=t;){let n=e+t>>1;this.t[n]<y?e=n+1:t=n-1,b=Math.min(e,o-1)}b>0&&Math.abs(this.t[b-1]-y)<Math.abs(this.t[b]-y)&&b--;let x=_(this.t[b]);a.strokeStyle=C,a.lineWidth=1,a.beginPath(),a.moveTo(Math.round(x)+.5,8),a.lineTo(Math.round(x)+.5,r-22),a.stroke(),this.series.forEach((e,t)=>{a.beginPath(),a.arc(x,v(this.y[t][b]),4,0,2*Math.PI),a.fillStyle=e.color,a.fill(),a.lineWidth=2,a.strokeStyle=ce,a.stroke()}),this.tip.hidden=!1,this.tip.innerHTML=`<div class="tt-head">t = ${this.t[b].toFixed(1)} ${this.xUnit}</div>`+this.series.map((e,t)=>`<div><i style="background:${e.color}"></i>${e.name}<b>${w(this.y[t][b],u.step/10)} ${this.unit}</b></div>`).join(``);let S=this.tip.offsetWidth;this.tip.style.left=`${x+12+S>n?x-12-S:x+12}px`,this.tip.style.top=`8px`}},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=new te(1,24,16),ge=new c(1,1,1,10,1).translate(0,.5,0),_e=new y(0,1,0),T=e=>ne[e]??1.5,ve=class{el;renderer=new m({antialias:!0,alpha:!0});scene=new s;camera=new t(30,1,.05,1e3);controls;group=new a;atoms=null;bonds=null;cell=null;sys=null;inv=null;dirty=!0;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 g(16777215,4212824,1.6));let t=new re(16777215,1.6);t.position.set(3,5,6),this.camera.add(t),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 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.atoms=new r(he,new l({roughness:.45,metalness:.05}),t),e.numbers.forEach((e,t)=>this.atoms.setColorAt(t,new d(f[e]??11579568))),this.bonds=new r(ge,new l({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,n,r]=e.cell.map(e=>new y(...e)),a=[new y,t,n,r,t.clone().add(n),t.clone().add(r),n.clone().add(r),t.clone().add(n).add(r)],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 o(new ie().setFromPoints(s.flatMap(([e,t])=>[a[e],a[t]])),new i({color:9081766})),this.group.add(this.cell),this.inv=pe(e.cell)}this.update(Float32Array.from(e.positions.flat())),this.fit()}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 a=this.wrap(t),o=i.numbers.length,s=new ae,c=new e,l=e=>new y(a[3*e],a[3*e+1],a[3*e+2]);for(let e=0;e<o;e++){let t=.18+.32*T(i.numbers[e]);n.setMatrixAt(e,s.compose(l(e),c,new y(t,t,t)))}n.instanceMatrix.needsUpdate=!0;let u=0;for(let e=0;e<o;e++)for(let t=e+1;t<o;t++){let n=l(e),a=l(t).sub(n),o=a.length();o>1.2*(T(i.numbers[e])+T(i.numbers[t]))||(c.setFromUnitVectors(_e,a.clone().normalize()),r.setMatrixAt(u++,s.compose(n,c,new y(.09,o,.09))))}r.count=u,r.instanceMatrix.needsUpdate=!0,this.dirty=!0}fit(){let e=this.sys.positions,t=new y,r=[...e,...this.cell?[this.sys.cell.reduce((e,t)=>e.map((e,n)=>e+t[n]/2),[0,0,0])]:[]];r.forEach(e=>t.add(new y(...e))),t.divideScalar(r.length);let i=2;e.forEach(e=>i=Math.max(i,t.distanceTo(new y(...e))+1.5)),this.cell&&this.sys.cell.forEach(e=>i=Math.max(i,new y(...e).length()*.9));let a=i/Math.sin(n.degToRad(this.camera.fov/2));this.controls.target.copy(t),this.camera.position.copy(t).add(new y(0,0,a)),this.camera.near=a/50,this.camera.far=a*10,this.camera.updateProjectionMatrix(),this.dirty=!0}},E=e=>document.getElementById(e),ye=new Worker(new URL(new URL(`md.worker-DvY8AHPT.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),D=(e,t=[])=>ye.postMessage(e,t),O=e=>E(`status`).innerHTML=e,be=`#3987e5`,xe=`#d95926`,Se=`#199e70`,Ce=new ve(E(`traj`)),k=new de(E(`energy-chart`),[{name:`Total`,color:Se},{name:`Potential`,color:be},{name:`Kinetic`,color:xe}],`eV`),A=new de(E(`temp-chart`),[{name:`Temperature`,color:be}],`K`),j=S.ethanol,M=``,N=``,P=[],F=!1,I=!0,L=!1,R=0,z=0,B=0,V=0,H=0,we=4,Te=(e,t,n,r)=>{let i=+E(e).value;return Number.isFinite(i)?Math.min(Math.max(i,t),n):r},U=()=>Te(`temperature`,0,5e3,300),W=()=>Te(`dt`,.05,5,.5),Ee=()=>E(`force-mode`).value;function G(){if(!P.length)return;let e=j.numbers.filter(e=>!P.includes(e));e.length?O(`<b>${N} cannot handle this structure</b> (no parameters for Z = ${[...new Set(e)].join(`, `)})`):(R++,L=!0,[z,B,V,H]=[NaN,0,0,0],k.clear(),A.clear(),A.refs=[{y:U(),label:`T₀`},{y:U()/2,label:`T₀/2`}],Ce.setSystem(j),D({type:`start`,run:R,system:j,temperature:U(),dt:W(),forces:Ee()}))}function De(){I&&!L&&P.length&&(L=!0,D({type:`advance`,run:R,steps:we,dt:W()}))}function Oe(e){I=e,E(`run`).textContent=e?`Pause`:`Run`,E(`run`).classList.toggle(`on`,e),De()}function ke(e){let t=j.numbers.length,n=e.potential+e.kinetic;Number.isNaN(z)&&(z=n),Ce.update(e.positions),k.push(e.time,[n-z,e.potential-z,e.kinetic]),A.push(e.time,[e.temperature]),k.draw(),A.draw(),e.step>0&&(B+=e.temperature,V++);let r=(n-z)/t*1e3;H=Math.max(H,Math.abs(r)),E(`t-now`).textContent=`${e.temperature.toFixed(0)} K`,E(`t-mean`).textContent=V?`mean ${(B/V).toFixed(0)} K`:`T₀ ${U()} K`,E(`drift`).textContent=`${r>=0?`+`:`−`}${Math.abs(r).toFixed(2)}`,E(`drift-max`).textContent=`meV/atom · worst ${H.toFixed(2)}`,e.step>0&&(E(`speed`).textContent=`${e.msPerStep.toFixed(1)} ms`,E(`ms`).textContent=`per step · ${(1e3/e.msPerStep*W()).toFixed(0)} fs/s`,we=Math.min(Math.max(Math.round(60/e.msPerStep),1),50)),E(`clock`).textContent=`t = ${e.time>=1e3?`${(e.time/1e3).toFixed(2)} ps`:`${e.time.toFixed(1)} fs`} · step ${e.step}`,O(`<b>${N}</b> · ${t} atoms · ${Ee()===`direct`&&F?`direct`:`conservative`} forces<br>${M}`)}var K=E(`kind`),q=E(`model`),Ae=new Set,J=[],Y=`models/`,X={el:E(`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 Z(e){let t=e.label??e.name;P=[],R++,L=!1;try{if(O(`loading ${t}…`),Ae.has(e.name)){D({type:`loadModel`,id:e.name,kind:e.kind,meta:null,weights:null,label:t});return}X.show(`Loading ${t}`);let n=e.meta?await u(v(Y,e.meta)):{},r=e.weights?await x(v(Y,e.weights),(e,t)=>X.stage(`Downloading the weights: ${t}`,e)):null;X.stage(`Building ${t}…`,1),D({type:`loadModel`,id:e.name,kind:e.kind,meta:n,weights:r,label:t},r?[r]:[])}catch(e){X.hide(),O(`<b>Could not load ${t}:</b> ${e.message}`)}}async function je(){if({entries:J,base:Y}=await h(),J=J.filter(e=>e.kind!==`krr`),!J.length){O(`<b>No models found</b> locally or on Hugging Face.`);return}K.innerHTML=_.filter(e=>J.some(t=>t.kind===e)).map(e=>`<option value="${e}">${p[e]?.typeName??p[e]?.name??e} · ${p[e]?.family??``}</option>`).join(``);let e=()=>{q.innerHTML=J.filter(e=>e.kind===K.value).map(e=>`<option value="${e.name}">${e.label??e.name}</option>`).join(``)},t=()=>J.find(e=>e.name===q.value),n=new URLSearchParams(location.search),r=J.find(e=>e.name===n.get(`model`))??J.find(e=>e.kind===n.get(`kind`));r&&(K.value=r.kind),e(),r&&(q.value=r.name),K.onchange=()=>{e(),Z(t())},q.onchange=()=>Z(t()),Z(t())}var Q=E(`structure`);Q.innerHTML=Object.entries(S).map(([e,t])=>`<option value="${e}">${t.label}</option>`).join(``);var $=new URLSearchParams(location.search).get(`structure`);$&&S[$]&&(j=S[$]),Q.value=Object.keys(S).find(e=>S[e]===j),Q.onchange=()=>{j=S[Q.value],G()},E(`xyz-file`).onchange=async e=>{let t=e.target.files?.[0];if(t)try{j=ee(await t.text());let e=document.createElement(`option`);e.textContent=t.name,Q.prepend(e),Q.selectedIndex=0,G()}catch(e){O(`<b>Could not read ${t.name}:</b> ${e.message}`)}},E(`force-mode`).onchange=G,E(`temperature`).onchange=G,E(`restart`).onclick=G,E(`run`).onclick=()=>Oe(!I),document.addEventListener(`keydown`,e=>{e.target.closest(`input, select`)||(e.key===` `&&(e.preventDefault(),Oe(!I)),(e.key===`r`||e.key===`R`)&&G())}),ye.onmessage=e=>{let t=e.data;if(t.type===`ready`)M=t.backend,O(M),je();else if(t.type===`model`){Ae.add(t.id),X.hide(),[N,P,F]=[t.label,t.elements,t.hasNC],E(`force-mode`).querySelector(`[value=direct]`).disabled=!F,F||(E(`force-mode`).value=`conservative`);let e=e=>e.numbers.every(e=>P.includes(e));if(!e(j)){let t=Object.keys(S).find(t=>e(S[t]));t&&(j=S[t],Q.value=t)}G()}else if(t.type===`frame`){if(t.frame.run!==R)return;L=!1,ke(t.frame),De()}else t.type===`progress`?X.stage(t.text,t.fraction):t.type===`error`&&(L=!1,X.hide(),O(`<b>Error:</b> ${t.text}`),console.error(t.text))},D({type:`init`,backend:new URLSearchParams(location.search).get(`backend`)??`auto`});
|
|
|
|
|
|
assets/md-BKxiF21f.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 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-_ytKdV9O.css
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
.brand{color:var(--text);text-decoration:none}.page-tag{color:var(--accent);border:1px solid var(--accent);border-radius:999px;margin-right:6px;padding:1px 9px;font-size:12px}header input[type=number]{width:68px;font:inherit;color:var(--text);border:1px solid var(--line);font-variant-numeric:tabular-nums;background:#1a1e28;border-radius:6px;padding:3px 6px}body.md main{grid-template-columns:minmax(0,1fr) minmax(360px,34%);min-height:0;display:grid}#stage{background:radial-gradient(ellipse at 50% 40%, #161a23, var(--bg) 70%);min-height:0;position:relative}#traj{position:absolute;inset:0}#traj canvas{display:block}#clock{color:var(--muted);font-variant-numeric:tabular-nums;pointer-events:none;font-size:13px;position:absolute;bottom:12px;left:14px}#md-loading{z-index:5;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);text-align:center;background:#0c0e13c7;flex-direction:column;justify-content:center;align-items:center;gap:10px;padding:16px;display:flex;position:absolute;inset:0}#md-loading[hidden]{display:none}#panel{background:var(--panel);border-left:1px solid var(--line);flex-direction:column;gap:14px;padding:14px 16px;display:flex;overflow-y:auto}#tiles{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;display:grid}.tile{border:1px solid var(--line);border-radius:8px;flex-direction:column;min-width:0;padding:8px 10px;display:flex}.tile small{color:var(--muted);text-transform:uppercase;letter-spacing:.06em;font-size:11px}.tile b{font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;font-size:18px;font-weight:600;overflow:hidden}.tile span{color:var(--muted);font-variant-numeric:tabular-nums;font-size:11.5px}#panel figure{margin:0}#panel figcaption{color:var(--muted);margin-bottom:4px;font-size:12px}.note{color:var(--muted);margin:0;font-size:12.5px}.note b{color:var(--text);font-weight:600}.chart{flex-direction:column;gap:4px;display:flex}.chart-legend{color:var(--text);gap:14px;font-size:12px;display:flex}.chart-legend i{vertical-align:-1px;border-radius:2px;width:10px;height:10px;margin-right:5px;display:inline-block}.chart-plot{height:180px;position:relative}.chart-plot canvas{cursor:crosshair;display:block}.chart-tip{pointer-events:none;white-space:nowrap;font-variant-numeric:tabular-nums;z-index:2;background:#1a1e28;border:1px solid #3a4256;border-radius:6px;padding:6px 8px;font-size:12px;position:absolute}.chart-tip .tt-head{color:var(--muted);margin-bottom:2px}.chart-tip div{align-items:center;gap:6px;display:flex}.chart-tip i{border-radius:2px;width:8px;height:8px}.chart-tip b{margin-left:auto;padding-left:12px;font-weight:600}@media (width<=900px){body.md main{flex-direction:column;display:flex}#stage{flex:none;height:52vh;min-height:260px}#panel{border-left:0;border-top:1px solid var(--line);overflow:visible}header input[type=number]{width:58px}}@media (width<=520px){body.md header label:not(.file){gap:4px;font-size:12px}body.md header label:has(select){gap:0;font-size:0}header input[type=number]{width:54px;font-size:12px}.page-tag{display:none}#panel{padding:12px 10px}#tiles{gap:6px}.tile{padding:6px 8px}.tile b{font-size:16px}}
|
|
|
|
|
|
assets/md-mHVDup8I.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
.brand{color:var(--text);text-decoration:none}#modes{border:1px solid var(--line);border-radius:7px;margin-right:6px;display:flex;overflow:hidden}#modes button{color:var(--muted);background:0 0;border:0;border-radius:0;padding:4px 10px}#modes button+button{border-left:1px solid var(--line)}#modes button.on{color:var(--accent);background:#262b36}body.mode-md .dmc-only,body.mode-dmc .md-only{display:none!important}header input[type=number]{width:68px;font:inherit;color:var(--text);border:1px solid var(--line);font-variant-numeric:tabular-nums;background:#1a1e28;border-radius:6px;padding:3px 6px}body.md main{grid-template-columns:minmax(0,1fr) minmax(360px,34%);min-height:0;display:grid}#stage{background:radial-gradient(ellipse at 50% 40%, #161a23, var(--bg) 70%);min-height:0;position:relative}#traj{position:absolute;inset:0}#traj canvas{display:block}#clock{color:var(--muted);font-variant-numeric:tabular-nums;pointer-events:none;font-size:13px;position:absolute;bottom:12px;left:14px}#md-loading{z-index:5;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);text-align:center;background:#0c0e13c7;flex-direction:column;justify-content:center;align-items:center;gap:10px;padding:16px;display:flex;position:absolute;inset:0}#md-loading[hidden]{display:none}#panel{background:var(--panel);border-left:1px solid var(--line);flex-direction:column;gap:14px;padding:14px 16px;display:flex;overflow-y:auto}.tiles{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.tile{border:1px solid var(--line);border-radius:8px;flex-direction:column;min-width:0;padding:8px 10px;display:flex}.tile small{color:var(--muted);text-transform:uppercase;letter-spacing:.06em;font-size:11px}.tile b{font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;font-size:18px;font-weight:600;overflow:hidden}.tile span{color:var(--muted);font-variant-numeric:tabular-nums;font-size:11.5px}#panel figure{margin:0}#panel figcaption{color:var(--muted);margin-bottom:4px;font-size:12px}.note{color:var(--muted);margin:0;font-size:12.5px}.note b{color:var(--text);font-weight:600}.chart{flex-direction:column;gap:4px;display:flex}.chart-legend{color:var(--text);gap:14px;font-size:12px;display:flex}.chart-legend i{vertical-align:-1px;border-radius:2px;width:10px;height:10px;margin-right:5px;display:inline-block}.chart-plot{height:180px;position:relative}.chart-plot canvas{cursor:crosshair;display:block}.chart-tip{pointer-events:none;white-space:nowrap;font-variant-numeric:tabular-nums;z-index:2;background:#1a1e28;border:1px solid #3a4256;border-radius:6px;padding:6px 8px;font-size:12px;position:absolute}.chart-tip .tt-head{color:var(--muted);margin-bottom:2px}.chart-tip div{align-items:center;gap:6px;display:flex}.chart-tip i{border-radius:2px;width:8px;height:8px}.chart-tip b{margin-left:auto;padding-left:12px;font-weight:600}@media (width<=900px){body.md main{flex-direction:column;display:flex}#stage{flex:none;height:52vh;min-height:260px}#panel{border-left:0;border-top:1px solid var(--line);overflow:visible}header input[type=number]{width:58px}}@media (width<=520px){body.md header label:not(.file){gap:4px;font-size:12px}body.md header label:has(select){gap:0;font-size:0}header input[type=number]{width:54px;font-size:12px}#modes button{padding:3px 8px;font-size:12px}#panel{padding:12px 10px}.tiles{gap:6px}.tile{padding:6px 8px}.tile b{font-size:16px}}
|
assets/{md.worker-DvY8AHPT.js → md.worker-nvMdrUZd.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
assets/{xyz-DREixYwO.js → xyz-BRZpSlyC.js}
RENAMED
|
The diff for this file is too large to render.
See raw diff
|
|
|
index.html
CHANGED
|
@@ -5,8 +5,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-
|
| 9 |
-
<link rel="modulepreload" crossorigin href="./assets/xyz-
|
| 10 |
<link rel="stylesheet" crossorigin href="./assets/xyz-DgYWMidH.css">
|
| 11 |
</head>
|
| 12 |
<body>
|
|
@@ -22,7 +22,7 @@
|
|
| 22 |
<option value="direct">direct (non-conservative)</option>
|
| 23 |
<option value="both">both, compared</option></select></label>
|
| 24 |
<button id="rattle" title="Displace every atom a little and run a new pass">Rattle</button>
|
| 25 |
-
<a class="nav" id="md-link" href="md.html" title="
|
| 26 |
<div id="status"></div>
|
| 27 |
</header>
|
| 28 |
<main>
|
|
|
|
| 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>
|
|
|
|
| 22 |
<option value="direct">direct (non-conservative)</option>
|
| 23 |
<option value="both">both, compared</option></select></label>
|
| 24 |
<button id="rattle" title="Displace every atom a little and run a new pass">Rattle</button>
|
| 25 |
+
<a class="nav" id="md-link" href="md.html" title="Molecular dynamics and diffusion Monte Carlo with this model">MD & DMC →</a>
|
| 26 |
<div id="status"></div>
|
| 27 |
</header>
|
| 28 |
<main>
|
md.html
CHANGED
|
@@ -4,27 +4,32 @@
|
|
| 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="
|
| 8 |
-
<script type="module" crossorigin src="./assets/md-
|
| 9 |
-
<link rel="modulepreload" crossorigin href="./assets/xyz-
|
| 10 |
<link rel="stylesheet" crossorigin href="./assets/xyz-DgYWMidH.css">
|
| 11 |
-
<link rel="stylesheet" crossorigin href="./assets/md-
|
| 12 |
</head>
|
| 13 |
-
<body class="md">
|
| 14 |
<header>
|
| 15 |
<a class="brand" href="./" title="Back to the network visualiser">MLIP<span>viz</span></a>
|
| 16 |
-
<
|
|
|
|
|
|
|
|
|
|
| 17 |
<label title="The kind of model">Model <select id="kind"></select></label>
|
| 18 |
<label title="Which trained weights">Weights <select id="model"></select></label>
|
| 19 |
<label>Structure <select id="structure"></select></label>
|
| 20 |
<label class="file">Open .xyz…<input id="xyz-file" type="file" accept=".xyz,.extxyz" /></label>
|
| 21 |
-
<label id="force-mode-wrap" title="How forces are computed">Forces <select id="force-mode">
|
| 22 |
<option value="conservative">conservative (−∂E/∂r)</option>
|
| 23 |
<option value="direct">direct (non-conservative)</option></select></label>
|
| 24 |
-
<label title="Initial temperature: Maxwell–Boltzmann velocities, no net momentum">T₀ <input id="temperature" type="number" value="300" min="0" max="5000" step="50" /> K</label>
|
| 25 |
-
<label title="Time step (applies immediately)">Δt <input id="dt" type="number" value="0.5" min="0.05" max="5" step="0.05" /> fs</label>
|
|
|
|
|
|
|
| 26 |
<button id="run" class="on" title="Run or pause (Space)">Pause</button>
|
| 27 |
-
<button id="restart" title="
|
| 28 |
<div id="status">starting…</div>
|
| 29 |
</header>
|
| 30 |
<main>
|
|
@@ -38,26 +43,54 @@
|
|
| 38 |
</div>
|
| 39 |
</section>
|
| 40 |
<aside id="panel">
|
| 41 |
-
<div
|
| 42 |
<div class="tile"><small>Temperature</small><b id="t-now">–</b><span id="t-mean"></span></div>
|
| 43 |
<div class="tile"><small>Energy drift</small><b id="drift">–</b><span id="drift-max"></span></div>
|
| 44 |
-
<div class="tile"><small>Speed</small><b id="speed">–</b><span id="ms"></span></div>
|
|
|
|
| 45 |
</div>
|
| 46 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
<figcaption>Energy, eV, relative to the total at t = 0</figcaption>
|
| 48 |
<div id="energy-chart"></div>
|
| 49 |
</figure>
|
| 50 |
-
<figure>
|
| 51 |
<figcaption>Temperature, K</figcaption>
|
| 52 |
<div id="temp-chart"></div>
|
| 53 |
</figure>
|
| 54 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
Velocity Verlet at constant particle number, volume and energy, with forces from the model in the
|
| 56 |
browser. A good potential and time step keep the <b>total</b> energy flat while kinetic and potential
|
| 57 |
energy trade places. Starting from a relaxed structure, about half the initial kinetic energy flows into
|
| 58 |
the potential, so the temperature settles near T₀/2. <b>Direct</b> forces are not the gradient of any
|
| 59 |
energy, so the total drifts. Too large a Δt does the same, faster.
|
| 60 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
</aside>
|
| 62 |
</main>
|
| 63 |
</body>
|
|
|
|
| 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>
|
| 13 |
+
<body class="md mode-md">
|
| 14 |
<header>
|
| 15 |
<a class="brand" href="./" title="Back to the network visualiser">MLIP<span>viz</span></a>
|
| 16 |
+
<nav id="modes" title="What to run">
|
| 17 |
+
<button data-mode="md" class="on" title="Classical molecular dynamics at constant energy">NVE dynamics</button>
|
| 18 |
+
<button data-mode="dmc" title="Diffusion Monte Carlo: the quantum vibrational ground state">Diffusion Monte Carlo</button>
|
| 19 |
+
</nav>
|
| 20 |
<label title="The kind of model">Model <select id="kind"></select></label>
|
| 21 |
<label title="Which trained weights">Weights <select id="model"></select></label>
|
| 22 |
<label>Structure <select id="structure"></select></label>
|
| 23 |
<label class="file">Open .xyz…<input id="xyz-file" type="file" accept=".xyz,.extxyz" /></label>
|
| 24 |
+
<label class="md-only" id="force-mode-wrap" title="How forces are computed">Forces <select id="force-mode">
|
| 25 |
<option value="conservative">conservative (−∂E/∂r)</option>
|
| 26 |
<option value="direct">direct (non-conservative)</option></select></label>
|
| 27 |
+
<label class="md-only" title="Initial temperature: Maxwell–Boltzmann velocities, no net momentum">T₀ <input id="temperature" type="number" value="300" min="0" max="5000" step="50" /> K</label>
|
| 28 |
+
<label class="md-only" title="Time step (applies immediately)">Δt <input id="dt" type="number" value="0.5" min="0.05" max="5" step="0.05" /> fs</label>
|
| 29 |
+
<label class="dmc-only" title="Target number of walkers (all are evaluated in batched passes)">Walkers <input id="walkers" type="number" value="500" min="20" max="20000" step="100" /></label>
|
| 30 |
+
<label class="dmc-only" title="Imaginary time step, atomic units (applies immediately)">Δτ <input id="dtau" type="number" value="10" min="0.5" max="50" step="1" /> a.u.</label>
|
| 31 |
<button id="run" class="on" title="Run or pause (Space)">Pause</button>
|
| 32 |
+
<button id="restart" title="Start again from the starting structure (R)">Restart</button>
|
| 33 |
<div id="status">starting…</div>
|
| 34 |
</header>
|
| 35 |
<main>
|
|
|
|
| 43 |
</div>
|
| 44 |
</section>
|
| 45 |
<aside id="panel">
|
| 46 |
+
<div class="tiles md-only">
|
| 47 |
<div class="tile"><small>Temperature</small><b id="t-now">–</b><span id="t-mean"></span></div>
|
| 48 |
<div class="tile"><small>Energy drift</small><b id="drift">–</b><span id="drift-max"></span></div>
|
| 49 |
+
<div class="tile" title="Simulated nanoseconds per day of wall-clock time at this rate"><small>Speed</small><b id="speed">–</b><span id="ms"></span></div>
|
| 50 |
+
<div class="tile flops-tile"><small>Compute</small><b id="flops">–</b><span id="flops-detail"></span></div>
|
| 51 |
</div>
|
| 52 |
+
<div class="tiles dmc-only">
|
| 53 |
+
<div class="tile" title="Mean of E_ref − V_min over the second half of the run, with a blocking error"><small>Zero-point energy</small><b id="zpe">–</b><span id="zpe-detail"></span></div>
|
| 54 |
+
<div class="tile"><small>Walkers</small><b id="walkers-now">–</b><span id="walkers-detail"></span></div>
|
| 55 |
+
<div class="tile" title="Walker energies evaluated per day of wall-clock time at this rate"><small>Throughput</small><b id="samples">–</b><span id="samples-detail"></span></div>
|
| 56 |
+
<div class="tile flops-tile"><small>Compute</small><b id="dmc-flops">–</b><span id="dmc-flops-detail"></span></div>
|
| 57 |
+
</div>
|
| 58 |
+
<figure class="md-only">
|
| 59 |
<figcaption>Energy, eV, relative to the total at t = 0</figcaption>
|
| 60 |
<div id="energy-chart"></div>
|
| 61 |
</figure>
|
| 62 |
+
<figure class="md-only">
|
| 63 |
<figcaption>Temperature, K</figcaption>
|
| 64 |
<div id="temp-chart"></div>
|
| 65 |
</figure>
|
| 66 |
+
<figure class="dmc-only">
|
| 67 |
+
<figcaption>Reference energy E_ref − V_min, cm⁻¹</figcaption>
|
| 68 |
+
<div id="eref-chart"></div>
|
| 69 |
+
</figure>
|
| 70 |
+
<figure class="dmc-only">
|
| 71 |
+
<figcaption>Walkers</figcaption>
|
| 72 |
+
<div id="pop-chart"></div>
|
| 73 |
+
</figure>
|
| 74 |
+
<p class="note md-only">
|
| 75 |
Velocity Verlet at constant particle number, volume and energy, with forces from the model in the
|
| 76 |
browser. A good potential and time step keep the <b>total</b> energy flat while kinetic and potential
|
| 77 |
energy trade places. Starting from a relaxed structure, about half the initial kinetic energy flows into
|
| 78 |
the potential, so the temperature settles near T₀/2. <b>Direct</b> forces are not the gradient of any
|
| 79 |
energy, so the total drifts. Too large a Δt does the same, faster.
|
| 80 |
</p>
|
| 81 |
+
<p class="note dmc-only">
|
| 82 |
+
Diffusion Monte Carlo treats the nuclei as quantum particles. The structure is relaxed on the model's
|
| 83 |
+
surface first. Then walkers, each a copy of the molecule, take random steps sized by ħ²Δτ/m. Each walker
|
| 84 |
+
is copied or removed with weight exp(−Δτ (V − E<sub>ref</sub>)), and E<sub>ref</sub> is steered to keep the
|
| 85 |
+
population steady. The population settles into the vibrational ground state, and the mean of
|
| 86 |
+
E<sub>ref</sub> above the minimum is the <b>zero-point energy</b>. The cloud shows where the walkers are
|
| 87 |
+
(light atoms spread furthest). Only energies are needed, so every walker is evaluated in batched passes.
|
| 88 |
+
Walkers that fall far below the minimum have found a <b>hole</b> in the surface and are removed.
|
| 89 |
+
</p>
|
| 90 |
+
<p class="note" id="flops-note">
|
| 91 |
+
FLOPs are estimated from the shapes of the kernels the model runs (a multiply-add counts as 2). The rate
|
| 92 |
+
includes everything else in a step: the neighbour list, data transfer and the read-back of results.
|
| 93 |
+
</p>
|
| 94 |
</aside>
|
| 95 |
</main>
|
| 96 |
</body>
|