Author Topic: How to continue a calculation?  (Read 4230 times)

0 Members and 1 Guest are viewing this topic.

Offline yangzw1985

  • QuantumATK Guru
  • ****
  • Posts: 113
  • Reputation: 0
    • View Profile
How to continue a calculation?
« on: March 11, 2009, 11:02 »
Hi, everyone!
I want to know if the calculation be stopped when the calculation has not finished, can I continue the calculation?
Last time, I have spend two days to calculation a curves, but power failure when the calculation has not finished. It means I waster a lot of time.
Can anyone tell me how to continue a calculation being stopped un-finished?
Thanks!!

Offline Nordland

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 812
  • Reputation: 18
    • View Profile
Re: How to continue a calculation?
« Reply #1 on: March 11, 2009, 11:56 »
In the manual under the section executeSelfconsistentCalculation you can find inspiration, but to summarize shortly.

Take a backup of the crashed netcdf file of the calculation and call it crash.nc

Then the following code will take this calculation and restart the calculation from this crash.nc
Quote
crashed_scf = restoreSelfConsistentCalculation('crash.nc')
new_scf = executeSelfConsistentCalculation(self_consistent_calculation=crashed_scf)

Offline yangzw1985

  • QuantumATK Guru
  • ****
  • Posts: 113
  • Reputation: 0
    • View Profile
Re: How to continue a calculation?
« Reply #2 on: March 11, 2009, 14:35 »
Hi,Nordland! To be honest, I can not understand what you have said accurately.

"Take a backup of the crashed netcdf file of the calculation and call it crash.nc"

can you give me more details? I didn't find any netcdf file in my computer.

"crashed_scf = restoreSelfConsistentCalculation('crash.nc')
new_scf = executeSelfConsistentCalculation(self_consistent_calculation=crashed_scf)"

where the quote should be place in order to re-continue a crashed calculation.


Thank you !

Offline Nordland

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 812
  • Reputation: 18
    • View Profile
Re: How to continue a calculation?
« Reply #3 on: March 11, 2009, 17:48 »
Look in the script you used for the calculation, in that file there should be something named checkpoint_filename or similar.
This will be the name of your netcdf file. A netcdf file has the extension .nc


Offline yangzw1985

  • QuantumATK Guru
  • ****
  • Posts: 113
  • Reputation: 0
    • View Profile
Re: How to continue a calculation?
« Reply #4 on: March 12, 2009, 12:17 »
Hi, Nordland! I have found the file,and I want to know
where the quote should be place in order to re-continue a crashed calculation.
Please give me some details.


please change the file and quote in the attached script.

Thanks!
« Last Edit: March 12, 2009, 12:33 by yangzw1985 »

Offline Nordland

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 812
  • Reputation: 18
    • View Profile
Re: How to continue a calculation?
« Reply #5 on: March 12, 2009, 14:59 »
You should have file in F:/li-h2-li/li-h2-li.nc, take a backup of this file
and call it something new like backup.nc.

Then should this script restart your calculation and use the old file for restarting:
Quote
from ATK.TwoProbe import *
from ATK.MPI import processIsMaster


# Opening vnlfile

if processIsMaster(): file = VNLFile('F:/li-h2-li/Li-H2-Li .vnl')

# Perform self-consistent field calculation

scf = executeSelfConsistentCalculation(
selfconsistent_calculation=restoreSelfConsistentCalculation('F:/li-h2-li/backup.nc')


######################################################################

# Calculate physical properties

######################################################################

import numpy

density_of_states = calculateDensityOfStates(

    self_consistent_calculation = scf,

    energies = numpy.arange(-12.0, 12.0+0.00480961923848, 0.0480961923848)*electronVolt,

    brillouin_zone_integration_parameters = brillouinZoneIntegrationParameters((1, 1)),

    green_function_infinitesimal = 1.0e-5*electronVolt

)

if processIsMaster(): nlPrint(density_of_states)

if processIsMaster(): file.addToSample(density_of_states, 'Li-H2-Li ', 'Density of states')