Git Product home page Git Product logo

dean0x7d / pybinding Goto Github PK

View Code? Open in Web Editor NEW
182.0 182.0 67.0 1.94 MB

Scientific Python package for tight-binding calculations in solid state physics

Home Page: https://pybinding.site

License: BSD 2-Clause "Simplified" License

CMake 1.56% C++ 55.60% Python 41.56% Cuda 1.22% Shell 0.05%
band-structure condensed-matter quantum-mechanics scientific-computing solid-state-physics tight-binding

pybinding's People

Contributors

dean0x7d avatar mandelkovic 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pybinding's Issues

Edit the hamilton matrix

Hi.
I have been testing the module with a lattice of kagome and this generated a doubt, the hamilton matrix gives me pure ones but I would like to know if this default matrix can be edited and if this is how I can do it from jupyter lab.
Thank you.

install pybinding

Hi Sir,
I want to install pybinding, but this is the error (I have a win64,7):

binding\repository\graphene
copying pybinding\repository\graphene\utils.py -> build\lib.win-amd64-3.6\py
binding\repository\graphene
copying pybinding\repository\graphene_init_.py -> build\lib.win-amd64-3.6
\pybinding\repository\graphene
creating build\lib.win-amd64-3.6\pybinding\tests
copying tests\conftest.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_kpm.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_kwant.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_lattice.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_leads.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_model.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_modifiers.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_parallel.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_pickle.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_results.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_shape.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_solver.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_system.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests\test_wrapper.py -> build\lib.win-amd64-3.6\pybinding\tests
copying tests_init_.py -> build\lib.win-amd64-3.6\pybinding\tests
running egg_info
writing pybinding.egg-info\PKG-INFO
writing dependency_links to pybinding.egg-info\dependency_links.txt
writing requirements to pybinding.egg-info\requires.txt
writing top-level names to pybinding.egg-info\top_level.txt
reading manifest file 'pybinding.egg-info\SOURCES.txt'
reading manifest template 'setup.manifest'
no previously-included directories found matching 'cppcore\deps\catch'
no previously-included directories found matching 'docs_api'
no previously-included directories found matching 'tests\failed'
warning: no previously-included files matching '*.pyc' found anywhere in dis
tribution
writing manifest file 'pybinding.egg-info\SOURCES.txt'
copying tests\local.cfg -> build\lib.win-amd64-3.6\pybinding\tests
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_data
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\conductivity[graphene-const_potential].pbz -

build\lib.win-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\conductivity[graphene-magnetic_field].pbz ->
build\lib.win-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\dos[graphene-const_potential].pbz -> build\l
ib.win-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\dos[graphene-magnetic_field].pbz -> build\li
b.win-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\ldos[graphene-const_potential].pbz -> build
lib.win-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\ldos[graphene-magnetic_field].pbz -> build\l
ib.win-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\ldos[graphene-pristine-oversized].pbz -> bui
ld\lib.win-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\ldos[graphene-pristine].pbz -> build\lib.win
-amd64-3.6\pybinding\tests\baseline_data\kpm
copying tests\baseline_data\kpm\ldos[mos2].pbz -> build\lib.win-amd64-3.6\py
binding\tests\baseline_data\kpm
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_data\lattice
copying tests\baseline_data\lattice\expected[graphene-bilayer].pbz -> build
lib.win-amd64-3.6\pybinding\tests\baseline_data\lattice
copying tests\baseline_data\lattice\expected[graphene-monolayer-4atom].pbz -
build\lib.win-amd64-3.6\pybinding\tests\baseline_data\lattice
copying tests\baseline_data\lattice\expected[graphene-monolayer-nn].pbz -> b
uild\lib.win-amd64-3.6\pybinding\tests\baseline_data\lattice
copying tests\baseline_data\lattice\expected[graphene-monolayer].pbz -> buil
d\lib.win-amd64-3.6\pybinding\tests\baseline_data\lattice
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_data\parallel
copying tests\baseline_data\parallel\ndsweep.pbz -> build\lib.win-amd64-3.6
pybinding\tests\baseline_data\parallel
copying tests\baseline_data\parallel\sweep.pbz -> build\lib.win-amd64-3.6\py
binding\tests\baseline_data\parallel
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_data\shape
copying tests\baseline_data\shape\freeform.pbz -> build\lib.win-amd64-3.6\py
binding\tests\baseline_data\shape
copying tests\baseline_data\shape\polygon_expected[diamond].pbz -> build\lib
.win-amd64-3.6\pybinding\tests\baseline_data\shape
copying tests\baseline_data\shape\polygon_expected[pentagon].pbz -> build\li
b.win-amd64-3.6\pybinding\tests\baseline_data\shape
copying tests\baseline_data\shape\polygon_expected[square].pbz -> build\lib.
win-amd64-3.6\pybinding\tests\baseline_data\shape
copying tests\baseline_data\shape\polygon_expected[triangle90].pbz -> build
lib.win-amd64-3.6\pybinding\tests\baseline_data\shape
copying tests\baseline_data\shape\polygon_expected[triangle].pbz -> build\li
b.win-amd64-3.6\pybinding\tests\baseline_data\shape
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_data\solver
copying tests\baseline_data\solver\dos[arpack-graphene-magnetic_field].pbz -
build\lib.win-amd64-3.6\pybinding\tests\baseline_data\solver
copying tests\baseline_data\solver\dos[feast-graphene-magnetic_field].pbz ->
build\lib.win-amd64-3.6\pybinding\tests\baseline_data\solver
copying tests\baseline_data\solver\eigenvalues[arpack-graphene-magnetic_fiel
d].pbz -> build\lib.win-amd64-3.6\pybinding\tests\baseline_data\solver
copying tests\baseline_data\solver\eigenvalues[feast-graphene-magnetic_field
].pbz -> build\lib.win-amd64-3.6\pybinding\tests\baseline_data\solver
copying tests\baseline_data\solver\lapack.pbz -> build\lib.win-amd64-3.6\pyb
inding\tests\baseline_data\solver
copying tests\baseline_data\solver\spatial_ldos[arpack-graphene-magnetic_fie
ld].pbz -> build\lib.win-amd64-3.6\pybinding\tests\baseline_data\solver
copying tests\baseline_data\solver\spatial_ldos[feast-graphene-magnetic_fiel
d].pbz -> build\lib.win-amd64-3.6\pybinding\tests\baseline_data\solver
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-bilayer].pbz -> build\l
ib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-monolayer-4atom-periodi
c-2d].pbz -> build\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-monolayer-4atom].pbz ->
build\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-monolayer-alt].pbz -> b
uild\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-monolayer-nn].pbz -> bu
ild\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-monolayer-periodic-1d-a
lt].pbz -> build\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-monolayer-periodic-1d].
pbz -> build\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-monolayer-periodic-2d].
pbz -> build\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
copying tests\baseline_data\system\expected[graphene-monolayer].pbz -> build
\lib.win-amd64-3.6\pybinding\tests\baseline_data\system
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_plots
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_plots\results
copying tests\baseline_plots\results\structure_map_plot.png -> build\lib.win
-amd64-3.6\pybinding\tests\baseline_plots\results
creating build\lib.win-amd64-3.6\pybinding\tests\baseline_plots\system
copying tests\baseline_plots\system\system_plot.png -> build\lib.win-amd64-3
.6\pybinding\tests\baseline_plots\system
creating build\lib.win-amd64-3.6\pybinding\tests\utils
copying tests\utils_init_.py -> build\lib.win-amd64-3.6\pybinding\tests\u
tils
copying tests\utils\compare_figures.py -> build\lib.win-amd64-3.6\pybinding
tests\utils
copying tests\utils\fuzzy_equal.py -> build\lib.win-amd64-3.6\pybinding\test
s\utils
copying tests\utils\path.py -> build\lib.win-amd64-3.6\pybinding\tests\utils

running build_ext
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17134.0 to target Windows 6.1.7601.
-- The C compiler identification is MSVC 19.15.26732.1
-- The CXX compiler identification is MSVC 19.15.26732.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu

dio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu
dio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S
tudio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S
tudio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Downloading eigen3 v3.3.3...
curl: (52) Empty reply from server
CMake Error at cppcore/cmake/download.cmake:15 (message):
Could not download https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz
Call Stack (most recent call first):
cppcore/cmake/download.cmake:24 (download)
cppcore/cmake/download.cmake:65 (download_tar_gz)
cppcore/CMakeLists.txt:116 (download_dependency)

-- Configuring incomplete, errors occurred!
See also "C:/Users/sana/AppData/Local/Temp/pip-req-build-aohfjani/build/temp

.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/sana/AppData/Local/Temp/pip-req-build-aohfjani/build/temp
.win-amd64-3.6/Release/CMakeFiles/CMakeError.log".
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17134.0 to target Windows 6.1.7601.
-- The C compiler identification is MSVC 19.15.26732.1
-- The CXX compiler identification is MSVC 19.15.26732.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu
dio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu
dio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S
tudio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S
tudio/2017/Community/VC/Tools/MSVC/14.15.26726/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Downloading eigen3 v3.3.3...
curl: (52) Empty reply from server
CMake Error at cppcore/cmake/download.cmake:15 (message):
Could not download https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz
Call Stack (most recent call first):
cppcore/cmake/download.cmake:24 (download)
cppcore/cmake/download.cmake:65 (download_tar_gz)
cppcore/CMakeLists.txt:116 (download_dependency)

-- Configuring incomplete, errors occurred!
See also "C:/Users/sana/AppData/Local/Temp/pip-req-build-aohfjani/build/temp

.win-amd64-3.6/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/sana/AppData/Local/Temp/pip-req-build-aohfjani/build/temp
.win-amd64-3.6/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "C:\Users\sana\AppData\Local\Temp\pip-req-build-aohfjani\setup.py", l
ine 74, in build_extension
build()
File "C:\Users\sana\AppData\Local\Temp\pip-req-build-aohfjani\setup.py", l
ine 70, in build
check_call(["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp, e
nv=env)
File "c:\programdata\anaconda3\lib\subprocess.py", line 291, in check_call

    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\sana\\AppData\

\Local\Temp\pip-req-build-aohfjani', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Use
rs\sana\AppData\Local\Temp\pip-req-build-aohfjani\build\lib.win-amd64-3.6
', '-DPYTHON_EXECUTABLE=c:\programdata\anaconda3\python.exe', '-DPB_WERROR=OF
F', '-DPB_TESTS=OFF', '-DPB_NATIVE_SIMD=ON', '-DPB_MKL=OFF', '-DPB_CUDA=OFF', '-
DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\sana\AppData\Local\Temp\p
ip-req-build-aohfjani\build\lib.win-amd64-3.6', '-A', 'x64']' returned non-zer
o exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\sana\AppData\Local\Temp\pip-req-build-aohfjani\setup.py", l

ine 132, in
cmdclass=dict(build_ext=CMakeBuild)
File "c:\programdata\anaconda3\lib\site-packages\setuptools_init_.py",
line 129, in setup
return distutils.core.setup(**attrs)
File "c:\programdata\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\programdata\anaconda3\lib\distutils\dist.py", line 955, in run_co
mmands
self.run_command(cmd)
File "c:\programdata\anaconda3\lib\distutils\dist.py", line 974, in run_co
mmand
cmd_obj.run()
File "c:\programdata\anaconda3\lib\site-packages\setuptools\command\instal
l.py", line 61, in run
return orig.install.run(self)
File "c:\programdata\anaconda3\lib\distutils\command\install.py", line 545
, in run
self.run_command('build')
File "c:\programdata\anaconda3\lib\distutils\cmd.py", line 313, in run_com
mand
self.distribution.run_command(command)
File "c:\programdata\anaconda3\lib\distutils\dist.py", line 974, in run_co
mmand
cmd_obj.run()
File "c:\programdata\anaconda3\lib\distutils\command\build.py", line 135,
in run
self.run_command(cmd_name)
File "c:\programdata\anaconda3\lib\distutils\cmd.py", line 313, in run_com
mand
self.distribution.run_command(command)
File "c:\programdata\anaconda3\lib\distutils\dist.py", line 974, in run_co
mmand
cmd_obj.run()
File "C:\Users\sana\AppData\Local\Temp\pip-req-build-aohfjani\setup.py", l
ine 38, in run
self.build_extension(ext)
File "C:\Users\sana\AppData\Local\Temp\pip-req-build-aohfjani\setup.py", l
ine 77, in build_extension
build()
File "C:\Users\sana\AppData\Local\Temp\pip-req-build-aohfjani\setup.py", l
ine 70, in build
check_call(["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp, e
nv=env)
File "c:\programdata\anaconda3\lib\subprocess.py", line 291, in check_call

    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\sana\\AppData\

\Local\Temp\pip-req-build-aohfjani', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Use
rs\sana\AppData\Local\Temp\pip-req-build-aohfjani\build\lib.win-amd64-3.6
', '-DPYTHON_EXECUTABLE=c:\programdata\anaconda3\python.exe', '-DPB_WERROR=OF
F', '-DPB_TESTS=OFF', '-DPB_NATIVE_SIMD=ON', '-DPB_MKL=OFF', '-DPB_CUDA=OFF', '-
DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\sana\AppData\Local\Temp\p
ip-req-build-aohfjani\build\lib.win-amd64-3.6', '-A', 'x64']' returned non-zer
o exit status 1.

----------------------------------------

Command "c:\programdata\anaconda3\python.exe -u -c "import setuptools, tokenize;
file='C:\Users\sana\AppData\Local\Temp\pip-req-build-aohfjani\setup.p
y';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n
');f.close();exec(compile(code, file, 'exec'))" install --record C:\Users\sa
na\AppData\Local\Temp\pip-record-j6a2irnh\install-record.txt --single-version-ex
ternally-managed --compile" failed with error code 1 in C:\Users\sana\AppData\Lo
cal\Temp\pip-req-build-aohfjani\

Any ideas?
Thank you in advance.

Random hopping

Hi,

Is it possible to generate randomized hopping amplitude?
It is feasible in kwant by defining a function which generates a
random number and then call it in the definitions of hoppings.
I tried this on pybinding but it returns the uniform hopping, i.e.,
the function is only called once then every sites are connected by
the same hopping amplitude.

Attached below is the snippet of my code

import pybinding as pb
import numpy as np

def random_hopping(mu):
    return np.random.normal(mu, 1)


def chain_lattice(d, mu):
    lat = pb.Lattice(a1=[d])
    lat.add_sublattices(('A', [0]))
    lat.add_hoppings( ([0, 1], 'A', 'A', random_hopping(mu)),
    ([1, 0], 'A', 'A', random_hopping(mu)))
    return lat

lattice = chain_lattice(d=0.1,mu=0)
model = pb.Model(
    lattice,
    pb.primitive(a1=20)
)

The resulting finite size model shows that
all the hopping matrix elements are the same.

Thx~

Finite Boundary condition

Hello everyone,
I have working with the Pybinding for a while, I am interesting in the finite structure. I have the following question:
How does Pybinding handle the boundary condition in the direction where we set to finite? (please see the image below) Is it the boundary condition in Pybinding is the endpoint boundary condition? Thank you in advance!
shape_symmetry-5

Build windows

Hi, I am having some trouble building from the source in windows, the pip output says that there are undefined function calls, can you give me a little crash course on the windows compilation?

Pip installation fails on windows

Hello, I was trying to install pybinding for python 3.12 on windows using command prompt and had the cmake make list error from #46,
and got the same setup tools error but it is not fixed when I use pip install setuptools as it says I already have an up to date version,
as seen here:
`C:\Users\oldpo>py -m pip install -i https://test.pypi.org/simple/ pybinding
Looking in indexes: https://test.pypi.org/simple/
Collecting pybinding
Downloading https://test-files.pythonhosted.org/packages/29/e7/d11577e8d603994c27443cebafd1f6b8bdfe84c6e8a641dd41bc1c3c9c21/pybinding-1.0.3.tar.gz (759 kB)
---------------------------------------- 759.1/759.1 kB 4.8 MB/s eta 0:00:00
Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
Looking in indexes: https://test.pypi.org/simple/
ERROR: Could not find a version that satisfies the requirement setuptools>=42 (from versions: none)
ERROR: No matching distribution found for setuptools>=42
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

C:\Users\oldpo>py -m pip install setuptools
Requirement already satisfied: setuptools in c:\users\oldpo\appdata\local\programs\python\python312\lib\site-packages (69.0.2)`

brillouin_zone -> scipy Voronoi segfaults on macos 10.10.5

Hi Pybinding people,

8 June: not your problem -- cd .../scipy/spatial/tests; pytest test_qhull.py crashes too, also in scipy 1.7.0rc1 .
scipy/scipy#9858 from 2019 mentions "older versions of Xcode / MacOS".


brillouin_zone -> scipy Voronoi segfaults for me, in 0.9.5
with numpy 1.20.3 scipy 1.6.3 python 3.7.9 mac 10.10.5
both in test_brillouin_zone and examples phosphorene --

cd .../site/pybinding/tests
pytest -v test_lattice.py::test_brillouin_zone
	platform darwin -- Python 3.7.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
	cachedir: .pytest_cache
	rootdir: /opt/local/py3/lib/python3.7/site-packages/pybinding/tests
	collected 1 item                                                                         

	test_lattice.py::test_brillouin_zone Segmentation fault  (no stacktrace ?)


cd .../pybinding-master/docs/examples/lattice
python phosphorene.py
	Fatal Python error: Segmentation fault

	Current thread 0x00007fff75e3e300 (most recent call first):
	  File "/opt/local/py3/lib/python3.7/site-packages/pybinding/lattice.py", line 333 in brillouin_zone
	  File "/opt/local/py3/lib/python3.7/site-packages/pybinding/lattice.py", line 524 in plot_brillouin_zone
	  File "/opt/local/py/pybinding-master/docs/examples/lattice/phosphorene.py", line 72 in <module>

lattice.py:333
            vor = Voronoi([p[:self.ndim] for p in points])

Are other platforms ok ? Maybe my old 10.10.5 ?
scipy.spatial.Delaunay crashed for me a couple of years ago, haven't checked if it still does.
Possibly related: scipy/scipy#8929

conda install cmake numpy scipy matplotlib in your good install doc
didn't help -- how does that differ from just
pip install numpy scipy matplotlib pybinding ?

thanks, cheers

minimum size of graphene twist bilayers to avoid bulk construction in below 1 degree

Hi pybinding friends,
I try to build the bilayer G/G and G/hBN separately, and in building two monolayers for constructing a supercell of twist bilayer graphene I do not know the minimum number of atoms or in another world the minimum size of the circular layer to avoid the bulk structure for a supercell, in DFT usually, a vacuum add to two layers about 20 Angstrom, so for example, is a 1-nanometer radius of layers create a supercell for twist bilayers in angel bellow the 1 degree by using the PYBINDING?
thank you in advance for your guidance and help

accents in `changelog.md` cause errors during installs

I came across a weird behavior during installation in a ubuntu based docker container.
the specific error message was:

Collecting git+https://github.com/oroszl/pybinding.git
  Cloning https://github.com/oroszl/pybinding.git to /tmp/pip-o1lx1h0j-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-o1lx1h0j-build/setup.py", line 105, in <module>
        long_description="Documentation: http://pybinding.site/\n\n" + changelog(),
      File "/tmp/pip-o1lx1h0j-build/setup.py", line 94, in changelog
        log = file.read()
      File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 394: ordinal not in range(128)

After some trial and error installation proceeds normally if I ditch the accents from my own name in
https://github.com/dean0x7d/pybinding/blob/master/changelog.md
I guess I am ok without my accents if that means that more people can install pybinding :)
Funnily enough in a debian docker container the above situation did not occur.

Modifiers not working

I was going through the tutorial and there's an issue with anything that involves using the modifiers, i.e. strain, defects, magnetic field. The process simply doesn't terminate.

For instance, from section 7.5 Defects and Strain, we have the following example:

"""Strain a triangular system by pulling on its vertices"""
import pybinding as pb
import numpy as np
import matplotlib.pyplot as plt
from pybinding.repository import graphene
from math import pi

pb.pltutils.use_style()

def triaxial_strain(c):
"""Strain-induced displacement and hopping energy modification"""
@pb.site_position_modifier
def displacement(x, y, z):
ux = 2c * xy
uy = c * (x2 - y2)
return x + ux, y + uy, z

@pb.hopping_energy_modifier
def strained_hopping(energy, x1, y1, z1, x2, y2, z2):
    l = np.sqrt((x1-x2)**2 + (y1-y2)**2 + (z1-z2)**2)
    w = l / graphene.a_cc - 1
    return energy * np.exp(-3.37 * w)

return displacement, strained_hopping

model = pb.Model(
graphene.monolayer(),
pb.regular_polygon(num_sides=3, radius=2, angle=pi),
triaxial_strain(c=0.1)
)
model.plot()
plt.show()

This will not terminate. If I comment out model.plot(), it will terminate. However, if I then type in model.system.x, or model.hamiltonian that doesn't terminate either. This suggests that model is not being set up correctly when there is a modifier in the argument. Any ideas what might be going on?

I have numpy 1.15.4, scipy 1.2.0, python 3.7, and I'm using Spyder 3.3.3

Modifying specific hoppings

Hi I am modelling pillars in graphene to try and replicate the results of a paper https://rdcu.be/dxC9c and need to be able to change the hoppings differently to match their equations, and I tried using hop_id arguments, however I can't seem to get the hop_id conditional statements like used in the documentation for sub_id too to pick up on the hopping names. I tried using register_hopping_energies to name them as that was the only method I could see in the documentation.

a_cc = a/np.sqrt(3) # nm, carbon carbon bond length
gamma = 3.033 # eV hopping energy from full solution of tight binding nearest neighbor
t1 = gamma
t2 = gamma
t3 = gamma

lattice = pb.Lattice(a1=[a/2,(np.sqrt(3)*a)/2],a2=[a/2,-(np.sqrt(3)*a)/2])
lattice.add_sublattices(('A',[0, -a_cc/2]), ('B', [0, a_cc/2]))
lattice.add_hoppings(([0,0],'A','B',t1),([0,1],'A','B',t2),([1,0],'B','A',t3))
hoppingMap = {'t1':t1}
lattice.register_hopping_energies(hoppingMap)
hoppings = lattice.hoppings
nhop = lattice.nhop
lattice.impl
lattice.plot()
plt.show()
def vectorPotential(ab, x, y):
    b1Term = -(1/sqrt(3))*np.sin((2*pi*x/ab) - (2*pi*y/(ab*sqrt(3))))
    b2Term = (2/sqrt(3))*np.cos(4*pi*y/(sqrt(3)*ab))
    b3Term = (1/sqrt(3))*np.cos((2*pi*x/ab)+(2*pi*y/(ab*sqrt(3))))
    Ax = b1Term + b2Term + b3Term
    return Ax
shiftInEnergies = []
def pilarStrain(B,ab):
    @pb.hopping_energy_modifier
    def strained_hopping(energy, x1, y1, z1, x2, y2, z2, hop_id):
        Ax = vectorPotential(ab,x1,y1)
        t1_shifted = gamma*(1-(((3*pi*a_cc*B)/(2*phi0))*Ax))
        t2_shifted = gamma*(1+(((3*pi*a_cc*B)/(2*phi0))*Ax))
        t3_shifted = t2_shifted
        xVec = x2-x1
        yVec = y2-y1
        energy[hop_id == 't1'] *= 1.1
        if hop_id == 't1':
            energy = t1_shifted
        elif hop_id == 't2':
            energy = t2_shifted
        elif hop_id == 't3':
            energy = t3_shifted
        global shiftInEnergies
        shiftInEnergies = energy - gamma
        return energy
      
    return  strained_hopping

can not install on windows

here is the log, I don't know what is happening

Collecting pybinding
  Using cached pybinding-0.9.5.tar.gz (1.6 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.12 in c:\users\yx\miniconda3\lib\site-packages (from pybinding) (1.25.2)
Requirement already satisfied: scipy>=0.19 in c:\users\yx\miniconda3\lib\site-packages (from pybinding) (1.11.1)
Requirement already satisfied: matplotlib>=2.0 in c:\users\yx\miniconda3\lib\site-packages (from pybinding) (3.7.1)
Collecting pytest>=5.0 (from pybinding)
  Using cached pytest-7.4.1-py3-none-any.whl (324 kB)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\yx\miniconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (1.0.5)
Requirement already satisfied: cycler>=0.10 in c:\users\yx\miniconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\yx\miniconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (4.25.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\yx\miniconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (1.4.4)
Requirement already satisfied: packaging>=20.0 in c:\users\yx\miniconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (23.0)
Requirement already satisfied: pillow>=6.2.0 in c:\users\yx\miniconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (9.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in c:\users\yx\miniconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\yx\miniconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (2.8.2)
Collecting iniconfig (from pytest>=5.0->pybinding)
  Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Requirement already satisfied: pluggy<2.0,>=0.12 in c:\users\yx\miniconda3\lib\site-packages (from pytest>=5.0->pybinding) (1.0.0)
Requirement already satisfied: colorama in c:\users\yx\miniconda3\lib\site-packages (from pytest>=5.0->pybinding) (0.4.6)
Requirement already satisfied: six>=1.5 in c:\users\yx\miniconda3\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.0->pybinding) (1.16.0)
Building wheels for collected packages: pybinding
  Building wheel for pybinding (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [606 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\chebyshev.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\constants.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\greens.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\lattice.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\leads.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\model.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\modifier.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\parallel.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\pltutils.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\results.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\shape.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\solver.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\system.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\__about__.py -> build\lib.win-amd64-cpython-311\pybinding
      copying pybinding\__init__.py -> build\lib.win-amd64-cpython-311\pybinding
      creating build\lib.win-amd64-cpython-311\pybinding\repository
      copying pybinding\repository\examples.py -> build\lib.win-amd64-cpython-311\pybinding\repository
      copying pybinding\repository\group6_tmd.py -> build\lib.win-amd64-cpython-311\pybinding\repository
      copying pybinding\repository\phosphorene.py -> build\lib.win-amd64-cpython-311\pybinding\repository
      copying pybinding\repository\__init__.py -> build\lib.win-amd64-cpython-311\pybinding\repository
      creating build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\alias.py -> build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\collections.py -> build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\deprecated.py -> build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\fuzzy_set.py -> build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\inspect.py -> build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\kwant.py -> build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\pickle.py -> build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\structure.py -> build\lib.win-amd64-cpython-311\pybinding\support
      copying pybinding\support\__init__.py -> build\lib.win-amd64-cpython-311\pybinding\support
      creating build\lib.win-amd64-cpython-311\pybinding\utils
      copying pybinding\utils\cpuinfo.py -> build\lib.win-amd64-cpython-311\pybinding\utils
      copying pybinding\utils\misc.py -> build\lib.win-amd64-cpython-311\pybinding\utils
      copying pybinding\utils\progressbar.py -> build\lib.win-amd64-cpython-311\pybinding\utils
      copying pybinding\utils\time.py -> build\lib.win-amd64-cpython-311\pybinding\utils
      copying pybinding\utils\__init__.py -> build\lib.win-amd64-cpython-311\pybinding\utils
      creating build\lib.win-amd64-cpython-311\pybinding\repository\graphene
      copying pybinding\repository\graphene\constants.py -> build\lib.win-amd64-cpython-311\pybinding\repository\graphene
      copying pybinding\repository\graphene\lattice.py -> build\lib.win-amd64-cpython-311\pybinding\repository\graphene
      copying pybinding\repository\graphene\modifiers.py -> build\lib.win-amd64-cpython-311\pybinding\repository\graphene
      copying pybinding\repository\graphene\shape.py -> build\lib.win-amd64-cpython-311\pybinding\repository\graphene
      copying pybinding\repository\graphene\utils.py -> build\lib.win-amd64-cpython-311\pybinding\repository\graphene
      copying pybinding\repository\graphene\__init__.py -> build\lib.win-amd64-cpython-311\pybinding\repository\graphene
      creating build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\conftest.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_kpm.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_kwant.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_lattice.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_leads.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_model.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_modifiers.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_parallel.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_pickle.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_results.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_shape.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_solver.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_system.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\test_wrapper.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      copying tests\__init__.py -> build\lib.win-amd64-cpython-311\pybinding\tests
      running egg_info
      writing pybinding.egg-info\PKG-INFO
      writing dependency_links to pybinding.egg-info\dependency_links.txt
      writing requirements to pybinding.egg-info\requires.txt
      writing top-level names to pybinding.egg-info\top_level.txt
      reading manifest file 'pybinding.egg-info\SOURCES.txt'
      reading manifest template 'setup.manifest'
      no previously-included directories found matching 'cppcore\deps\catch'
      no previously-included directories found matching 'docs\_api'
      no previously-included directories found matching 'tests\failed'
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      adding license file 'license.md'
      writing manifest file 'pybinding.egg-info\SOURCES.txt'
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.baseline_data.kpm' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.baseline_data.kpm' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.baseline_data.kpm' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.baseline_data.kpm' to be distributed and are
              already explicitly excluding 'pybinding.tests.baseline_data.kpm' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.baseline_data.lattice' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.baseline_data.lattice' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.baseline_data.lattice' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.baseline_data.lattice' to be distributed and are
              already explicitly excluding 'pybinding.tests.baseline_data.lattice' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.baseline_data.parallel' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.baseline_data.parallel' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.baseline_data.parallel' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.baseline_data.parallel' to be distributed and are
              already explicitly excluding 'pybinding.tests.baseline_data.parallel' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.baseline_data.shape' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.baseline_data.shape' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.baseline_data.shape' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.baseline_data.shape' to be distributed and are
              already explicitly excluding 'pybinding.tests.baseline_data.shape' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.baseline_data.solver' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.baseline_data.solver' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.baseline_data.solver' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.baseline_data.solver' to be distributed and are
              already explicitly excluding 'pybinding.tests.baseline_data.solver' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.baseline_data.system' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.baseline_data.system' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.baseline_data.system' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.baseline_data.system' to be distributed and are
              already explicitly excluding 'pybinding.tests.baseline_data.system' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.baseline_plots.results' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.baseline_plots.results' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.baseline_plots.results' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.baseline_plots.results' to be distributed and are
              already explicitly excluding 'pybinding.tests.baseline_plots.results' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.baseline_plots.system' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.baseline_plots.system' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.baseline_plots.system' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.baseline_plots.system' to be distributed and are
              already explicitly excluding 'pybinding.tests.baseline_plots.system' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      C:\Users\yx\miniconda3\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pybinding.tests.utils' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pybinding.tests.utils' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pybinding.tests.utils' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pybinding.tests.utils' to be distributed and are
              already explicitly excluding 'pybinding.tests.utils' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      copying tests\local.cfg -> build\lib.win-amd64-cpython-311\pybinding\tests
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\conductivity[graphene-const_potential].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\conductivity[graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\dos[graphene-const_potential].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\dos[graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\ldos[graphene-const_potential].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\ldos[graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\ldos[graphene-pristine-oversized].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\ldos[graphene-pristine].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      copying tests\baseline_data\kpm\ldos[mos2].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\kpm
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\lattice
      copying tests\baseline_data\lattice\expected[graphene-bilayer].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\lattice
      copying tests\baseline_data\lattice\expected[graphene-monolayer-4atom].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\lattice
      copying tests\baseline_data\lattice\expected[graphene-monolayer-nn].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\lattice
      copying tests\baseline_data\lattice\expected[graphene-monolayer].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\lattice
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\parallel
      copying tests\baseline_data\parallel\ndsweep.pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\parallel
      copying tests\baseline_data\parallel\sweep.pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\parallel
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\shape
      copying tests\baseline_data\shape\freeform.pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\shape
      copying tests\baseline_data\shape\polygon_expected[diamond].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\shape
      copying tests\baseline_data\shape\polygon_expected[pentagon].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\shape
      copying tests\baseline_data\shape\polygon_expected[square].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\shape
      copying tests\baseline_data\shape\polygon_expected[triangle90].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\shape
      copying tests\baseline_data\shape\polygon_expected[triangle].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\shape
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\solver
      copying tests\baseline_data\solver\dos[arpack-graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\solver
      copying tests\baseline_data\solver\dos[feast-graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\solver
      copying tests\baseline_data\solver\eigenvalues[arpack-graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\solver
      copying tests\baseline_data\solver\eigenvalues[feast-graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\solver
      copying tests\baseline_data\solver\lapack.pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\solver
      copying tests\baseline_data\solver\spatial_ldos[arpack-graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\solver
      copying tests\baseline_data\solver\spatial_ldos[feast-graphene-magnetic_field].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\solver
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-bilayer].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-monolayer-4atom-periodic-2d].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-monolayer-4atom].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-monolayer-alt].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-monolayer-nn].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-monolayer-periodic-1d-alt].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-monolayer-periodic-1d].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-monolayer-periodic-2d].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      copying tests\baseline_data\system\expected[graphene-monolayer].pbz -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_data\system
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_plots
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_plots\results
      copying tests\baseline_plots\results\structure_map_plot.png -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_plots\results
      creating build\lib.win-amd64-cpython-311\pybinding\tests\baseline_plots\system
      copying tests\baseline_plots\system\system_plot.png -> build\lib.win-amd64-cpython-311\pybinding\tests\baseline_plots\system
      creating build\lib.win-amd64-cpython-311\pybinding\tests\utils
      copying tests\utils\__init__.py -> build\lib.win-amd64-cpython-311\pybinding\tests\utils
      copying tests\utils\compare_figures.py -> build\lib.win-amd64-cpython-311\pybinding\tests\utils
      copying tests\utils\fuzzy_equal.py -> build\lib.win-amd64-cpython-311\pybinding\tests\utils
      copying tests\utils\path.py -> build\lib.win-amd64-cpython-311\pybinding\tests\utils
      running build_ext
      C:\Users\yx\AppData\Local\Temp\pip-install-pf38gbti\pybinding_a46e61d141a041bd978e585bdac3dd21\setup.py:33: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
      -- Building for: NMake Makefiles
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.


      CMake Error at CMakeLists.txt:2 (project):
        Generator

          NMake Makefiles

        does not support platform specification, but platform

          x64

        was specified.


      CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
      -- Configuring incomplete, errors occurred!
      -- Building for: NMake Makefiles
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.


      CMake Error at CMakeLists.txt:2 (project):
        Generator

          NMake Makefiles

        does not support platform specification, but platform

          x64

        was specified.


      CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "C:\Users\yx\AppData\Local\Temp\pip-install-pf38gbti\pybinding_a46e61d141a041bd978e585bdac3dd21\setup.py", line 73, in build_extension
          build()
        File "C:\Users\yx\AppData\Local\Temp\pip-install-pf38gbti\pybinding_a46e61d141a041bd978e585bdac3dd21\setup.py", line 69, in build
          check_call(["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
        File "C:\Users\yx\miniconda3\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\yx\\AppData\\Local\\Temp\\pip-install-pf38gbti\\pybinding_a46e61d141a041bd978e585bdac3dd21', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\yx\\AppData\\Local\\Temp\\pip-install-pf38gbti\\pybinding_a46e61d141a041bd978e585bdac3dd21\\build\\lib.win-amd64-cpython-311', '-DPYTHON_EXECUTABLE=C:\\Users\\yx\\miniconda3\\python.exe', '-DPB_WERROR=OFF', '-DPB_TESTS=OFF', '-DPB_NATIVE_SIMD=ON', '-DPB_MKL=OFF', '-DPB_CUDA=OFF', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\yx\\AppData\\Local\\Temp\\pip-install-pf38gbti\\pybinding_a46e61d141a041bd978e585bdac3dd21\\build\\lib.win-amd64-cpython-311', '-A', 'x64']' returned non-zero exit status 1.

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\yx\AppData\Local\Temp\pip-install-pf38gbti\pybinding_a46e61d141a041bd978e585bdac3dd21\setup.py", line 100, in <module>
          setup(
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\dist.py", line 1244, in run_command
          super().run_command(command)
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\yx\miniconda3\Lib\site-packages\wheel\bdist_wheel.py", line 325, in run
          self.run_command("build")
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\dist.py", line 1244, in run_command
          super().run_command(command)
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
          self.run_command(cmd_name)
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\dist.py", line 1244, in run_command
          super().run_command(command)
        File "C:\Users\yx\miniconda3\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "C:\Users\yx\AppData\Local\Temp\pip-install-pf38gbti\pybinding_a46e61d141a041bd978e585bdac3dd21\setup.py", line 38, in run
          self.build_extension(ext)
        File "C:\Users\yx\AppData\Local\Temp\pip-install-pf38gbti\pybinding_a46e61d141a041bd978e585bdac3dd21\setup.py", line 76, in build_extension
          build()
        File "C:\Users\yx\AppData\Local\Temp\pip-install-pf38gbti\pybinding_a46e61d141a041bd978e585bdac3dd21\setup.py", line 69, in build
          check_call(["cmake", ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env)
        File "C:\Users\yx\miniconda3\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\yx\\AppData\\Local\\Temp\\pip-install-pf38gbti\\pybinding_a46e61d141a041bd978e585bdac3dd21', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\yx\\AppData\\Local\\Temp\\pip-install-pf38gbti\\pybinding_a46e61d141a041bd978e585bdac3dd21\\build\\lib.win-amd64-cpython-311', '-DPYTHON_EXECUTABLE=C:\\Users\\yx\\miniconda3\\python.exe', '-DPB_WERROR=OFF', '-DPB_TESTS=OFF', '-DPB_NATIVE_SIMD=ON', '-DPB_MKL=OFF', '-DPB_CUDA=OFF', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\yx\\AppData\\Local\\Temp\\pip-install-pf38gbti\\pybinding_a46e61d141a041bd978e585bdac3dd21\\build\\lib.win-amd64-cpython-311', '-A', 'x64']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pybinding
  Running setup.py clean for pybinding
Failed to build pybinding
ERROR: Could not build wheels for pybinding, which is required to install pyproject.toml-based projects

update PyBind11-version

The current linked version of PyBind11 isn't compatible with the latest version of Visual Studio. The Py_ssize_t-variable isn't available. In a future release, a new version will be linked. Please contact me at [email protected] if you encouter a similar problem on Windows machines.

installation error

I used the line: pip install git+https://github.com/dean0x7d/pybinding.git

And I got this error:
Collecting git+https://github.com/dean0x7d/pybinding.git
Cloning https://github.com/dean0x7d/pybinding.git to c:\users\usuario\appdata\local\temp\pip-req-build-02uqj574
Running command git clone -q https://github.com/dean0x7d/pybinding.git 'C:\Users\USUARIO\AppData\Local\Temp\pip-req-build-02uqj574'
ERROR: Error [WinError 2] El sistema no puede encontrar el archivo especificado while executing command git clone -q https://github.com/dean0x7d/pybinding.git 'C:\Users\USUARIO\AppData\Local\Temp\pip-req-build-02uqj574'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

installation with pip fails

Hello
the installation fails. The final message says

  subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pybinding
Running setup.py clean for pybinding
Failed to build pybinding
ERROR: Could not build wheels for pybinding, which is required to install pyproject.toml-based projects

Thank you for your help
Romuald

Installation Error

Problem with the installation.

Operating system is Arch Linux, Python version is 3.6.1, Cmake 3.8.2, GCC 7.1.1.

pip install pybinding

Running setup.py install for pybinding ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-oz72p0ht/pybinding/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-yjtdpjk5-record/install-record.txt --single-version-externally-managed --compile:

Continued at https://pastebin.com/60iN0tEv

pip list

appdirs (1.4.3)
cycler (0.10.0)
decorator (4.0.11)
ipython (5.3.0)
ipython-genutils (0.1.0)
jedi (0.10.2)
louis (3.0.0)
matplotlib (2.0.2)
numpy (1.13.0)
packaging (16.8)
pexpect (4.2.1)
pickleshare (0.7.4)
pip (9.0.1)
prompt-toolkit (1.0.14)
ptyprocess (0.5.1)
py (1.4.34)
pycairo (1.13.3)
Pygments (2.2.0)
pygobject (3.24.1)
pyparsing (2.2.0)
pytest (3.1.2)
python-dateutil (2.6.0)
python-libtorrent (1.1.3)
pytz (2017.2)
pyxdg (0.25)
scipy (0.19.0)
setuptools (36.0.1)
simplegeneric (0.8.1)
six (1.10.0)
team (1.0)
traitlets (4.3.2)
wcwidth (0.1.7)

pacman -Qe

accerciser 3.22.0-2
adapta-gtk-theme 3.90.1.44-1
aircrack-ng 1.2rc4-4
aisleriot 3.22.2-1
alsa-utils 1.1.4-1
anjuta 3.22.0+1+g2bd433c-1
arduino 1:1.8.3-1
arduino-docs 1.6.6-4
atom 1.17.2-1
atomix 3.22.0-1
autoconf 2.69-4
automake 1.15-2
baobab 3.24.0+1+g202d168-1
bash 4.4.012-2
binutils 2.28.0-3
bison 3.0.4-2
brasero 3.12.1-2
bzip2 1.0.6-6
chromium 59.0.3071.86-1
chromium-widevine 1:1.4.8.970-1
coreutils 8.27-1
cower 16-1
cryptsetup 1.7.5-1
cups 2.2.3-1
cups-pdf 3.0.1-1
dconf-editor 3.23.4+48+g9acdf0a-1
devhelp 3.24.0+7+gefb59e2-1
device-mapper 2.02.171-1
dhcpcd 6.11.5-1
dialog 1:1.3_20170509-1
diffutils 3.6-1
dosfstools 4.1-1
e2fsprogs 1.43.4-1
empathy 3.12.12+120+g4a4b45b94-1
eog 3.24.1-1
epiphany 3.24.2-1
evince 3.24.0+8+ga8363215-1
evolution 3.24.2-1
fakeroot 1.21-2
file 5.31-1
file-roller 3.24.1-1
filesystem 2017.03-2
findutils 4.6.0-2
five-or-more 3.22.2-1
flex 2.6.4-1
four-in-a-row 3.22.1-1
gawk 4.1.4-2
gcc 7.1.1-2
gcc-libs 7.1.1-2
gdm 3.24.2-1
gedit 3.22.0+44+ge706c1259-1
gedit-code-assistance 3.16.0+4+gd19b879-1
gettext 0.19.8.1-2
gftp 2.0.19-8
git 2.13.1-1
gitg 3.24.0-1
glibc 2.25-2
gnome-2048 3.22.0+7+ga460b20-1
gnome-backgrounds 3.24.0+2+g755b6f9-1
gnome-builder 3.24.2-1
gnome-calculator 3.24.0+2+g0ca2919b-1
gnome-calendar 3.24.3-1
gnome-characters 3.22.0+49+g0d6a0bd-1
gnome-chess 3.24.1-1
gnome-clocks 3.24.0+4+gd1003cd-1
gnome-code-assistance 3.16.1-1
gnome-contacts 3.22.1+4+gb235b6d-1
gnome-control-center 3.24.2-1
gnome-devel-docs 3.22.1-1
gnome-dictionary 3.24.0+5+ga7aa054-1
gnome-disk-utility 3.24.1-1
gnome-documents 3.24.2-1
gnome-font-viewer 3.24.0-1
gnome-getting-started-docs 3.24.1-1
gnome-keyring 1:3.20.0+57+g9db67ef6-1
gnome-klotski 3.22.1-1
gnome-logs 3.24.1+1+gf949685-1
gnome-mahjongg 3.22.0+1+g55799c1-1
gnome-screenshot 3.22.0+42+g8472361-1
gnome-session 3.24.1-1
gnome-settings-daemon 3.24.2-1
gnome-shell 3.24.2-1
gnome-shell-extension-dash-to-dock 57-1
gnome-shell-extensions 3.24.2-1
gnome-system-monitor 3.24.0+4+g9140c85a-1
gnome-terminal 3.24.2-1
gnome-themes-standard 3.22.3-1
gnome-tweak-tool 3.24.1-1
gnome-user-docs 3.24.2-1
gnome-user-share 3.18.3+2+g7b451ae-1
grep 3.0-1
grilo-plugins 0.3.4+13+gf460a00-1
groff 1.22.3-7
gtk3-print-backends 3.22.15-1
gucharmap 9.0.4-1
gvfs-afc 1.32.1-1
gvfs-goa 1.32.1-1
gvfs-google 1.32.1-1
gvfs-gphoto2 1.32.1-1
gvfs-mtp 1.32.1-1
gvfs-nfs 1.32.1-1
gvfs-smb 1.32.1-1
gzip 1.8-2
hexchat 2.12.4-4
inetutils 1.9.4-5
intel-ucode 20170511-1
iproute2 4.11.0-1
iputils 20161105.1f2bb12-2
jfsutils 1.1.15-4
less 487-1
libgnome-games-support 1.2.0-1
libtool 2.4.6-8
licenses 20140629-2
linux 4.11.4-1
logrotate 3.12.2-1
lvm2 2.02.171-1
m4 1.4.18-1
make 4.2.1-2
man-db 2.7.6.1-2
man-pages 4.11-1
mdadm 4.0-1
mousetweaks 3.12.0-2
mutter 3.24.2+18+g0f7c3f367-1
nano 2.8.4-1
nautilus 3.24.1-1
netctl 1.12-2
networkmanager 1.8.0-1
numix-icon-theme-pack LATEST-1
nvidia-utils 381.22-1
openssh 7.5p1-2
p7zip 16.02-3
pacaur 4.7.5-1
pacman 5.0.1-5
patch 2.7.5-1
pciutils 3.5.4-1
pcmciautils 018-7
pepper-flash 24.0.0.221-1
perl 5.26.0-1
pkg-config 0.29.2-1
procps-ng 3.3.12-1
psmisc 22.21-3
python-pip 9.0.1-2
qbittorrent 3.3.13-1
qt4 4.8.7-20
reiserfsprogs 3.6.25-1
rfkill 0.5-2
s-nail 14.8.16-2
screenfetch 3.8.0-2
sed 4.4-1
shadow 4.4-3
slack-desktop 2.5.1-1
spotify 1.0.49.125-2
sublime-text-dev 3.3126-1
sudo 1.8.20.p2-1
sushi 3.24.0-1
sysfsutils 2.1.0-9
systemd-sysvcompat 232-8
tar 1.29-2
terminator 1.91-5
texinfo 6.3-2
tk 8.6.6-1
tor-browser 6.5.1-1
totem 3.24.0-1
tracker 1.12.0+1+g922c213a5-2
ttf-inconsolata 20151221.480630d-2
usbutils 008-1
util-linux 2.29.2-2
vi 1:070224-2
vino 3.22.0+3+g67773d0-1
vlc 2.2.6-1
vsftpd 3.0.3-3
weechat 1.8-2
wget 1.19.1-2
which 2.21-2
wpa_supplicant 1:2.6-6
xdg-user-dirs-gtk 0.10+9+g5b7efc6-1
xf86-video-intel 1:2.99.917+777+g6babcf15-1
xf86-video-vesa 2.3.4-3
xfsprogs 4.11.0-1
xorg-docs 1.7.1-1
xorg-fonts-100dpi 1.0.3-3
xorg-fonts-75dpi 1.0.3-3
xorg-iceauth 1.0.7-1
xorg-luit 1.1.1-2
xorg-server-devel 1.19.3-2
xorg-server-xdmx 1.19.3-2
xorg-server-xephyr 1.19.3-2
xorg-server-xnest 1.19.3-2
xorg-server-xvfb 1.19.3-2
xorg-server-xwayland 1.19.3-2
xorg-sessreg 1.1.1-1
xorg-smproxy 1.0.6-1
xorg-x11perf 1.6.0-1
xorg-xbacklight 1.2.1-1
xorg-xcmsdb 1.0.5-1
xorg-xcursorgen 1.0.6-1
xorg-xdpyinfo 1.3.2-1
xorg-xdriinfo 1.0.5-2
xorg-xev 1.2.2-1
xorg-xgamma 1.0.6-1
xorg-xhost 1.0.7-1
xorg-xinit 1.3.4-4
xorg-xinput 1.6.2-1
xorg-xkbevd 1.1.4-1
xorg-xkbutils 1.0.4-2
xorg-xkill 1.0.4-1
xorg-xlsatoms 1.1.2-1
xorg-xlsclients 1.1.3-1
xorg-xpr 1.0.4-2
xorg-xrandr 1.5.0-1
xorg-xrefresh 1.0.5-1
xorg-xset 1.2.3-1
xorg-xvinfo 1.1.3-1
xorg-xwd 1.0.6-1
xorg-xwininfo 1.1.3-1
xorg-xwud 1.0.4-2
yelp 3.22.0+1+gfabd8eb-1

Any help would be appreciated, and from what I've seen in the docs this looks like a great tool.

Installation error

Hi, I am relatively new to python so please forgive me.

I tried to install the pybinding under python 3.8 and got some errors.

(base) C:\Windows\system32>pip install pybinding
Collecting pybinding
Using cached pybinding-0.9.5-cp38-cp38-win_amd64.whl (768 kB)
Requirement already satisfied: pytest>=5.0 in c:\programdata\anaconda3\lib\site-packages (from pybinding) (5.4.3)
Requirement already satisfied: numpy>=1.12 in c:\programdata\anaconda3\lib\site-packages (from pybinding) (1.18.5)
Requirement already satisfied: matplotlib>=2.0 in c:\programdata\anaconda3\lib\site-packages (from pybinding) (3.2.2)
Requirement already satisfied: scipy>=0.19 in c:\programdata\anaconda3\lib\site-packages (from pybinding) (1.5.0)
Requirement already satisfied: py>=1.5.0 in c:\programdata\anaconda3\lib\site-packages (from pytest>=5.0->pybinding) (1.9.0)
Requirement already satisfied: packaging in c:\programdata\anaconda3\lib\site-packages (from pytest>=5.0->pybinding) (20.4)
Requirement already satisfied: attrs>=17.4.0 in c:\programdata\anaconda3\lib\site-packages (from pytest>=5.0->pybinding) (19.3.0)
Requirement already satisfied: more-itertools>=4.0.0 in c:\programdata\anaconda3\lib\site-packages (from pytest>=5.0->pybinding) (8.4.0)
Requirement already satisfied: pluggy<1.0,>=0.12 in c:\programdata\anaconda3\lib\site-packages (from pytest>=5.0->pybinding) (0.13.1)
Requirement already satisfied: wcwidth in c:\programdata\anaconda3\lib\site-packages (from pytest>=5.0->pybinding) (0.2.5)
Requirement already satisfied: atomicwrites>=1.0 in c:\programdata\anaconda3\lib\site-packages (from pytest>=5.0->pybinding) (1.4.0)
Requirement already satisfied: colorama in c:\programdata\anaconda3\lib\site-packages (from pytest>=5.0->pybinding) (0.4.3)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (2.4.7)
Requirement already satisfied: cycler>=0.10 in c:\programdata\anaconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (1.2.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib>=2.0->pybinding) (2.8.1)
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from packaging->pytest>=5.0->pybinding) (1.15.0)
Installing collected packages: pybinding
Successfully installed pybinding-0.9.5

Although Pybinding shows a successful installation, an error occurs when I run import Pybinding as pb.
It gives me


runfile('C:/Users/Administrator/.spyder-py3/temp.py', wdir='C:/Users/Administrator/.spyder-py3')
Traceback (most recent call last):

File "C:\Users\Administrator.spyder-py3\temp.py", line 8, in
import pybinding as pb

File "C:\ProgramData\Anaconda3\lib\site-packages\pybinding_init_.py", line 20, in
import _pybinding as _cpp

ImportError: DLL load failed while importing _pybinding: The specified module could not be found。

I wonder how to deal with the issue.
Thanks.

The calc_conductivity in KPM takes in temperature as a number in the input variables

The KPM method for computing conductivity has the advantage that once you have computed all the moments, a simple integration with the Fermi-Dirac distribution should yield results for many temperatures and chemical potentials (see Phys. Rev. Lett. 114. 116602 (2015) equation (1).)

The current implementation supports the input of chemical potentials as an array. However, the variable temperature is taken as one number. This is not very efficient since you need to run the same KPM for many temperatures.

Small question about heatmap-plot of the eigenvalue.

Dear developers,

Recently i try to use the 'solver.calc_eigenvalues' to map the distributiuon of some satets after solving the model. Detials see below:
%%%
solver = pb.solver.lapack(model)
eigen=solver.calc_eigenvalues(map_probability_at=[XX,XX])
eigen.plot_heatmap()
%%%%
The output is beautiful. But I also want to change the x and y limition (in a larged view) as nomally done in the plt.plot, such as "ax.set_xlim(-0.2,0.2)".
In the Docs (https://docs.pybinding.site/en/stable/_api/pybinding.Eigenvalues.html?highlight=plot_heatmap#pybinding.Eigenvalues.plot_heatmap), I cannot find the tag to change this? Can u help me about this?

Random Disorder in multiorbital model

Hello. I'm new to Python and Pybinding, and I'm attempting to add random disorder on site energies in a two-orbital model (Rashba spin-orbit interaction) with linear potential drop.

def linear(v,w):
    @pb.onsite_energy_modifier
    def potential(energy,x, sub_id):
        np.random.seed(2); # seed to generate same random number
        return  np.eye(2) * v *(x/8) + np.eye(2) * w *(np.random.uniform(-.5, .5, size=energy.size) ) # size is required
    return potential

But I am getting an error -

operands could not be broadcast together with shapes (2,2) (3696,) 

Can any one help me ?

I am expecting same onsite energies for up and down spin (i.e. the same diagonal term )
e.g. say, for site-1 the onsite term : [(x1,0),(0,x1)] i.e. same random number for up and down spin in site - 1
for site-2 the onsite term : [(x2,0),(0,x2)] i.e. same random number for up and down spin in site - 2.

Also I tried using sub_id.eye or putting size=1, but its also not working.

Also I am trying to incorporate Rashba in graphene_4atom model. Can somebody tell me if I'm doing it correctly or not?
Here is my code .....

def monolayer_graphene_4atom_soc():
    rashba = 1.   # [eV] strength of Rashba SOC
    rashba_so = 1j * 2/3 * rashba

    # create a lattice with 2 primitive vectors
    a1 = np.array([a, 0])
    a2 = np.array([0, 3*a_cc])
    lat = pb.Lattice(a1=a1, a2=a2)

    pos_a = np.array([  0, -a_cc/2])
    pos_b = np.array([  0,  a_cc/2])
    pos_a2 = np.array([a/2, a_cc])
    pos_b2 = np.array([a/2, 2*a_cc])

    lat.add_sublattices(
        ('A', pos_a,np.zeros(2)),
        ('B', pos_b,np.zeros(2))) #zero onsite
    lat.add_aliases(
        ('A2', 'A',  pos_a2),
        ('B2', 'B', pos_b2))

    # nearest neighbor vectors
    dab = (pos_b - pos_a) / a_cc          # [ 0,  0]
    dba2= (pos_a2 - pos_b) / a_cc
    da2b2= (pos_b2 - pos_a2) / a_cc
    
    dab2 = (pos_b2 - pos_a - a1 - a2) / a_cc     # [-1,  -1]
    dab22 = (pos_b2 - pos_a - a2) / a_cc     # [0,  -1]
    dba2 = (pos_b - pos_a - a1) / a_cc     # [ -1, 0]

    nn_hopp = np.array([[t, 0], [0, t]])                            # nn hopping, same spin
    t1 = nn_hopp + rashba_so * (pauli.x * dab[1] - pauli.y * dab[0])  # cross([sx , sy], [dx, dy])
    t2 = nn_hopp + rashba_so * (pauli.x * dba2[1] - pauli.y * dba2[0])
    t3 = nn_hopp + rashba_so * (pauli.x * da2b2[1] - pauli.y * da2b2[0])
    t4 = nn_hopp + rashba_so * (pauli.x * dab2[1] - pauli.y * dab2[0])  # cross([sx , sy], [dx, dy])
    t5 = nn_hopp + rashba_so * (pauli.x * dab22[1] - pauli.y * dab22[0])
    t6 = nn_hopp + rashba_so * (pauli.x * dba2[1] - pauli.y * dba2[0])

    lat.add_hoppings(
        # inside the unit sell
        ([0, 0], 'A',  'B',  t1),
        ([0, 0], 'B',  'A2', t2),
        ([0, 0], 'A2', 'B2', t3),
        # between neighbouring unit cells
        ([-1, -1], 'A', 'B2', t4),
        ([ 0, -1], 'A', 'B2', t5),
        ([-1,  0], 'B', 'A2', t6),
    )

    return lat

def linear(v,w):
    @pb.onsite_energy_modifier
    def potential(energy,x, sub_id):
        np.random.seed(2); # seed to generate same random number
        return  np.eye(2) * v *(x/8) + sub_id.eye * w *(np.random.uniform(-.5, .5, size=energy.size) ) # size is required
    return potential

def make_model(length, width, v, w):
    model_out = pb.Model(
        monolayer_graphene_4atom_soc(),
        pb.rectangle(length, width),
        linear(v,w)
    )
    shift=0.0
    model_out.attach_lead(-1, pb.line([-length/2-shift, -width/2], [-length/2-shift, width/2]))
    model_out.attach_lead(+1, pb.line([ length/2+shift, -width/2], [ length/2+shift, width/2]))
    return model_out

model = make_model(length=8,width=6,v=1,w=1)
pyplot.figure(figsize=(15, 9))
model.onsite_map.plot(cmap="coolwarm", site_radius=0.04)
pb.pltutils.colorbar()
model.leads[0].plot_contact()
model.leads[1].plot_contact()
model.lattice.plot_vectors(position=[0, 4])

Addition of Hermitian conjugate

Sir! I find that there is a strong constraint on the addition of hopping, whose Hermitian conjugate is added automatically. Therefore, I wonder that it is posisble to switch off this partially (e.g., for some hopping addition, allowing the non-Hermitian conjugate). It is possible to realize this?

THX!
Chenqiang Hua

Silicon Modelling

I am trying to model Silicon using Pybinding, with the code attached below.

( I apologise if this is not the appropriate forum for this question)
##############################################33
d = 0.543 # [nm] unit cell length
t = 0.17 # [eV] hopping energy
lattice = pb.Lattice(a1=[1,1,0], a2=[0,1,1],a3=[1,0,1])
lattice.add_sublattices(
("A",[0,0,0]),
("B",[0,1,0]),
("C",[0,0,1]),
("D",[0,1,1]),
("E",[1,0,0]),
("F",[1,0,1]),
("G",[1,1,1]),
("H",[1,1,0]),
##################################################333
("I",[0,0.5,0.5]),
("J",[0.5,0.5,0]),
("K",[0.5,0,0.5]),
("L",[1,0.5,0.5]),
("M",[0.5,0.5,1]),
("N",[0.5,1,0.5]),
###################################################33
("O",[0.75,0.75,0.75]),
("P",[0.75,0.25,0.25]),
("Q",[0.25,0.75,0.25]),
("R",[0.25,0.25,0.75]))
lattice.add_hoppings(
#(relative_index, from_sublattice, to_sublattice, energy)
([0.25, -0.25,0.25], 'Q', 'B', t),
([-0.25,-0.25,-0.25], 'Q', 'N', t),
([-0.25,0.25,0.25], 'Q', 'J', t),
([0.25,0.25,-0.25], 'Q', 'I', t),
([-0.25, 0.25,0.25], 'P', 'E', t),
([0.25, 0.25,-0.25], 'P', 'K', t),
([-0.25,-0.25,-0.25], 'P', 'L', t),
([0.25,-0.25,0.25], 'P', 'J', t),
######################################################################33
([0.25,0.25,-0.25], 'R', 'C', t),
([-0.25,0.25,0.25], 'R', 'K', t),
([0.25, -0.25,0.25], 'R', 'I', t),
([-0.25, -0.25,-0.25], 'R', 'M', t),
([-0.25,-0.25, -0.25], 'O', 'G', t),
([0.25,-0.25,0.25 ], 'O', 'N', t),
([-0.25,0.25,0.25], 'O', 'L', t),
([0.25,0.25,-0.25], 'O', 'M', t))
image

Lattice Structure (As expected)

Unfortunately the E-k diagram is not expected, attached below.

image
Can anyone point out the error in the code. (As the expected graph should not look like this)

onsite term not set correctly

First of all, let me express my greatest admiration for the package.. It is really useful!
Specially I would like to express my profound gratitude for implementing the KPM stuff!
So I have been playing around with the package. The current problem I am investigating is a 3D lattice with two orbitals on a single site and I have came up on a small bug.
Let me illustrate it with the following small bit of code

import pybinding as pb
import numpy as np
import matplotlib.pyplot as plt

def makesys(U):
    lat=pb.Lattice(a1=[1,0,0],a2=[0,1,0],a3=[0,0,1])
    lat.add_sublattices(('A', [0,0,0],U ))
    lat.add_hoppings(
                 ([1,0,0], 'A', 'A', eye(2)),
                 ([0,1,0], 'A', 'A', eye(2)),
                 ([0,0,1], 'A', 'A', eye(2))
                )
    model = pb.Model(lat,pb.primitive(a1=2, a2=2,a3=2))
    return model

Now I define two models. The first has the identity matrix as onsite term the other has the first Pauli matrix.

model1=makesys([[1,0],
                [0,1]])
model2=makesys([[0,1],
                [1,0]])

looking at the first site onsite element of the generated Hamiltonian I get in the first case the expected result:

model1.hamiltonian[:2,:2].todense()
>matrix([[ 1.,  0.],
>        [ 0.,  1.]], dtype=float32)

in the second case however the zero matrix is returned !

model2.hamiltonian[:2,:2].todense()
>matrix([[ 0.,  0.],
>        [ 0.,  0.]], dtype=float32)

Fermi surface plotting

Hi everyone, I have started using pybinding a couple days ago and I am having a bit of trouble plotting Fermi surfaces. First of all, is there anyway to do it with the package or is it necessary to do it ''by hand''? Secondly, I was wondering in what basis the set_wave_vector() method assumes the wave vectors given are. I tried reading in the documentation and the basis doesn't seem to be specified. I assumed it was in the cartesian basis, but the resulting Fermi surface seems to be dependant on the reciprocal wave vectors of my model...

Installation issue

Hi, I am relatively new to python so please forgive me.

I tried to install the pybinding under python 3.5 and when I run the
import pybinding as pb

it gives me

Traceback (most recent call last):
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\ptvsd_launcher.py", line 119, in
vspd.debug(filename, port_num, debug_id, debug_options, run_as)
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\Packages\ptvsd\debugger.py", line 39, in debug
run()
File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\Packages\ptvsd_main_.py", line 316, in run_file
runpy.run_path(target, run_name='main')
File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 240, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\User\OneDrive\桌面\Project_IMRE\Python\MOS2 QD Simulation\MOS2 QD Simulation\MOS2_QD_Simulation.py", line 3, in
import pybinding as pb
File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\site-packages\pybinding_init
.py", line 20, in
import _pybinding as _cpp
ImportError: DLL load failed: The specified procedure could not be found.
The thread 'MainThread' (0x1) has exited with code 0 (0x0).
The program 'python.exe' has exited with code 0 (0x0).

I wonder how to deal with the issue

spin

i wrote this cod similar pybinding document page 101-102
import pybinding as pb
import numpy as np
import matplotlib.pyplot as plt

pb.pltutils.use_style()
%matplotlib inline
import pybinding as pb
def s():
lat = pb.Lattice([1, 0], [0, 1])
lat.add_sublattices(
("A", [0.0, 0.0], 0.5), # single-orbital: scalar
("B", [0.0, 0.2], [[1.5, 2j], # two-orbital: 2x2 Hermitian matrix
[-2j, 1.5]]),
("C", [0.3, 0.1], np.zeros(2)), # two-orbital: zero onsite term
("D", [0.1, 0.0], [[4, 0, 0], # three-orbital: only diagonal
[0, 5, 0],
[0, 0, 6]]),
("E", [0.2, 0.2], [4, 5, 6])) # three-orbital: only diagonal, terse notation

lat.add_hoppings(
    ([0, 1], "A", "A", 1.2),          # scalar
    ([0, 1], "B", "B", [[1, 2],       # 2x2
                        [3, 4]]),
    ([0, 0], "B", "C", [[2j, 0],      # 2x2
                        [1j, 0]]),
    ([0, 0], "A", "D", [[1, 2, 3]]),  # 1x3
    ([0, 1], "D", "A", [[7],          # 3x1
                        [8],
                        [9]]),
   ([0, 0], "B", "D", [[1j, 0,  0],  # 2x3
                    [2,  0, 3j]]))
return lat

@pb.onsite_energy_modifier
def potential(energy, x, sub_id):
"""Applies different functions to different sublattices"""
if sub_id == "A":
return energy + x # we know sublattice A is single-orbital
elif sub_id == "D":
energy[x > 0] += sub_id.eye * x # the notation can be mixed with numpy indexing
return energy # apply only to sites where x > 0
elif sub_id == "B":
sigma_y = np.array([[0, -1j],
[1j, 0]])
return energy + sigma_y * 1.3 - np.eye(2) * 0.6 # add multiple 2x2 matrices
else:
return energy
lattice=s()
lattice.plot()
plt.show()
model = pb.Model(s(),
pb.rectangle(4,4),
potential)
model.plot()

errore:
boolean index did not match indexed array along dimension 1; dimension is 3 but corresponding boolean dimension is 1

pybinding returns an error for a 1D lattice defined by the book (literally)

Bert
I am sorry to bother you again :-(
I wanted to play with simple models, following the documentation to the letter. After graphene, I moved to a simple 1D lattice. Yet, the following piece of code gives an error message
Could it be related to some issue in the development version?
Best
Romuald

import pybinding as pb
import matplotlib.pyplot as plt

pb.pltutils.use_style()

def simple_chain_lattice(a=1, t=-1):
"""Very simple 1D lattice"""
lat = pb.Lattice(a)
lat.add_one_sublattice('A', [0, 0])
lat.add_one_hopping(1, 'A', 'A', t)
return lat

model = pb.Model(
simple_chain_lattice(),
pb.line(-3.5, 3.5) # line start/end in nanometers
)
model.plot()
plt.show()

returns:


IndexError Traceback (most recent call last)
Cell In[4], line 18
12 return lat
14 model = pb.Model(
15 simple_chain_lattice(),
16 pb.line(-3.5, 3.5) # line start/end in nanometers
17 )
---> 18 model.plot()
19 plt.show()

File ~/Python3/ML/lib64/python3.11/site-packages/pybinding/model.py:172, in Model.plot(self, num_periods, lead_length, axes, **kwargs)
170 for lead in self.leads:
171 lead.plot(lead_length, axes=axes, **kwargs)
--> 172 decorate_structure_plot(axes=axes)

File ~/Python3/ML/lib64/python3.11/site-packages/pybinding/system.py:246, in decorate_structure_plot(axes, add_margin, ax, **_)
244 ax = plt.gca()
245 ax.set_aspect('equal')
--> 246 ax.autoscale_view()
247 ax.set_xlabel("{} (nm)".format(axes[0]))
248 ax.set_ylabel("{} (nm)".format(axes[1]))

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axes/_base.py:2939, in _AxesBase.autoscale_view(self, tight, scalex, scaley)
2934 # End of definition of internal function 'handle_single_axis'.
2936 handle_single_axis(
2937 scalex, self._shared_axes["x"], 'x', self.xaxis, self._xmargin,
2938 x_stickies, self.set_xbound)
-> 2939 handle_single_axis(
2940 scaley, self._shared_axes["y"], 'y', self.yaxis, self._ymargin,
2941 y_stickies, self.set_ybound)

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axes/_base.py:2932, in _AxesBase.autoscale_view..handle_single_axis(scale, shared_axes, name, axis, margin, stickies, set_bound)
2929 x1 = min(x1, x1bound)
2931 if not self._tight:
-> 2932 x0, x1 = locator.view_limits(x0, x1)
2933 set_bound(x0, x1)

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/ticker.py:2170, in MaxNLocator.view_limits(self, dmin, dmax)
2166 dmin, dmax = mtransforms.nonsingular(
2167 dmin, dmax, expander=1e-12, tiny=1e-13)
2169 if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':
-> 2170 return self._raw_ticks(dmin, dmax)[[0, -1]]
2171 else:
2172 return dmin, dmax

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/ticker.py:2114, in MaxNLocator._raw_ticks(self, vmin, vmax)
2111 large_steps = large_steps & (floored_vmaxs >= _vmax)
2113 # Find index of smallest large step
-> 2114 istep = np.nonzero(large_steps)[0][0]
2116 # Start at smallest of the steps greater than the raw step, and check
2117 # if it provides enough ticks. If not, work backwards through
2118 # smaller steps until one is found that provides enough ticks.
2119 for step in steps[:istep+1][::-1]:

IndexError: index 0 is out of bounds for axis 0 with size 0

Error in callback <function _draw_all_if_interactive at 0x7fe6bc615a80> (for post_execute), with arguments args (),kwargs {}:


IndexError Traceback (most recent call last)
File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/pyplot.py:197, in _draw_all_if_interactive()
195 def _draw_all_if_interactive() -> None:
196 if matplotlib.is_interactive():
--> 197 draw_all()

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/_pylab_helpers.py:132, in Gcf.draw_all(cls, force)
130 for manager in cls.get_all_fig_managers():
131 if force or manager.canvas.figure.stale:
--> 132 manager.canvas.draw_idle()

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/backend_bases.py:1893, in FigureCanvasBase.draw_idle(self, *args, **kwargs)
1891 if not self._is_idle_drawing:
1892 with self._idle_draw_cntx():
-> 1893 self.draw(*args, **kwargs)

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/backends/backend_agg.py:388, in FigureCanvasAgg.draw(self)
385 # Acquire a lock on the shared font cache.
386 with (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar
387 else nullcontext()):
--> 388 self.figure.draw(self.renderer)
389 # A GUI class may be need to update a window using this draw, so
390 # don't forget to call the superclass.
391 super().draw()

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/artist.py:95, in _finalize_rasterization..draw_wrapper(artist, renderer, *args, **kwargs)
93 @wraps(draw)
94 def draw_wrapper(artist, renderer, *args, **kwargs):
---> 95 result = draw(artist, renderer, *args, **kwargs)
96 if renderer._rasterizing:
97 renderer.stop_rasterizing()

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/artist.py:72, in allow_rasterization..draw_wrapper(artist, renderer)
69 if artist.get_agg_filter() is not None:
70 renderer.start_filter()
---> 72 return draw(artist, renderer)
73 finally:
74 if artist.get_agg_filter() is not None:

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/figure.py:3154, in Figure.draw(self, renderer)
3151 # ValueError can occur when resizing a window.
3153 self.patch.draw(renderer)
-> 3154 mimage._draw_list_compositing_images(
3155 renderer, self, artists, self.suppressComposite)
3157 for sfig in self.subfigs:
3158 sfig.draw(renderer)

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/image.py:132, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
131 for a in artists:
--> 132 a.draw(renderer)
133 else:
134 # Composite any adjacent images together
135 image_group = []

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/artist.py:72, in allow_rasterization..draw_wrapper(artist, renderer)
69 if artist.get_agg_filter() is not None:
70 renderer.start_filter()
---> 72 return draw(artist, renderer)
73 finally:
74 if artist.get_agg_filter() is not None:

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axes/_base.py:3070, in _AxesBase.draw(self, renderer)
3067 if artists_rasterized:
3068 _draw_rasterized(self.figure, artists_rasterized, renderer)
-> 3070 mimage._draw_list_compositing_images(
3071 renderer, self, artists, self.figure.suppressComposite)
3073 renderer.close_group('axes')
3074 self.stale = False

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/image.py:132, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
131 for a in artists:
--> 132 a.draw(renderer)
133 else:
134 # Composite any adjacent images together
135 image_group = []

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/artist.py:72, in allow_rasterization..draw_wrapper(artist, renderer)
69 if artist.get_agg_filter() is not None:
70 renderer.start_filter()
---> 72 return draw(artist, renderer)
73 finally:
74 if artist.get_agg_filter() is not None:

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axis.py:1387, in Axis.draw(self, renderer, *args, **kwargs)
1384 return
1385 renderer.open_group(name, gid=self.get_gid())
-> 1387 ticks_to_draw = self._update_ticks()
1388 tlb1, tlb2 = self._get_ticklabel_bboxes(ticks_to_draw, renderer)
1390 for tick in ticks_to_draw:

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axis.py:1275, in Axis._update_ticks(self)
1270 def _update_ticks(self):
1271 """
1272 Update ticks (position and labels) using the current data interval of
1273 the axes. Return the list of ticks that will be drawn.
1274 """
-> 1275 major_locs = self.get_majorticklocs()
1276 major_labels = self.major.formatter.format_ticks(major_locs)
1277 major_ticks = self.get_major_ticks(len(major_locs))

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axis.py:1495, in Axis.get_majorticklocs(self)
1493 def get_majorticklocs(self):
1494 """Return this Axis' major tick locations in data coordinates."""
-> 1495 return self.major.locator()

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/ticker.py:2142, in MaxNLocator.call(self)
2140 def call(self):
2141 vmin, vmax = self.axis.get_view_interval()
-> 2142 return self.tick_values(vmin, vmax)

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/ticker.py:2150, in MaxNLocator.tick_values(self, vmin, vmax)
2147 vmin = -vmax
2148 vmin, vmax = mtransforms.nonsingular(
2149 vmin, vmax, expander=1e-13, tiny=1e-14)
-> 2150 locs = self._raw_ticks(vmin, vmax)
2152 prune = self._prune
2153 if prune == 'lower':

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/ticker.py:2114, in MaxNLocator._raw_ticks(self, vmin, vmax)
2111 large_steps = large_steps & (floored_vmaxs >= _vmax)
2113 # Find index of smallest large step
-> 2114 istep = np.nonzero(large_steps)[0][0]
2116 # Start at smallest of the steps greater than the raw step, and check
2117 # if it provides enough ticks. If not, work backwards through
2118 # smaller steps until one is found that provides enough ticks.
2119 for step in steps[:istep+1][::-1]:

IndexError: index 0 is out of bounds for axis 0 with size 0


IndexError Traceback (most recent call last)
File ~/Python3/ML/lib/python3.11/site-packages/IPython/core/formatters.py:340, in BaseFormatter.call(self, obj)
338 pass
339 else:
--> 340 return printer(obj)
341 # Finally look for special method names
342 method = get_real_method(obj, self.print_method)

File ~/Python3/ML/lib/python3.11/site-packages/IPython/core/pylabtools.py:152, in print_figure(fig, fmt, bbox_inches, base64, **kwargs)
149 from matplotlib.backend_bases import FigureCanvasBase
150 FigureCanvasBase(fig)
--> 152 fig.canvas.print_figure(bytes_io, **kw)
153 data = bytes_io.getvalue()
154 if fmt == 'svg':

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/backend_bases.py:2164, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2161 # we do this instead of self.figure.draw_without_rendering
2162 # so that we can inject the orientation
2163 with getattr(renderer, "_draw_disabled", nullcontext)():
-> 2164 self.figure.draw(renderer)
2165 if bbox_inches:
2166 if bbox_inches == "tight":

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/artist.py:95, in _finalize_rasterization..draw_wrapper(artist, renderer, *args, **kwargs)
93 @wraps(draw)
94 def draw_wrapper(artist, renderer, *args, **kwargs):
---> 95 result = draw(artist, renderer, *args, **kwargs)
96 if renderer._rasterizing:
97 renderer.stop_rasterizing()

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/artist.py:72, in allow_rasterization..draw_wrapper(artist, renderer)
69 if artist.get_agg_filter() is not None:
70 renderer.start_filter()
---> 72 return draw(artist, renderer)
73 finally:
74 if artist.get_agg_filter() is not None:

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/figure.py:3154, in Figure.draw(self, renderer)
3151 # ValueError can occur when resizing a window.
3153 self.patch.draw(renderer)
-> 3154 mimage._draw_list_compositing_images(
3155 renderer, self, artists, self.suppressComposite)
3157 for sfig in self.subfigs:
3158 sfig.draw(renderer)

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/image.py:132, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
131 for a in artists:
--> 132 a.draw(renderer)
133 else:
134 # Composite any adjacent images together
135 image_group = []

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/artist.py:72, in allow_rasterization..draw_wrapper(artist, renderer)
69 if artist.get_agg_filter() is not None:
70 renderer.start_filter()
---> 72 return draw(artist, renderer)
73 finally:
74 if artist.get_agg_filter() is not None:

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axes/_base.py:3070, in _AxesBase.draw(self, renderer)
3067 if artists_rasterized:
3068 _draw_rasterized(self.figure, artists_rasterized, renderer)
-> 3070 mimage._draw_list_compositing_images(
3071 renderer, self, artists, self.figure.suppressComposite)
3073 renderer.close_group('axes')
3074 self.stale = False

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/image.py:132, in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
131 for a in artists:
--> 132 a.draw(renderer)
133 else:
134 # Composite any adjacent images together
135 image_group = []

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/artist.py:72, in allow_rasterization..draw_wrapper(artist, renderer)
69 if artist.get_agg_filter() is not None:
70 renderer.start_filter()
---> 72 return draw(artist, renderer)
73 finally:
74 if artist.get_agg_filter() is not None:

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axis.py:1387, in Axis.draw(self, renderer, *args, **kwargs)
1384 return
1385 renderer.open_group(name, gid=self.get_gid())
-> 1387 ticks_to_draw = self._update_ticks()
1388 tlb1, tlb2 = self._get_ticklabel_bboxes(ticks_to_draw, renderer)
1390 for tick in ticks_to_draw:

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axis.py:1275, in Axis._update_ticks(self)
1270 def _update_ticks(self):
1271 """
1272 Update ticks (position and labels) using the current data interval of
1273 the axes. Return the list of ticks that will be drawn.
1274 """
-> 1275 major_locs = self.get_majorticklocs()
1276 major_labels = self.major.formatter.format_ticks(major_locs)
1277 major_ticks = self.get_major_ticks(len(major_locs))

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/axis.py:1495, in Axis.get_majorticklocs(self)
1493 def get_majorticklocs(self):
1494 """Return this Axis' major tick locations in data coordinates."""
-> 1495 return self.major.locator()

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/ticker.py:2142, in MaxNLocator.call(self)
2140 def call(self):
2141 vmin, vmax = self.axis.get_view_interval()
-> 2142 return self.tick_values(vmin, vmax)

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/ticker.py:2150, in MaxNLocator.tick_values(self, vmin, vmax)
2147 vmin = -vmax
2148 vmin, vmax = mtransforms.nonsingular(
2149 vmin, vmax, expander=1e-13, tiny=1e-14)
-> 2150 locs = self._raw_ticks(vmin, vmax)
2152 prune = self._prune
2153 if prune == 'lower':

File ~/Python3/ML/lib64/python3.11/site-packages/matplotlib/ticker.py:2114, in MaxNLocator._raw_ticks(self, vmin, vmax)
2111 large_steps = large_steps & (floored_vmaxs >= _vmax)
2113 # Find index of smallest large step
-> 2114 istep = np.nonzero(large_steps)[0][0]
2116 # Start at smallest of the steps greater than the raw step, and check
2117 # if it provides enough ticks. If not, work backwards through
2118 # smaller steps until one is found that provides enough ticks.
2119 for step in steps[:istep+1][::-1]:

IndexError: index 0 is out of bounds for axis 0 with size 0

Modifiers infinite loop ?

Hi,

Have been playing around with the modifiers inside the model and that seems to send the model on infinite loop.

Creating the model with modifier works fine, but once created, anything from plotting to displaying Hamiltonian starts a infinite loop in the system.

Bug in KPM method

auto const row = index_queue[h2_row];
has the expression of a vector where the index is taken from using an other vector. However, if the Hamiltonian is block-diagonal, the index_queue doesn't contain all the indices to connect all the sites to each other. In essence, you could only reorder for one 'block'. If the matrix is block-diagonal, is would be faster to treat the system in separate calculations. However, this can create strange segmentation errors if for example the hopping parameter between two different systems is changed and goes through zero.

An easy fix is to assign the value of 'row' to the first nonzero integer not in index_queue, and also add this integer to the slice_border_indices-vector. This fix works, and will be added in a future release.

install pybinding with source

hi please help me
i want install pybinding but i donot have Internet in my system. i download pybinding by an other system. i donot know how to install pybinding with my download؟

how to use Polygon.contains ?

I want to use a Polygon to determine if I should add on site energy or not. but when I use Polygon.contains(x,y) like this

def potential(energy, x, y, sub_id):
        if not rhombus(l / 2).contains(x, y):
            print("out of range")
        return energy

I got the following error

TypeError: contains(): incompatible function arguments. The following argument types are supported:
    1. (self: _pybinding.Shape, x: numpy.ndarray[numpy.float64[m, 1]], y: numpy.ndarray[numpy.float64[m, 1]], z: numpy.ndarray[numpy.float64[m, 1]]) -> numpy.ndarray[bool[m, 1]]

Invoked with: <pybinding.shape.Polygon object at 0x00000121FFBFF7D0>, array([-8.  , -7.5 , -7.  , -6.5 , -6.  , -5.5 , -5.  , -4.5 , -4.  , 
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  , -7.75, -7.25, -6.75, -6.25,
       -5.75, -5.25, -4.75, -4.25, -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25, -7.5 , -7.  , -6.5 , -6.  , -5.5 , -5.  , -4.5 , -4.  ,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 , -7.25, -6.75, -6.25,
       -5.75, -5.25, -4.75, -4.25, -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75, -7.  , -6.5 , -6.  , -5.5 , -5.  , -4.5 , -4.  ,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  , -6.75, -6.25,
       -5.75, -5.25, -4.75, -4.25, -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25, -6.5 , -6.  , -5.5 , -5.  , -4.5 , -4.  ,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  ,  4.5 , -6.25,
       -5.75, -5.25, -4.75, -4.25, -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25,  4.75, -6.  , -5.5 , -5.  , -4.5 , -4.  ,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  ,  4.5 ,  5.  ,
       -5.75, -5.25, -4.75, -4.25, -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25,  4.75,  5.25, -5.5 , -5.  , -4.5 , -4.  ,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  ,  4.5 ,  5.  ,
        5.5 , -5.25, -4.75, -4.25, -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25,  4.75,  5.25,  5.75, -5.  , -4.5 , -4.  ,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  ,  4.5 ,  5.  ,
        5.5 ,  6.  , -4.75, -4.25, -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25,  4.75,  5.25,  5.75,  6.25, -4.5 , -4.  ,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  ,  4.5 ,  5.  ,
        5.5 ,  6.  ,  6.5 , -4.25, -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25,  4.75,  5.25,  5.75,  6.25,  6.75, -4.  ,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  ,  4.5 ,  5.  ,
        5.5 ,  6.  ,  6.5 ,  7.  , -3.75, -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25,  4.75,  5.25,  5.75,  6.25,  6.75,  7.25,
       -3.5 , -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  ,  4.5 ,  5.  ,
        5.5 ,  6.  ,  6.5 ,  7.  ,  7.5 , -3.25, -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25,  4.75,  5.25,  5.75,  6.25,  6.75,  7.25,
        7.75, -3.  , -2.5 , -2.  , -1.5 , -1.  , -0.5 ,  0.  ,  0.5 ,
        1.  ,  1.5 ,  2.  ,  2.5 ,  3.  ,  3.5 ,  4.  ,  4.5 ,  5.  ,
        5.5 ,  6.  ,  6.5 ,  7.  ,  7.5 ,  8.  , -2.75, -2.25, -1.75,
       -1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25,  2.75,
        3.25,  3.75,  4.25,  4.75,  5.25,  5.75,  6.25,  6.75,  7.25,
        7.75]), array([-4.47446459, -4.47446459, -4.47446459, -4.47446459, -4.47446459,
       -4.47446459, -4.47446459, -4.47446459, -4.47446459, -4.47446459,
       -4.47446459, -4.47446459, -4.47446459, -4.47446459, -4.47446459,
       -4.47446459, -4.47446459, -4.47446459, -4.47446459, -4.47446459,
       -4.47446459, -4.47446459, -4.47446459, -4.04145188, -4.04145188,
       -4.04145188, -4.04145188, -4.04145188, -4.04145188, -4.04145188,
       -4.04145188, -4.04145188, -4.04145188, -4.04145188, -4.04145188,
       -4.04145188, -4.04145188, -4.04145188, -4.04145188, -4.04145188,
       -4.04145188, -4.04145188, -4.04145188, -4.04145188, -4.04145188,
       -4.04145188, -3.60843918, -3.60843918, -3.60843918, -3.60843918,
       -3.60843918, -3.60843918, -3.60843918, -3.60843918, -3.60843918,
       -3.60843918, -3.60843918, -3.60843918, -3.60843918, -3.60843918,
       -3.60843918, -3.60843918, -3.60843918, -3.60843918, -3.60843918,
       -3.60843918, -3.60843918, -3.60843918, -3.60843918, -3.17542648,
       -3.17542648, -3.17542648, -3.17542648, -3.17542648, -3.17542648,
       -3.17542648, -3.17542648, -3.17542648, -3.17542648, -3.17542648,
       -3.17542648, -3.17542648, -3.17542648, -3.17542648, -3.17542648,
       -3.17542648, -3.17542648, -3.17542648, -3.17542648, -3.17542648,
       -3.17542648, -3.17542648, -2.74241378, -2.74241378, -2.74241378,
       -2.74241378, -2.74241378, -2.74241378, -2.74241378, -2.74241378,
       -2.74241378, -2.74241378, -2.74241378, -2.74241378, -2.74241378,
       -2.74241378, -2.74241378, -2.74241378, -2.74241378, -2.74241378,
       -2.74241378, -2.74241378, -2.74241378, -2.74241378, -2.74241378,
       -2.30940108, -2.30940108, -2.30940108, -2.30940108, -2.30940108,
       -2.30940108, -2.30940108, -2.30940108, -2.30940108, -2.30940108,
       -2.30940108, -2.30940108, -2.30940108, -2.30940108, -2.30940108,
       -2.30940108, -2.30940108, -2.30940108, -2.30940108, -2.30940108,
       -2.30940108, -2.30940108, -2.30940108, -1.87638837, -1.87638837,
       -1.87638837, -1.87638837, -1.87638837, -1.87638837, -1.87638837,
       -1.87638837, -1.87638837, -1.87638837, -1.87638837, -1.87638837,
       -1.87638837, -1.87638837, -1.87638837, -1.87638837, -1.87638837,
       -1.87638837, -1.87638837, -1.87638837, -1.87638837, -1.87638837,
       -1.87638837, -1.44337567, -1.44337567, -1.44337567, -1.44337567,
       -1.44337567, -1.44337567, -1.44337567, -1.44337567, -1.44337567,
       -1.44337567, -1.44337567, -1.44337567, -1.44337567, -1.44337567,
       -1.44337567, -1.44337567, -1.44337567, -1.44337567, -1.44337567,
       -1.44337567, -1.44337567, -1.44337567, -1.44337567, -1.01036297,
       -1.01036297, -1.01036297, -1.01036297, -1.01036297, -1.01036297,
       -1.01036297, -1.01036297, -1.01036297, -1.01036297, -1.01036297,
       -1.01036297, -1.01036297, -1.01036297, -1.01036297, -1.01036297,
       -1.01036297, -1.01036297, -1.01036297, -1.01036297, -1.01036297,
       -1.01036297, -1.01036297, -0.57735027, -0.57735027, -0.57735027,
       -0.57735027, -0.57735027, -0.57735027, -0.57735027, -0.57735027,
       -0.57735027, -0.57735027, -0.57735027, -0.57735027, -0.57735027,
       -0.57735027, -0.57735027, -0.57735027, -0.57735027, -0.57735027,
       -0.57735027, -0.57735027, -0.57735027, -0.57735027, -0.57735027,
       -0.14433757, -0.14433757, -0.14433757, -0.14433757, -0.14433757,
       -0.14433757, -0.14433757, -0.14433757, -0.14433757, -0.14433757,
       -0.14433757, -0.14433757, -0.14433757, -0.14433757, -0.14433757,
       -0.14433757, -0.14433757, -0.14433757, -0.14433757, -0.14433757,
       -0.14433757, -0.14433757, -0.14433757,  0.28867513,  0.28867513,
        0.28867513,  0.28867513,  0.28867513,  0.28867513,  0.28867513,
        0.28867513,  0.28867513,  0.28867513,  0.28867513,  0.28867513,
        0.28867513,  0.28867513,  0.28867513,  0.28867513,  0.28867513,
        0.28867513,  0.28867513,  0.28867513,  0.28867513,  0.28867513,
        0.28867513,  0.72168784,  0.72168784,  0.72168784,  0.72168784,
        0.72168784,  0.72168784,  0.72168784,  0.72168784,  0.72168784,
        0.72168784,  0.72168784,  0.72168784,  0.72168784,  0.72168784,
        0.72168784,  0.72168784,  0.72168784,  0.72168784,  0.72168784,
        0.72168784,  0.72168784,  0.72168784,  0.72168784,  1.15470054,
        1.15470054,  1.15470054,  1.15470054,  1.15470054,  1.15470054,
        1.15470054,  1.15470054,  1.15470054,  1.15470054,  1.15470054,
        1.15470054,  1.15470054,  1.15470054,  1.15470054,  1.15470054,
        1.15470054,  1.15470054,  1.15470054,  1.15470054,  1.15470054,
        1.15470054,  1.15470054,  1.58771324,  1.58771324,  1.58771324,
        1.58771324,  1.58771324,  1.58771324,  1.58771324,  1.58771324,
        1.58771324,  1.58771324,  1.58771324,  1.58771324,  1.58771324,
        1.58771324,  1.58771324,  1.58771324,  1.58771324,  1.58771324,
        1.58771324,  1.58771324,  1.58771324,  1.58771324,  1.58771324,
        2.02072594,  2.02072594,  2.02072594,  2.02072594,  2.02072594,
        2.02072594,  2.02072594,  2.02072594,  2.02072594,  2.02072594,
        2.02072594,  2.02072594,  2.02072594,  2.02072594,  2.02072594,
        2.02072594,  2.02072594,  2.02072594,  2.02072594,  2.02072594,
        2.02072594,  2.02072594,  2.02072594,  2.45373864,  2.45373864,
        2.45373864,  2.45373864,  2.45373864,  2.45373864,  2.45373864,
        2.45373864,  2.45373864,  2.45373864,  2.45373864,  2.45373864,
        2.45373864,  2.45373864,  2.45373864,  2.45373864,  2.45373864,
        2.45373864,  2.45373864,  2.45373864,  2.45373864,  2.45373864,
        2.45373864,  2.88675135,  2.88675135,  2.88675135,  2.88675135,
        2.88675135,  2.88675135,  2.88675135,  2.88675135,  2.88675135,
        2.88675135,  2.88675135,  2.88675135,  2.88675135,  2.88675135,
        2.88675135,  2.88675135,  2.88675135,  2.88675135,  2.88675135,
        2.88675135,  2.88675135,  2.88675135,  2.88675135,  3.31976405,
        3.31976405,  3.31976405,  3.31976405,  3.31976405,  3.31976405,
        3.31976405,  3.31976405,  3.31976405,  3.31976405,  3.31976405,
        3.31976405,  3.31976405,  3.31976405,  3.31976405,  3.31976405,
        3.31976405,  3.31976405,  3.31976405,  3.31976405,  3.31976405,
        3.31976405,  3.31976405,  3.75277675,  3.75277675,  3.75277675,
        3.75277675,  3.75277675,  3.75277675,  3.75277675,  3.75277675,
        3.75277675,  3.75277675,  3.75277675,  3.75277675,  3.75277675,
        3.75277675,  3.75277675,  3.75277675,  3.75277675,  3.75277675,
        3.75277675,  3.75277675,  3.75277675,  3.75277675,  3.75277675,
        4.18578945,  4.18578945,  4.18578945,  4.18578945,  4.18578945,
        4.18578945,  4.18578945,  4.18578945,  4.18578945,  4.18578945,
        4.18578945,  4.18578945,  4.18578945,  4.18578945,  4.18578945,
        4.18578945,  4.18578945,  4.18578945,  4.18578945,  4.18578945,
        4.18578945,  4.18578945,  4.18578945,  4.61880215,  4.61880215,
        4.61880215,  4.61880215,  4.61880215,  4.61880215,  4.61880215,
        4.61880215,  4.61880215,  4.61880215,  4.61880215,  4.61880215,
        4.61880215,  4.61880215,  4.61880215,  4.61880215,  4.61880215,
        4.61880215,  4.61880215,  4.61880215,  4.61880215,  4.61880215])```
I believe those numbers are the x,y arrays, what am I doing wrong?

Problem with attaching leads to bilayer graphene

Hello everyone. I was trying to attach leads to bilayer graphene but it gives me error.

import pybinding as pb
import matplotlib.pyplot as plt
from pybinding.repository import graphene
from math import pi, sqrt
pb.pltutils.use_style()

def bilayer_graphene():
lat = pb.Lattice(a1=[graphene.a, 0], a2=[0.5graphene.a, 0.5sqrt(3)graphene.a])
c0 = 0.335 # [nm] interlayer spacing
lat.add_sublattices(('A1', [0, -graphene.a_cc/2, 0]),
('B1', [0, graphene.a_cc/2, 0]),
('A2', [0, graphene.a_cc/2, -c0]),
('B2', [0, 3
graphene.a_cc/2, -c0]))
lat.register_hopping_energies({'t': graphene.t, 't_layer': -0.4})
lat.add_hoppings(
# layer 1
([ 0, 0], 'A1', 'B1', 't'),
([ 1, -1], 'A1', 'B1', 't'),
([ 0, -1], 'A1', 'B1', 't'),
# layer 2
([ 0, 0], 'A2', 'B2', 't'),
([ 1, -1], 'A2', 'B2', 't'),
([ 0, -1], 'A2', 'B2', 't'),
# interlayer
([ 0, 0], 'B1', 'A2', 't_layer')
)
lat.min_neighbors = 2
return lat

model = pb.Model(
bilayer_graphene(),
pb.rectangle(2,1) # nm
)
#model.attach_lead(direction=-1, contact=pb.line([-.5, -0.5 ], [-.5, 0.6]))
model.attach_lead(direction=1, contact=pb.Polygon([[1,0.4, 0], [1,-0.4, 0], [1,-0.4, -0.33], [1,0.4, -0.33]]))
plt.figure(figsize=(10, 6)) # make the figure wider
model.plot()
plt.show()

Error:
RuntimeError: Can't attach lead: no sites in lead junction

can anyone suggest me how to solve this problem ?

Also can one attach leads to only a single layer ?

Is the pip version the last version?

I installed pybinding through pip. Is this the last version? I'm getting the following error.

module 'pybinding' has no attribute 'site_generator'

However, I see that in one of the commits a year ago the site_generator attribute has been added...

I would have to clone and build myself? I tried using

python setup.py build

but it does not seem as straightforward as I thought.

Any suggestions?

Thank you. I like this tool more and more :)

plot hopping strength

Hello,
First of all, thank you for the great work on this package!

I was playing around with the strained model given in the tutorial section and at some point I wanted to plot the strength of the hopping term on a finite systeme.
I couldn't find any simple way to access the hopping except by directly using the model.Hamiltonian.
Is there a easier way to plot the hopping strength?

ERROR: Failed building wheel for pybinding

Hi!

I am trying to install pybinding on my existing miniconda environment (the one I use for basically all my work). I am trying to do so with pip install pybinding
but with no success (Details ahead). The installation works in another miniconda environment I do not use, but for me it is essential to use pybinding in my usual environment. The error I get in the installation is:

Building wheel for pybinding (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1

A LOT OF TEXT

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pybinding
Running setup.py clean for pybinding
Failed to build pybinding
ERROR: Could not build wheels for pybinding, which is required to install pyproject.toml-based projects

Any idea on how I can fix this? I am such a dummy for technical stuff. I have also tried with the other suggested installation methods but they did not work.

Suggestions?

Thanks in advance

Limit on number of hoppings

Hi,

I am getting the following error: "RuntimeError: Can't create any more hoppings: 127".
Is there a way around it for a system where one includes that many hoppings?

Thanks.

Cannot import name allow_rasterization

I just install pybinding and I'm trying to run the first example that is proposed in the documentation of this library.

import pybinding as pb
import numpy as np
import matplotlib.pyplot as plt
import pybinding as pb

d = 0.2  # [nm] unit cell length
t = 1    # [eV] hopping energy

# create a simple 2D lattice with vectors a1 and a2
lattice = pb.Lattice(a1=[d, 0], a2=[0, d])
lattice.add_sublattices(
    ('A', [0, 0])  # add an atom called 'A' at position [0, 0]
)
lattice.add_hoppings(
    # (relative_index, from_sublattice, to_sublattice, energy)
    ([0, 1], 'A', 'A', t),
    ([1, 0], 'A', 'A', t)
)

lattice.plot()
plt.show() 

I have already installed what is required in the documentation (for Windows OS) and the sicrpt run pretty well until it has to do the lattice.plot() throwing the following error

Traceback (most recent call last):
File "prueba.py", line 25, in
lattice.plot()
File "C:\xampp7\Python\lib\site-packages\pybinding\lattice.py", line 463, in plot
axes=axes))
File "C:\xampp7\Python\lib\site-packages\pybinding\results.py", line 598, in plot
plot_sites(self.positions, self.sublattices, **props['site'])
File "C:\xampp7\Python\lib\site-packages\pybinding\system.py", line 285, in plot_sites
from pybinding.support.collections import CircleCollection
File "C:\xampp7\Python\lib\site-packages\pybinding\support\collections.py", line 2, in
from matplotlib.collections import Collection, allow_rasterization
ImportError: cannot import name 'allow_rasterization'

I have already check and matplotlib is correctly installed (I try some plots recommended in the documentation of matplotlib and worked pretty well). Also a looked for the file collections.py in the pybinding library and the mistake is in the second line

import numpy as np
from matplotlib.collections import Collection, allow_rasterization

And looking at collections.py of the matplolib and searching for 'allow_rasterization' I found the duplicated 6 time the following function

@artist.allow_rasterization
def draw(self, renderer):

I am pretty new at python so I'm don't know if I'm looking at what I should. Thanks in advance

FreeformShape, Composites, and Modifiers on macOS

Hi all

I am new to pybinding and using macOS. Going through the tutorial everything is going smooth as long as polygns are being used. Problems show up when using rings , circles, or composite shapes and/or modifiers. Basically, the job does not terminate. I systematically downgraded both python to 3.5 and pybinding down to 0.8, but still facing the same issue. I do not have any similar issues by installing pybinding on windows or linux
Any suggestion?!

Divacancy in random

Hi,

I want to create some Di vacancies (two neighboring atoms)but in random in Pybinding. but when I run the script, the left vacancies are not neighbor but both are belong to two different cell.

Do you have any idea?

coordinates inside displacement function

Hi,

I would like to generalize displacement(x, y, z) such that ux and uy are read from a list istead of being
a function of (x,y,z), but I realized that

x,y,z and ux and uy have a dimension larger than the number of atoms.

I would expect that the modifier acts on the coordinates of the unstrained model,
which have coordinates model.system.x with len(model.system.x) = number of atoms.

I would be glad if you could clarify what x,y,z are and why its values and lengths are different from the unmodified model, in order to understand how to read

ux, uy from an external list.
In the following the scipt where the issue is exemplified,

the aim is to substitute ux with ux_ext inside the function.

Thank you for any advice!

modifier-gen.txt

Non-hermitian matrix

Hi, it is possible to use solver that can solve non-Hermtian matrix, I want to use this to construct some non-hermtian hoppings that can demonstrate non-Hermitian effect

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.