! Module file: getbestphase ! ! CNS module ! ********** ! ! Authors: Piet Gros and Axel T. Brunger ! ! copyright Yale University ! ! Function: ! Compute best phase from phase probability ! ! Requirements: ! 1. This module can only be called from xray ! 2. Probability must be precomputed ! module {getbestphase} ( &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} &phase; {phase array.} &sel=(all); {structure factor selection} &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 declare domain=reci type=real name=gbp_pk end @@CNS_XTALMODULE:normalizeprobability ( sel=&sel; pk=gbp_pk; pa=&pa;pb=&pb;pc=&pc;pd=&pd; phistep=&phistep; cen360=&cen360; ) {* acentric phases *} do (&phase= (imaximize[_phi,0,360,&phistep] ( exp ( gbp_pk+&pa*cos(_phi)+&pb*sin(_phi)+&pc*cos(2*_phi)+&pd*sin(2*_phi) ) ) ) ) ((&cen360 or acentric) and &sel) {* centric phases *} do (&phase= phase(combine(1,centric_phase)* ( exp ( gbp_pk+&pa*cos(centric_phase)+&pb*sin(centric_phase) ) -exp ( gbp_pk-&pa*cos(centric_phase)-&pb*sin(centric_phase) ) ) )) ((not &cen360) and centric and &sel) undeclare domain=reci name=gbp_pk end