Author Topic: ERROR  (Read 4542 times)

0 Members and 1 Guest are viewing this topic.

Offline Jahanzaib

  • QuantumATK Guru
  • ****
  • Posts: 103
  • Country: gb
  • Reputation: 3
    • View Profile
ERROR
« on: November 29, 2022, 16:29 »
Respected Experts,
I have attached the input and I found this error. Can someone please suggest me what's the issue

Convergence Report                                                           |
+------------------------------------------------------------------------------+
|                                                                              |
| SCF Tolerance: 1.00000e-04                                                   |
| Maximum number of steps: 100                                                 |
|                                                                              |
| Convergence Criteria:                                                        |
|                                                                              |
|  * Label: dE                                                                 |
|    Description: Band Energy Absolute Difference (Hartree)                    |
|    Value: 1.57915e-01 (Tolerance not reached)                                |
|                                                                              |
|  * Label: dH                                                                 |
|    Description: Maximum Norm of Hamiltonian Difference (Hartree)             |
|    Value: 9.84124e-04 (Tolerance not reached)

Offline filipr

  • QuantumATK Staff
  • Heavy QuantumATK user
  • *****
  • Posts: 81
  • Country: dk
  • Reputation: 6
  • QuantumATK developer
    • View Profile
Re: ERROR
« Reply #1 on: December 5, 2022, 11:17 »
I can't try out your script as copying from a PDF doesn't work for me. It would have been more useful if you simply attached the original .py file.

I'm not an expert in all kinds of materials, but my immediate intuition tells me that this Tin-Hydrogen-Iron compound is metallic (also it only really makes sense to do spin-polarized calculations for metallic systems). For metallic systems you should use a sizeable smearing, but you use 0.01 eV which is very low and only useful for ungapped systems. So try to change the smearing/electron temperature to the default value of 1000K, which is suitable for most metals. This should improve convergence. If you think this influences the results too much you have to use a denser k-point sampling. See also: https://docs.quantumatk.com/manual/technicalnotes/occupation_methods/occupation_methods.html

Offline Jahanzaib

  • QuantumATK Guru
  • ****
  • Posts: 103
  • Country: gb
  • Reputation: 3
    • View Profile
Re: ERROR
« Reply #2 on: December 5, 2022, 12:20 »
Thank you so much for detailed reply.

Actually, I am optimizing cluster on stanene nanoribbon, even 4 days optimization - it's never converged. I am using 1,1,1 k-points in A,B,C direction respectively because there is alot of vaccuum in A and B directions so alot of k-points doesn't have impact on it. I think so?  I have attached .py file. Can you please suggest how to improve it?

Offline filipr

  • QuantumATK Staff
  • Heavy QuantumATK user
  • *****
  • Posts: 81
  • Country: dk
  • Reputation: 6
  • QuantumATK developer
    • View Profile
Re: ERROR
« Reply #3 on: December 6, 2022, 09:12 »
Geometry optimization is really hard and time consuming for all but the simplest systems due to the very high number of degrees of freedom. You need very high numerical parameters (basis set, k-point sampling, density mesh cutoff) in order for it to converge smoothly, as you otherwise get random numerical errors that are on the order of magnitude as the energy differences and forces involved in the optimization steps.

The first step before doing geometry optimization is always to first determine the numerical parameters to use by doing a convergence study. This means doing repeatet DFT calculations of energy, forces and stress for the initial structure at increasing basis set, k-point sampling and density mesh cutoff (vary each independently) until the energy/forces/stress change less than at least an order of magnitude lower than the tolerances you want to use for the geometry optimization. Having found the optimal numerical parameters you can then proceed to use those for the geometry optimization.

However, in many cases, especially for larger composite system, geometry optimization is simply not possible in a single "hit the button and run" approach. Either it simply takes too long time or it gets stuck jumping between the many local minima. In these situations it is better to break the optimization into steps.

For instance in your case you can break the optimization into 4 steps, each done as separate calculations/jobs:

  • Optimize the Stanene nanoribbon geometry alone by running a geometry optimization (atoms + unit cell along periodic direction) of a single unit cell
  • Optimize the molecule alone without the nanoribbin in a separate calculation
  • Find the optimimal nanoribbon <-> molecule distance by simply calculating the total energy of the nanoribbon + molecule system at different distances, fitting some polynomial to the results and finding the minimum
  • Relax the atoms in the molecule and in the nanoribbon close to the molecule with a regular geometry optimization where you fix the unit cell and most atoms in the nanoribbon. The more atoms and thus degrees of freedom you fix, the faster and more stable the geometry optimization will be

In this way you trade computational load with more manual work, but the above approach should work in most cases. Also you can find the optimum numerical parameters from doing calculations on the sub-parts: nanoribbon unit cell and molecule separately - this will be much, much faster than trying to do so for the entire system.

Offline Jahanzaib

  • QuantumATK Guru
  • ****
  • Posts: 103
  • Country: gb
  • Reputation: 3
    • View Profile
Re: ERROR
« Reply #4 on: December 6, 2022, 15:04 »
Thank you so much for your detailed response.

Just to add, I have separately optimized stanene, then doing optimization.
but I will follow your guidance and hopefully It starts converging.

Thank you

Offline Jahanzaib

  • QuantumATK Guru
  • ****
  • Posts: 103
  • Country: gb
  • Reputation: 3
    • View Profile
Re: ERROR
« Reply #5 on: December 6, 2022, 16:29 »
Your point 3rd is not clear to me, Could you please elaborate?

Thank you

Offline filipr

  • QuantumATK Staff
  • Heavy QuantumATK user
  • *****
  • Posts: 81
  • Country: dk
  • Reputation: 6
  • QuantumATK developer
    • View Profile
Re: ERROR
« Reply #6 on: December 7, 2022, 13:50 »
You calculate the total energy of the configuration, but with different distances between the ribbon and molecule. The most optimal distance is the one that minimizes the total energy. This can be done in a Pythons script with a loop over distances, for example:
Code
distances = numpy.linspace(1.0, 3.0, 11) * Angstrom

for distance in distances:
    cartesian_coordinates[molecule_indices, 1] += distance

    configuration = BulkConfiguration(..., cartesian_coordinates=cartesian_coordinates)

    total_energy_analysis = TotalEnergy(configuration)
    nlsave(total_energy_analysis, ...)
Of course you have to write the actual script yourself so that it actually works. You can also do it by setting up multiple configurations in the Builder in the GUI and manually adjust the distance using the coordinate tools and submit each job separately if you're not experienced with Python programming.

Offline Jahanzaib

  • QuantumATK Guru
  • ****
  • Posts: 103
  • Country: gb
  • Reputation: 3
    • View Profile
Re: ERROR
« Reply #7 on: December 7, 2022, 14:19 »
Thank you so much.

I will try this script - i hope it will work