Details
ABACUS have the different max-force criterion from ASE and VASP.
In ABACUS, the max-force, namely LARGEST GRAD in print-out and Largest gradient in running*.log, which seems to be calculated by source/module_relax/relax_new/relax.cpp:
//=========================================
//set gradient for ions degrees of freedom
//=========================================
grad_ion.zero_out();
ModuleBase::matrix force_eva = force * (ModuleBase::Ry_to_eV / ModuleBase::BOHR_TO_A); //convert to eV/A
int iat=0;
for(int it = 0;it < GlobalC::ucell.ntype;it++)
{
Atom* atom = &GlobalC::ucell.atoms[it];
for(int ia =0;ia< GlobalC::ucell.atoms[it].na;ia++)
{
double force2 = 0.0;
if(atom->mbl[ia].x == 1)
{
grad_ion(iat, 0) = force_eva(iat, 0);
if( std::abs(force_eva(iat,0)) > max_grad) max_grad = std::abs(force_eva(iat,0));
}
if(atom->mbl[ia].y == 1)
{
grad_ion(iat, 1) = force_eva(iat, 1);
if( std::abs(force_eva(iat,1)) > max_grad) max_grad = std::abs(force_eva(iat,1));
}
if(atom->mbl[ia].z == 1)
{
grad_ion(iat, 2) = force_eva(iat, 2);
if( std::abs(force_eva(iat,2)) > max_grad) max_grad = std::abs(force_eva(iat,2));
}
++iat;
}
}
assert(iat==nat);
if(max_grad > force_thr_eva) force_converged = false;
if(GlobalV::OUT_LEVEL=="ie")
{
std::cout << " ETOT DIFF (eV) : " << etot - etot_p << std::endl;
std::cout << " LARGEST GRAD (eV/A) : " << max_grad << std::endl;
etot_p = etot;
}
The max force is directly calculated by the maximum of TOTAL-FORCE along x, y, and z.
An example is :
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
TOTAL-FORCE (eV/Angstrom)
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
atom x y z
H1 +0.012106811 -0.0042683316 +0.0037308624
H2 -0.024080247 -0.018872146 +0.047958005
........
Ion relaxation is converged!
Energy difference (Ry) = +0.000000
Largest gradient is (eV/A) = +0.047958
end of geometry optimization
But this method is different from ASE and VASP, which use the number of real force calculated by the vector sum of force along x, y, z, direction, respectively.
In ASE, the max-force calculation code is
if forces is None:
forces = self.atoms.get_forces()
fmax = sqrt((forces ** 2).sum(axis=1).max())
using the same example above, but by ASE-ABACUS, the fmax will be 0.057059 eV/Ang.
in which the force is read from ABACUS calculation result.
in VASP, an example is :
POSITION TOTAL-FORCE (eV/Angst)
-----------------------------------------------------------------------------------
9.58597 2.23321 7.72570 0.010849 0.007507 -0.021642
4.66193 2.20102 9.10501 -0.008403 0.036297 -0.019736
........
FORCES: max atom, RMS 0.042162 0.016426
FORCE total and by dimension 0.179943 0.040538
The max-force is calculated by the same method of ASE.
I consider that the max-force criterion of ASE and VASP is more reasonable, and the largest gradient in ABACUS my cause confusion to user and may raise problem during relaxation ?
By the way, in QE, the relaxation criterion is by total-force, which is the sum of all number of real-force.
@kirk0830 Thanks for checking
Task list for Issue attackers (only for developers)
Details
ABACUS have the different max-force criterion from ASE and VASP.
In ABACUS, the max-force, namely
LARGEST GRADin print-out andLargest gradientin running*.log, which seems to be calculated bysource/module_relax/relax_new/relax.cpp:The max force is directly calculated by the maximum of TOTAL-FORCE along x, y, and z.
An example is :
But this method is different from ASE and VASP, which use the number of real force calculated by the vector sum of force along x, y, z, direction, respectively.
In ASE, the max-force calculation code is
using the same example above, but by ASE-ABACUS, the
fmaxwill be 0.057059 eV/Ang.in which the force is read from ABACUS calculation result.
in VASP, an example is :
The max-force is calculated by the same method of ASE.
I consider that the max-force criterion of ASE and VASP is more reasonable, and the largest gradient in ABACUS my cause confusion to user and may raise problem during relaxation ?
By the way, in QE, the relaxation criterion is by total-force, which is the sum of all number of real-force.
@kirk0830 Thanks for checking
Task list for Issue attackers (only for developers)