Author Topic: Charge Density Difference  (Read 7702 times)

0 Members and 1 Guest are viewing this topic.

Offline dprai

  • Regular QuantumATK user
  • **
  • Posts: 23
  • Country: in
  • Reputation: 0
  • Learning Simulation of Nanoelectronics
    • View Profile
Charge Density Difference
« on: March 6, 2022, 13:57 »
Dear All,
How can we obtain a charge density difference plot in ATK?
I have attached a plot for reference. The reference doi for the article is https://doi.org/10.1021/acsomega.1c06860.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: Charge Density Difference
« Reply #1 on: April 6, 2022, 04:24 »
If you have computed the difference electron density you just plot it in the Viewer. To get the geometry included as well you drop the structure onto the same open Viewer window.

Offline Kim_W

  • Heavy QuantumATK user
  • ***
  • Posts: 59
  • Country: cn
  • Reputation: 0
    • View Profile
Re: Charge Density Difference
« Reply #2 on: December 7, 2022, 04:58 »
As far as I know, ATK cannot calculate the charge density difference between two individuals, only the EDD
« Last Edit: December 7, 2022, 05:00 by Wang Jin »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: Charge Density Difference
« Reply #3 on: December 7, 2022, 17:17 »
EDD = electron difference density

Not sure what you mean by "individuals"

Offline Kim_W

  • Heavy QuantumATK user
  • ***
  • Posts: 59
  • Country: cn
  • Reputation: 0
    • View Profile
Re: Charge Density Difference
« Reply #4 on: December 8, 2022, 09:44 »
How can we obtain a charge density difference (CDD) of the system in ATK? Not EDD.

Offline filipr

  • QuantumATK Staff
  • Heavy QuantumATK user
  • *****
  • Posts: 81
  • Country: dk
  • Reputation: 6
  • QuantumATK developer
    • View Profile
Re: Charge Density Difference
« Reply #5 on: December 12, 2022, 11:40 »
If I understand what you mean by charge density difference, you need to split it up in three different calculations: 1) Full system, e.g. surface + molecule 2) only surface 3) only molecule. It is important that you use the same unit cell and grid sampling for each calculation, even the small molecule. To set a specific grid sampling you can use: density_mesh_cutoff=GridSampling(Na, Nb, Nc). If you do the calculation of the full system you can read off the grid sampling used in the log output or using e.g. density.shape() in Python. Calculate the electron density for each system, then you can calculate the difference as:
Code
density_full = nlread('calculation_surface+molecule.hdf5', ElectronDensity)[0]
density_surface = nlread('calculation_surface.hdf5', ElectronDensity)[0]
density_molecule = nlread('calculation_molecule.hdf5', ElectronDensity)[0]

charge_difference_density = density_full - density_surface - density_molecule
nlsave('charge_difference_density.hdf5', charge_difference_density)
The charge_difference_density variable will contain a generic GridValues object that can be opened and viewed in NanoLab.

Offline Kim_W

  • Heavy QuantumATK user
  • ***
  • Posts: 59
  • Country: cn
  • Reputation: 0
    • View Profile
Re: Charge Density Difference
« Reply #6 on: March 8, 2023, 08:04 »
I have an error while running.
 
Traceback (most recent call last):
  File "charge_difference_density.py", line 5, in <module>
    charge_difference_density = density_full - density_Graphene - density_MoSe2
TypeError: unsupported operand type(s) for -: 'list' and 'list'

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: Charge Density Difference
« Reply #7 on: March 8, 2023, 08:30 »
Did you remember the [ 0 ] at the end of each line? Else show your script. (I have to use spaces, else it gets formatted weirdly, you don't need those)

nlread always returns a list, even if the file only contains one object of each kind.

PS: Please do not use "Report" for a post unless it's spam
« Last Edit: March 8, 2023, 08:35 by Anders Blom »

Offline Kim_W

  • Heavy QuantumATK user
  • ***
  • Posts: 59
  • Country: cn
  • Reputation: 0
    • View Profile
Re: Charge Density Difference
« Reply #8 on: March 23, 2023, 04:35 »
There should be some problems with my script, please help me to modify it, thank you.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: Charge Density Difference
« Reply #9 on: March 27, 2023, 07:23 »
Right, as I said, you are missing the index 0. It should be
density_full = nlread('Interface.hdf5', ElectronDensity)[0]
and so on

Offline Kim_W

  • Heavy QuantumATK user
  • ***
  • Posts: 59
  • Country: cn
  • Reputation: 0
    • View Profile
Re: Charge Density Difference
« Reply #10 on: March 30, 2023, 08:37 »
Errors are still being reported. :'( :'(

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5573
  • Country: dk
  • Reputation: 95
    • View Profile
    • QuantumATK at Synopsys
Re: Charge Density Difference
« Reply #11 on: March 30, 2023, 20:55 »
Well, then this file does not contain any object of the type ElectronDensity. Maybe it's an ElectronDifferenceDensity?

Note that the task you are trying to achieve can actually be done in the GUI. Select all 3 objects in the Data view or LabFloor for older versions, and right-click and choose Open with > Grid Operations Analyzer. Then you can subtract them, and save the result.
« Last Edit: March 30, 2023, 21:04 by Anders Blom »

Offline Kim_W

  • Heavy QuantumATK user
  • ***
  • Posts: 59
  • Country: cn
  • Reputation: 0
    • View Profile
Re: Charge Density Difference
« Reply #12 on: March 31, 2023, 05:19 »
A new problem has arisen. How to keep three objects with same grid points?

Offline filipr

  • QuantumATK Staff
  • Heavy QuantumATK user
  • *****
  • Posts: 81
  • Country: dk
  • Reputation: 6
  • QuantumATK developer
    • View Profile
Re: Charge Density Difference
« Reply #13 on: March 31, 2023, 10:00 »
If I understand what you mean by charge density difference, you need to split it up in three different calculations: 1) Full system, e.g. surface + molecule 2) only surface 3) only molecule. It is important that you use the same unit cell and grid sampling for each calculation, even the small molecule. To set a specific grid sampling you can use: density_mesh_cutoff=GridSampling(Na, Nb, Nc). If you do the calculation of the full system you can read off the grid sampling used in the log output or using e.g. density.shape() in Python. Calculate the electron density for each system, then you can calculate the difference as:
Code
density_full = nlread('calculation_surface+molecule.hdf5', ElectronDensity)[0]
density_surface = nlread('calculation_surface.hdf5', ElectronDensity)[0]
density_molecule = nlread('calculation_molecule.hdf5', ElectronDensity)[0]

charge_difference_density = density_full - density_surface - density_molecule
nlsave('charge_difference_density.hdf5', charge_difference_density)
The charge_difference_density variable will contain a generic GridValues object that can be opened and viewed in NanoLab.