我希望设计一个简洁且易维护的网站,用于构建一个 DFT (Density Functional Theory) Agent 的交互界面。用户可以输入问题并查看计算过程和结果。用户在输入框中输入一句话问题,例如“计算LiNa的能量”。后端接收请求后,调用 Agent 和相关工具执行 DFT 计算。DFT 计算开始之前,后端会提供该分子的结构文件,前端需要在页面上展示该分子的结构图(基于后端提供的结构文件生成的图片)。DFT 计算过程中,后端会逐步返回中间输出,前端需要实时在页面上展示这些中间结果,而不是用打勾或进度条的形式简化显示。DFT 计算完成后,后端会提供该分子的 HOMO 和 LUMO 结构图,前端需在页面上显式展示。页面整体使用浅色背景,设计要有一定科技感,例如柔和的渐变和简洁的图标或边框。界面布局要保持平衡,不允许出现一边元素过多、一边空旷的情况,布局要合理分配空间,避免界面拥挤或不平衡。输入仅支持用户输入一句话问题,例如“计算LiNa的能量”。输出应显式展示后端输出的中间结果和最终结果,包括文字信息和结构图。分子结构图和 HOMO/LUMO 结构图应嵌入页面,在数据返回后自动更新。前端代码需尽可能简洁,便于维护。后端接口假定已准备好,可以通过简单的 API 调用获取分子结构图和计算结果。 - Initial Deployment
Browse files- README.md +7 -5
- index.html +436 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: dftagent
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: green
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,436 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="zh-CN">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>DFT Agent - 密度泛函理论计算平台</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
9 |
+
<script>
|
10 |
+
tailwind.config = {
|
11 |
+
theme: {
|
12 |
+
extend: {
|
13 |
+
colors: {
|
14 |
+
primary: '#3b82f6',
|
15 |
+
secondary: '#6366f1',
|
16 |
+
accent: '#8b5cf6',
|
17 |
+
dark: '#1e293b',
|
18 |
+
light: '#f8fafc'
|
19 |
+
},
|
20 |
+
animation: {
|
21 |
+
'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite',
|
22 |
+
'float': 'float 6s ease-in-out infinite',
|
23 |
+
},
|
24 |
+
keyframes: {
|
25 |
+
float: {
|
26 |
+
'0%, 100%': { transform: 'translateY(0)' },
|
27 |
+
'50%': { transform: 'translateY(-10px)' },
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
</script>
|
34 |
+
<style>
|
35 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
36 |
+
|
37 |
+
body {
|
38 |
+
font-family: 'Inter', sans-serif;
|
39 |
+
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
|
40 |
+
min-height: 100vh;
|
41 |
+
}
|
42 |
+
|
43 |
+
.molecule-card {
|
44 |
+
transition: all 0.3s ease;
|
45 |
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
|
46 |
+
}
|
47 |
+
|
48 |
+
.molecule-card:hover {
|
49 |
+
transform: translateY(-5px);
|
50 |
+
box-shadow: 0 10px 25px rgba(99, 102, 241, 0.2);
|
51 |
+
}
|
52 |
+
|
53 |
+
.terminal-output {
|
54 |
+
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
|
55 |
+
background: rgba(15, 23, 42, 0.9);
|
56 |
+
border-radius: 0.5rem;
|
57 |
+
}
|
58 |
+
|
59 |
+
.atom-pulse {
|
60 |
+
animation: pulse-slow 2s infinite;
|
61 |
+
}
|
62 |
+
|
63 |
+
.glow-border {
|
64 |
+
box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
|
65 |
+
}
|
66 |
+
|
67 |
+
.progress-bar {
|
68 |
+
height: 4px;
|
69 |
+
background: linear-gradient(90deg, #6366f1, #8b5cf6);
|
70 |
+
animation: progress-animation 2s infinite linear;
|
71 |
+
background-size: 200% 100%;
|
72 |
+
}
|
73 |
+
|
74 |
+
@keyframes progress-animation {
|
75 |
+
0% { background-position: 100% 0; }
|
76 |
+
100% { background-position: -100% 0; }
|
77 |
+
}
|
78 |
+
|
79 |
+
.orbital-animation {
|
80 |
+
animation: float 8s ease-in-out infinite;
|
81 |
+
}
|
82 |
+
|
83 |
+
.orbital-animation:nth-child(2) {
|
84 |
+
animation-delay: 1s;
|
85 |
+
}
|
86 |
+
|
87 |
+
.orbital-animation:nth-child(3) {
|
88 |
+
animation-delay: 2s;
|
89 |
+
}
|
90 |
+
</style>
|
91 |
+
</head>
|
92 |
+
<body class="min-h-screen py-8 px-4 sm:px-6 lg:px-8">
|
93 |
+
<div class="max-w-6xl mx-auto">
|
94 |
+
<!-- 页眉 -->
|
95 |
+
<header class="text-center mb-12">
|
96 |
+
<div class="flex items-center justify-center mb-4">
|
97 |
+
<div class="w-12 h-12 rounded-full bg-gradient-to-r from-primary to-secondary flex items-center justify-center mr-3">
|
98 |
+
<i class="fas fa-atom text-white text-xl"></i>
|
99 |
+
</div>
|
100 |
+
<h1 class="text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-primary to-accent">DFT Agent</h1>
|
101 |
+
</div>
|
102 |
+
<p class="text-lg text-slate-600 max-w-2xl mx-auto">
|
103 |
+
密度泛函理论计算平台 - 输入分子结构,实时获取DFT计算结果
|
104 |
+
</p>
|
105 |
+
</header>
|
106 |
+
|
107 |
+
<!-- 主内容区 -->
|
108 |
+
<main class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
109 |
+
<!-- 输入区域 -->
|
110 |
+
<div class="lg:col-span-1">
|
111 |
+
<div class="bg-white rounded-2xl p-6 molecule-card">
|
112 |
+
<h2 class="text-xl font-semibold text-slate-800 mb-4 flex items-center">
|
113 |
+
<i class="fas fa-keyboard mr-2 text-secondary"></i>计算输入
|
114 |
+
</h2>
|
115 |
+
|
116 |
+
<div class="mb-6">
|
117 |
+
<label class="block text-sm font-medium text-slate-700 mb-2">输入分子结构</label>
|
118 |
+
<div class="relative">
|
119 |
+
<input
|
120 |
+
type="text"
|
121 |
+
id="molecule-input"
|
122 |
+
placeholder="例如: 计算LiNa的能量"
|
123 |
+
class="w-full px-4 py-3 border border-slate-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent transition"
|
124 |
+
>
|
125 |
+
<button
|
126 |
+
id="calculate-btn"
|
127 |
+
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"
|
128 |
+
>
|
129 |
+
计算
|
130 |
+
</button>
|
131 |
+
</div>
|
132 |
+
</div>
|
133 |
+
|
134 |
+
<div class="mt-8">
|
135 |
+
<h3 class="text-lg font-medium text-slate-800 mb-3 flex items-center">
|
136 |
+
<i class="fas fa-history mr-2 text-secondary"></i>最近计算
|
137 |
+
</h3>
|
138 |
+
<ul class="space-y-2">
|
139 |
+
<li class="flex items-center justify-between bg-slate-50 p-3 rounded-lg">
|
140 |
+
<span class="text-slate-700">H₂O</span>
|
141 |
+
<span class="text-sm text-slate-500">-76.42 eV</span>
|
142 |
+
</li>
|
143 |
+
<li class="flex items-center justify-between bg-slate-50 p-3 rounded-lg">
|
144 |
+
<span class="text-slate-700">CO₂</span>
|
145 |
+
<span class="text-sm text-slate-500">-187.65 eV</span>
|
146 |
+
</li>
|
147 |
+
<li class="flex items-center justify-between bg-slate-50 p-3 rounded-lg">
|
148 |
+
<span class="text-slate-700">CH₄</span>
|
149 |
+
<span class="text-sm text-slate-500">-40.52 eV</span>
|
150 |
+
</li>
|
151 |
+
</ul>
|
152 |
+
</div>
|
153 |
+
</div>
|
154 |
+
|
155 |
+
<div class="bg-white rounded-2xl p-6 molecule-card mt-8">
|
156 |
+
<h2 class="text-xl font-semibold text-slate-800 mb-4 flex items-center">
|
157 |
+
<i class="fas fa-info-circle mr-2 text-secondary"></i>DFT计算说明
|
158 |
+
</h2>
|
159 |
+
<p class="text-slate-600 mb-3">
|
160 |
+
密度泛函理论(DFT)是一种量子力学计算方法,用于研究多电子体系的电子结构。
|
161 |
+
</p>
|
162 |
+
<ul class="text-slate-600 space-y-2">
|
163 |
+
<li class="flex items-start">
|
164 |
+
<i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
|
165 |
+
<span>输入分子式(如H₂O, CO₂)</span>
|
166 |
+
</li>
|
167 |
+
<li class="flex items-start">
|
168 |
+
<i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
|
169 |
+
<span>系统自动生成分子结构</span>
|
170 |
+
</li>
|
171 |
+
<li class="flex items-start">
|
172 |
+
<i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
|
173 |
+
<span>实时显示计算过程</span>
|
174 |
+
</li>
|
175 |
+
<li class="flex items-start">
|
176 |
+
<i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
|
177 |
+
<span>获取HOMO/LUMO轨道可视化</span>
|
178 |
+
</li>
|
179 |
+
</ul>
|
180 |
+
</div>
|
181 |
+
</div>
|
182 |
+
|
183 |
+
<!-- 输出区域 -->
|
184 |
+
<div class="lg:col-span-2">
|
185 |
+
<div class="bg-white rounded-2xl p-6 molecule-card">
|
186 |
+
<h2 class="text-xl font-semibold text-slate-800 mb-4 flex items-center">
|
187 |
+
<i class="fas fa-microchip mr-2 text-secondary"></i>计算过程
|
188 |
+
</h2>
|
189 |
+
|
190 |
+
<div id="calculation-status" class="mb-6">
|
191 |
+
<div class="flex items-center mb-2">
|
192 |
+
<div class="w-6 h-6 rounded-full bg-primary flex items-center justify-center mr-2">
|
193 |
+
<i class="fas fa-play text-white text-xs"></i>
|
194 |
+
</div>
|
195 |
+
<span class="text-slate-800">准备开始计算...</span>
|
196 |
+
</div>
|
197 |
+
<div class="progress-bar w-full rounded-full"></div>
|
198 |
+
</div>
|
199 |
+
|
200 |
+
<div class="terminal-output p-4 rounded-lg mb-6">
|
201 |
+
<div id="terminal-content" class="text-green-400 text-sm h-64 overflow-y-auto">
|
202 |
+
<div>> DFT Agent 已就绪</div>
|
203 |
+
<div>> 等待用户输入...</div>
|
204 |
+
</div>
|
205 |
+
</div>
|
206 |
+
|
207 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
|
208 |
+
<div class="bg-slate-50 rounded-lg p-4">
|
209 |
+
<h3 class="font-medium text-slate-700 mb-2 flex items-center">
|
210 |
+
<i class="fas fa-cube mr-2 text-secondary"></i>分子结构
|
211 |
+
</h3>
|
212 |
+
<div id="molecule-structure" class="flex items-center justify-center h-48">
|
213 |
+
<div class="text-center text-slate-400">
|
214 |
+
<i class="fas fa-molecule text-4xl mb-2"></i>
|
215 |
+
<p>等待分子结构数据...</p>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
+
</div>
|
219 |
+
|
220 |
+
<div class="bg-slate-50 rounded-lg p-4">
|
221 |
+
<h3 class="font-medium text-slate-700 mb-2 flex items-center">
|
222 |
+
<i class="fas fa-bolt mr-2 text-secondary"></i>能量信息
|
223 |
+
</h3>
|
224 |
+
<div id="energy-info" class="h-48 flex items-center justify-center">
|
225 |
+
<div class="text-center text-slate-400">
|
226 |
+
<i class="fas fa-battery-quarter text-4xl mb-2"></i>
|
227 |
+
<p>计算完成后显示能量数据</p>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
</div>
|
231 |
+
</div>
|
232 |
+
|
233 |
+
<div class="mb-6">
|
234 |
+
<h3 class="font-medium text-slate-700 mb-3 flex items-center">
|
235 |
+
<i class="fas fa-orbit mr-2 text-secondary"></i>分子轨道
|
236 |
+
</h3>
|
237 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
238 |
+
<div class="bg-slate-50 rounded-lg p-4">
|
239 |
+
<h4 class="text-sm font-medium text-slate-600 mb-2">HOMO (最高占据分子轨道)</h4>
|
240 |
+
<div id="homo-orbital" class="flex items-center justify-center h-40">
|
241 |
+
<div class="text-center text-slate-400">
|
242 |
+
<i class="fas fa-circle-notch text-3xl mb-2 orbital-animation"></i>
|
243 |
+
<p class="text-sm">计算中...</p>
|
244 |
+
</div>
|
245 |
+
</div>
|
246 |
+
</div>
|
247 |
+
<div class="bg-slate-50 rounded-lg p-4">
|
248 |
+
<h4 class="text-sm font-medium text-slate-600 mb-2">LUMO (最低未占分子轨道)</h4>
|
249 |
+
<div id="lumo-orbital" class="flex items-center justify-center h-40">
|
250 |
+
<div class="text-center text-slate-400">
|
251 |
+
<i class="fas fa-circle-notch text-3xl mb-2 orbital-animation" style="animation-delay: 0.5s"></i>
|
252 |
+
<p class="text-sm">计算中...</p>
|
253 |
+
</div>
|
254 |
+
</div>
|
255 |
+
</div>
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
|
259 |
+
<div class="flex justify-end">
|
260 |
+
<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">
|
261 |
+
<i class="fas fa-download mr-2"></i>导出结果
|
262 |
+
</button>
|
263 |
+
</div>
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
+
</main>
|
267 |
+
|
268 |
+
<!-- 页脚 -->
|
269 |
+
<footer class="mt-12 text-center text-slate-500 text-sm">
|
270 |
+
<p>DFT Agent - 密度泛函理论计算平台 © 2023 | 量子化学计算工具</p>
|
271 |
+
<p class="mt-1">本系统仅用于科研和教育目的</p>
|
272 |
+
</footer>
|
273 |
+
</div>
|
274 |
+
|
275 |
+
<script>
|
276 |
+
document.addEventListener('DOMContentLoaded', function() {
|
277 |
+
const moleculeInput = document.getElementById('molecule-input');
|
278 |
+
const calculateBtn = document.getElementById('calculate-btn');
|
279 |
+
const terminalContent = document.getElementById('terminal-content');
|
280 |
+
const moleculeStructure = document.getElementById('molecule-structure');
|
281 |
+
const energyInfo = document.getElementById('energy-info');
|
282 |
+
const homoOrbital = document.getElementById('homo-orbital');
|
283 |
+
const lumoOrbital = document.getElementById('lumo-orbital');
|
284 |
+
|
285 |
+
// 模拟分子结构图
|
286 |
+
const moleculeImages = {
|
287 |
+
'LiNa': '<div class="text-center"><div class="relative mx-auto w-32 h-32"><div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-16 h-16 rounded-full bg-blue-500 flex items-center justify-center text-white font-bold">Li</div><div class="absolute top-1/2 right-1/4 transform -translate-y-1/2 w-20 h-20 rounded-full bg-purple-500 flex items-center justify-center text-white font-bold">Na</div><div class="absolute inset-0 flex items-center justify-center"><div class="w-full h-1 bg-slate-300"></div></div></div><p class="mt-2 text-slate-700">Li-Na 分子结构</p></div>',
|
288 |
+
'H2O': '<div class="text-center"><div class="relative mx-auto w-32 h-32"><div class="absolute top-1/4 left-1/2 transform -translate-x-1/2 w-12 h-12 rounded-full bg-red-500 flex items-center justify-center text-white font-bold">O</div><div class="absolute bottom-1/4 left-1/4 w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center text-white font-bold">H</div><div class="absolute bottom-1/4 right-1/4 w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center text-white font-bold">H</div><div class="absolute inset-0 flex items-center justify-center"><div class="w-1/2 h-1 bg-slate-300 transform rotate-45 origin-bottom"></div><div class="w-1/2 h-1 bg-slate-300 transform -rotate-45 origin-bottom"></div></div></div><p class="mt-2 text-slate-700">H₂O 分子结构</p></div>',
|
289 |
+
'default': '<div class="text-center"><div class="relative mx-auto w-32 h-32"><div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-20 h-20 rounded-full bg-gradient-to-r from-blue-500 to-purple-500 flex items-center justify-center text-white font-bold">M</div></div><p class="mt-2 text-slate-700">分子结构图</p></div>'
|
290 |
+
};
|
291 |
+
|
292 |
+
// 模拟能量数据
|
293 |
+
const energyData = {
|
294 |
+
'LiNa': {
|
295 |
+
total: '-5.42 eV',
|
296 |
+
fermi: '-2.15 eV',
|
297 |
+
homo: '-3.78 eV',
|
298 |
+
lumo: '-1.25 eV'
|
299 |
+
},
|
300 |
+
'H2O': {
|
301 |
+
total: '-76.42 eV',
|
302 |
+
fermi: '-7.18 eV',
|
303 |
+
homo: '-9.25 eV',
|
304 |
+
lumo: '-0.87 eV'
|
305 |
+
},
|
306 |
+
'default': {
|
307 |
+
total: '-0.00 eV',
|
308 |
+
fermi: '-0.00 eV',
|
309 |
+
homo: '-0.00 eV',
|
310 |
+
lumo: '-0.00 eV'
|
311 |
+
}
|
312 |
+
};
|
313 |
+
|
314 |
+
// 模拟轨道图
|
315 |
+
const orbitalImages = {
|
316 |
+
'homo': '<div class="text-center"><div class="relative mx-auto w-32 h-32"><div class="absolute inset-0 rounded-full border-4 border-green-500 opacity-70"></div><div class="absolute inset-8 rounded-full border-4 border-green-500 opacity-50"></div><div class="absolute inset-16 rounded-full border-4 border-green-500 opacity-30"></div><div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-green-500"></div></div><p class="mt-2 text-slate-700">HOMO 轨道</p></div>',
|
317 |
+
'lumo': '<div class="text-center"><div class="relative mx-auto w-32 h-32"><div class="absolute inset-0 rounded-full border-4 border-blue-500 opacity-70 transform rotate-45"></div><div class="absolute inset-8 rounded-full border-4 border-blue-500 opacity-50 transform rotate-45"></div><div class="absolute inset-16 rounded-full border-4 border-blue-500 opacity-30 transform rotate-45"></div><div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-4 h-4 rounded-full bg-blue-500"></div></div><p class="mt-2 text-slate-700">LUMO 轨道</p></div>'
|
318 |
+
};
|
319 |
+
|
320 |
+
// 添加终端输出
|
321 |
+
function addTerminalOutput(message) {
|
322 |
+
const newLine = document.createElement('div');
|
323 |
+
newLine.textContent = '> ' + message;
|
324 |
+
newLine.className = 'terminal-line';
|
325 |
+
terminalContent.appendChild(newLine);
|
326 |
+
terminalContent.scrollTop = terminalContent.scrollHeight;
|
327 |
+
}
|
328 |
+
|
329 |
+
// 模拟计算过程
|
330 |
+
function simulateCalculation(molecule) {
|
331 |
+
// 重置显示
|
332 |
+
moleculeStructure.innerHTML = '<div class="text-center text-slate-400"><i class="fas fa-spinner fa-spin text-3xl mb-2"></i><p>生成分子结构...</p></div>';
|
333 |
+
energyInfo.innerHTML = '<div class="text-center text-slate-400"><i class="fas fa-spinner fa-spin text-3xl mb-2"></i><p>计算能量数据...</p></div>';
|
334 |
+
homoOrbital.innerHTML = '<div class="text-center text-slate-400"><i class="fas fa-spinner fa-spin text-3xl mb-2"></i><p>计算HOMO轨道...</p></div>';
|
335 |
+
lumoOrbital.innerHTML = '<div class="text-center text-slate-400"><i class="fas fa-spinner fa-spin text-3xl mb-2"></i><p>计算LUMO轨道...</p></div>';
|
336 |
+
|
337 |
+
// 清空终端
|
338 |
+
terminalContent.innerHTML = '';
|
339 |
+
|
340 |
+
// 开始模拟计算过程
|
341 |
+
addTerminalOutput(`开始计算: ${molecule}`);
|
342 |
+
|
343 |
+
setTimeout(() => {
|
344 |
+
addTerminalOutput('��析分子式...');
|
345 |
+
addTerminalOutput('生成初始几何结构...');
|
346 |
+
|
347 |
+
// 显示分子结构
|
348 |
+
setTimeout(() => {
|
349 |
+
moleculeStructure.innerHTML = moleculeImages[molecule] || moleculeImages['default'];
|
350 |
+
addTerminalOutput('分子结构生成完成');
|
351 |
+
}, 1500);
|
352 |
+
|
353 |
+
setTimeout(() => {
|
354 |
+
addTerminalOutput('初始化DFT计算参数...');
|
355 |
+
addTerminalOutput('使用PBE交换关联泛函');
|
356 |
+
addTerminalOutput('设置截断能量: 500 eV');
|
357 |
+
}, 3000);
|
358 |
+
|
359 |
+
setTimeout(() => {
|
360 |
+
addTerminalOutput('开始自洽场迭代...');
|
361 |
+
|
362 |
+
// 模拟迭代过程
|
363 |
+
for (let i = 1; i <= 5; i++) {
|
364 |
+
setTimeout(() => {
|
365 |
+
addTerminalOutput(`SCF迭代 ${i}: 能量变化 = ${(0.05 - i*0.01).toFixed(4)} eV`);
|
366 |
+
}, 3000 + i*1000);
|
367 |
+
}
|
368 |
+
}, 5000);
|
369 |
+
|
370 |
+
setTimeout(() => {
|
371 |
+
addTerminalOutput('自洽场收敛完成');
|
372 |
+
addTerminalOutput('计算总能...');
|
373 |
+
|
374 |
+
// 显示能量信息
|
375 |
+
const energy = energyData[molecule] || energyData['default'];
|
376 |
+
energyInfo.innerHTML = `
|
377 |
+
<div class="space-y-2">
|
378 |
+
<div class="flex justify-between">
|
379 |
+
<span class="text-slate-600">总能量:</span>
|
380 |
+
<span class="font-medium">${energy.total}</span>
|
381 |
+
</div>
|
382 |
+
<div class="flex justify-between">
|
383 |
+
<span class="text-slate-600">费米能级:</span>
|
384 |
+
<span class="font-medium">${energy.fermi}</span>
|
385 |
+
</div>
|
386 |
+
<div class="flex justify-between">
|
387 |
+
<span class="text-slate-600">HOMO能量:</span>
|
388 |
+
<span class="font-medium">${energy.homo}</span>
|
389 |
+
</div>
|
390 |
+
<div class="flex justify-between">
|
391 |
+
<span class="text-slate-600">LUMO能量:</span>
|
392 |
+
<span class="font-medium">${energy.lumo}</span>
|
393 |
+
</div>
|
394 |
+
<div class="mt-4 pt-2 border-t border-slate-200">
|
395 |
+
<span class="text-sm text-slate-500">带隙: ${(parseFloat(energy.lumo) - parseFloat(energy.homo)).toFixed(2)} eV</span>
|
396 |
+
</div>
|
397 |
+
</div>
|
398 |
+
`;
|
399 |
+
|
400 |
+
addTerminalOutput('计算分子轨道...');
|
401 |
+
}, 10000);
|
402 |
+
|
403 |
+
setTimeout(() => {
|
404 |
+
addTerminalOutput('可视化HOMO/LUMO轨道...');
|
405 |
+
|
406 |
+
// 显示轨道图
|
407 |
+
homoOrbital.innerHTML = orbitalImages['homo'];
|
408 |
+
lumoOrbital.innerHTML = orbitalImages['lumo'];
|
409 |
+
|
410 |
+
addTerminalOutput('计算完成!');
|
411 |
+
}, 12000);
|
412 |
+
}, 500);
|
413 |
+
}
|
414 |
+
|
415 |
+
// 计算按钮事件
|
416 |
+
calculateBtn.addEventListener('click', function() {
|
417 |
+
const molecule = moleculeInput.value.trim();
|
418 |
+
if (!molecule) {
|
419 |
+
alert('请输入分子式');
|
420 |
+
return;
|
421 |
+
}
|
422 |
+
|
423 |
+
// 简单提取分子式
|
424 |
+
let mol = 'default';
|
425 |
+
if (molecule.includes('LiNa') || molecule.includes('lina')) mol = 'LiNa';
|
426 |
+
if (molecule.includes('H2O') || molecule.includes('水') || molecule.includes('water')) mol = 'H2O';
|
427 |
+
|
428 |
+
simulateCalculation(mol);
|
429 |
+
});
|
430 |
+
|
431 |
+
// 示例:模拟输入
|
432 |
+
moleculeInput.value = '计算LiNa的能量';
|
433 |
+
});
|
434 |
+
</script>
|
435 |
+
<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>
|
436 |
+
</html>
|