# -*- coding: utf-8 -*-
"""Round 255: batch add 5 Physics PhD (fifth tier)
- Georgia Tech Physics PhD (Jan 3 deadline; GRE General NOT required; GRE Physics Subject NOT required; no BS in Physics needed; research areas astrophysics/AMO/condensed matter/nonlinear/soft matter/computational/physics of living systems)
- Dartmouth Physics and Astronomy PhD (Dec 1, 2026; $150 fee; GRE General + Physics Subject optional; 3 LOR up to 4; admits 8-10 new PhD/year, ~50 total grad students; 17 full-time faculty + 12 research/adjunct)
- Emory Physics PhD (Dec 18, 2026; GRE General NOT required; TOEFL optional; Physics Subject optional; ETS 5187 no dept code; stipend $43,260/12mo + full tuition + SHIP + conference travel; 8 courses 4 core + 4 elective; candidacy by Sept 15 of Year 4; GPA 2.70)
- Washington University St Louis Physics PhD (Arts & Sciences unified early-December deadline; 36 units; 5-year; GPA 3.0; first 2 years 4 semesters grad courses; oral exam end of Year 2; 2 semesters mentored teaching; RAC by end Year 3; research condensed matter/2D materials/nanostructured/magnetism/superconductivity/high-pressure)
- UVA Physics PhD (Dec 15; GRE General NOT required; GRE PHYSICS SUBJECT REQUIRED - last holdout; TOEFL iBT 90 with subscore minima 22S/22W/23R/23L; ~105 grad students / 36 standing faculty; 11 dept-required courses (6 core + 5 elective) + 7 letter-graded + 18 research credits; qualifying exam in CM/E&M/QM/StatMech; funding through assistantships/fellowships; research at CERN/Fermilab/Oak Ridge/Jefferson Lab)
Key finding: fifth tier splits - GaTech/Dartmouth/Emory fully GRE-free; WashU Arts & Sciences unified (dept-specific GRE not listed); UVA is the last holdout still requiring Physics Subject.
"""
import os, re

BASE = os.path.dirname(os.path.abspath(__file__))
DET = os.path.join(BASE, "details")
os.makedirs(DET, exist_ok=True)

