Author Topic: Unit trouble dipole moments  (Read 5027 times)

0 Members and 1 Guest are viewing this topic.

Offline MariaWJ

  • Regular QuantumATK user
  • **
  • Posts: 8
  • Country: dk
  • Reputation: 0
    • View Profile
Unit trouble dipole moments
« on: April 30, 2024, 14:06 »
Using the script for calculating dipole moments seems to have an error in the unit. I follow the tutorial: https://docs.quantumatk.com/manual/Types/ElectronDensity/ElectronDensity.html . What is the correct unit for the dipole moment?

I think the problem is this line:
# Calculate the volume of the volume element.
dV = numpy.dot(dX, numpy.cross(dY,dZ)) * length_unit**3

When I print dV.unit() I get bohr**6, I assume that is a mistake.
So is the final dipole printed in the unit of e*bohr or is it maybe Debye? or am I misunderstanding something?

Please help me, I am very confused!

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Unit trouble dipole moments
« Reply #1 on: April 30, 2024, 20:28 »
Yes, it's a mistake. At some point in the ancient past numpy.dot would strip off the unit so we had to reapply now, but now it gets multiplied in with the unit already applied.

Just skip the length_unit**3 and it works better! However, also see https://forum.quantumatk.com/index.php?topic=10790 about why you should use the ElectronDifferenceDensity, rather.

Offline MariaWJ

  • Regular QuantumATK user
  • **
  • Posts: 8
  • Country: dk
  • Reputation: 0
    • View Profile
Re: Unit trouble dipole moments
« Reply #2 on: May 1, 2024, 09:39 »
So the final unit should then be bohr*e, great. I am actually using electron difference density with a script adapted from your tutorial, but thanks for the heads up. I have a final curious question, would this dipole approach actually be applicable for periodic boundary conditions or is this purely molecular?
I am trying to calculate both polarization using the dipole for a monolayer with a bias. The bias I create with the metal plates but the dipole and  seem to respond rather drastically yielding too high values, so I just wondered if maybe I shouldn't do dipole with periodic boundaries?

Hope you have some insight

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Unit trouble dipole moments
« Reply #3 on: May 1, 2024, 20:10 »
I think the way we evaluate the dipole from the electron density is basically limited to molecules. For monolayers with voltages applied etc, it's more relevant to consider the dielectric response, i.e. the field gradient in the material vs. the external electric field.

Offline MariaWJ

  • Regular QuantumATK user
  • **
  • Posts: 8
  • Country: dk
  • Reputation: 0
    • View Profile
Re: Unit trouble dipole moments
« Reply #4 on: May 2, 2024, 09:52 »
Thank you for the response, but should polarization then not be a good property to calculate for a monolayer? Or is that best for a bulk material? I have tried running it but again I get mysteriously large values, in fact almost the same as when I do the dipole over the volume. That makes me question, is the polarization actually calculated through the dipole as in the scripts?

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Unit trouble dipole moments
« Reply #5 on: May 6, 2024, 23:12 »
If you mean ferroelectric polarization this can be evaluated (in-plane at least) the same way as for 3D bulk: https://docs.quantumatk.com/tutorials/polarization/polarization.html

Offline MariaWJ

  • Regular QuantumATK user
  • **
  • Posts: 8
  • Country: dk
  • Reputation: 0
    • View Profile
Re: Unit trouble dipole moments
« Reply #6 on: May 7, 2024, 13:47 »
I am sorry but I am really confused about the unit of the dipole moment when using the tutorial (with ElectronDifferenceDensity). I am trying to finalize a paper and this is my hold up.

When I calculate the dipole of CO I get 0.14 [whateverunit] and the experimental value is 0.16 debye. Are you sure ATK is not actually printing the value in debye? and not e*bohr?

Really hope you can help

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Unit trouble dipole moments
« Reply #7 on: May 7, 2024, 18:46 »
QuantumATK does not print anything you don't tell it to (apart from the self-consistent log) so this really depends on what your script looks like, which I don't know. Also, all quantities are kept internally with a unit attached, so there should never be a doubt about the unit, unless some special instructions are used to remove it. But you would have to share the script for us to help.
« Last Edit: May 7, 2024, 18:48 by Anders Blom »

Offline MariaWJ

  • Regular QuantumATK user
  • **
  • Posts: 8
  • Country: dk
  • Reputation: 0
    • View Profile
Re: Unit trouble dipole moments
« Reply #8 on: May 9, 2024, 12:09 »
I have attached the script I use to get the dipole. It is a modified version of the one you have to get the dipole from the electron density, this one just uses the electron difference density. I hope it is not too messy.

Hope you can help,
Maria

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Unit trouble dipole moments
« Reply #9 on: May 9, 2024, 20:30 »
I don't think there should be any confusion about units? It prints
X Y Z of dipole: [ 7.50489746e-07 -5.50684384e-05  6.86097535e-01] Bohr**4*e
to the file, and if you had printed the magnitude as you perhaps intended (you write m1 to the file) it would have shown
0.686097536725 Bohr**4*e

(The numbers are not your numbers as I don't have your molecule, I just use NH3 as an example)

Oh, I see you still use the old wrong script from the manual. You need to remove * length_unit**3 from the line defining dV
« Last Edit: May 9, 2024, 20:38 by Anders Blom »