Skip to content

Commit f23415f

Browse files
authored
Runic formatting (#162)
1 parent 1519456 commit f23415f

File tree

136 files changed

+13820
-13810
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+13820
-13810
lines changed

.JuliaFormatter.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/CompatHelper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: "CompatHelper"
22

33
on:
44
schedule:
5-
- cron: 0 0 * * *
5+
- cron: '0 0 * * *'
66
workflow_dispatch:
77
permissions:
88
contents: write

.github/workflows/FormatCheck.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: "Format Check"
22

33
on:
4-
push:
5-
branches:
6-
- 'main'
7-
tags: '*'
8-
pull_request:
4+
pull_request_target:
5+
paths: ['**/*.jl']
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
8+
permissions:
9+
contents: read
10+
actions: write
11+
pull-requests: write
912

1013
jobs:
1114
format-check:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
.vscode/
1010
Manifest.toml
1111
benchmark/*.json
12+
dev/
13+
docs/LocalPreferences.toml
1214
docs/Manifest.toml
1315
docs/build/
1416
docs/src/index.md
17+
examples/LocalPreferences.toml
18+
test/LocalPreferences.toml

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ci:
2-
skip: [julia-formatter]
2+
skip: [runic]
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -11,7 +11,7 @@ repos:
1111
- id: end-of-file-fixer
1212
exclude_types: [markdown] # incompatible with Literate.jl
1313

14-
- repo: "https://github.com/domluna/JuliaFormatter.jl"
15-
rev: v2.1.6
14+
- repo: https://github.com/fredrikekre/runic-pre-commit
15+
rev: v2.0.1
1616
hooks:
17-
- id: "julia-formatter"
17+
- id: runic

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorMPS"
22
uuid = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2"
33
authors = ["Matthew Fishman <mfishman@flatironinstitute.org>", "Miles Stoudenmire <mstoudenmire@flatironinstitute.org>"]
4-
version = "0.3.21"
4+
version = "0.3.22"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,39 +52,39 @@ the behavior of quantum systems.
5252
````julia
5353
using ITensors, ITensorMPS
5454
let
55-
# Create 100 spin-one indices
56-
N = 100
57-
sites = siteinds("S=1", N)
58-
59-
# Input operator terms which define
60-
# a Hamiltonian matrix, and convert
61-
# these terms to an MPO tensor network
62-
# (here we make the 1D Heisenberg model)
63-
os = OpSum()
64-
for j in 1:(N - 1)
65-
os += "Sz", j, "Sz", j + 1
66-
os += 0.5, "S+", j, "S-", j + 1
67-
os += 0.5, "S-", j, "S+", j + 1
68-
end
69-
H = MPO(os, sites)
70-
71-
# Create an initial random matrix product state
72-
psi0 = random_mps(sites)
73-
74-
# Plan to do 5 passes or 'sweeps' of DMRG,
75-
# setting maximum MPS internal dimensions
76-
# for each sweep and maximum truncation cutoff
77-
# used when adapting internal dimensions:
78-
nsweeps = 5
79-
maxdim = [10, 20, 100, 100, 200]
80-
cutoff = 1E-10
81-
82-
# Run the DMRG algorithm, returning energy
83-
# (dominant eigenvalue) and optimized MPS
84-
energy, psi = dmrg(H, psi0; nsweeps, maxdim, cutoff)
85-
println("Final energy = $energy")
86-
87-
nothing
55+
# Create 100 spin-one indices
56+
N = 100
57+
sites = siteinds("S=1", N)
58+
59+
# Input operator terms which define
60+
# a Hamiltonian matrix, and convert
61+
# these terms to an MPO tensor network
62+
# (here we make the 1D Heisenberg model)
63+
os = OpSum()
64+
for j in 1:(N - 1)
65+
os += "Sz", j, "Sz", j + 1
66+
os += 0.5, "S+", j, "S-", j + 1
67+
os += 0.5, "S-", j, "S+", j + 1
68+
end
69+
H = MPO(os, sites)
70+
71+
# Create an initial random matrix product state
72+
psi0 = random_mps(sites)
73+
74+
# Plan to do 5 passes or 'sweeps' of DMRG,
75+
# setting maximum MPS internal dimensions
76+
# for each sweep and maximum truncation cutoff
77+
# used when adapting internal dimensions:
78+
nsweeps = 5
79+
maxdim = [10, 20, 100, 100, 200]
80+
cutoff = 1.0e-10
81+
82+
# Run the DMRG algorithm, returning energy
83+
# (dominant eigenvalue) and optimized MPS
84+
energy, psi = dmrg(H, psi0; nsweeps, maxdim, cutoff)
85+
println("Final energy = $energy")
86+
87+
nothing
8888
end
8989

9090
# output

docs/make.jl

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,54 @@ using ITensorMPS
22
using ITensors
33
using Documenter: Documenter, DocMeta, deploydocs, makedocs
44

5-
DocMeta.setdocmeta!(ITensorMPS, :DocTestSetup, :(using ITensorMPS); recursive=true)
6-
DocMeta.setdocmeta!(ITensors, :DocTestSetup, :(using ITensors); recursive=true)
5+
DocMeta.setdocmeta!(ITensorMPS, :DocTestSetup, :(using ITensorMPS); recursive = true)
6+
DocMeta.setdocmeta!(ITensors, :DocTestSetup, :(using ITensors); recursive = true)
77

88
include("make_index.jl")
99

1010
makedocs(;
11-
# Allows using ITensors.jl docstrings in ITensorMPS.jl documentation:
12-
# https://github.com/JuliaDocs/Documenter.jl/issues/1734
13-
modules=[ITensorMPS, ITensors],
14-
authors="ITensor developers <support@itensor.org> and contributors",
15-
sitename="ITensorMPS.jl",
16-
format=Documenter.HTML(;
17-
canonical="https://itensor.github.io/ITensorMPS.jl",
18-
edit_link="main",
19-
assets=["assets/favicon.ico", "assets/extras.css"],
20-
prettyurls=false,
21-
),
22-
pages=[
23-
"Home" => "index.md",
24-
"Tutorials" => [
25-
"DMRG" => "tutorials/DMRG.md",
26-
"Quantum Number Conserving DMRG" => "tutorials/QN_DMRG.md",
27-
"MPS Time Evolution" => "tutorials/MPSTimeEvolution.md",
11+
# Allows using ITensors.jl docstrings in ITensorMPS.jl documentation:
12+
# https://github.com/JuliaDocs/Documenter.jl/issues/1734
13+
modules = [ITensorMPS, ITensors],
14+
authors = "ITensor developers <support@itensor.org> and contributors",
15+
sitename = "ITensorMPS.jl",
16+
format = Documenter.HTML(;
17+
canonical = "https://itensor.github.io/ITensorMPS.jl",
18+
edit_link = "main",
19+
assets = ["assets/favicon.ico", "assets/extras.css"],
20+
prettyurls = false,
21+
),
22+
pages = [
23+
"Home" => "index.md",
24+
"Tutorials" => [
25+
"DMRG" => "tutorials/DMRG.md",
26+
"Quantum Number Conserving DMRG" => "tutorials/QN_DMRG.md",
27+
"MPS Time Evolution" => "tutorials/MPSTimeEvolution.md",
28+
],
29+
"Code Examples" => [
30+
"MPS and MPO Examples" => "examples/MPSandMPO.md",
31+
"DMRG Examples" => "examples/DMRG.md",
32+
"Physics (SiteType) System Examples" => "examples/Physics.md",
33+
],
34+
"Documentation" => [
35+
"MPS and MPO" => "MPSandMPO.md",
36+
"SiteType and op, state, val functions" => "SiteType.md",
37+
"SiteTypes Included with ITensor" => "IncludedSiteTypes.md",
38+
"DMRG" => [
39+
"DMRG.md",
40+
"Sweeps.md",
41+
"ProjMPO.md",
42+
"ProjMPOSum.md",
43+
"Observer.md",
44+
"DMRGObserver.md",
45+
],
46+
"OpSum" => "OpSum.md",
47+
],
48+
"Frequently Asked Questions" =>
49+
["DMRG FAQs" => "faq/DMRG.md", "Quantum Number (QN) FAQs" => "faq/QN.md"],
50+
"HDF5 File Formats" => "HDF5FileFormats.md",
2851
],
29-
"Code Examples" => [
30-
"MPS and MPO Examples" => "examples/MPSandMPO.md",
31-
"DMRG Examples" => "examples/DMRG.md",
32-
"Physics (SiteType) System Examples" => "examples/Physics.md",
33-
],
34-
"Documentation" => [
35-
"MPS and MPO" => "MPSandMPO.md",
36-
"SiteType and op, state, val functions" => "SiteType.md",
37-
"SiteTypes Included with ITensor" => "IncludedSiteTypes.md",
38-
"DMRG" => [
39-
"DMRG.md",
40-
"Sweeps.md",
41-
"ProjMPO.md",
42-
"ProjMPOSum.md",
43-
"Observer.md",
44-
"DMRGObserver.md",
45-
],
46-
"OpSum" => "OpSum.md",
47-
],
48-
"Frequently Asked Questions" =>
49-
["DMRG FAQs" => "faq/DMRG.md", "Quantum Number (QN) FAQs" => "faq/QN.md"],
50-
"HDF5 File Formats" => "HDF5FileFormats.md",
51-
],
52-
warnonly=true,
52+
warnonly = true,
5353
)
5454

55-
deploydocs(; repo="github.com/ITensor/ITensorMPS.jl", devbranch="main", push_preview=true)
55+
deploydocs(; repo = "github.com/ITensor/ITensorMPS.jl", devbranch = "main", push_preview = true)

docs/make_index.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ using Literate: Literate
22
using ITensorMPS: ITensorMPS
33

44
function ccq_logo(content)
5-
include_ccq_logo = """
5+
include_ccq_logo = """
66
```@raw html
77
<img class="display-light-only" src="assets/CCQ.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
88
<img class="display-dark-only" src="assets/CCQ-dark.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
99
```
1010
"""
11-
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12-
return content
11+
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12+
return content
1313
end
1414

1515
Literate.markdown(
16-
joinpath(pkgdir(ITensorMPS), "examples", "README.jl"),
17-
joinpath(pkgdir(ITensorMPS), "docs", "src");
18-
flavor=Literate.DocumenterFlavor(),
19-
name="index",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir(ITensorMPS), "examples", "README.jl"),
17+
joinpath(pkgdir(ITensorMPS), "docs", "src");
18+
flavor = Literate.DocumenterFlavor(),
19+
name = "index",
20+
postprocess = ccq_logo,
2121
)

docs/make_readme.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ using Literate: Literate
22
using ITensorMPS: ITensorMPS
33

44
function ccq_logo(content)
5-
include_ccq_logo = """
5+
include_ccq_logo = """
66
<picture>
77
<source media="(prefers-color-scheme: dark)" width="20%" srcset="docs/src/assets/CCQ-dark.png">
88
<img alt="Flatiron Center for Computational Quantum Physics logo." width="20%" src="docs/src/assets/CCQ.png">
99
</picture>
1010
"""
11-
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12-
return content
11+
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12+
return content
1313
end
1414

1515
Literate.markdown(
16-
joinpath(pkgdir(ITensorMPS), "examples", "README.jl"),
17-
joinpath(pkgdir(ITensorMPS));
18-
flavor=Literate.CommonMarkFlavor(),
19-
name="README",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir(ITensorMPS), "examples", "README.jl"),
17+
joinpath(pkgdir(ITensorMPS));
18+
flavor = Literate.CommonMarkFlavor(),
19+
name = "README",
20+
postprocess = ccq_logo,
2121
)

0 commit comments

Comments
 (0)