QuantumATK Forum

QuantumATK => General Questions and Answers => Topic started by: fanjiaping on October 21, 2010, 13:44

Title: confused by how to set the distance between molecule and electrode again :'(
Post by: fanjiaping on October 21, 2010, 13:44
   Dear
   I have learned the method about how to obtain the distance by calculating the total energy of the bulk (or we can call it as molecule-extend). That is to say, the distance could be obtained when the lowest total energy is reached. Unfortunately, the calculated energy can’t reach the lowest one point, and instead of that several points on a line are obtained. Therefore, I cannot get the exact distance between the certain molecule and the gold electrode. I am confused by the phenomenon and wonder how I can get the right distance. Could you give me some advices? Additionally, the script and the table of the total energy versus distance are in the attachment.
Thank you!
Title: Re: confused by how to set the distance between molecule and electrode again :'(
Post by: Anders Blom on October 21, 2010, 13:49
The method is right. Just get more decimals on the numbers, then you should hopefully see the real minimum!
Title: Re: confused by how to set the distance between molecule and electrode again :'(
Post by: fanjiaping on October 21, 2010, 14:31
       Thank you for your reply. but I don't still understand what is your meaning! How can I get more decimals on the numbers?  could you show more details about how to operate ?(the distance given by paper was 2.39 angstrom)
Title: Re: confused by how to set the distance between molecule and electrode again :'(
Post by: Anders Blom on October 21, 2010, 14:35
The Excel sheet you include only shows numbers without decimals. One of those numbers is actually the smallest one (probably), but you can only see this if you see the decimals, either by increasing the number of decimals shown in Excel, or just go to the source data and look at the numbers.
Title: Re: confused by how to set the distance between molecule and electrode again :'(
Post by: fanjiaping on October 21, 2010, 14:49
thank you ! I understand your meaning! thank you very much!
Title: Re: confused by how to set the distance between molecule and electrode again :'(
Post by: Nordland on October 21, 2010, 14:53
   but the .nc file also have't the decimals about total energy ? where can I find the decimals in total energy? or plus Exchange correlation and kinetic and so on?

Do you read the values from VNL or from atkpython?
Title: Re: confused by how to set the distance between molecule and electrode again :'(
Post by: Anders Blom on October 21, 2010, 16:50
Probably you are reading the NC file with VNL? That gives just a few decimals, if any, yes.

You can use a small script instead. Let's fist imagine we have only one NC file (I know, you have many, but let's take it step by step :) ). We can then read the total energy from the NC file, and print it, using a few lines of code

Code: python
total_energy = nlread("file.nc",TotalEnergy)[0]
print "%.10f" % float(total_energy.evaluate())

This prints the total energy with a lot of decimals!

Now, what to do if we have more than one file? Python to the rescue - specifically the module "glob"! Assuming we want all the NC files in the current directory:

Code: python
import glob
list_of_files = glob.glob("*.nc")
for file in list_of_files:
    total_energy = nlread(file,TotalEnergy)[0]
    print "%s\t%.10f" % (file,float(total_energy.evaluate()))

If you just want some files, just create a suitable file mask instead of "*.nc", like if your files are "abc_2.1.nc", "abc_2.2.nc", "abc_2.3.nc", and so on, use "abc*.nc".

Have fun!
Title: Re: confused by how to set the distance between molecule and electrode again :'(
Post by: fanjiaping on October 22, 2010, 15:27
     thank you for your kindly reply. I find I love the ATK software due to we can do what we want by using python language!