This shows you the differences between two versions of the page.

Link to this comparison view

penalties_and_restraints [2016/10/09 15:02]
johnsoevans created
penalties_and_restraints [2020/07/16 11:29]
Line 1: Line 1:
-====== Penalties and Restraints ====== 
-These are discussed in section 5 of the Tech Ref.  The notes below are all covered in Tech Ref but in a slightly different order. ​ You may find these useful. 
-Imagine a simple case where you want to use some form of soft-restraint to keep a coordinate x1 close to a particular fractional coordinate, e.g. close to 0.137. ​ Here 0.137 represents an “expected value”. 
-• In topas you could use a penalty equation: penalty = (x1 - 0.137)^2; 
-• Or you could use a restraint equation: restraint = (x1 - 0.137); 
-• Internally topas will square the restraint equation. ​ Your overall chi^2 therefore increases regardless of whether x1 is less than or greater than 0.137. ​ It therefore ends up being very similar to using the penalty equation. 
-• Don’t get too confused by the terms “penalty” and “restraint”. ​ They both try to steer the refinement towards a solution that is consistent with a non-diffraction based observation (e.g. here for some reason you expect x1 to be close to 0.137; more commonly you expect bond distances or angles to have certain values), or some condition such as non-overlap of atoms or an energetically sensible configuration (e.g. Topas anti_bump or grs_interaction). 
-• Soft-restraints differ from constraints. ​ Constraints are built into the refinement mathematically so that they have to be obeyed exactly. 
-• Restraint equations are handled by the least squares in exactly the same way as experimental observations (they are “extra observations”). ​ The restraint is an integral part of refinement and would typically be included in esd calculations.  ​ 
-• Penalties are typically used to influence the direction of a refinement. ​ For example, anti bump penalties can reduce the number of minima in Chi^2. ​ Penalties typically aren’t included in esd calculations (though you can override this with do_errors_include_penalties). 
-• Topas mimimises the overall Chi^2, which is a weighted sum of Chi^2(data) + k1 Chi^2(penalties) + k2*Chi^2(restraints) where k1 and k2 are weights for penalties and restraints (see the manual for exact definitions). 
-• Topas uses a separate A matrix for the data, penalties and restraints. ​ It chooses how to scale penalties or restraints against the data (i.e. how closely each is obeyed) by considering the relative magnitudes of the inverse error terms in each matrix.  ​ 
-• If you have several penalty equations you can change their relative weighting by using an equation like: penalty = w*(x1 - 0.137)^2. ​ The value w might be different for a soft-restraint on a bond angle compared to a bond distance. Typically you’d weight by 1/sigma^2 where sigma^2 is the standard uncertainty on the quantity. ​ The relative weighting for soft-restraints on distances (sigma = 0.01) and angles (sigma = 1) might therefore be 10000 to 1. 
-• The relative importance of penalties to data can be increased using the “penalties_weighting_K1 1” keyword. ​ Normally the default value of 1 is appropriate. 
-• Tech Ref tells you how to change the penalty/​restraint weightings to, for example, exactly mimic the formulation in shelx. 
-• There are differences in how penalties and restraints feed into the minimisation of Chi^2. ​ These are covered in detail in Tech Ref.  One difference is that off-diagonal terms in the A matrix are not calculated for penalties (unless approximate_A is defined). ​ This means that you might get quicker minimisation using restraint equations. ​ If penalties have a significant contribution to chi^2 than using approximate_A may give faster convergence as the off diagonal terms are then approximated by the BFGS method. 
-• Penalty equations can take any form – i.e. they can be more complex than the sum of differences squared which appear in restraint equations. ​ For example the equations in grs_interaction (which calculates a Lennard-Jones or Born-Mayer potentaion) can’t be written as the sum of differences between observed can calculated atomic interactions. 
-• Depending on how you write your soft-restraint equations they will have different weightings against the diffraction data and the mimimisation pathway and final minimum may differ. 
-• The built-in topas macros for soft-restraints such as Distance_Restrain() mainly apply penalty equations. 

Personal Tools