Author Topic: Optimization issue  (Read 1200 times)

0 Members and 1 Guest are viewing this topic.

Offline Jahanzaib

  • Heavy QuantumATK user
  • ***
  • Posts: 81
  • Country: gb
  • Reputation: 2
    • View Profile
Optimization issue
« on: November 26, 2022, 23:57 »
Hello,
I am optimizing the stanene nanoribbon and cluster on it surface, but even 3,4 days it's not converging. I have attached the input file - Can some one guide me what would be the issue due to which it's not converging even after 3,4 days?

# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Bulk Configuration
# -------------------------------------------------------------

# Set up lattice
vector_a = [87.7884, 0.0, 0.0]*Angstrom
vector_b = [0.0, 175.0, 0.0]*Angstrom
vector_c = [0.0, 0.0, 32.51127454211999]*Angstrom
lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
elements = [Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin,
            Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin,
            Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin,
            Tin, Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen, Hydrogen,
            Hydrogen, Hydrogen, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin,
            Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin,
            Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin, Tin,
            Tin, Tin, Tin, Tin, Tin, Hydrogen, Hydrogen, Hydrogen, Hydrogen,
            Hydrogen, Hydrogen, Hydrogen, Hydrogen, Tin, Tin, Tin, Tin, Tin,
            Tin, Tin, Tin, Tin, Iron, Iron, Tin, Tin, Tin, Tin, Tin, Tin, Tin,
            Tin, Tin, Iron]

