Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix in unitcell #79

Merged
merged 1 commit into from
Jul 27, 2020
Merged

Bug fix in unitcell #79

merged 1 commit into from
Jul 27, 2020

Conversation

pablosanjose
Copy link
Owner

@pablosanjose pablosanjose commented Jul 27, 2020

There was a bad bug in unitcell. This h = LatticePresets.honeycomb() |> hamiltonian(hopping(1, range = 1/√3)) |> unitcell((1,-1), region = r -> abs(r[2])<10) failed to produce a graphene nanoribbon, as it included only one vertical row of sites in a unitcell, not an armchair chain. The reason was an ugly bug in the unitcell core function pinvmultiple that computes an integer matrix that is an integer multiple of the supercell pseudoinverse. That multiple was computed as the determinant of the R factor in the QR decomposition of the supercell matrix s, but that is only actually valid if the latter is square and invertible. The (or at least one) correct multiple is det(s's).

Hat tip to @baggepinnen in discourse

test fixes

fix tests

test fiix
@codecov-commenter
Copy link

Codecov Report

Merging #79 into master will decrease coverage by 1.29%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
- Coverage   62.35%   61.06%   -1.30%     
==========================================
  Files          15       15              
  Lines        2351     2219     -132     
==========================================
- Hits         1466     1355     -111     
+ Misses        885      864      -21     
Impacted Files Coverage Δ
src/lattice.jl 63.57% <100.00%> (-1.23%) ⬇️
src/tools.jl 61.08% <100.00%> (-1.94%) ⬇️
src/convert.jl 20.00% <0.00%> (-30.00%) ⬇️
src/model.jl 65.94% <0.00%> (-5.79%) ⬇️
src/parametric.jl 79.06% <0.00%> (-3.69%) ⬇️
src/hamiltonian.jl 66.28% <0.00%> (-2.07%) ⬇️
src/KPM.jl 61.59% <0.00%> (-1.68%) ⬇️
src/mesh.jl 92.95% <0.00%> (-0.97%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68d5eab...b0ea644. Read the comment docs.

@pablosanjose pablosanjose merged commit f25bea7 into master Jul 27, 2020
@pablosanjose pablosanjose deleted the unitcell branch August 27, 2020 15:43
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