Author Topic: How to restart phonon band calculation  (Read 2260 times)

0 Members and 1 Guest are viewing this topic.

Offline zhenlan

  • Regular QuantumATK user
  • **
  • Posts: 8
  • Country: dk
  • Reputation: 0
    • View Profile
How to restart phonon band calculation
« on: August 6, 2024, 14:43 »
Dear all,

I am currently working on a phonon band structure calculation. Unfortunately, the process stopped before completion. I would like to restart it but couldn't find instructions on how to do so in the tutorial. Below is the script I am using.



# Set up lattice
lattice = Hexagonal(10.7585*Angstrom, 21.0*Angstrom)

# Define elements
elements = [Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon,
            Carbon, Carbon, Carbon, Carbon]

# Define coordinates
fractional_coordinates = [[ 0.     ,  0.     ,  0.42024],
                          [ 0.03509,  0.2807 ,  0.42024],
                          [ 0.15789,  0.26315,  0.42024],
                          [ 0.29825,  0.38597,  0.42024],
                          [ 0.05263,  0.42105,  0.42024],
                          [ 0.19298,  0.54386,  0.42024],
                          [ 0.31579,  0.52632,  0.42024],
                          [ 0.45614,  0.64912,  0.42024],
                          [ 0.57895,  0.63158,  0.42024],
                          [ 0.7193 ,  0.75439,  0.42024],
                          [ 0.08772,  0.70176,  0.42024],
                          [ 0.21053,  0.68421,  0.42024],
                          [ 0.35088,  0.80702,  0.42024],
                          [ 0.47368,  0.78947,  0.42024],
                          [ 0.61404,  0.91229,  0.42024],
                          [ 0.73684,  0.89473,  0.42024],
                          [ 0.87719,  1.01754,  0.42024],
                          [ 0.10526,  0.8421 ,  0.42024],
                          [ 0.24561,  0.96491,  0.42024],
                          [ 0.36842,  0.94737,  0.42024],
                          [ 0.50877,  1.07017,  0.42024],
                          [ 0.63158,  1.05263,  0.42024],
                          [ 0.77193,  1.17544,  0.42024],
                          [ 0.89474,  1.1579 ,  0.42024],
                          [ 0.14035,  1.12281,  0.42024],
                          [ 0.26316,  1.10527,  0.42024],
                          [ 0.40351,  1.22807,  0.42024],
                          [ 0.52632,  1.21053,  0.42024],
                          [ 0.66667,  1.33334,  0.42024],
                          [ 0.78947,  1.31579,  0.42024],
                          [ 0.92982,  1.43859,  0.42024],
                          [ 0.42105,  1.36842,  0.42024],
                          [ 0.5614 ,  1.49122,  0.42024],
                          [ 0.68421,  1.47368,  0.42024],
                          [ 0.82456,  1.59649,  0.42024],
                          [ 0.94737,  1.57895,  0.42024],
                          [ 0.84211,  1.73685,  0.42024],
                          [ 0.98246,  1.85965,  0.42024],
                          [ 0.     ,  0.     ,  0.57976],
                          [ 0.12281,  0.14035,  0.57976],
                          [ 0.10526,  0.26315,  0.57976],
                          [ 0.22807,  0.40351,  0.57976],
                          [ 0.36842,  0.42105,  0.57976],
                          [ 0.49123,  0.56141,  0.57976],
                          [ 0.07018,  0.50878,  0.57976],
                          [ 0.21053,  0.52632,  0.57976],
                          [ 0.33333,  0.66666,  0.57976],
                          [ 0.47368,  0.68421,  0.57976],
                          [ 0.59649,  0.82456,  0.57976],
                          [ 0.73684,  0.8421 ,  0.57976],
                          [ 0.85965,  0.98246,  0.57976],
                          [ 0.05263,  0.63158,  0.57976],
                          [ 0.17544,  0.77193,  0.57976],
                          [ 0.31579,  0.78947,  0.57976],
                          [ 0.4386 ,  0.92983,  0.57976],
                          [ 0.57895,  0.94737,  0.57976],
                          [ 0.70175,  1.08771,  0.57976],
                          [ 0.84211,  1.10527,  0.57976],
                          [ 0.96491,  1.24561,  0.57976],
                          [ 0.01754,  0.87719,  0.57976],
                          [ 0.15789,  0.89473,  0.57976],
                          [ 0.2807 ,  1.03509,  0.57976],
                          [ 0.42105,  1.05263,  0.57976],
                          [ 0.54386,  1.19298,  0.57976],
                          [ 0.68421,  1.21053,  0.57976],
                          [ 0.80702,  1.35088,  0.57976],
                          [ 0.94737,  1.36842,  0.57976],
                          [ 0.26316,  1.1579 ,  0.57976],
                          [ 0.38596,  1.29824,  0.57976],
                          [ 0.52632,  1.31579,  0.57976],
                          [ 0.64912,  1.45614,  0.57976],
                          [ 0.78947,  1.47368,  0.57976],
                          [ 0.91228,  1.61403,  0.57976],
                          [ 0.63158,  1.57895,  0.57976],
                          [ 0.75439,  1.7193 ,  0.57976],
                          [ 0.89474,  1.73685,  0.57976]]