PROGRAMS = [
    {
        "id": "gatech-physics-phd",
        "s": "gatech",
        "n": "物理博士",
        "en": "PhD in Physics (Georgia Tech, College of Sciences, School of Physics; located in Atlanta, GA; offers three doctoral majors: Physics / Computational Science and Engineering / Quantitative Biosciences - this entry is Physics)",
        "deg": "PhD",
        "lvl": "d",
        "stem": 1,
        "dur": "Typically 5-6 years; program of study in core and advanced physics courses; RCR course; Comprehensive Exam (written Thesis Proposal + oral Proposal Exam); minor course of study; written PhD thesis and public defense; on-campus residential (Atlanta, GA); Fall admission primarily",
        "ddl": "Fall 2027: **Deadline January 3, 2027** per School of Physics graduate admissions FAQ. Application reviewed by School of Physics Graduate Committee after submission to Office of Graduate Education; review of applications at end of January; decision emails sent mid-February. Note: catalog lists three doctoral majors - Physics, Computational Science and Engineering, Quantitative Biosciences; this entry is Physics.",
        "lang": "TOEFL iBT / IELTS Academic required for non-native English speakers per Georgia Tech Graduate Education. ETS institution code for Georgia Tech. Unofficial transcripts accepted with application; official required upon admission.",
        "test": {"cls": "GRE GENERAL NOT REQUIRED; GRE PHYSICS SUBJECT NOT REQUIRED (Georgia Tech Physics: 'The GRE Physics Test is NOT REQUIRED for all applicants. The General GRE Test is NOT REQUIRED for all applicants.' Applies to both domestic and international applicants. No BS in Physics required, but background preparation expected. Official transcripts required; if not graduated, unofficial transcript showing Spring-term courses accepted.)"},
        "tui": "Georgia Tech Physics PhD students typically receive multi-year fully-funded support through a combination of Research Assistantships, Teaching Assistantships, and fellowships, including tuition, stipend, and health insurance. The School of Physics maintains research strengths in astrophysics, AMO, condensed matter, nonlinear physics, soft matter, computational physics, and physics of living systems.",
        "url": "details/gatech-physics-phd.html",
    },
    {
        "id": "dartmouth-physics-phd",
        "s": "dartmouth",
        "n": "物理与天文博士",
        "en": "PhD in Physics and Astronomy (Dartmouth College, Guarini School of Graduate and Advanced Studies, Department of Physics and Astronomy; located in Hanover, NH; admits 8-10 new PhD students per year, ~50 total grad students; 17 full-time faculty + 12 research/adjunct faculty; smallest Ivy League)",
        "deg": "PhD",
        "lvl": "d",
        "stem": 1,
        "dur": "Typically 5-6 years; rigorous core coursework (6 of 8 core courses for Physics students; 4 of 8 core + 4 astronomy courses for Astronomy students); departmental qualifying examination; thesis proposal and oral defense; at least two terms of Supervised Undergraduate Teaching; on-campus residential (Hanover, NH); Fall admission only; thesis proposal certification by end of fall term of fourth year",
        "ddl": "Fall 2027: **Deadline December 1, 2026**. Application fee $150 (fee waivers available). All materials submitted through online application system; no paper materials accepted. Select up to three faculty members in contact with or particularly interested in working with.",
        "lang": "TOEFL iBT / IELTS Academic required for non-native English speakers per Guarini School. ETS institution code for Dartmouth. Unofficial transcripts uploaded as part of application; official transcripts not needed during application process.",
        "test": {"cls": "GRE GENERAL OPTIONAL; GRE PHYSICS SUBJECT OPTIONAL (Dartmouth Guarini: 'GRE and physics GRE subject are optional.' 3 letters of recommendation required, up to 4 accepted; program supplement to indicate area of interest; unofficial transcripts; select up to three faculty.)"},
        "tui": "Dartmouth Physics and Astronomy PhD students typically receive multi-year fully-funded support through a combination of Research Assistantships, Teaching Assistantships, and Guarini School fellowships, including tuition, stipend, and health insurance. Smallest Ivy League department with close student-faculty interaction; admits only 8-10 new PhD students per year.",
        "url": "details/dartmouth-physics-phd.html",
    },
    {
        "id": "emory-physics-phd",
        "s": "emory",
        "n": "物理博士",
        "en": "PhD in Physics (Emory University, Laney Graduate School of Arts and Sciences, Department of Physics; located in Atlanta, GA; research strengths in biophysics, condensed matter and optics, soft matter physics; stipend $43,260 for 12 months)",
        "deg": "PhD",
        "lvl": "d",
        "stem": 1,
        "dur": "Typically 5-6 years; 8 courses total (4 core: PHYS 501 Quantum Mechanics, PHYS 502 Mathematical Methods I, plus electives; 4 electives); Qualifier Proposal submitted mid-November of second year (title + 300-word summary of problem/hypothesis/approach); candidacy by September 15 of Year 4; minimum 54 credit hours at 500-level or above; cumulative GPA minimum 2.70; dissertation; on-campus (Atlanta, GA); Fall admission primarily",
        "ddl": "Fall 2027: **Deadline December 18, 2026** per Department of Physics graduate program page (Laney Graduate School old listing January 8 is outdated). Application submitted through Laney Graduate School online application. Deadline 11:59 p.m. Eastern Time.",
        "lang": "TOEFL test optional for Fall 2027 per Department of Physics page; Laney Graduate School generally requires TOEFL/IELTS/DET for non-native English speakers. ETS institution code 5187 (no department code needed - used for GRE, GMAT, and TOEFL). Test scores valid 5 years for GRE; 2 years for TOEFL/IELTS/DET.",
        "test": {"cls": "GRE GENERAL NOT REQUIRED; GRE PHYSICS SUBJECT OPTIONAL (Emory Physics: 'For Fall 2027, the Graduate School application does not require the GRE General Test scores. The TOEFL test is optional. The Physics GRE Subject Test is optional.' ETS institution code 5187 no department code needed. Contact barbara.conner@emory.edu with application questions.)"},
        "tui": "Emory Physics: comprehensive funding package including a competitive stipend of $43,260 for 12 months plus full tuition coverage, Emory's student health insurance (SHIP), and conference travel support. Students gain first-hand teaching experience as instructors for undergraduate laboratory courses and work closely with faculty on research.",
        "url": "details/emory-physics-phd.html",
    },
    {
        "id": "wustl-physics-phd",
        "s": "wustl",
        "n": "物理博士",
        "en": "PhD in Physics (Washington University in St. Louis, Arts & Sciences, Department of Physics; located in St. Louis, MO; ~36 units total; 5-year typical; first two years four semesters graduate courses; oral exam end of Year 2; 2 semesters mentored teaching; RAC by end of Year 3; separate from Medical Physics PhD in School of Medicine)",
        "deg": "PhD",
        "lvl": "d",
        "stem": 1,
        "dur": "Typically 5 years; total units 36; maintain average grade at least B (3.0 GPA); first two years (four semesters) taking graduate courses (typically completes MA requirements by end of Year 2); oral examination at end of second year; two semesters of mentored teaching experience; Research Advisory Committee (RAC) created no later than end of third year; dissertation; on-campus residential (St. Louis, MO); Fall admission primarily (rare spring admission)",
        "ddl": "Fall 2027: Arts & Sciences Office of Graduate Studies sets a single application deadline for all doctoral programs each year, generally falling during the first week of December (per bulletin.wustl.edu/grad/artsci/admissions). Exact 2027 cycle date not explicitly listed on department page - applicants should verify on application page. Note: Medical Physics PhD is a separate program in the School of Medicine (CAMPEP-accredited, 70 credit units) - this entry is Arts & Sciences Physics, NOT Medical Physics.",
        "lang": "TOEFL iBT / IELTS Academic required for non-native English speakers per Arts & Sciences graduate school. ETS institution code for Washington University in St. Louis. Official scores required upon matriculation.",
        "test": {"cls": "GRE STATUS NOT EXPLICITLY LISTED ON DEPARTMENT BULLETIN (Arts & Sciences Office of Graduate Studies generally requires GRE-free admissions for most doctoral programs; applicants should verify on current Physics admissions page before applying). Degree requirements per bulletin: 36 units total; 5-year degree length; minimum 3.0 GPA; RAC by end Year 3; dissertation submitted at least 1 year before expected conferral or before beginning 8th semester of full-time enrollment."},
        "tui": "WashU Physics PhD students typically receive multi-year fully-funded support through a combination of Research Assistantships, Teaching Assistantships, and fellowships, including tuition, stipend, and health insurance. Department is a major participant in McDonnell Center for the Space Sciences, Institute of Materials Science & Engineering, and Center for Quantum Leaps. Research strengths in condensed matter, 2D atomic crystals, nanostructured materials, metallic glasses and liquids, magnetism, superconductivity, high-pressure physics.",
        "url": "details/wustl-physics-phd.html",
    },
    {
        "id": "uva-physics-phd",
        "s": "uva",
        "n": "物理博士",
        "en": "PhD in Physics (University of Virginia, College and Graduate School of Arts and Sciences, Department of Physics; located in Charlottesville, VA; ~105 graduate students / 36 standing faculty; strengths in high-energy particle, nuclear, quantum information, AMO, condensed matter, gravitational physics, medical physics; separate from Engineering Physics PhD in School of Engineering)",
        "deg": "PhD",
        "lvl": "d",
        "stem": 1,
        "dur": "Typically 5-6 years; unless advanced standing credit given, PhD candidates must pass 11 department-required courses (6 specified core courses + 5 departmental electives) plus 7 additional letter-graded courses and 18 credits that can include non-topical research; qualifying examination in classical mechanics, electricity and magnetism, quantum mechanics, and statistical mechanics; dissertation defended in oral examination; on-campus residential (Charlottesville, VA); Fall admission only",
        "ddl": "Fall 2027: **Deadline December 15, 2026** per Graduate School of Arts & Sciences deadlines page. Application portal opens October 1. Note: Engineering Physics PhD is a separate program in the School of Engineering and Applied Science - this entry is College of Arts & Sciences Physics, NOT Engineering Physics.",
        "lang": "TOEFL iBT minimum total 90 (sectional minimums: speaking 22, writing 22, reading 23, listening 23). IELTS Academic and Duolingo English Test also accepted per Graduate School. Test scores valid 2 years. GRE scores valid 5 years. Official scores not necessary for review process but required if matriculating.",
        "test": {"cls": "GRE GENERAL NOT REQUIRED; GRE PHYSICS SUBJECT REQUIRED (UVA Graduate School: 'Applicants to degree programs in Physics require a valid Physics GRE score; general GRE scores are not required. Applicants to degree programs in Economics, Sociology, and Statistics must record their GRE scores. Applicants to all other programs are not required to submit GRE scores.')"},
        "tui": "UVA Physics PhD students receive financial support through assistantships or fellowships. Dissertation research may be conducted within the department or at national and international laboratories such as CERN, Fermilab, Oak Ridge, and Jefferson Lab. Annual reviews ensure student progress; graduates go on to careers in academia, national labs, and industry. Program ~105 graduate students supported by 36 standing faculty plus strong network of emeritus professors, postdocs, visiting scholars, and staff.",
        "url": "details/uva-physics-phd.html",
    },
]

