QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: lknife on May 18, 2017, 22:04

Title: how to center the lattice through python script?
Post by: lknife on May 18, 2017, 22:04
Dear all,

Followed the tutorial, I made a script to adjust the interlayer distance of a bilayer system with various D values. I wanted to calculate the "total energy vs interlayer distance" curve. I found that the value of lattice vectors had some effects on the total energy. Thus, I don't want to change the value of vector c as the tutorial does:
--------------------------------------------   
vc = vc + [0.0, 0.0, d]*Angstrom
--------------------------------------------
However, if I delete this code line, the final bulk configuration will not be at the center of the lattice, which will also affect the successive calculation.

My question is: how to center the bulk configuration through python script?

I am looking forward to your kind help!

Thank you very much for your time!
Title: Re: how to center the lattice through python script?
Post by: Anders Blom on May 18, 2017, 23:26
There are many ways, but the easiest (even if it's a bit unofficial, so maybe in later versions it doesn't work) is

from NL.CommonConcepts.Configurations.Utilities import center
center(bulk_configuration, axes=[False,False,True])

where the "axes" keyword controls in which directions the centering should be applied (A,B,C).
Title: Re: how to center the lattice through python script?
Post by: lknife on May 19, 2017, 19:03
Thank you very much for your kind help!