Skip to content

Modifiers not working #17

@zizuphos

Description

@zizuphos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions