-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
249 lines (219 loc) · 8.33 KB
/
Copy pathindex.html
File metadata and controls
249 lines (219 loc) · 8.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PUNCH-X - GAMESS Data Extraction Suite</title>
<style>
:root {
--bg-color: #0a0e14;
--card-bg: #151d27;
--accent-cyan: #00f2ff;
--accent-pink: #ff007a;
--text-color: #e0e6ed;
--border-color: #2c3e50;
}
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background-image: radial-gradient(circle at 2px 2px, rgba(0, 242, 255, 0.05) 1px, transparent 0);
background-size: 40px 40px;
}
.card {
background: var(--card-bg);
width: 500px;
padding: 40px;
border-radius: 20px;
box-shadow: 0 0 30px rgba(0, 0, 0, 0.5), 0 0 2px var(--accent-cyan);
border: 1px solid var(--border-color);
position: relative;
}
h1 {
text-align: center;
font-size: 2.5em;
letter-spacing: 6px;
margin: 0;
color: var(--accent-cyan);
text-transform: uppercase;
text-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}
.subtitle {
text-align: center;
font-size: 0.8em;
color: #888;
margin-bottom: 30px;
letter-spacing: 2px;
}
/* ドロップ領域を明確に限定 */
.file-box {
border: 2px dashed var(--border-color);
padding: 40px 20px;
border-radius: 12px;
margin-bottom: 30px;
background: rgba(255, 255, 255, 0.02);
transition: 0.3s;
text-align: center;
cursor: pointer;
z-index: 10; /* ボタンより前面に置かない */
}
.file-box.dragover {
border-color: var(--accent-cyan);
background: rgba(0, 242, 255, 0.1);
box-shadow: inset 0 0 15px rgba(0, 242, 255, 0.2);
}
.file-box p { margin: 0; font-size: 0.9em; color: #aaa; pointer-events: none; }
#file-name-display {
margin-top: 10px;
color: var(--accent-cyan);
font-weight: bold;
font-size: 0.85em;
word-break: break-all;
pointer-events: none;
}
#fileInput { display: none; }
/* ボタンエリアを完全に分離 */
.btn-group {
display: flex;
gap: 20px;
position: relative;
z-index: 20;
}
button {
flex: 1;
padding: 15px;
cursor: pointer;
border: none;
border-radius: 8px;
font-weight: bold;
text-transform: uppercase;
transition: 0.3s;
background: transparent;
pointer-events: auto; /* ボタン単体で確実にイベントを拾う */
}
.btn-vec { border: 1px solid var(--accent-cyan); color: var(--accent-cyan); }
.btn-vec:hover { background: var(--accent-cyan); color: var(--bg-color); box-shadow: 0 0 20px rgba(0, 242, 255, 0.4); }
.btn-hess { border: 1px solid var(--accent-pink); color: var(--accent-pink); }
.btn-hess:hover { background: var(--accent-pink); color: var(--text-color); box-shadow: 0 0 20px rgba(255, 0, 122, 0.4); }
#status {
margin-top: 25px;
text-align: center;
font-family: 'Courier New', monospace;
font-size: 0.8em;
color: var(--accent-cyan);
text-transform: uppercase;
}
</style>
</head>
<body>
<div class="card">
<h1>PUNCH-X</h1>
<div class="subtitle">GAMESS Data Extraction Suite</div>
<div class="file-box" id="drop-zone" onclick="document.getElementById('fileInput').click()">
<p>Click or Drop PUNCH/Output file here</p>
<div id="file-name-display">NO_FILE_SELECTED</div>
<input type="file" id="fileInput">
</div>
<div class="btn-group">
<button class="btn-vec" onclick="process('VEC')">Extract VEC</button>
<button class="btn-hess" onclick="process('HESS')">Extract HESS</button>
</div>
<div id="status">System: Ready</div>
</div>
<script>
const dropZone = document.getElementById('drop-zone');
const fileInput = document.getElementById('fileInput');
const fileNameDisplay = document.getElementById('file-name-display');
const status = document.getElementById('status');
let selectedFile = null;
function handleFiles(files) {
if (files.length > 0) {
selectedFile = files[0];
fileNameDisplay.innerText = "SELECTED: " + selectedFile.name;
status.innerText = "File loaded. Ready to extract.";
}
}
// ドロップ領域外でのブラウザのデフォルト挙動(ファイルを開く)を抑制
window.addEventListener('dragover', (e) => e.preventDefault(), false);
window.addEventListener('drop', (e) => e.preventDefault(), false);
// ドロップ領域内のみでのイベント
dropZone.addEventListener('dragover', (e) => {
e.stopPropagation(); // イベントの拡散を止める
e.preventDefault();
dropZone.classList.add('dragover');
});
dropZone.addEventListener('dragleave', (e) => {
e.stopPropagation();
dropZone.classList.remove('dragover');
});
dropZone.addEventListener('drop', (e) => {
e.stopPropagation();
e.preventDefault();
dropZone.classList.remove('dragover');
handleFiles(e.dataTransfer.files);
});
fileInput.addEventListener('change', (e) => {
handleFiles(e.target.files);
});
// --- Core Logic (Unchanged) ---
async function process(type) {
if (!selectedFile) {
alert("Please select or drop a file first.");
return;
}
const text = await selectedFile.text();
const lines = text.split(/\r?\n/);
let finalnum = -1;
const searchWord = "$" + type;
for (let i = 0; i < lines.length; i++) {
if (lines[i].includes(searchWord)) finalnum = i;
}
if (finalnum !== -1) {
status.innerText = "STATUS: PROCESSING_" + type + "...";
if (type === 'VEC') extractVEC(selectedFile.name, lines, finalnum);
else extractHESS(selectedFile.name, lines, finalnum);
status.innerText = "STATUS: " + type + "_SUCCESS";
} else {
alert("Error: " + searchWord + " not found.");
status.innerText = "STATUS: ERROR_NOT_FOUND";
}
}
function extractVEC(fileName, lines, finalnum) {
let headerContent = "";
const startIdx = Math.max(0, finalnum - 3);
for (let i = startIdx; i < finalnum; i++) headerContent += lines[i] + "\n";
let result = "##### INFORMATION ##############################################################\n.....\n"
+ headerContent + "################################################################################\n\n";
for (let i = finalnum; i < lines.length; i++) {
if (lines[i].includes("POPULATION ANALYSIS")) break;
result += lines[i] + "\n";
}
download(fileName.replace(/\.[^/.]+$/, "") + "_vec.txt", result);
}
function extractHESS(fileName, lines, finalnum) {
let result = "";
if (finalnum > 0 && lines[finalnum - 1].includes("CAUTION, APPROXIMATE HESSIAN!")) {
result += "!Caution, Approximate Hessian\n\n";
alert("CAUTION: Approximate Hessian detected!");
}
for (let i = finalnum; i < lines.length; i++) {
if (lines[i].trim() === "$END") break;
result += lines[i] + "\n";
}
result += " $END\n";
download(fileName.replace(/\.[^/.]+$/, "") + "_hess.txt", result);
}
function download(name, content) {
const blob = new Blob([content], { type: 'text/plain' });
const a = document.createElement("a");
a.href = URL.createObjectURL(blob);
a.download = name;
a.click();
}
</script>
</body>
</html>