我希望设计一个简洁且易维护的网站,用于构建一个 DFT (Density Functional Theory) Agent 的交互界面。用户可以输入问题并查看计算过程和结果。用户在输入框中输入一句话问题,例如“计算LiNa的能量”。后端接收请求后,调用 Agent 和相关工具执行 DFT 计算。DFT 计算开始之前,后端会提供该分子的结构文件,前端需要在页面上展示该分子的结构图(基于后端提供的结构文件生成的图片)。DFT 计算过程中,后端会逐步返回中间输出,前端需要实时在页面上展示这些中间结果,而不是用打勾或进度条的形式简化显示。DFT 计算完成后,后端会提供该分子的 HOMO 和 LUMO 结构图,前端需在页面上显式展示。页面整体使用浅色背景,设计要有一定科技感,例如柔和的渐变和简洁的图标或边框。界面布局要保持平衡,不允许出现一边元素过多、一边空旷的情况,布局要合理分配空间,避免界面拥挤或不平衡。输入仅支持用户输入一句话问题,例如“计算LiNa的能量”。输出应显式展示后端输出的中间结果和最终结果,包括文字信息和结构图。分子结构图和 HOMO/LUMO 结构图应嵌入页面,在数据返回后自动更新。前端代码需尽可能简洁,便于维护。后端接口假定已准备好,可以通过简单的 API 调用获取分子结构图和计算结果。 - Initial Deployment
e1a63f9
verified
| <html lang="zh-CN"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>DFT Agent - 密度泛函理论计算平台</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: '#3b82f6', | |
| secondary: '#6366f1', | |
| accent: '#8b5cf6', | |
| dark: '#1e293b', | |
| light: '#f8fafc' | |
| }, | |
| animation: { | |
| 'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite', | |
| 'float': 'float 6s ease-in-out infinite', | |
| }, | |
| keyframes: { | |
| float: { | |
| '0%, 100%': { transform: 'translateY(0)' }, | |
| '50%': { transform: 'translateY(-10px)' }, | |
| } | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap'); | |
| body { | |
| font-family: 'Inter', sans-serif; | |
| background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); | |
| min-height: 100vh; | |
| } | |
| .molecule-card { | |
| transition: all 0.3s ease; | |
| box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); | |
| } | |
| .molecule-card:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 10px 25px rgba(99, 102, 241, 0.2); | |
| } | |
| .terminal-output { | |
| font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; | |
| background: rgba(15, 23, 42, 0.9); | |
| border-radius: 0.5rem; | |
| } | |
| .atom-pulse { | |
| animation: pulse-slow 2s infinite; | |
| } | |
| .glow-border { | |
| box-shadow: 0 0 15px rgba(99, 102, 241, 0.3); | |
| } | |
| .progress-bar { | |
| height: 4px; | |
| background: linear-gradient(90deg, #6366f1, #8b5cf6); | |
| animation: progress-animation 2s infinite linear; | |
| background-size: 200% 100%; | |
| } | |
| @keyframes progress-animation { | |
| 0% { background-position: 100% 0; } | |
| 100% { background-position: -100% 0; } | |
| } | |
| .orbital-animation { | |
| animation: float 8s ease-in-out infinite; | |
| } | |
| .orbital-animation:nth-child(2) { | |
| animation-delay: 1s; | |
| } | |
| .orbital-animation:nth-child(3) { | |
| animation-delay: 2s; | |
| } | |
| </style> | |
| </head> | |
| <body class="min-h-screen py-8 px-4 sm:px-6 lg:px-8"> | |
| <div class="max-w-6xl mx-auto"> | |
| <!-- 页眉 --> | |
| <header class="text-center mb-12"> | |
| <div class="flex items-center justify-center mb-4"> | |
| <div class="w-12 h-12 rounded-full bg-gradient-to-r from-primary to-secondary flex items-center justify-center mr-3"> | |
| <i class="fas fa-atom text-white text-xl"></i> | |
| </div> | |
| <h1 class="text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-primary to-accent">DFT Agent</h1> | |
| </div> | |
| <p class="text-lg text-slate-600 max-w-2xl mx-auto"> | |
| 密度泛函理论计算平台 - 输入分子结构,实时获取DFT计算结果 | |
| </p> | |
| </header> | |
| <!-- 主内容区 --> | |
| <main class="grid grid-cols-1 lg:grid-cols-3 gap-8"> | |
| <!-- 输入区域 --> | |
| <div class="lg:col-span-1"> | |
| <div class="bg-white rounded-2xl p-6 molecule-card"> | |
| <h2 class="text-xl font-semibold text-slate-800 mb-4 flex items-center"> | |
| <i class="fas fa-keyboard mr-2 text-secondary"></i>计算输入 | |
| </h2> | |
| <div class="mb-6"> | |
| <label class="block text-sm font-medium text-slate-700 mb-2">输入分子结构</label> | |
| <div class="relative"> | |
| <input | |
| type="text" | |
| id="molecule-input" | |
| placeholder="例如: 计算LiNa的能量" | |
| class="w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition" | |
| > | |
| <button | |
| id="calculate-btn" | |
| class="absolute right-2 top-1/2 transform -translate-y-1/2 bg-gradient-to-r from-primary to-secondary text-white px-4 py-1.5 rounded-lg hover:opacity-90 transition" | |
| > | |
| 计算 | |
| </button> | |
| </div> | |
| </div> | |
| <div class="mt-8"> | |
| <h3 class="text-lg font-medium text-slate-800 mb-3 flex items-center"> | |
| <i class="fas fa-history mr-2 text-secondary"></i>最近计算 | |
| </h3> | |
| <ul class="space-y-2"> | |
| <li class="flex items-center justify-between bg-slate-50 p-3 rounded-lg"> | |
| <span class="text-slate-700">H₂O</span> | |
| <span class="text-sm text-slate-500">-76.42 eV</span> | |
| </li> | |
| <li class="flex items-center justify-between bg-slate-50 p-3 rounded-lg"> | |
| <span class="text-slate-700">CO₂</span> | |
| <span class="text-sm text-slate-500">-187.65 eV</span> | |
| </li> | |
| <li class="flex items-center justify-between bg-slate-50 p-3 rounded-lg"> | |
| <span class="text-slate-700">CH₄</span> | |
| <span class="text-sm text-slate-500">-40.52 eV</span> | |
| </li> | |
| </ul> | |
| </div> | |
| </div> | |
| <div class="bg-white rounded-2xl p-6 molecule-card mt-8"> | |
| <h2 class="text-xl font-semibold text-slate-800 mb-4 flex items-center"> | |
| <i class="fas fa-info-circle mr-2 text-secondary"></i>DFT计算说明 | |
| </h2> | |
| <p class="text-slate-600 mb-3"> | |
| 密度泛函理论(DFT)是一种量子力学计算方法,用于研究多电子体系的电子结构。 | |
| </p> | |
| <ul class="text-slate-600 space-y-2"> | |
| <li class="flex items-start"> | |
| <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i> | |
| <span>输入分子式(如H₂O, CO₂)</span> | |
| </li> | |
| <li class="flex items-start"> | |
| <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i> | |
| <span>系统自动生成分子结构</span> | |
| </li> | |
| <li class="flex items-start"> | |
| <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i> | |
| <span>实时显示计算过程</span> | |
| </li> | |
| <li class="flex items-start"> | |
| <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i> | |
| <span>获取HOMO/LUMO轨道可视化</span> | |
| </li> | |
| </ul> | |
| </div> | |
| </div> | |
| <!-- 输出区域 --> | |
| <div class="lg:col-span-2"> | |
| <div class="bg-white rounded-2xl p-6 molecule-card"> | |
| <h2 class="text-xl font-semibold text-slate-800 mb-4 flex items-center"> | |
| <i class="fas fa-microchip mr-2 text-secondary"></i>计算过程 | |
| </h2> | |
| <div id="calculation-status" class="mb-6"> | |
| <div class="flex items-center mb-2"> | |
| <div class="w-6 h-6 rounded-full bg-primary flex items-center justify-center mr-2"> | |
| <i class="fas fa-play text-white text-xs"></i> | |
| </div> | |
| <span class="text-slate-800">准备开始计算...</span> | |
| </div> | |
| <div class="progress-bar w-full rounded-full"></div> | |
| </div> | |
| <div class="terminal-output p-4 rounded-lg mb-6"> | |
| <div id="terminal-content" class="text-green-400 text-sm h-64 overflow-y-auto"> | |
| <div>> DFT Agent 已就绪</div> | |
| <div>> 等待用户输入...</div> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> | |
| <div class="bg-slate-50 rounded-lg p-4"> | |
| <h3 class="font-medium text-slate-700 mb-2 flex items-center"> | |
| <i class="fas fa-cube mr-2 text-secondary"></i>分子结构 | |
| </h3> | |
| <div id="molecule-structure" class="flex items-center justify-center h-48"> | |
| <div class="text-center text-slate-400"> | |
| <i class="fas fa-molecule text-4xl mb-2"></i> | |
| <p>等待分子结构数据...</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-slate-50 rounded-lg p-4"> | |
| <h3 class="font-medium text-slate-700 mb-2 flex items-center"> | |
| <i class="fas fa-bolt mr-2 text-secondary"></i>能量信息 | |
| </h3> | |
| <div id="energy-info" class="h-48 flex items-center justify-center"> | |
| <div class="text-center text-slate-400"> | |
| <i class="fas fa-battery-quarter text-4xl mb-2"></i> | |
| <p>计算完成后显示能量数据</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="mb-6"> | |
| <h3 class="font-medium text-slate-700 mb-3 flex items-center"> | |
| <i class="fas fa-orbit mr-2 text-secondary"></i>分子轨道 | |
| </h3> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div class="bg-slate-50 rounded-lg p-4"> | |
| <h4 class="text-sm font-medium text-slate-600 mb-2">HOMO (最高占据分子轨道)</h4> | |
| <div id="homo-orbital" class="flex items-center justify-center h-40"> | |
| <div class="text-center text-slate-400"> | |
| <i class="fas fa-circle-notch text-3xl mb-2 orbital-animation"></i> | |
| <p class="text-sm">计算中...</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-slate-50 rounded-lg p-4"> | |
| <h4 class="text-sm font-medium text-slate-600 mb-2">LUMO (最低未占分子轨道)</h4> | |
| <div id="lumo-orbital" class="flex items-center justify-center h-40"> | |
| <div class="text-center text-slate-400"> | |
| <i class="fas fa-circle-notch text-3xl mb-2 orbital-animation" style="animation-delay: 0.5s"></i> | |
| <p class="text-sm">计算中...</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="flex justify-end"> | |
| <button id="export-btn" class="px-4 py-2 bg-slate-100 text-slate-700 rounded-lg hover:bg-slate-200 transition flex items-center"> | |
| <i class="fas fa-download mr-2"></i>导出结果 | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <!-- 页脚 --> | |
| <footer class="mt-12 text-center text-slate-500 text-sm"> | |
| <p>DFT Agent - 密度泛函理论计算平台 © 2023 | 量子化学计算工具</p> | |
| <p class="mt-1">本系统仅用于科研和教育目的</p> | |
| </footer> | |
| </div> | |
| <script> | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Yyk040316/dftagent" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |