Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Modifiers not working #17

Closed
zizuphos opened this issue Feb 18, 2019 · 3 comments
Closed

Modifiers not working #17

zizuphos opened this issue Feb 18, 2019 · 3 comments

Comments

@zizuphos
Copy link

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

@santoshkumarradha
Copy link

santoshkumarradha commented Oct 7, 2019

Can confirm. This is the first time I am setting up modifier and have the same problem.

@zakariaazhar
Copy link

I can confirm too!

@dean0x7d
Copy link
Owner

Version 0.9.5 that was just released should fix this issue (compatibility with Python 3.7 and 3.8).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants