Giter Club home page Giter Club logo

lattpy's Introduction

Hi, I'm Dylan ๐Ÿ‘‹

Currently pursuing a PhD in strongly-correlated condensed matter physics at the University of Augsburg. Interested in computational physics, quantum computing, machine learning and programming in general.

Projects

Computational physics

  • lattpy - Simple and efficient Python package for modeling d-dimensional Bravais lattices in solid state physics.
  • exactdiag - Exact diagonalization of fermionic many-body systems.

Music

  • pyrekordbox - Inofficial Python package for interacting with the database and other files (XML, ANLZ, MySettings) of Pioneers Rekordbox DJ software.

Other

  • ftmplt - Simple string parsing and formatting using Python's f-string templates.
  • mplstyles - Collection of scientific Matplotlib styles.

github contribution grid snake animationgithub contribution grid snake animation

lattpy's People

Contributors

dylanljones avatar lgtm-migrator avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lattpy's Issues

Periodic boundary conditions misses some neighbors for non-square lattices

Describe the bug
Setting periodic boundary conditions misses neighbors for some lattices.

To Reproduce
See, for example, the hexagonal lattice

import lattpy as lp
import matplotlib.pyplot as plt

latt = lp.Lattice.hexagonal()
latt.add_atom()
latt.add_connections()

latt.build((3, 3, ), primitive=True)
latt.set_periodic([0, ], primitive=True)

latt.plot()
plt.show()

The top (12) and bottom (3) sites are each missing one neighbor (site 1 and 14, respectively)

Figure_1

Environment

  • lattpy version: 0.7.4
  • OS and Python version: All

Suggestions for contribution

I just discovered this package and used it to generate some graphics for my masters thesis (graphene, but with the basis rotated in comparison to the predefined one to be in line with my definition) . It absolutely saved me a lot of work doing things myself, but I struggled a bit with the documentation, so I would like to contribute to that a bit.

I can imagine adding the following:

  • My code as an example somewhere, to illustrate how to create lattice and BZ graphics
  • API Documentation where its missing
  • Typehints

Also, I couldn't really figure out how to use the things provided in lattpy.disptools, so I did plotting of bands myself. If you have any hints, I can also add that to the documentation.

Periodic boundary conditions fails for small models with d>1

Describe the bug
Setting periodic boundary conditions for small lattices in higher dimensions fails due a broadcasting error and raises a ValueError.

To Reproduce
Steps to reproduce the behavior:

import lattpy as lp

latt = lp.finite_hypercubic((2, 2), periodic=True)

The resulting error is:

Traceback (most recent call last):
File "D:\Dropbox\Dev\Physics\lattpy\issue.py", line 16, in <module>
  main()
File "D:\Dropbox\Dev\Physics\lattpy\issue.py", line 12, in main
  latt = lp.finite_hypercubic((2, 2), periodic=True)
File "D:\Dropbox\Dev\Physics\lattpy\lattpy\__init__.py", line 451, in finite_hypercubic
  latt.build(s, primitive=primitive, periodic=periodic)
File "D:\Dropbox\Dev\Physics\lattpy\lattpy\lattice.py", line 431, in build
  self.set_periodic(periodic, primitive)
File "D:\Dropbox\Dev\Physics\lattpy\lattpy\lattice.py", line 620, in set_periodic
  self.data.set_periodic(pidx, pdists, pnvecs, paxs)
File "D:\Dropbox\Dev\Physics\lattpy\lattpy\data.py", line 467, in set_periodic
  self.neighbors[i, i0:i1] = pidx
ValueError: could not broadcast input array from shape (2,) into shape (1,)

Expected behavior
Set periodic boundary conditions if possible. In the example above this is not necessary since the sites are already neighbors.

Environment

  • lattpy version: 0.7.4
  • OS and Python version: All

Wrong neighbors if we set 2nd connections

Describe the bug
See below, site 5 is found for site 3 as nearest neighbor, but site 3 is not found for site 5 as nearest neighbor,

To Reproduce
Steps to reproduce the behavior:

import lattpy as lp
import matplotlib.pyplot as plt

latt = lp.Lattice.hexagonal()
latt.add_atom()
latt.add_connections(2)

latt.build((3-0.1, 3-0.1, ), primitive=True)
latt.set_periodic([1, ], primitive=True)

latt.plot(show_indices=True)
plt.show()
print(latt.neighbors(3,distidx=0))
print(latt.neighbors(5,distidx=0))

The resulting error is:

[1 0 4 6 5 8]
[7 4 2 8 0]

Expected behavior
[1 0 4 6 5 8]
[7 4 2 8 0 3]

Environment

  • lattpy version: 0.7.7
  • OS and Python version: MacOs, python3.8

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.