potfit wiki

open source force-matching

User Tools

Site Tools


analytic_potentials_punishments

Punishments for Analytic Potentials


For analytic potentials it may sometimes be necessary to use additional punishments to keep the potential in a predefined parameter space. If the initial contraints, given in the parameter file can not achieve this, then there is a special function which is called before every force calculation. This function can be used to check for additional contraints on analytic potentials.

The function is called apot_punish and can be found in functions.c.

/****************************************************************
 *
 * punish analytic potential for bad habits
 *
 ****************************************************************/
 
real apot_punish(real *params, real *forces)

The parameters are

real *params
   This is the array with the new parameters, access it with params[idx[i]], where $i<\text{ndim}$.

real *forces
   This is the global forces array, store additional punishments to ''forces[punish_par_p+ i]'', where $i<\text{ndim}$

Here is an example, where a function is punished if two parameters are too close together:

/* punish m=n for universal embedding function */
    if (strcmp(apot_table.names[i], "universal") == 0) {
      x = params[j+ 2] - params[j+ 1];
      if (fabs(x) < 1e-6) {
	forces[punish_pot_p+ i] = apot_punish_value / (x * x);
	tmpsum += apot_punish_value / (x * x);
      }
    }

The return value is used to make potfit aware of these extra punishments.

analytic_potentials_punishments.txt ยท Last modified: 2013/03/04 09:57 by daniel