GithubHelp home page GithubHelp logo

Comments (11)

zerothi avatar zerothi commented on June 4, 2024

It can be done by following the example in the documentation (just added).

So for instance if you already have a device.TBT.nc one may do the following which adds $1 \mathrm{eV}$ on the diagonal terms for all orbitals on atoms 10, 11, 12 and 13:

import numpy as np
import sisl
# The important thing is that we should know the number of orbitals per atom
geom = sisl.get_sile('device.TBT.nc').read_geometry()
dH = sisl.Hamiltonian(geom, dtype=np.complex128)
orb_diag = geom.a2o(range(10, 14), all=True)
for o in orb_diag:
    dH[o, o] = 1.j
sisl.get_sile('delta.dH.nc', 'w').write_delta(dH)

Let me know if you have other inquiries.

from sisl.

KitchenSong avatar KitchenSong commented on June 4, 2024

I test it and think it is working. This code explains a lot. Thank you.

from sisl.

zerothi avatar zerothi commented on June 4, 2024

Great, will mark as resolved.

from sisl.

KitchenSong avatar KitchenSong commented on June 4, 2024

Sorry for not doing the test carefully. I do get the delta.dH.nc fil. However, when redoing the tbtrans calculation, I get

tbtrans: Using buffer atoms with dH method. tbtrans: Ensure no buffer orbitals used in dH!

and

Error occured in NCDF: NetCDF: Invalid argument Status number: -36 ncdf: Stopped due to error in NetCDF file ncdf-Node 0

I checked the atom index and I thought it should not be in the buffer atom list. Just wondering what leads to this problem.

from sisl.

zerothi avatar zerothi commented on June 4, 2024

It most definitely is in the buffer list.

Remember, when you do programming in Python it is 0-based indexing, while in the input it is 1-based.

from sisl.

zerothi avatar zerothi commented on June 4, 2024

However, note that in future versions of tbtrans, this check has been removed because it is not important. However, it should still run.

from sisl.

KitchenSong avatar KitchenSong commented on June 4, 2024

Hmm, I do check the atom and orbital index carefully... Even I only assign delta to only an atom and looped the index of this atom, the same error exists. I notice the file delta.dH.nc is not large, can I print all the file contents to see if anything is going wrong?

The error message posted:

`Error occured in NCDF:
Retrieving information about: RedH in file: delta.dH.nc

Error occured in NCDF:
Retrieving information about: RedH in file: delta.dH.nc

Error occured in NCDF:
NetCDF: Variable not found
Status number: -49
NetCDF: Variable not found
Status number: -49
NetCDF: Variable not found
Status number: -49
ncdf: Stopped due to error in NetCDF file
ncdf-Node 8
ncdf: Stopped due to error in NetCDF file
ncdf-Node 2`

from sisl.

zerothi avatar zerothi commented on June 4, 2024

Ah, yes.

This is my mistake.

I would suggest you to download the latest commit for siesta-4.1 and use the TBtrans in that version.

https://bazaar.launchpad.net/~siesta-maint/siesta/rel-4.1/tarball/846

The reason is that I found out that the $\delta H$ term should have been expressed in two separate terms: $\delta H$ and $\delta \Sigma$. The first contributes to bond-currents, while the last term does not. This is a necessity and is enabled in the coming 4.1-b4 release.
As for sisl, I quickly adopted this convention, hence the variable name change.

So, please download the latest 4.1 commit and use that.

from sisl.

KitchenSong avatar KitchenSong commented on June 4, 2024

I used 4.1-b3. Will have a try on the new version.

from sisl.

zerothi avatar zerothi commented on June 4, 2024

Exactly. ;)

from sisl.

KitchenSong avatar KitchenSong commented on June 4, 2024

That version you mentioned works properly.

from sisl.

Related Issues (20)

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.