Commit b3c3830
committed
feat(mta): NNPot-style link atom replacement (correct ONIOM approach)
Replicate the NNPot algorithm for link atoms: boundary MM atoms are
included in the metatomic atom set and their positions/types are
REPLACED with link atoms each step. This is fundamentally different
from the previous broken approach that APPENDED link atoms as extra
atoms, causing the ML model to see chemically nonsensical fragments.
Algorithm:
1. Preprocessing: buildLinkFrontier() finds boundary bonds, then
boundary MM atom indices are added to mtaIndices_
2. Per-step: gatherAtomPositions() gathers boundary MM positions.
Then positions are replaced with link atom positions and atomic
numbers overwritten with H (Z=1)
3. Model evaluation: the model sees ML atoms + H caps (at boundary
MM slots), not ML atoms + extra random H atoms
4. Force redistribution: link atom forces are split between the
embedded ML atom and the real MM atom via spreadForce()
5. Force scatter: all forces (including redistributed) applied to
GROMACS atoms normally
No explicit E_MM(model) subtraction needed: topology surgery removes
internal ML terms, and the link atom replacement handles boundary
terms. This matches the NNPot ONIOM implementation.1 parent e45f75e commit b3c3830
2 files changed
Lines changed: 176 additions & 2 deletions
Lines changed: 81 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
| |||
486 | 489 | | |
487 | 490 | | |
488 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
489 | 502 | | |
490 | 503 | | |
491 | 504 | | |
| |||
1153 | 1166 | | |
1154 | 1167 | | |
1155 | 1168 | | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
1156 | 1205 | | |
1157 | 1206 | | |
1158 | 1207 | | |
| |||
1256 | 1305 | | |
1257 | 1306 | | |
1258 | 1307 | | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
1259 | 1336 | | |
1260 | 1337 | | |
1261 | 1338 | | |
| |||
1608 | 1685 | | |
1609 | 1686 | | |
1610 | 1687 | | |
1611 | | - | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
1612 | 1692 | | |
1613 | 1693 | | |
1614 | 1694 | | |
| |||
Lines changed: 95 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
295 | 360 | | |
296 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
297 | 365 | | |
298 | 366 | | |
299 | 367 | | |
| |||
309 | 377 | | |
310 | 378 | | |
311 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
312 | 392 | | |
313 | 393 | | |
314 | 394 | | |
| |||
332 | 412 | | |
333 | 413 | | |
334 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
335 | 429 | | |
336 | 430 | | |
337 | 431 | | |
| |||
0 commit comments