Author Topic: Optimization parameters for convergence  (Read 4971 times)

0 Members and 1 Guest are viewing this topic.

Offline Yue-Wen Fang

  • Heavy QuantumATK user
  • ***
  • Posts: 29
  • Country: cn
  • Reputation: 0
    • View Profile
Optimization parameters for convergence
« on: April 1, 2015, 04:58 »
Dear all, For the geometry optimization in ATK, we usually use the parameters including
Code
 OptimizeGeometry(
configuration,
max_forces,
max_stress,
max_steps,
max_step_length,
scf_restart_step_length,
constraints,
trajectory_filename,
disable_stress,
optimizer_method
)
For the small systems such as a five atoms unite cell, it's easy to get convergence.  However, I found that sometimes it's not a trivial thing for large systems more that 50 atoms using ATK-DFT methods in VNL-ATK 2014.1.  I think it should be caused the unreasonable optimization parameters setted by me. As said by the official manual (http://www.quantumwise.com/documents/manuals/ATK-13.8/ReferenceManual/ref.optimizegeometry.html) , combining with my personal experience, max_forces is applied to atoms and the max_stress is applied to the cell. However, how to make them collaborate with each other effectively for large systems, together with max_steps and max_step_length? In the VASP software, we usually set two converge criterion, one is energy and the other is force. ATK seems different from VASP in this aspect. Energy criterion is absent in ATK. I don't  understand why ATK employs max_step_length (the maximum step length the optimizer may take).  Especially, why angstrom is chosen to serve as its length unit? Any comments are appreciated. Thank you in advance. Fang

Offline kstokbro

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 392
  • Reputation: 13
    • View Profile
    • QuantumWise
Re: Optimization parameters for convergence
« Reply #1 on: April 1, 2015, 10:32 »
Dear Fang,
In ATK there is a line minimization along the conjugate force direction. The step length is estimated from a parabolic interpolation, and it is our experience that this estimate is not reliable if the step length is too long, we therefore restrict the step lengths. The step length is specified as a physical quantity, and you can use any lenght scale, i.e. 2*Bohr or 1*Ang, 10**-10*Meter, etc.

In ATK-2015 we will release some additional relaxation methods

Offline Yue-Wen Fang

  • Heavy QuantumATK user
  • ***
  • Posts: 29
  • Country: cn
  • Reputation: 0
    • View Profile
Re: Optimization parameters for convergence
« Reply #2 on: April 2, 2015, 02:49 »
Hi, Dr. Kstokbro,

Thanks a lot.
Do you have experience in the settings of max_forces and max_stress for large systems?
For the step length, is it a good manner to use the default value given by ATK?
Comparing with other electronic structure calculation packages in our group, ATK isn't very fast within the framework of ATK-DFT.

Bests

Offline kstokbro

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 392
  • Reputation: 13
    • View Profile
    • QuantumWise
Re: Optimization parameters for convergence
« Reply #3 on: April 7, 2015, 21:53 »
For molecules you can try increasing the temperature to get better SCF convergence. In ATK-2015 we have the LBFGS which converges faster, and we have also optimized the force calculation. For molecules you may use the FFT solver for the electrostatics, it is much faster and is default in ATK-2015. ATK should be the fastest code available when you have more than 200 atoms in your system.

Offline Yue-Wen Fang

  • Heavy QuantumATK user
  • ***
  • Posts: 29
  • Country: cn
  • Reputation: 0
    • View Profile
Re: Optimization parameters for convergence
« Reply #4 on: April 9, 2015, 13:47 »
Dear Dr. Kstokbro, Thanks for your answers. Usually I need to conduct DFT calculations for large systems composed of solids or oxides thin films. Did you mean  ATK-DFT should be the fastest code when treating this kind of calculation?  But the calculation for me isn't as fast as you said. I think some important parameters may not be very reasonable in my recent calculations. To make it clear, the codes of a recent DFT calculation was pasted here. Could you give me some advice especially for the convergence criterion. This work of geometry optimization cost me 17 hours using one master and 3 slaves, which was much slower than other packages did. Kindest bests Fang
Code
# -------------------------------------------------------------
# Bulk configuration
# -------------------------------------------------------------

# Set up lattice
lattice = SimpleTetragonal(3.9909999371*Angstrom, 36.2396011353*Angstrom)

# Define elements
elements = [Platinum, Platinum, Platinum, Platinum, Platinum, Platinum,
            Platinum, Platinum, Platinum, Platinum, Platinum, Platinum,
            Platinum, Platinum, Platinum, Platinum, Platinum, Platinum, Barium,
            Barium, Barium, Barium, Titanium, Titanium, Titanium, Titanium,
            Titanium, Oxygen, Oxygen, Oxygen, Oxygen, Oxygen, Oxygen, Oxygen,
            Oxygen, Oxygen, Oxygen, Oxygen, Oxygen, Oxygen, Oxygen]

# Define coordinates
fractional_coordinates = [[ 0.         ,  0.         ,  0.054310001],
                          [ 0.         ,  0.         ,  0.162929997],
                          [ 0.         ,  0.5        ,  0.         ],
                          [ 0.         ,  0.5        ,  0.108620003],
                          [ 0.         ,  0.5        ,  0.217230007],
                          [ 0.5        ,  0.         ,  0.         ],
                          [ 0.5        ,  0.         ,  0.108620003],
                          [ 0.5        ,  0.         ,  0.217230007],
                          [ 0.5        ,  0.5        ,  0.054310001],
                          [ 0.5        ,  0.5        ,  0.162929997],
                          [ 0.         ,  0.         ,  0.945689976],
                          [ 0.         ,  0.         ,  0.837069988],
                          [ 0.         ,  0.5        ,  0.891380012],
                          [ 0.         ,  0.5        ,  0.782769978],
                          [ 0.5        ,  0.         ,  0.891380012],
                          [ 0.5        ,  0.         ,  0.782769978],
                          [ 0.5        ,  0.5        ,  0.945689976],
                          [ 0.5        ,  0.5        ,  0.837069988],
                          [ 0.         ,  0.         ,  0.331499994],
                          [ 0.         ,  0.         ,  0.443830013],
                          [ 0.         ,  0.         ,  0.556169987],
                          [ 0.         ,  0.         ,  0.668500006],
                          [ 0.5        ,  0.5        ,  0.276719987],
                          [ 0.5        ,  0.5        ,  0.389050007],
                          [ 0.5        ,  0.5        ,  0.501380026],
                          [ 0.5        ,  0.5        ,  0.613709986],
                          [ 0.5        ,  0.5        ,  0.726040006],
                          [ 0.5        ,  0.         ,  0.275339991],
                          [ 0.5        ,  0.         ,  0.38767001 ],
                          [ 0.5        ,  0.         ,  0.5        ],
                          [ 0.5        ,  0.         ,  0.612330019],
                          [ 0.5        ,  0.         ,  0.724659979],
                          [ 0.         ,  0.5        ,  0.275339991],
                          [ 0.         ,  0.5        ,  0.38767001 ],
                          [ 0.         ,  0.5        ,  0.5        ],
                          [ 0.         ,  0.5        ,  0.612330019],
                          [ 0.         ,  0.5        ,  0.724659979],
                          [ 0.5        ,  0.5        ,  0.331499994],
                          [ 0.5        ,  0.5        ,  0.443830013],
                          [ 0.5        ,  0.5        ,  0.556169987],
                          [ 0.5        ,  0.5        ,  0.668500006]]

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

# Add tags
bulk_configuration.addTags('Constraints')

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = [
    GGABasis.Oxygen_DoubleZetaPolarized,
    GGABasis.Titanium_DoubleZetaPolarized,
    GGABasis.Barium_DoubleZetaPolarized,
    GGABasis.Platinum_DoubleZetaPolarized,
    ]

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

numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=(4, 4, 1),
    )

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

bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('fer_relax.nc', bulk_configuration)

constraints = [FixStrain(x=True, y=True, z=False), 2, 5]
bulk_configuration = OptimizeGeometry(
        bulk_configuration,
        max_forces=0.1*eV/Ang,
        max_stress=0.05*eV/Ang**3,
        max_steps=200,
        max_step_length=0.2*Ang,
        constraints=constraints,
        trajectory_filename=None,
        optimizer_method=LBFGS(),
        )
nlsave('fer_relax.nc', bulk_configuration)
nlprint(bulk_configuration)

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile
Re: Optimization parameters for convergence
« Reply #5 on: April 14, 2015, 07:49 »
Dear Fang, your script looks fine. However, you can indeed modify the mixing a little bit to help convergence.
In particular, you can change the damping factor to 0.8.
By doing so you will speed up considerably each SCF step by reducing the number of steps need to reach convergence.
I did a quick test and your first step will converge in 48 steps insted of 89 going from about 7m 45s to about 4m and 20s with ATK 2014.
I don't know how many force and stress steps your job took to converge (it seems quite a lot) but you can see that saving about 45% of the time for each SCF step will make a difference.

These timing are done by using 4 MPI processes, 1 master and 3 slaves as you do.
However, notice that  since you use 4x4 k-points you will speed up even more your job by using 8 (1 master and 7 slaves) or even 16 MPI processes.
By doing so you can save another 30% for each SCF step going down to 3 minutes per cycle.

Finally, let me just mention that ATK 2015 will be much faster :) as already mentioned.