abTEM / abTEM

ab initio Transmission Electron Microscopy
GNU General Public License v3.0
200 stars 64 forks source link

Size of the CBED disk #145

Closed Chuqiao2333 closed 7 months ago

Chuqiao2333 commented 7 months ago

Hi,

May I ask how to control the size of the simulated CBED disk? I am trying to simulate some CBED patterns in a 4D-STEM data with a 25 mrad probe. I expect the center disk in CBED is also 25 mrad. But I found the size is actually determined by the atomic structure size in real space . If I use a (5,5) unit cell, the disk is large, while if I make the atom structure larger, say (10,10), the center disk will be come smaller. like the attached images.

This is from (5,5) unit cell

image

This is from (10,10) unit cell

image

I am trying to simulate the 4D data with a consistent disk size (e.g 25 mrad) and a consistent FOV of diffraction (70 mrad) in a larger FOV in real space. Is there a way to do it?

TomaSusi commented 7 months ago

That certainly seems strange, could you please share your code?

Chuqiao2333 commented 7 months ago

Sure ,

potential = abtem.Potential(atom_surface * (10,10,1), slice_thickness=1, gpts = 256)

sampling = 1.16785

probe = abtem.Probe(energy=80e3, semiangle_cutoff=30, defocus=250)
probe.grid.match(potential)
grid_scan = abtem.GridScan(
    start=[0, 0],
    end=[1/2, 1/2 ],
    sampling=sampling,
    fractional=True,
    potential=potential,    
)

pixelated_detector = abtem.PixelatedDetector(max_angle=63)

pixelated_measurements = probe.scan(detectors=pixelated_detector ,scan=grid_scan,potential = potential) pixelated_measurements.compute()

Here is the code to simulate the 4D diffraction, if I change the "atom_surface * (10,10,1)" in the potential (first line), as (5,5,1) or different sizes, the result diffraction size and the CBED disk size will also change. Is there any suggestion to fix it?

And here is the entire code in the collar

https://drive.google.com/file/d/1KeNP3SA_p34nYMpPajEGhZ5pcPiYgp02/view?usp=sharing

Thank you

TomaSusi commented 7 months ago

I'd still need the file /content/drive/MyDrive/Bilayer_simulation/relax/h_axis/structure.cif to run the simulation.

In the meanwhile, why are you using a defocus of 250 Å with a 30 Å cell?

TomaSusi commented 7 months ago

I cannot reproduce this issue with a similar hexagonal cell. Are you sure you are re-running all cells correctly when you change the model size? Maybe the probe.grid.match(potential) isn't evaluated to accommodate the changed potential?

Chuqiao2333 commented 7 months ago

Hi

Here is the .cif file

https://drive.google.com/file/d/1d8i94cXzIGrJkWxTIhfA7zDeqSXqNL_O/view?usp=sharing

and here is the new colab file. I modified a little to make it clearer, and I am pretty sure I run all the cells.

https://drive.google.com/file/d/1KeNP3SA_p34nYMpPajEGhZ5pcPiYgp02/view?usp=sharing

I tried a defocus 250 A probe because I am trying to simulate such a 4D dataset for the ptychography reconstruction.

One thing I feel weird is that if I use the build in Au model, the CBED disk is the same size no matter the atom lattice is (5,5) or (10,10), but if I switch it to my own .cif file, the disk size changes when I modify the lattice size. The results look like this:

image

I am not sure, is there any special setting or sth I need to modify in the .cif file?

Thank you so much for the reply!

TomaSusi commented 7 months ago

Yeah, that matches that I cannot reproduce this issue with the structure I create programmatically. Your structure has a hexagonal cell, which we do support and I also tried a hexagonal cell, but perhaps something odd is going wrong here.

Could you try orthogonalizing your cell before you repeat it and make a potential out of it? unit_cell = abtem.orthogonalize_cell(unit_cell)

I don't think you need to use the ASE surface function at all, it might also be doing something unwanted.

For the orthogonal cell, repetition by 4x2 gives a roughly square cell: atoms = unit_cell * (4, 2, 1)

Chuqiao2333 commented 7 months ago

I try the orthogonalize_cell and repetition by 4x2, but the disk size of a (8,4,1) lattice and (12,6,1) are still different.

image

I am not sure what to do..Could you help check it again?

Thank you!

TomaSusi commented 7 months ago

Okay yes, I can reproduce this with your structure, even when the model is orthogonal. I also did discover the source of the issue now.

You are specifying the sampling of the potential by giving the number of grid points (gpts). That is not ideal when you change the size of your supercell, since you can easily end up with insufficient real-space sampling of the potential.

In fact, for the (8,4,1) supercell, with 256 points you get a sampling of (0.371, 0.322) A per pixel, which is already much, much larger than our recommended default of 0.05 A/px. For (12,6,1), you get (0.557, 0.482) A/px.

With such low sampling of the potential, no one can guarantee physical results, though I am not sure why in abTEM the size of the CBED disk would thereby change (any idea, @jacobjma?)

It is instead recommended to use the sampling keyword, and set this no larger than 0.1 A (typically we would recommend around 0.05 A, but even that may be insufficient for full convergence if you have heavier elements in the specimen).

With a sampling of 0.1 A/px of the potential, I no longer get any difference in the CBED disk size.

download download

Chuqiao2333 commented 7 months ago

Thank you! That works!