Author Topic: A question about MPSH calculation:some eigenstates can't be obtained  (Read 8566 times)

0 Members and 1 Guest are viewing this topic.

Offline iamddba

  • Regular QuantumATK user
  • **
  • Posts: 16
  • Reputation: 0
    • View Profile
Hello,everyone.  :) :)
I found that my probe-system calculation can terminated normally when the quantity of the MPSH eigenstates was less than 17, however, can not terminated normally when the quantity was 18 or larger.  ??? In the case of the latter, the *.vnl file can still plot normally in the Nanoscope but there are only 17(index from 0 to 16) eigenstates, and other eigenstates above the 17th can't present in the nanoscope list.  The error message in the output log is as below:

Traceback (most recent call last):
  File "c:/docume~1/admini~1/locals~1/temp/tmpb12hgk.nl", line 298, in ?
    if processIsMaster(): file.addToSample(state, 'MPSH 2.0V', label)
MemoryError:
Terminated Abnormally

Can anyone tell me the reason? And how can I solve the problem? Thanks in advance! :D

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
The reason is given in the error message: you run out of memory.

3D grids of this kind uses quite a lot of memory, and even if ATK could put all of the states into the same VNL file, you would have some trouble importing the file into VNL since the states also use a lot of memory there, so you would risk not being able to plot them anyway.

So, the solution is readily given: only put a few MPSH states in each VNL file.

Offline iamddba

  • Regular QuantumATK user
  • **
  • Posts: 16
  • Reputation: 0
    • View Profile
Thanks for your reply, dear Blom! ;D 
In fact I have guessed the reason and have dealed with it like your reply. Of course, I must use more times to complete the calculation.
thanks again.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
It should not take more time, provided you use the functionality to restore the checkpoint file and compute the MPSH states from that. In that case the overhead should be minimal since you do not need to re-run anything, i.e. you run the SCF loop once only, and then use the converged state to perform various types of analysis, like the MPSH states or compute the transmission, etc.

Restoring the checkpoint file can be set up from VNL, although it's often best to do it directly in a script, using copied code generated by VNL.

Offline iamddba

  • Regular QuantumATK user
  • **
  • Posts: 16
  • Reputation: 0
    • View Profile
It should not take more time, provided you use the functionality to restore the checkpoint file and compute the MPSH states from that. In that case the overhead should be minimal since you do not need to re-run anything, i.e. you run the SCF loop once only, and then use the converged state to perform various types of analysis, like the MPSH states or compute the transmission, etc.

Restoring the checkpoint file can be set up from VNL, although it's often best to do it directly in a script, using copied code generated by VNL.

Oh lord, I actually don't know the function of the checkpoint file and never used it before. According to what you said I have wasted much time. :'( Thank you very much for the useful advice. I will learn how to use checkpoint file and hope you give me guidance if I encounter some trouble. :D

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
If your original script looked something like this (as it would if generated by VNL)
Code
...
# Opening vnlfile
if processIsMaster(): file = VNLFile('myfile.vnl')

# Scattering elements and coordinates
...

if processIsMaster(): nlPrint(twoprobe_configuration)
if processIsMaster(): file.addToSample(twoprobe_configuration, 'twoprobe_configuration')

######################################################################
# Central region parameters
######################################################################

...

runtime_parameters = runtimeParameters(
    verbosity_level = 10,
    checkpoint_filename = "mycheckpoint.nc"
)

# Perform self-consistent field calculation
scf = executeSelfConsistentCalculation(
    twoprobe_configuration,
    two_probe_method,
    runtime_parameters = runtime_parameters
)

Always make sure to specify a checkpoint file!!! You can then use code which looks something like the following to create new VNL files, which contain the geometry plus some MPSH states:
Code
from ATK.TwoProbe import *
if processIsMaster(): 
    geo_file = VNLFile('myfile.vnl')
    samples = geo_file.readAtomicConfigurations()
    geometry = samples[samples.keys()[0]]

scf = restoreSelfConsistentCalculation("mycheckpoint.nc")

######################################################################
# Calculate physical properties
######################################################################
quantum_numbers = (0,1,2,3)

projected_hamiltonian_eigenstates = calculateProjectedHamiltonianEigenstates(
    self_consistent_calculation = scf,
    projection_atoms = (0,),
    quantum_numbers = quantum_numbers
)

if processIsMaster(): 
    mpsh_file = VNLFile('mpsh_%s.vnl' %s str(quantum_numbers))
    file.addToSample(geometry, 'twoprobe_configuration')

for i in range(len(quantum_numbers)):
    label = 'Projected Hamiltonian Eigenstates'+' '+str(quantum_numbers[i])
    if processIsMaster(): file.addToSample(projected_hamiltonian_eigenstates[i], 'twoprobe_configuration', label)
Note that we make new VNL files all the time, but "copy" the geometry from the old file. Make sure to change file names, projection atoms, etc above to match your own conditions! I didn't test the above extensively, there might be a typo, but you still need to make it work for your case (file names etc). So just let me know if there are any problems.

Offline iamddba

  • Regular QuantumATK user
  • **
  • Posts: 16
  • Reputation: 0
    • View Profile
Usually, I used VNL to create new input file, and looked through the scripts sometime. I will try on how to use the checkpoint file.
Thanks!

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
You can achieve roughly the same in VNL, but I think this is a good opportunity to learn a bit about the scripting language, since in this case it will give you a sense of more control over the files etc, plus that it will be easier to modify the script for different situations, than to click your way through the NanoLanguage Scripter.

In general this case highlights in a nice way several, imho superb features of ATK/NanoLanguage:
  • The ability to defer analysis until after the SCF loop is completed
  • The elimination of having to redo the SCF loop if you forgot some analysis in the original setup (ok, this is just an alternative formulation of the first point, but still :) )
  • Complete control of data in NanoLanguage
« Last Edit: August 31, 2009, 16:31 by Anders Blom »

Offline iamddba

  • Regular QuantumATK user
  • **
  • Posts: 16
  • Reputation: 0
    • View Profile
It looks very attractive to use script language to configurate the calculation conditions. :) I will try it following your words. ;D