# Define coordinates
fractional_coordinates = [[ 0.545001091377,  0.439667441783,  0.008394265003],
                          [ 0.545001091377,  0.439667441783,  0.258394265003],
                          [ 0.545001091377,  0.439667441783,  0.508394265003],
                          [ 0.545001091377,  0.439667441783,  0.758394265003],
                          [ 0.545001091377,  0.466482059909,  0.008394265003],
                          [ 0.545001091377,  0.466482059909,  0.258394265003],
                          [ 0.545001091377,  0.466482059909,  0.508394265003],
                          [ 0.545001091377,  0.466482059909,  0.758394265003],
                          [ 0.545001091377,  0.493296678034,  0.008394265003],
                          [ 0.545001091377,  0.493296678034,  0.258394265003],
                          [ 0.545001091377,  0.493296678034,  0.508394265003],
                          [ 0.545001091377,  0.493296678034,  0.758394265003],
                          [ 0.545001091377,  0.520111296159,  0.008394265003],
                          [ 0.545001091377,  0.520111296159,  0.258394265003],
                          [ 0.545001091377,  0.520111296159,  0.508394265003],
                          [ 0.545001091377,  0.520111296159,  0.758394265003],
                          [ 0.545001091377,  0.546925914284,  0.008394265003],
                          [ 0.545001091377,  0.546925914284,  0.258394265003],
                          [ 0.545001091377,  0.546925914284,  0.508394265003],
                          [ 0.545001091377,  0.546925914284,  0.758394265003],
                          [ 0.534447034618,  0.439666890916,  0.091815649394],
                          [ 0.534447034618,  0.439666890916,  0.341815649394],
                          [ 0.534447034618,  0.439666890916,  0.591815649394],
                          [ 0.534447034618,  0.439666890916,  0.841815649394],
                          [ 0.534447034618,  0.466481509041,  0.091815649394],
                          [ 0.534447034618,  0.466481509041,  0.341815649394],
                          [ 0.534447034618,  0.466481509041,  0.591815649394],
                          [ 0.534447034618,  0.466481509041,  0.841815649394],
                          [ 0.534447034618,  0.520110745291,  0.091815649394],
                          [ 0.534447034618,  0.520110745291,  0.341815649394],
                          [ 0.534447034618,  0.520110745291,  0.591815649394],
                          [ 0.534447034618,  0.520110745291,  0.841815649394],
                          [ 0.534447034618,  0.546925363416,  0.091815649394],
                          [ 0.534447034618,  0.546925363416,  0.341815649394],
                          [ 0.534447034618,  0.546925363416,  0.591815649394],
                          [ 0.534447034618,  0.546925363416,  0.841815649394],
                          [ 0.534447034618,  0.493296127166,  0.091815649395],
                          [ 0.534447034618,  0.493296127166,  0.341815649395],
                          [ 0.534447034618,  0.493296127166,  0.591815649395],
                          [ 0.534447034618,  0.493296127166,  0.841815649395],
                          [ 0.538725180092,  0.568336949088,  0.108590434607],
                          [ 0.538725180092,  0.568336949088,  0.358590434607],
                          [ 0.538725180092,  0.568336949088,  0.608590434607],
                          [ 0.538725180092,  0.568336949088,  0.858590434607],
                          [ 0.540784511345,  0.431663050912,  0.116665156977],
                          [ 0.540784511345,  0.431663050912,  0.366665156977],
                          [ 0.540784511345,  0.431663050912,  0.616665156977],
                          [ 0.540784511345,  0.431663050912,  0.866665156977],
                          [ 0.545062656885,  0.533518490939,  0.133439941882],
                          [ 0.545062656885,  0.533518490939,  0.383439941882],
                          [ 0.545062656885,  0.533518490939,  0.633439941882],
                          [ 0.545062656885,  0.533518490939,  0.883439941882],
                          [ 0.545062656885,  0.453074636564,  0.133439941882],
                          [ 0.545062656885,  0.453074636564,  0.383439941882],
                          [ 0.545062656885,  0.453074636564,  0.633439941882],
                          [ 0.545062656885,  0.453074636564,  0.883439941882],
                          [ 0.545062656885,  0.479889254689,  0.133439941882],
                          [ 0.545062656885,  0.479889254689,  0.383439941882],
                          [ 0.545062656885,  0.479889254689,  0.633439941882],
                          [ 0.545062656885,  0.479889254689,  0.883439941882],
                          [ 0.545062656885,  0.506703872814,  0.133439941882],
                          [ 0.545062656885,  0.506703872814,  0.383439941882],
                          [ 0.545062656885,  0.506703872814,  0.633439941882],
                          [ 0.545062656885,  0.506703872814,  0.883439941882],
                          [ 0.545062656885,  0.560333109065,  0.133439941882],
                          [ 0.545062656885,  0.560333109065,  0.383439941882],
                          [ 0.545062656885,  0.560333109065,  0.633439941882],
                          [ 0.545062656885,  0.560333109065,  0.883439941882],
                          [ 0.534391508784,  0.453074334526,  0.216743534207],
                          [ 0.534391508784,  0.453074334526,  0.466743534207],
                          [ 0.534391508784,  0.453074334526,  0.716743534207],
                          [ 0.534391508784,  0.453074334526,  0.966743534207],
                          [ 0.534391508784,  0.479888952651,  0.216743534207],
                          [ 0.534391508784,  0.479888952651,  0.466743534207],
                          [ 0.534391508784,  0.479888952651,  0.716743534207],
                          [ 0.534391508784,  0.479888952651,  0.966743534207],
                          [ 0.534391508784,  0.506703570776,  0.216743534207],
                          [ 0.534391508784,  0.506703570776,  0.466743534207],
                          [ 0.534391508784,  0.506703570776,  0.716743534207],
                          [ 0.534391508784,  0.506703570776,  0.966743534207],
                          [ 0.534391508784,  0.533518188901,  0.216743534207],
                          [ 0.534391508784,  0.533518188901,  0.466743534207],
                          [ 0.534391508784,  0.533518188901,  0.716743534207],
                          [ 0.534391508784,  0.533518188901,  0.966743534207],
                          [ 0.534391508784,  0.560332807026,  0.216743534207],
                          [ 0.534391508784,  0.560332807026,  0.466743534207],
                          [ 0.534391508784,  0.560332807026,  0.716743534207],
                          [ 0.534391508784,  0.560332807026,  0.966743534207],
                          [ 0.538668007478,  0.431664087298,  0.233532064004],
                          [ 0.538668007478,  0.431664087298,  0.483532064004],
                          [ 0.538668007478,  0.431664087298,  0.733532064004],
                          [ 0.538668007478,  0.431664087298,  0.983532064004],
                          [ 0.540724592801,  0.56833616151 ,  0.241605734997],
                          [ 0.540724592801,  0.56833616151 ,  0.491605734997],
                          [ 0.540724592801,  0.56833616151 ,  0.741605734997],
                          [ 0.540724592801,  0.56833616151 ,  0.991605734997],
                          [ 0.481191360607,  0.490116494889,  0.433668563691],
                          [ 0.454937343115,  0.51128640202 ,  0.559207748975],
                          [ 0.457765726314,  0.510467556028,  0.433668031845],
                          [ 0.481191138358,  0.493838475594,  0.326063421612],
                          [ 0.457767592128,  0.496900652858,  0.510787308269],
                          [ 0.454940306488,  0.496082029735,  0.38524772928 ],
                          [ 0.498185776347,  0.50860527515 ,  0.326062205358],
                          [ 0.46419187606 ,  0.508606614722,  0.326063035667],
                          [ 0.481187018047,  0.518888042359,  0.385245850884],
                          [ 0.481189107277,  0.503683181452,  0.472227097958],
                          [ 0.481189352698,  0.503683318637,  0.398966408015],
                          [ 0.481186853947,  0.517249868015,  0.510785632225],
                          [ 0.507440871439,  0.496079960885,  0.385246446941],
                          [ 0.50461248824 ,  0.496898806876,  0.510786164071],
                          [ 0.481187076197,  0.51352788731 ,  0.618390774304],
                          [ 0.504610622426,  0.510465710046,  0.433666887647],
                          [ 0.507437908066,  0.511284333169,  0.559206466636],
                          [ 0.464192438208,  0.498761087755,  0.618391990558],
                          [ 0.498186338494,  0.498759748182,  0.618391160249],
                          [ 0.481191196508,  0.488478320545,  0.559208345032],
                          [ 0.481188861857,  0.503683044267,  0.545487787901]]

