Skip to content

Download DMRG scripts from ALPSim/ALPS instead of vendoring them - #140

Open
marcusr2ML wants to merge 1 commit into
ALPSim:mainfrom
marcusr2ML:feat/dmrg-source-downloads
Open

Download DMRG scripts from ALPSim/ALPS instead of vendoring them#140
marcusr2ML wants to merge 1 commit into
ALPSim:mainfrom
marcusr2ML:feat/dmrg-source-downloads

Conversation

@marcusr2ML

Copy link
Copy Markdown
Collaborator

Brings the DMRG series in line with the DMFT and MCS tutorials: the scripts are fetched from ALPSim/ALPS instead of being copied into this repo.

What changed

  • The 26 download links in dmrg03dmrg06 now point at raw.githubusercontent.com/ALPSim/ALPS/master/tutorials/... and use the shared alps-download.js handler, so a click saves the file instead of navigating the reader to GitHub.
  • The 27 vendored copies under content/en/tutorials/dmrg/codes/ are removed.
  • Adds assets/js/alps-download.js and wires it up in layouts/baseof.html.

Tracking master rather than a pinned commit means the tutorials always serve the current source. The trade-off is deliberate: if a file is renamed upstream the link 404s instead of silently serving a stale snapshot, which is the failure mode you want to hear about.

Verification

  • All 27 vendored files were byte-identical to their master counterparts before removal, so readers get exactly the same bytes from the canonical source.
  • All 26 new URLs confirmed to return 200 on master.
  • Nothing else in the repo referenced dmrg/codes/.
  • Clean hugo --gc --minify --cleanDestinationDir build: 26 anchors render (dmrg03: 10, dmrg04: 5, dmrg05: 7, dmrg06: 4), no stale codes/ output.

Scope: English only

The Japanese and Chinese DMRG pages are deliberately untouched, and they need a separate content pass rather than a URL rewrite.

They are already broken on the live site: 9 of their 23 link targets point at tutorials/dmrg-01-dmrg/... on master, which no longer exists after the upstream folder rename, so those are live 404s today. The remaining 14 are pinned to bd842d1 and still resolve, but serve pre-rename content.

Remapping the URLs would not be enough for DMRG-05. The English page is 293 lines across 17 sections after the restructure; the translations are 127 lines across 8, and still walk the reader through spin_one and spin_one.py, which the English version no longer uses at all — it uses spin_one_uniform, spin_one_capped, and build_lattice.py. Pointing those links at the new files would leave the prose describing one file while the button downloads another.

DMRG-03/04/06 match the English structure and name the same files, so those would remap cleanly whenever the translation pass happens.

Note for merging

Two other open PRs (#138 MCS, #139 DMFT) add the same assets/js/alps-download.js and the same layouts/baseof.html block. Whichever merges first will make the other two conflict on those two files — identical content, so resolution is trivial, but it will come up.

🤖 Generated with Claude Code

@marcusr2ML
marcusr2ML requested a review from Ooolab August 12, 2026 18:31
@marcusr2ML

Copy link
Copy Markdown
Collaborator Author

@Ooolab Same deal as before. I just wanted to give you a heads up that the en DMRG-05 is much different than the translations as of now. It needed a lot of work over the weekend.

@egull egull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this much better than the previous solution, but @Ooolab should also weigh in (and possibly @afeiguin who has the final say over all things DMRG)

@marcusr2ML

Copy link
Copy Markdown
Collaborator Author

@egull I'll wait for Fei. I'll add Adrian as a reviewer, but might merge if we are waiting too long for a follow up.

Also, I simply made Claude do the updates. I think it duplciated the JS I gave it. Will clean up today.

@marcusr2ML
marcusr2ML requested a review from afeiguin August 13, 2026 14:58
The DMRG tutorials served 27 copies of the ALPS tutorial files out of
content/en/tutorials/dmrg/codes/. Point the 26 download links at
ALPSim/ALPS master over raw.githubusercontent.com and drop the copies,
matching the DMFT and MCS series.

All 27 vendored files were byte-identical to their master counterparts
before removal, and all 26 new URLs were confirmed to return 200, so
readers get the same bytes from the canonical source.

English only. The Japanese and Chinese DMRG pages are left untouched
for now: DMRG-05 has drifted badly (English is 293 lines across 17
sections after the restructure, the translations 127 lines across 8),
and the translated text still walks the reader through spin_one and
spin_one.py, which the English version no longer uses at all. Remapping
those links would leave the prose describing one file and the button
downloading another, so the translations need a content pass first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@marcusr2ML
marcusr2ML force-pushed the feat/dmrg-source-downloads branch from 95af54c to 54e5ec0 Compare August 13, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants