! Module file: normalizeprobability ! ! CNS module ! ********** ! ! Authors: Piet Gros and Axel T. Brunger ! ! copyright Yale University ! ! Function: ! Normalize phase probability. Note: the normalization is dependent on ! the size of the phase step in the integration. ! ! Requirements: ! 1. This module can only be called called from xray ! 2. Probability must be supplied in Hendrickson & Lattman coefficients ! module {normalizeprobability} ( &messages="off"; &sel=(all); {structure factor selection} &pk=pk; {Hendrickson and Lattman K array, i.e.-log normalization factor} &pa=pa; {Hendrickson and Lattman A array} &pb=pb; {Hendrickson and Lattman B array} &pc=pc; {Hendrickson and Lattman C array} &pd=pd; {Hendrickson and Lattman D array} &phistep=20; {size of phase steps in integration} &cen360=FALSE; { TRUE | FALSE (type logical); if TRUE a full 0...360 phase prob. distr. } { is used for centric reflections (useful if the "native" } { structure factor has an anomalous signal). } ) checkversion 1.3 do (&pk=get_norm[phistep=&phistep,CEN360=&cen360](&pa,&pb,&pc,&pd)) (&sel) ! {*Normalize*} ! !do (work=0) (all) {avoid numerical overflow} !do (work= ! max ! ( ! (pa*cos(centric_phase)+pb*sin(centric_phase)), ! (-pa*cos(centric_phase)-pb*sin(centric_phase)) ! ) ! ) ( (not &cen360) and centric and sel) !do (work= ! maximize[_phi,0,360,phistep] ! ( ! pa*cos(_phi)+pb*sin(_phi)+pc*cos(2*_phi)+pd*sin(2*_phi) ! ) ! ) (( &cen360 or acentric) and sel) ! !do (pk= {normalize} ! exp ! ( ! pa*cos(centric_phase)+pb*sin(centric_phase) ! -work ! ) ! +exp ! ( ! -pa*cos(centric_phase)-pb*sin(centric_phase) ! -work ! ) ! ) ((not &cen360) and centric and sel) !do (pk= ! integrate[_phi,0,360,phistep] ! (exp ! ( ! pa*cos(_phi)+pb*sin(_phi)+pc*cos(2*_phi)+pd*sin(2*_phi)-work ! ) ! ) ! ) (( &cen360 or acentric) and sel) !