Author Topic: Setting different temperature for different regions  (Read 2576 times)

0 Members and 1 Guest are viewing this topic.

Offline AsifShah

  • QuantumATK Guru
  • ****
  • Posts: 166
  • Country: in
  • Reputation: 2
    • View Profile
Setting different temperature for different regions
« on: August 16, 2024, 21:55 »
Dear Admin,

How can one set a heating rate only for a specific tag of atoms? In QuantumATK by default heating rate is set for all atoms.
« Last Edit: August 16, 2024, 22:50 by AsifShah »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5531
  • Country: dk
  • Reputation: 90
    • View Profile
    • QuantumATK at Synopsys
Re: Setting different temperature for different regions
« Reply #1 on: August 27, 2024, 01:28 »
No, that is currently not implemented.

Offline AsifShah

  • QuantumATK Guru
  • ****
  • Posts: 166
  • Country: in
  • Reputation: 2
    • View Profile
Re: Setting different temperature for different regions
« Reply #2 on: August 27, 2024, 07:27 »
Dear Anders Blom,
Thanks for your response.
I was able to do it manually using post_step_hook. Looks like post_step_hook is a nice way to do many things.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5531
  • Country: dk
  • Reputation: 90
    • View Profile
    • QuantumATK at Synopsys
Re: Setting different temperature for different regions
« Reply #3 on: August 31, 2024, 00:06 »
That's really nice, good job! Yes, the hooks are very useful.

May I ask what your application is, in case it's worthwhile that we implement more of a core-level support for this? And perhaps you can share your hook so the community can benefit from your clever solution!

Offline AsifShah

  • QuantumATK Guru
  • ****
  • Posts: 166
  • Country: in
  • Reputation: 2
    • View Profile
Re: Setting different temperature for different regions
« Reply #4 on: August 31, 2024, 21:35 »
Dear Ander Bloms, It's for simulating Joule's heating in a small region. I would love to share but I am still improving upon the code. I am not able to maintain temperature properly. I used manual code in hook method but I was thinking if I could utilize velocity distribution from class MaxwellBoltzmannDistribution in QuantumATK. I have been trying to obtain velocities from this distribution but i run into errors. Can you help me with that? I am trying to set velocities using this method for a configuration but it runs into error. Kindly help in this case. Also, is there a direct way to extract say 10 random velocities from class MaxwellBoltzmannDistribution?
Code
# %% Molybdenite (1)

# Set up lattice
lattice = Hexagonal(3.1604*Angstrom, 12.295*Angstrom)

# Define elements
elements = [Molybdenum, Sulfur, Molybdenum]

# Define coordinates
fractional_coordinates = [[ 0.333333333333,  0.666666666667,  0.25          ],
                          [ 0.666666666667,  0.333333333333,  0.121         ],
                          [ 0.666666666667,  0.333333333333,  0.379         ]]

# Set up configuration
molybdenite_1 = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates,
    )
molybdenite_1_name = "molybdenite_1"

molybdenite_1.setVelocities(
    velocities=MaxwellBoltzmannDistribution(
        temperature=300*Kelvin
        )
    )
« Last Edit: September 2, 2024, 06:41 by AsifShah »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5531
  • Country: dk
  • Reputation: 90
    • View Profile
    • QuantumATK at Synopsys
Re: Setting different temperature for different regions
« Reply #5 on: September 5, 2024, 23:50 »
This is a special use case, normally the MaxwellBoltzmannDistribution is passed as an argument to the molecular dynamics algorithm, not the configuration itself. But it can be done, like so:
Code: python
mb = MaxwellBoltzmannDistribution(temperature=300*Kelvin)
mb._applyToConfiguration(molybdenite_1)
However, if you anyway intend to run MD on this, you don't need to set velocities on the atoms, just tell the MD algorithm to use the Maxwell Boltzmann distribution for initial velocities.

Offline AsifShah

  • QuantumATK Guru
  • ****
  • Posts: 166
  • Country: in
  • Reputation: 2
    • View Profile
Re: Setting different temperature for different regions
« Reply #6 on: September 6, 2024, 22:32 »
Thanks a lot.