# Set up configuration
tbg13cif = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )
tbg13cif_name = "tbg13cif"


# %% Set LCAOCalculator

# %% LCAOCalculator

#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = GGA.PBE

correction_extension = GrimmeDFTD3(
    exchange_correlation=exchange_correlation
)

k_point_sampling = MonkhorstPackGrid(
    na=5,
    nb=5,
    nc=1
)

numerical_accuracy_parameters = NumericalAccuracyParameters(
    density_mesh_cutoff=70.0*Hartree,
    k_point_sampling=k_point_sampling
)

iteration_control_parameters = IterationControlParameters(
    tolerance=1e-06
)

calculator = LCAOCalculator(
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    iteration_control_parameters=iteration_control_parameters,
    checkpoint_handler=NoCheckpointHandler,
    correction_extension=correction_extension
)


# %% Set Calculator

tbg13cif.setCalculator(calculator)

tbg13cif.update()

nlsave('TBG-13-ocu-relax-dyn.hdf5', tbg13cif)


# %% OptimizeGeometry

restart_strategy = RestartFromTrajectory(
    trajectory_filename='TBG-13-ocu-relax-dyn.hdf5',
    object_id='optimize_trajectory'
)

optimized_configuration = OptimizeGeometry(
    configuration=tbg13cif,
    max_forces=0.001*eV/Angstrom,
    constraints=[
        FixStrain(False, False, True)
    ],
    trajectory_filename='TBG-13-ocu-relax-dyn.hdf5',
    trajectory_object_id='optimize_trajectory',
    optimize_cell=True,
    restart_strategy=restart_strategy
)

nlsave('TBG-13-ocu-relax-dyn.hdf5', optimized_configuration)


# %% Bandstructure

bandstructure = Bandstructure(
    configuration=optimized_configuration,
    route=['G', 'M', 'K', 'G']
)
nlsave('TBG-13-ocu-relax-dyn.hdf5', bandstructure)


# %% DynamicalMatrix

dynamical_matrix = DynamicalMatrix(
    configuration=optimized_configuration,
    filename='TBG-13-ocu-relax-dyn.hdf5',
    object_id='dm',
    calculator=calculator,
    repetitions=(3, 3, 1),
    processes_per_displacement=8
)
dynamical_matrix.update()


# %% PhononBandstructure

phonon_bandstructure = PhononBandstructure(
    dynamical_matrix=dynamical_matrix,
    configuration=optimized_configuration,
    route=['G', 'M', 'K', 'G'],
    points_per_segment=100
)
nlsave('TBG-13-ocu-relax-dyn.hdf5', phonon_bandstructure)

Thank you for your assistance!

Best regards,
Zy

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5529
  • Country: dk
  • Reputation: 90
    • View Profile
    • QuantumATK at Synopsys
Re: How to restart phonon band calculation
« Reply #1 on: August 7, 2024, 23:52 »
Just run the script again, it will continue where it was interrupted.

Offline zhenlan

  • Regular QuantumATK user
  • **
  • Posts: 8
  • Country: dk
  • Reputation: 0
    • View Profile
Re: How to restart phonon band calculation
« Reply #2 on: August 8, 2024, 11:09 »
Thank you for your reply.