# Set up configuration
bulk_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = SGGA.PBE

numerical_accuracy_parameters = NumericalAccuracyParameters(
    density_mesh_cutoff=85.0*Hartree,
    occupation_method=FermiDirac(0.01*eV),
    )

calculator = LCAOCalculator(
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    )

bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('C-Pre.hdf5', bulk_configuration)

# -------------------------------------------------------------
# Optimize Geometry
# -------------------------------------------------------------

constraints = [FixStrain(x=False, y=False, z=True)]

bulk_configuration = OptimizeGeometry(
    bulk_configuration,
    max_forces=0.05*eV/Ang,
    max_stress=0.1*GPa,
    max_steps=200,
    max_step_length=0.2*Ang,
    constraints=constraints,
    trajectory_filename='C-Pre_trajectory.hdf5',
    trajectory_interval=5.0*Minute,
    restart_strategy=RestartFromTrajectory(),
    optimizer_method=LBFGS(),
    enable_optimization_stop_file=True,
)
nlsave('C-Pre.hdf5', bulk_configuration)
nlprint(bulk_configuration)

Offline AsifShah

  • QuantumATK Guru
  • ****
  • Posts: 144
  • Country: in
  • Reputation: 2
    • View Profile
Re: Optimization issue
« Reply #1 on: November 27, 2022, 07:44 »
Try keeping max stress 0.001 eV/[A][/-3]
change the gpa unit to eV/A-3

Offline Jahanzaib

  • Heavy QuantumATK user
  • ***
  • Posts: 81
  • Country: gb
  • Reputation: 2
    • View Profile
Re: Optimization issue
« Reply #2 on: November 28, 2022, 13:55 »
Yes, I tried - I don't know why It's not working