DETAIL_TEMPLATE = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{school} - {en}</title>
<style>
body{{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;max-width:960px;margin:24px auto;padding:0 20px;color:#222;line-height:1.6}}
h1{{font-size:24px;border-bottom:2px solid #1a73e8;padding-bottom:8px}}
h2{{font-size:18px;color:#1a73e8;margin-top:24px}}
.card{{background:#f8f9fa;border-left:4px solid #1a73e8;padding:12px 16px;margin:12px 0;border-radius:4px}}
.meta{{display:grid;grid-template-columns:120px 1fr;gap:6px 12px;font-size:14px}}
.meta b{{color:#555}}
ul{{margin:6px 0;padding-left:20px}}
.note{{background:#fff3cd;border-left-color:#ffc107;padding:10px 14px;margin-top:16px;font-size:13px}}
a{{color:#1a73e8}}
</style>
</head>
<body>
<h1>{school} - {en}</h1>
<div class="card">
<div class="meta">
<b>Degree</b><span>{deg}</span>
<b>Level</b><span>Research Doctorate (PhD)</span>
<b>STEM</b><span>{stem_label}</span>
<b>Duration</b><span>{dur}</span>
<b>Deadline</b><span>{ddl}</span>
<b>Language</b><span>{lang}</span>
<b>Standardized</b><span>{test_cls}</span>
<b>Funding</b><span>{tui}</span>
</div>
</div>

<h2>Program Overview</h2>
<div class="card">
{overview}
</div>

<h2>Admissions Requirements</h2>
<div class="card">
{requirements}
</div>

<h2>Research Areas</h2>
<div class="card">
{research}
</div>

<h2>Official Source</h2>
<div class="card">
{source}
</div>

<div class="note">
<strong>Note:</strong> Fifth batch of Physics PhD sweep (Georgia Tech, Dartmouth, Emory, WashU, UVA). Key finding: fifth tier splits - Georgia Tech, Dartmouth, and Emory are fully GRE-free; WashU Arts & Sciences unified deadline with dept-specific GRE not listed; UVA is the last holdout still requiring Physics Subject (General not required). Important distinctions: (1) Georgia Tech School of Physics lists three doctoral majors - Physics, Computational Science and Engineering, Quantitative Biosciences - this entry is Physics only. (2) Dartmouth Guarini Physics and Astronomy is the smallest Ivy League physics dept, admitting 8-10 new PhD per year; GRE General and Physics Subject both optional. (3) Emory Physics Dec 18, 2026 deadline supersedes Laney Graduate School old Jan 8 listing; stipend $43,260/12 months; candidacy by Sept 15 of Year 4 with minimum 54 credit hours at 500+ and 2.70 GPA. (4) WashU Physics in Arts & Sciences (36 units, 5-year, GPA 3.0) is NOT the same as WashU Medical Physics PhD in School of Medicine (CAMPEP-accredited, 70 units). (5) UVA Physics requires valid Physics GRE score per Graduate School policy; General GRE not required. UVA Engineering Physics PhD is separate program in School of Engineering.
</div>
</body>
</html>
"""

PAGES = {
    "gatech-physics-phd": {
        "school": "Georgia Tech, College of Sciences, School of Physics",
        "en": "PhD in Physics",
        "deg": "Doctor of Philosophy (PhD)",
        "stem_label": "STEM-designated (Physics / CIP 40.0801)",
        "dur": "Typically 5-6 years; core and advanced physics courses; RCR course; Comprehensive Exam (written Thesis Proposal + oral Proposal Exam); minor course of study; PhD thesis and public defense; on-campus (Atlanta, GA); Fall admission primarily",
        "ddl": "Fall 2027: **Deadline January 3, 2027** per School of Physics graduate admissions FAQ. Review end of January; decision emails mid-February.",
        "lang": "TOEFL iBT / IELTS required for non-native English speakers per Georgia Tech Graduate Education. ETS institution code for Georgia Tech. Unofficial transcripts accepted with application; official required upon admission.",
        "test_cls": "GRE GENERAL NOT REQUIRED; GRE PHYSICS SUBJECT NOT REQUIRED (School of Physics FAQ: 'The GRE Physics Test is NOT REQUIRED for all applicants. The General GRE Test is NOT REQUIRED for all applicants.' Applies to both domestic and international applicants. No BS in Physics required but background expected.)",
        "tui": "Multi-year fully-funded through RA/TA/fellowship: tuition + stipend + health insurance. Research strengths in astrophysics, AMO, condensed matter, nonlinear, soft matter, computational, physics of living systems.",
        "overview": "The Georgia Tech School of Physics, within the College of Sciences, offers the Doctor of Philosophy (PhD) with a major in Physics (the catalog also lists PhD with majors in Computational Science and Engineering and Quantitative Biosciences - this entry is Physics). Prospective physics graduate students may contact faculty members to inquire about research programs, but individual faculty cannot accept students into the graduate program. All prospective students must apply through the Georgia Tech Office of Graduate Education; the application is reviewed by the School of Physics Graduate Committee, which provides an admission recommendation to the Office. The application deadline is January 3. A limited number of application fee waivers are available for the January 3 deadline. CRITICAL POLICY: The GRE Physics Test is NOT REQUIRED for all applicants. The General GRE Test is NOT REQUIRED for all applicants. The same policy applies to international applicants: the GRE General and Physics Tests are not required for all applicants. You do not need to have a BS in Physics to apply, but you have to have a strong background in physics. Official transcripts are required with the application; if you have not graduated, send an unofficial transcript that shows the courses you are taking in the Spring term. Review of applications occurs at the end of January. Decision emails are sent out in mid-February. Per the graduate handbook: the PhD degree requires successful completion of (1) a program of study in core and advanced physics courses, (2) a course in the Responsible Conduct of Research (RCR), (3) a Comprehensive Exam consisting of a Thesis Proposal and an oral Proposal Exam, (4) a Minor course of study, and (5) a written PhD thesis and a public defense of that thesis. Georgia Tech requires all doctoral students to maintain a 3.0 GPA. Research areas of the School of Physics include Astrophysics, Astroparticles, and Gravitation; Atomic, Molecular, and Optical Physics; Condensed Matter and Materials; Non-linear Physics; Physics of Living Systems; Soft Matter; Computational Physics. Students working in world-renowned research groups have the opportunity to contribute to research published in leading scholarly journals and attend premier conferences. The School of Physics was established in 1939 and is located in Atlanta, Georgia.",
        "requirements": "<ul><li>Bachelor's degree in physics or related quantitative field (BS in Physics not strictly required but strong background expected)</li><li>GRE General: NOT required (domestic and international)</li><li>GRE Physics Subject: NOT required (domestic and international)</li><li>TOEFL iBT / IELTS required for non-native English speakers</li><li>Georgia Tech Office of Graduate Education online application</li><li>Official transcripts required; if not graduated, unofficial transcript showing Spring-term courses accepted</li><li>Statement of Purpose</li><li>Letters of recommendation (per Graduate Education default)</li><li>CV/Resume</li><li>Limited application fee waivers available for January 3 deadline</li><li>**Deadline January 3, 2027**</li><li>Review end of January; decision emails mid-February</li><li>Fall admission primarily</li><li>PhD requires: core/advanced physics courses + RCR course + Comprehensive Exam (written Thesis Proposal + oral Proposal Exam) + minor + PhD thesis + public defense</li><li>Maintain 3.0 GPA</li><li>Separate from Computational Science and Engineering PhD and Quantitative Biosciences PhD</li><li>On-campus residential (Atlanta, GA)</li></ul>",
        "research": "<ul><li>Astrophysics, astroparticles, and gravitation</li><li>Atomic, molecular, and optical physics (AMO)</li><li>Condensed matter and materials physics</li><li>Non-linear physics</li><li>Physics of living systems / biological physics</li><li>Soft matter physics</li><li>Computational physics</li><li>Interdisciplinary research with Georgia Tech schools of engineering, biology, chemistry, and computing</li></ul>",
        "source": '<a href="https://physics.gatech.edu/academics/graduate/faq" target="_blank">Georgia Tech Physics Admissions FAQ (application deadline January 3; GRE Physics Test NOT required; General GRE Test NOT required; applies to international applicants; no BS in Physics required but strong background expected; official transcripts required; review end of January; decision emails mid-February; limited fee waivers)</a> | <a href="https://physics.gatech.edu/graduate-program" target="_blank">Georgia Tech Physics Graduate Program (PhD requires coursework + seminars + Special Problems + candidacy by Comprehensive Exam (written Thesis Proposal + oral Proposal Exam) + thesis research; strengths in astrophysics, AMO, condensed matter, nonlinear, soft matter, computational, physics of living systems)</a> | <a href="https://catalog.gatech.edu/colleges/cos/physics/" target="_blank">Georgia Tech Catalog: School of Physics (doctoral degrees: PhD with major in Computational Science and Engineering / Physics / Quantitative Biosciences; PhD thesis 1-21 credit hours; research areas astrophysics/AMO/condensed matter/nonlinear/soft matter/computational/physics of living systems)</a> | <a href="https://physics.gatech.edu/sites/default/files/graduatehandbook.pdf" target="_blank">Georgia Tech Physics Graduate Handbook (PhD degree requires core and advanced physics courses + RCR course + Comprehensive Exam (Thesis Proposal + oral Proposal Exam) + minor + PhD thesis + public defense; maintain 3.0 GPA; RCR course requirement)</a>',
    },
    "dartmouth-physics-phd": {
        "school": "Dartmouth College, Guarini School of Graduate and Advanced Studies, Department of Physics and Astronomy",
        "en": "PhD in Physics and Astronomy",
        "deg": "Doctor of Philosophy (PhD)",
        "stem_label": "STEM-designated (Physics / CIP 40.0801; Astronomy / CIP 40.0201)",
        "dur": "Typically 5-6 years; rigorous core coursework; departmental qualifying examination; thesis proposal and oral defense; at least two terms of Supervised Undergraduate Teaching; on-campus (Hanover, NH); Fall admission only; thesis proposal certification by end of fall term of fourth year",
        "ddl": "Fall 2027: **Deadline December 1, 2026**. Application fee $150 (fee waivers available per Guarini criteria). All materials submitted through online application system; no paper materials accepted. Select up to three faculty members in contact with or particularly interested in working with.",
        "lang": "TOEFL iBT / IELTS required for non-native English speakers per Guarini School. ETS institution code for Dartmouth. Unofficial transcripts uploaded as part of application; official transcripts not needed during application process.",
        "test_cls": "GRE GENERAL OPTIONAL; GRE PHYSICS SUBJECT OPTIONAL (Dartmouth Guarini: 'GRE and physics GRE subject are optional.' 3 letters of recommendation required, up to 4 accepted; program supplement to indicate area of interest; unofficial transcripts; select up to three faculty.)",
        "tui": "Multi-year fully-funded through RA/TA/Guarini fellowship: tuition + stipend + health insurance. Smallest Ivy League physics department; admits 8-10 new PhD/year, ~50 total grad students; 17 full-time faculty + 12 research/adjunct.",
        "overview": "The Dartmouth College Department of Physics and Astronomy, within the Guarini School of Graduate and Advanced Studies, offers a unique graduate program leading to the PhD degree. The world-class Dartmouth faculty - among the top researchers in the world in targeted subjects of quantum and condensed matter physics, plasma and fluids, space physics, and astronomy, astrophysics and cosmology - work side-by-side with students. The department is dedicated to providing graduate students with both a broad background and in-depth training in their field of study. The graduate curriculum includes rigorous core coursework, coupled with an intense program of specialization through close interaction with faculty, advisors and mentors. As the smallest of the Ivy League institutions, Dartmouth maintains a tradition of close student-faculty interaction, a tradition which is also followed in the Physics and Astronomy graduate program. The graduate program admits eight to ten new PhD students per year, with a total enrollment of approximately 50 students. The department has seventeen full-time faculty members and twelve research and adjunct faculty. CRITICAL POLICY: GRE and physics GRE subject are optional. All application materials must be submitted directly through the online application system; Dartmouth does not accept paper application materials. Official transcripts should not be sent to the Guarini School office during the application process. The application fee is $150; fee waivers are available per Guarini criteria and details. Three recommendation letters are required, up to four accepted. Program supplement allows applicants to indicate area of interest: Astrophysics and Cosmology Observation; Astrophysics and Cosmology Theory; High Energy Theory; Plasma and Space Physics Experiment; Plasma and Space Physics Theory; Quantum and Condensed Matter Experiment; Quantum and Condensed Matter Theory. Applicants select up to three faculty members that they are in contact with or are particularly interested in working with. Application deadline is December 1, 2026. Degree offered: PhD. Per the historical departmental requirements: a student is admitted to PhD candidacy upon (1) receiving credit for six out of eight core courses for Physics students, or four of eight core plus four astronomy courses for Astronomy students; (2) passing the departmental qualifying examination; (3) presenting a thesis proposal and successfully defending it before an appointed PhD thesis committee; (4) passing a departmental review of course record and preliminary research progress; (5) receiving credit for at least two terms of Supervised Undergraduate Teaching. Students must achieve thesis proposal certification by the end of the fall term of their fourth year to remain in good standing. The department is located in Hanover, New Hampshire.",
        "requirements": "<ul><li>Bachelor's degree in physics, astronomy, or related quantitative field</li><li>GRE General: optional</li><li>GRE Physics Subject: optional</li><li>TOEFL iBT / IELTS required for non-native English speakers</li><li>ETS institution code for Dartmouth</li><li>Guarini School online application (no paper materials accepted)</li><li>Application fee $150 (fee waivers available)</li><li>Three letters of recommendation required, up to four accepted</li><li>Program supplement to indicate area of interest (7 tracks listed)</li><li>Select up to three faculty members in contact with or particularly interested in working with</li><li>Unofficial transcripts uploaded as part of application</li><li>Official transcripts not needed during application process</li><li>**Deadline December 1, 2026**</li><li>Fall admission only</li><li>Admits 8-10 new PhD/year; ~50 total grad students</li><li>17 full-time faculty + 12 research/adjunct faculty</li><li>6/8 core courses for Physics track; 4/8 core + 4 astronomy courses for Astronomy track</li><li>Departmental qualifying examination</li><li>At least two terms of Supervised Undergraduate Teaching</li><li>Thesis proposal certification by end of fall term of fourth year</li><li>On-campus residential (Hanover, NH)</li></ul>",
        "research": "<ul><li>Astrophysics and cosmology (observation and theory)</li><li>High energy physics / particle physics theory</li><li>Plasma and space physics (experiment and theory)</li><li>Quantum and condensed matter physics (experiment and theory)</li><li>Soft matter and fluid physics</li><li>Atomic, molecular, and optical physics</li><li>Interdisciplinary research with Dartmouth departments of chemistry, computer science, and engineering</li></ul>",
        "source": '<a href="https://physics.dartmouth.edu/graduate/graduate" target="_blank">Dartmouth Physics and Astronomy Graduate (smallest Ivy League; admits 8-10 new PhD/year, ~50 total grad students; 17 full-time faculty + 12 research/adjunct; deadline December 1, 2026; application fee $150; fee waivers available; close student-faculty interaction)</a> | <a href="https://graduate.dartmouth.edu/admissions/programs/physics-and-astronomy" target="_blank">Dartmouth Guarini: Physics and Astronomy (GRE and physics GRE subject optional; application fee $150; 3 LOR required up to 4 accepted; program supplement for 7 area tracks; unofficial transcripts; select up to three faculty; deadline December 1; degree PhD; no paper materials accepted)</a> | <a href="https://graduate.dartmouth.edu/academics/programs/physics-and-astronomy" target="_blank">Dartmouth Guarini Academics: Physics and Astronomy (GRE and GRE Subject optional; TOEFL/IELTS accepted; unofficial transcripts; program supplement area tracks)</a> | <a href="https://sites.dartmouth.edu/regarchive/course-descriptions/desc2006/phys/" target="_blank">Dartmouth Physics PhD Requirements (6/8 core courses Physics students; 4/8 core + 4 astronomy courses Astronomy students; departmental qualifying examination; thesis proposal and oral defense; two terms Supervised Undergraduate Teaching; thesis proposal certification by end of fall term of fourth year)</a>',
    },
    "emory-physics-phd": {
        "school": "Emory University, Laney Graduate School of Arts and Sciences, Department of Physics",
        "en": "PhD in Physics",
        "deg": "Doctor of Philosophy (PhD)",
        "stem_label": "STEM-designated (Physics / CIP 40.0801)",
        "dur": "Typically 5-6 years; 8 courses total (4 core: PHYS 501 Quantum Mechanics, PHYS 502 Mathematical Methods I, plus electives; 4 electives); Qualifier Proposal mid-November of Year 2; candidacy by September 15 of Year 4; minimum 54 credit hours at 500+; cumulative GPA minimum 2.70; dissertation; on-campus (Atlanta, GA); Fall admission primarily",
        "ddl": "Fall 2027: **Deadline December 18, 2026** per Department of Physics graduate page (Laney Graduate School old January 8 listing outdated). Application submitted through Laney Graduate School online application; deadline 11:59 p.m. Eastern Time.",
        "lang": "TOEFL test optional for Fall 2027 per Department of Physics page. ETS institution code 5187 (no department code needed - used for GRE, GMAT, and TOEFL). Test scores valid 5 years for GRE; 2 years for TOEFL/IELTS/DET.",
        "test_cls": "GRE GENERAL NOT REQUIRED; GRE PHYSICS SUBJECT OPTIONAL (Emory Physics: 'For Fall 2027, the Graduate School application does not require the GRE General Test scores. The TOEFL test is optional. The Physics GRE Subject Test is optional.' ETS institution code 5187 no department code. Contact barbara.conner@emory.edu.)",
        "tui": "Comprehensive funding package: stipend $43,260 for 12 months + full tuition coverage + Emory student health insurance (SHIP) + conference travel support. Students gain first-hand teaching experience as instructors for undergraduate lab courses.",
        "overview": "The Emory University Department of Physics, within the Laney Graduate School of Arts and Sciences, offers the Doctor of Philosophy (PhD) in Physics. Integrating emergent scientific research with innovative pedagogical training and community outreach, graduate students experience cutting-edge research in both experiment and theory. The online application form is available through the Laney Graduate School of Arts and Sciences. CRITICAL POLICY: The application deadline for Fall 2027 entry is December 18, 2026. For Fall 2027, the Graduate School application does not require the GRE General Test scores. The TOEFL test is optional. The Physics GRE Subject Test is optional. Applicants may email barbara.conner@emory.edu with additional questions about the application process. The ETS institution code for all three tests (GRE, GMAT, TOEFL) is 5187; no department code is needed. CRITICAL FUNDING: Graduate students receive comprehensive funding, including a competitive stipend of $43,260 for 12 months plus full tuition coverage, Emory's student health insurance, and conference travel support. Per the 2025-2026 graduate handbook: the Physics PhD degree requires completion of 8 courses (4 core courses + 4 electives), including PHYS 501 Quantum Mechanics (Fall term) and PHYS 502 Mathematical Methods I (Fall term), plus additional core and electives. Students must reach candidacy by September 15 at the start of their fourth year. Earn at least 54 credit hours at the 500 level or above and be in good academic standing with a minimum cumulative GPA of 2.70, with no unresolved Incomplete (I) or In Progress (IP) grades. For students starting in Fall 2017 or later, candidacy must be declared no later than September 15 of the fourth year. Timetable: before mid-November of the second year, the student submits to the Director of Graduate Studies a title for the Qualifier Proposal and a brief summary (300 words) outlining the problem, hypothesis, and approach. The DGS in consultation with the PhD advisor examines the proposal summary and gives notice to proceed with, or modify, the Qualifier Proposal. Research specializations in experimental and theoretical biophysics, condensed matter and optics, and soft matter physics. Students gain first-hand experience by being instructors for one of the undergraduate laboratory courses, and by working closely with a faculty member as a research assistant. The department is located in Atlanta, Georgia. Note: Laney Graduate School's old program deadlines table listed Physics PhD as January 8; the Department of Physics graduate page (December 18, 2026) is the authoritative 2027 cycle date.",
        "requirements": "<ul><li>Bachelor's degree in physics or related quantitative field</li><li>GRE General: NOT required for Fall 2027</li><li>GRE Physics Subject: optional</li><li>TOEFL: optional for Fall 2027 per Department of Physics page</li><li>ETS institution code 5187 (no department code needed; used for GRE/GMAT/TOEFL)</li><li>GRE scores valid 5 years; TOEFL/IELTS/DET valid 2 years</li><li>Laney Graduate School online application</li><li>Statement of Purpose</li><li>Letters of recommendation (per Laney default)</li><li>CV/Resume</li><li>Transcripts</li><li>**Deadline December 18, 2026** (11:59 p.m. Eastern; supersedes Laney old Jan 8 listing)</li><li>Fall admission primarily</li><li>8 courses total: 4 core (PHYS 501 QM, PHYS 502 Math Methods I, plus core electives) + 4 electives</li><li>Qualifier Proposal: mid-November of Year 2 (title + 300-word summary of problem/hypothesis/approach)</li><li>Candidacy by September 15 of Year 4</li><li>Minimum 54 credit hours at 500 level or above</li><li>Cumulative GPA minimum 2.70</li><li>No unresolved Incomplete (I) or In Progress (IP) grades</li><li>Comprehensive funding: stipend $43,260/12 months + full tuition + Emory SHIP + conference travel</li><li>Students instruct undergraduate laboratory courses</li><li>On-campus residential (Atlanta, GA)</li></ul>",
        "research": "<ul><li>Experimental and theoretical biophysics</li><li>Condensed matter physics and optics</li><li>Soft matter physics</li><li>Quantum physics and quantum information</li><li>Atomic, molecular, and optical physics</li><li>Interdisciplinary research with Emory departments of biology, chemistry, and Rollins School of Public Health</li></ul>",
        "source": '<a href="https://physics.emory.edu/grad/" target="_blank">Emory Physics Graduate Program (Fall 2027 deadline December 18, 2026; GRE General NOT required; TOEFL optional; Physics GRE Subject optional; ETS institution 5187 no dept code; stipend $43,260/12 months + full tuition + Emory SHIP + conference travel; instructors for undergraduate lab courses; contact barbara.conner@emory.edu)</a> | <a href="https://gs.emory.edu/admissions/faq" target="_blank">Emory Laney Graduate School FAQ (ETS institution code 5187 no department code; deadlines range Dec 1 to mid-Jan for PhD; decisions by April; GRE depends on program; official scores required upon matriculation; GRE valid 5 years; TOEFL/IELTS/DET valid 2 years)</a> | <a href="https://physics.emory.edu/documents/emory_physics_graduate_handbook_2025-2026.pdf" target="_blank">Emory Physics Graduate Handbook 2025-2026 (8 courses: 4 core + 4 electives; PHYS 501 QM Fall, PHYS 502 Math Methods I Fall; candidacy by Sept 15 of Year 4; minimum 54 credit hours at 500+; cumulative GPA 2.70; Qualifier Proposal mid-November Year 2 with 300-word summary)</a> | <a href="https://www.gradschool.emory.edu/admissions/program-admissions-requirements.html" target="_blank">Emory Program Admissions Requirements (note: old table lists Physics PhD January 8 - superseded by Department page December 18, 2026; deadlines fall midnight U.S. Eastern; ETS 5187 no dept code; contact program directly for GRE status)</a>',
    },
    "wustl-physics-phd": {
        "school": "Washington University in St. Louis, Arts & Sciences, Department of Physics",
        "en": "PhD in Physics",
        "deg": "Doctor of Philosophy (PhD)",
        "stem_label": "STEM-designated (Physics / CIP 40.0801)",
        "dur": "Typically 5 years; total units 36; maintain average grade at least B (3.0); first two years four semesters graduate courses; oral exam end of Year 2; two semesters mentored teaching; RAC by end of Year 3; dissertation; on-campus (St. Louis, MO); Fall admission primarily (rare spring)",
        "ddl": "Fall 2027: Arts & Sciences Office of Graduate Studies sets a single application deadline for all doctoral programs each year, generally falling during the first week of December. Exact 2027 cycle date not explicitly listed on department page - applicants should verify on application page. Note: Medical Physics PhD is a separate program in School of Medicine (CAMPEP-accredited, 70 units).",
        "lang": "TOEFL iBT / IELTS required for non-native English speakers per Arts & Sciences. ETS institution code for Washington University in St. Louis. Official scores required upon matriculation.",
        "test_cls": "GRE STATUS NOT EXPLICITLY LISTED ON DEPARTMENT BULLETIN (Arts & Sciences Office of Graduate Studies generally follows GRE-free admissions; applicants should verify on current Physics admissions page before applying). Degree requirements: 36 units total; 5-year length; minimum 3.0 GPA; RAC by end Year 3; dissertation submitted at least 1 year before expected conferral or before beginning 8th semester.",
        "tui": "Multi-year fully-funded through RA/TA/fellowship: tuition + stipend + health insurance. Major participant in McDonnell Center for Space Sciences, Institute of Materials Science & Engineering, Center for Quantum Leaps. Research strengths in condensed matter, 2D materials, nanostructured, magnetism, superconductivity, high-pressure.",
        "overview": "The Washington University in St. Louis Department of Physics, within Arts & Sciences, offers the Doctor of Philosophy (PhD) in Physics (also offers Master of Arts). Research in this department covers a wide area of experimental and theoretical physics and benefits from close contacts with nuclear and inorganic chemists in the Department of Chemistry, planetary scientists in the Department of Earth, Environmental, and Planetary Sciences, applied scientists in the McKelvey School of Engineering and the Institute of Materials Science & Engineering, and biological scientists both on the Danforth Campus and at the School of Medicine. The department is a major participant in the McDonnell Center for the Space Sciences, the Institute of Materials Science & Engineering, and the Center for Quantum Leaps. Per the Arts & Sciences Office of Graduate Studies: students may be admitted to study for a PhD degree directly from baccalaureate study or after undertaking other graduate or professional education, whether at Washington University or at another accredited institution. The Office sets one application deadline for all doctoral programs each year; the deadline generally falls during the first week of December. Applicants should use the deadline date displayed on their application page. Admissions and financial aid awards are for a specific academic year; admitted students can request deferral of admission up to one year, with approval required from the admitting program and Office of Graduate Studies (international applicants need additional approval from OISS). Arts & Sciences degree programs rarely admit applicants for spring semester. CRITICAL DEGREE REQUIREMENTS per bulletin: total units required 36; degree length five years; grade requirement average at least B (3.0 GPA). Doctoral students must complete a department-defined Mentored Experience. A Research Advisory Committee (RAC) must be created no later than the end of the student's third year; departments may set shorter timelines (e.g., by end of second year). The dissertation must be submitted to the Office of Graduate Studies at least one year before the degree is expected to be conferred or before beginning the eighth semester of full-time enrollment, whichever is earlier. After the defense, the student must submit an electronic copy of the dissertation online to the Office; dissertations must be submitted no later than three months after the oral defense. Students spend their first two years (four semesters) taking graduate courses. At the end of this time, they will typically have completed requirements for the master's degree. Students planning to complete a PhD will also need to find a dissertation advisor and start their research. PhD candidates will complete two semesters of mentored teaching experiences. After achieving the required course grades and passing an oral examination at the end of their second year, students will work on their research and write their dissertation. The PhD program typically takes five years to complete. Research strengths include: condensed matter and materials physics (graphene and other two-dimensional atomic crystals, nanostructured materials, metallic glasses and liquids, magnetism and superconductivity, high-pressure physics). Note: The Medical Physics PhD is a separate program in the School of Medicine (CAMPEP-accredited, minimum 70 credit units: 34 didactic + 36 thesis) - this entry is Arts & Sciences Physics, NOT Medical Physics. The department is located in St. Louis, Missouri.",
        "requirements": "<ul><li>Bachelor's degree in physics or related quantitative field (direct PhD admission from baccalaureate study accepted)</li><li>GRE status: not explicitly listed on department bulletin; verify on current Physics admissions page</li><li>TOEFL iBT / IELTS required for non-native English speakers</li><li>ETS institution code for Washington University in St. Louis</li><li>Arts & Sciences Office of Graduate Studies online application</li><li>Statement of Purpose</li><li>Letters of recommendation</li><li>Transcripts</li><li>**Deadline: first week of December per Arts & Sciences unified policy; exact 2027 cycle date on application page**</li><li>Fall admission primarily (rare spring admission; consult program faculty before applying for spring)</li><li>Admissions and financial aid awards are for a specific academic year; deferral up to 1 year with approval</li><li>Total units: 36</li><li>Degree length: 5 years</li><li>Maintain average grade at least B (3.0 GPA)</li><li>First two years (four semesters) graduate coursework; typically completes MA requirements by end of Year 2</li><li>Oral examination at end of Year 2</li><li>Two semesters of mentored teaching experience</li><li>Research Advisory Committee (RAC) created no later than end of Year 3</li><li>Dissertation submitted at least 1 year before expected conferral or before beginning 8th semester</li><li>Dissertation submitted no later than 3 months after oral defense</li><li>Separate from Medical Physics PhD in School of Medicine (CAMPEP, 70 units)</li><li>On-campus residential (St. Louis, MO; Danforth Campus)</li></ul>",
        "research": "<ul><li>Condensed matter and materials physics</li><li>Two-dimensional atomic crystals (graphene)</li><li>Nanostructured materials</li><li>Metallic glasses and liquids</li><li>Magnetism and superconductivity</li><li>High-pressure physics</li><li>Space physics (McDonnell Center for the Space Sciences)</li><li>Quantum physics (Center for Quantum Leaps)</li><li>Interdisciplinary with Chemistry (nuclear and inorganic), Earth/Planetary Sciences, McKelvey School of Engineering, Institute of Materials Science & Engineering, School of Medicine</li></ul>",
        "source": '<a href="https://bulletin.wustl.edu/grad/artsci/admissions/" target="_blank">WashU Arts & Sciences Graduate Admissions (single doctoral deadline each year, generally first week of December; deferral up to 1 year with approval; rarely admit spring; online application through Office of Graduate Studies)</a> | <a href="https://bulletin.wustl.edu/grad/artsci/degrees/physics-phd/" target="_blank">WashU Bulletin: Physics PhD (total units 36; degree length 5 years; minimum B/3.0 GPA; RAC by end Year 3; dissertation submitted at least 1 year before conferral or before beginning 8th semester; submission no later than 3 months after oral defense)</a> | <a href="https://bulletin.wustl.edu/grad/artsci/physics/" target="_blank">WashU Bulletin: Physics (offers MA and PhD; research in condensed matter/2D materials/nanostructured/metallic glasses/magnetism/superconductivity/high-pressure; first two years four semesters grad courses typically completing MA; oral exam end Year 2; two semesters mentored teaching; RAC by end Year 3; dissertation; 5-year typical)</a> | <a href="https://bulletin.wustl.edu/medicine/degrees-offerings/medical-physics-phd/" target="_blank">WashU Medical Physics PhD (SEPARATE in School of Medicine; CAMPEP-accredited; minimum 70 credit units = 34 didactic + 36 thesis; fall semester start; diagnostic imaging/radiation therapy/nuclear medicine/radiation safety; NOT Arts & Sciences Physics)</a>',
    },
    "uva-physics-phd": {
        "school": "University of Virginia, College and Graduate School of Arts and Sciences, Department of Physics",
        "en": "PhD in Physics",
        "deg": "Doctor of Philosophy (PhD)",
        "stem_label": "STEM-designated (Physics / CIP 40.0801)",
        "dur": "Typically 5-6 years; 11 department-required courses (6 core + 5 electives) + 7 letter-graded courses + 18 research credits; qualifying examination in CM/E&M/QM/StatMech; dissertation defended in oral examination; on-campus (Charlottesville, VA); Fall admission only",
        "ddl": "Fall 2027: **Deadline December 15, 2026** per Graduate School of Arts & Sciences deadlines page. Application portal opens October 1. Note: Engineering Physics PhD is a separate program in School of Engineering and Applied Science.",
        "lang": "TOEFL iBT minimum total 90 (sectional minimums: speaking 22, writing 22, reading 23, listening 23). IELTS Academic and Duolingo English Test also accepted. Test scores valid 2 years. GRE scores valid 5 years. Official scores not necessary for review but required if matriculating.",
        "test_cls": "GRE GENERAL NOT REQUIRED; GRE PHYSICS SUBJECT REQUIRED (UVA Graduate School: 'Applicants to degree programs in Physics require a valid Physics GRE score; general GRE scores are not required. Applicants to degree programs in Economics, Sociology, and Statistics must record their GRE scores. Applicants to all other programs are not required to submit GRE scores.')",
        "tui": "Financial support through assistantships or fellowships. Dissertation research may be conducted within the department or at national and international laboratories (CERN, Fermilab, Oak Ridge, Jefferson Lab). ~105 graduate students / 36 standing faculty. Annual reviews ensure progress.",
        "overview": "The University of Virginia Department of Physics, within the Graduate School of Arts and Sciences, offers the Doctor of Philosophy (PhD) in Physics. The graduate program in Physics is designed to prepare PhD students for careers in research and teaching, with strengths across disciplines such as high-energy particle physics, nuclear physics, quantum information, atomic, molecular and optical physics, condensed matter physics, gravitational physics, and medical physics. The program includes around 105 graduate students, supported by 36 standing faculty and a strong network of emeritus professors, postdocs, visiting scholars, and staff. Students admitted to the PhD program receive financial support through assistantships or fellowships, and dissertation research may be conducted within the department or at national and international laboratories such as CERN, Fermilab, Oak Ridge and Jefferson Lab. From the start, students are encouraged to explore different research areas, participate in seminars, and engage in supervised research projects, with the expectation of devoting the summer after their first year to laboratory or faculty-guided research. This hands-on experience often provides a foundation for dissertation work. Annual reviews ensure student progress, and graduates go on to successful careers in academia, national labs, and industry, often maintaining professional collaborations with their advisors. CRITICAL POLICY per UVA Graduate School requirements: Applicants to degree programs in Physics require a valid Physics GRE score; general GRE scores are not required. By contrast, applicants to degree programs in Economics, Sociology, and Statistics must record their GRE scores; applicants to all other programs are not required to submit GRE scores. Official scores are not necessary for the review process, but they will be required if the applicant matriculates. Once ETS sends official scores, they are automatically matched to the application. For international students, all must submit TOEFL scores, or scores from an accepted alternative (IELTS or DET). Applicants must record these scores on their electronic application. As with the GRE, official scores are not necessary for the review process but will be required upon matriculation. GRE scores are valid for five years, and TOEFL, IELTS, and DET scores are valid for two years. Minimum internet-based TOEFL score requirement is 90, including sectional minimums of 22 in speaking, 22 in writing, 23 in reading, and 23 in listening. Per the bulletin: unless credit for advanced standing is given by the departmental advisor, PhD candidates must pass 11 departmentally required courses (six specified core courses and five departmental electives) in addition to seven other courses passed with a letter grade (not S or U) and 18 additional credits that can include non-topical research. PhD candidates must pass a qualifying examination in the subjects of classical mechanics, electricity and magnetism, quantum mechanics, and statistical mechanics. The material for this examination is covered in the six core courses, which should be completed by the end of the second semester. PhD candidates must present a dissertation on their research that is satisfactory to their research advisor; the dissertation must be defended in an oral examination. Application deadlines per Graduate School: PhD in Physics is December 15; the application portal opens October 1. Note: Engineering Physics PhD is a separate program in the School of Engineering and Applied Science - this entry is College of Arts & Sciences Physics, NOT Engineering Physics. The department is located in Charlottesville, Virginia.",
        "requirements": "<ul><li>Bachelor's degree in physics or related quantitative field</li><li>GRE General: NOT required</li><li>GRE Physics Subject: REQUIRED (valid Physics GRE score)</li><li>TOEFL iBT minimum total 90 (sectional: speaking 22, writing 22, reading 23, listening 23)</li><li>IELTS Academic and Duolingo English Test also accepted</li><li>TOEFL/IELTS/DET scores valid 2 years</li><li>GRE scores valid 5 years</li><li>Official scores not necessary for review but required upon matriculation</li><li>UVA Graduate School of Arts & Sciences online application (portal opens October 1)</li><li>Statement of Purpose</li><li>Letters of recommendation</li><li>Transcripts</li><li>CV/Resume</li><li>**Deadline December 15, 2026** for PhD</li><li>Fall admission only</li><li>~105 graduate students / 36 standing faculty</li><li>11 department-required courses (6 core + 5 electives) unless advanced standing given</li><li>7 additional letter-graded courses (not S/U)</li><li>18 additional credits (may include non-topical research)</li><li>Qualifying examination in classical mechanics, E&M, quantum mechanics, statistical mechanics</li><li>Six core courses should be completed by end of second semester</li><li>Dissertation defended in oral examination</li><li>Financial support through assistantships or fellowships</li><li>Dissertation research may be at CERN, Fermilab, Oak Ridge, Jefferson Lab</li><li>Summer after first year devoted to lab or faculty-guided research</li><li>Annual reviews ensure progress</li><li>Separate from Engineering Physics PhD in School of Engineering</li><li>On-campus residential (Charlottesville, VA)</li></ul>",
        "research": "<ul><li>High-energy particle physics</li><li>Nuclear physics</li><li>Quantum information science</li><li>Atomic, molecular, and optical physics (AMO)</li><li>Condensed matter physics</li><li>Gravitational physics</li><li>Medical physics</li><li>Research opportunities at CERN, Fermilab, Oak Ridge National Lab, Jefferson Lab</li></ul>",
        "source": '<a href="https://graduate.as.virginia.edu/graduate-degree-programs/physics" target="_blank">UVA Graduate Physics (~105 grad students / 36 standing faculty; strengths in high-energy particle, nuclear, quantum information, AMO, condensed matter, gravitational, medical physics; funding through assistantships/fellowships; research at CERN/Fermilab/Oak Ridge/Jefferson Lab; annual reviews; PhD deadline Dec 15, MA Jan 15-May 1, MS Jan 15)</a> | <a href="https://graduate.as.virginia.edu/deadlines" target="_blank">UVA Graduate School Deadlines (portal opens Oct 1; PhD Physics December 15; PhD Astronomy/Mathematics/Statistics/Environmental Sciences/Classics/Philosophy/Sociology/Jan 15; deadlines for Fall enrollment of subsequent academic year)</a> | <a href="https://graduate.as.virginia.edu/requirements" target="_blank">UVA Graduate School Requirements (Physics requires valid Physics GRE score; general GRE not required; Economics/Sociology/Statistics must record GRE; all other programs not required; TOEFL iBT 90 with subscores 22S/22W/23R/23L; IELTS/DET accepted; GRE valid 5 years; TOEFL/IELTS/DET valid 2 years; official scores required upon matriculation)</a> | <a href="https://records.ureg.virginia.edu/preview_program.php?catoid=28&poid=2287" target="_blank">UVA Physics Bulletin (PhD candidates must pass 11 dept-required courses (6 core + 5 electives) + 7 letter-graded + 18 research credits unless advanced standing; qualifying exam in CM/E&M/QM/StatMech; six core courses completed by end of second semester; dissertation defended in oral exam; MS requires 30 credits + thesis)</a>',
    },
}

# Write detail pages
for p in PROGRAMS:
    key = p["id"]
    d = PAGES[key]
    html = DETAIL_TEMPLATE.format(
        school=d["school"], en=d["en"], deg=d["deg"], stem_label=d["stem_label"],
        dur=d["dur"], ddl=d["ddl"], lang=d["lang"], test_cls=d["test_cls"], tui=d["tui"],
        overview=d["overview"], requirements=d["requirements"],
        research=d["research"], source=d["source"],
    )
    path = os.path.join(DET, key + ".html")
    with open(path, "w", encoding="utf-8") as f:
        f.write(html)
    print(f"Wrote: {key}.html")

# Append PROGRAMS
idx_path = os.path.join(BASE, "index_main.html")
with open(idx_path, "r", encoding="utf-8") as f:
    html = f.read()

def build_entry(p):
    return ('{{id:"{id}",s:"{s}",n:"{n}",en:"{en}",deg:"{deg}",lvl:"{lvl}",stem:{stem},'
            'dur:"{dur}",ddl:"{ddl}",lang:"{lang}",test:{{cls:"{test_cls}"}},'
            'tui:"{tui}",url:"{url}"}}').format(
        id=p["id"], s=p["s"], n=p["n"], en=p["en"], deg=p["deg"], lvl=p["lvl"],
        stem=p["stem"], dur=p["dur"], ddl=p["ddl"], lang=p["lang"],
        test_cls=p["test"]["cls"].replace('"', "'"),
        tui=p["tui"].replace('"', "'"), url=p["url"],
    )

new_entries = ",\n".join(build_entry(p) for p in PROGRAMS)

m = re.search(r'const\s+PROGRAMS\s*=\s*\[', html)
start = m.end()
depth = 1
i = start
while i < len(html) and depth > 0:
    c = html[i]
    if c == '[': depth += 1
    elif c == ']': depth -= 1
    i += 1
insert_pos = i - 1
prefix = html[:insert_pos].rstrip()
suffix = html[insert_pos:]
if prefix.endswith('{'):
    new_block = prefix + "\n" + new_entries + "\n" + suffix
else:
    new_block = prefix + ",\n" + new_entries + "\n" + suffix

# Append VD on new_block (re-locate to avoid offset)
vd_entries = ",\n".join(f'"{p["url"]}"' for p in PROGRAMS)
m2 = re.search(r'VERIFIED_DETAILS\s*=\s*new\s+Set\s*\(\s*\[', new_block)
vstart = m2.end()
vdepth = 1
j = vstart
while j < len(new_block) and vdepth > 0:
    c = new_block[j]
    if c == '[': vdepth += 1
    elif c == ']': vdepth -= 1
    j += 1
vinsert_pos = j - 1
vprefix = new_block[:vinsert_pos].rstrip()
vsuffix = new_block[vinsert_pos:]
if vprefix.endswith(','):
    new_block = vprefix + "\n" + vd_entries + "\n" + vsuffix
elif vprefix.endswith('['):
    new_block = vprefix + "\n" + vd_entries + "\n" + vsuffix
else:
    new_block = vprefix + ",\n" + vd_entries + "\n" + vsuffix

with open(idx_path, "w", encoding="utf-8") as f:
    f.write(new_block)

print(f"Appended {len(PROGRAMS)} PROGRAMS entries and {len(PROGRAMS)} VD entries")
print(f"Done. File size: {os.path.getsize(idx_path)}")
