Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
e68d8ad4
Commit
e68d8ad4
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
reformulate "args" section of whatsnew/0.3, fixing some errors
parent
3a838318
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/source/whatsnew/0.3.rst
+11
-12
11 additions, 12 deletions
doc/source/whatsnew/0.3.rst
with
11 additions
and
12 deletions
doc/source/whatsnew/0.3.rst
+
11
−
12
View file @
e68d8ad4
...
...
@@ -96,8 +96,9 @@ passed to `solve` like this::
kwant.solve(sys, energy,
args=(2., 3., 4.))
A more verbose way to do the same is to pass to the functions an object,
containing all the parameters as attributes::
With many parameters it can be less error-prone to collect all of them into a
single object and pass this object as the single argument. Such a parameter
collection could be a dictionary, or a class instance, for example::
class SimpleNamespace(object):
def __init__(self, **kwargs):
...
...
@@ -105,21 +106,19 @@ containing all the parameters as attributes::
# With Python >= 3.3 we can have instead:
# from types import SimpleNamespace
params = SimpleNamespace()
def onsite(site, p):
mu = p.mu
...
return p.mu * ...
def hopping(site1, site2, p):
t, B = p.t, p.B
...
return p.t * exp(-1j * p.B * ...)
kwant.solve(sys, energy,
args=(params(t=1., mu=2., B=0.1))
params = SimpleNamespace(t=1, mu=2)
for params.B in B_values:
kwant.solve(sys, energy, args=[params])
Arguments can be passed in an equivalent way in calls to
`~kwant.solvers.default.wave_function` and `~kwant.solvers.default.ldos`.
Arguments can be passed in an equivalent way to
`~kwant.solvers.default.wave_function`,
`~kwant.system.System.hamiltonian_submatrix`, etc.
Lattice and shape improvements
------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment