3.4. Local histogram matching Local histogram matching in contrary to global history matching, where histogram of the whole map is matched, calculates match of an density map with an atom locally for each point of the whole unit cell map. The following procedure ">utils/hist_match.com" generates electron density of a single atom (sulphur) placed at the coordinate system origin in a P1 cell with its' b-value equal to HIST_TEMP and calculates convolution of the single atom with the underlaying map using the convoluion theorem. (Structure factors of single atom map are multiplied with structure factors of the underlaying map and then backtransformed into a map.) This procedure is intended to be called from other procedures as a subprocedue, which, after a structure factor calculation and its storage in the "fwork" array, multiplies it with the structure factors of the histogram. Product can be afterwards (after the return) transformed into a map that serves for inspection or further calculations. This file is made to be called from a solvent flattening procedure and utilizes the MAP_SOLV for its structure factor calculation. In your own cases change the variable name or assign accordingly the MAP_SOLV and HIST_TEMP values. main/utils/hist_match.com > read atom > * > SGX > set weight sele numb atom natom end 1.0 > set temp sele numb atom natom end HIST_TEMP > make map MAP_SOLV zero > make map MAP_SOLV conv real > make map MAP_SOLV atom dens sele numb atom natom end > delete atom sele numb atom natom end > four map MAP_SOLV > reflect set ampl phase fwork = fwork * 1.0 * fcalc * 1.0 > return