32 #include "ObjCryst/ObjCryst/ZScatterer.h"
33 #include "ObjCryst/ObjCryst/ScatteringData.h"
35 #include "ObjCryst/Quirks/VFNStreamFormat.h"
37 #include "ObjCryst/Quirks/VFNDebug.h"
44 #include <OpenGL/glu.h>
51 #include "ObjCryst/wxCryst/wxZScatterer.h"
52 #undef GetClassName // Conflict from wxMSW headers ? (cygwin)
55 #ifdef _MSC_VER // MS VC++ predefined macros....
68 ZAtom::ZAtom(ZScatterer &scatt,
const ScatteringPower *pow,
69 const long atomBond,
const REAL bondLength,
70 const long atomAngle,
const REAL bondAngle,
71 const long atomDihedral,
const REAL dihedralAngle,
72 const REAL popu,
const string &name):
74 mAtomBond(atomBond),mAtomAngle(atomAngle),mAtomDihed(atomDihedral),
75 mBondLength(bondLength),mAngle(bondAngle),mDihed(dihedralAngle),
76 mOccupancy(popu),mName(name),mpScatt(&scatt)
78 VFN_DEBUG_MESSAGE(
"ZAtom::ZAtom():("<<mName<<
")",5)
82 VFN_DEBUG_MESSAGE(
"ZAtom::~ZAtom():("<<
mName<<
")",5)
84 const string& ZAtom::GetClassName()
const
86 static string className=
"ZAtom";
89 const string& ZAtom::GetName()
const {
return mName;}
94 void ZAtom::SetName(
const string& name) {
mName=name;}
112 VFN_DEBUG_ENTRY(
"ZAtom::WXCreate()",7)
113 mpWXCrystObj=new
WXZAtom (parent,this);
114 VFN_DEBUG_EXIT("
ZAtom::WXCreate()",7)
121 void ZAtom::WXDelete()
125 VFN_DEBUG_MESSAGE(
"ZAtom::WXDelete()",5)
130 void ZAtom::WXNotifyDelete()
132 VFN_DEBUG_MESSAGE(
"ZAtom::WXNotifyDelete():"<<
mName,10)
142 ZMoveMinimizer::ZMoveMinimizer(ZScatterer &scatt):
144 mpZScatt(&scatt),mOptimObj(true)
146 mOptimObj.SetAlgorithmSimulAnnealing(ANNEALING_EXPONENTIAL,.1,.001,
147 ANNEALING_EXPONENTIAL,16,.25);
148 mOptimObj.AddRefinableObj(*
this);
150 ZMoveMinimizer::~ZMoveMinimizer(){}
155 TAU_PROFILE(
"ZMoveMinimizer::GetLogLikelihood()",
"void ()",TAU_DEFAULT);
156 const REAL *pX1=mpZScatt->
GetXCoord().data();
157 const REAL *pY1=mpZScatt->
GetYCoord().data();
158 const REAL *pZ1=mpZScatt->
GetZCoord().data();
159 const REAL *pX0=mXCoord0.data();
160 const REAL *pY0=mYCoord0.data();
161 const REAL *pZ0=mZCoord0.data();
162 const REAL *pW=mAtomWeight.data();
166 for(
int i=mXCoord0.numElements()-1;i>=0;i--)
168 dist+= *pW++* ( (*pX1 - *pX0)*(*pX1 - *pX0)
169 +(*pY1 - *pY0)*(*pY1 - *pY0)
170 +(*pZ1 - *pZ0)*(*pZ1 - *pZ0));
176 const CrystVector_REAL *pXcoord=&(mpZScatt->
GetXCoord());
177 const CrystVector_REAL *pYcoord=&(mpZScatt->
GetYCoord());
178 const CrystVector_REAL *pZcoord=&(mpZScatt->
GetZCoord());
180 for(
int i=pXcoord->numElements()-1;i>=0;i--)
182 dist+=mAtomWeight(i)*( ((*pXcoord)(i)-mXCoord0(i))*((*pXcoord)(i)-mXCoord0(i))
183 +((*pYcoord)(i)-mYCoord0(i))*((*pYcoord)(i)-mYCoord0(i))
184 +((*pZcoord)(i)-mZCoord0(i))*((*pZcoord)(i)-mZCoord0(i)));
187 return dist/mAtomWeight.sum();
189 void ZMoveMinimizer::RecordConformation()
194 if(mAtomWeight.numElements() != mXCoord0.numElements())
196 mAtomWeight.resize(mXCoord0.numElements());
200 void ZMoveMinimizer::SetZAtomWeight(
const CrystVector_REAL weight) {mAtomWeight=weight;}
201 void ZMoveMinimizer::MinimizeChange(
long nbTrial)
203 if(mAtomWeight.max()<1e-3)
return;
215 const REAL x,
const REAL y,
const REAL z,
216 const REAL phi,
const REAL chi,
const REAL psi):
217 mScattCompList(0),mNbAtom(0),mNbDummyAtom(0),
218 mPhi(0),mChi(0),mPsi(0),
219 mZAtomRegistry(
"List of ZAtoms"),
221 mPhiChiPsiMatrix(3,3),
222 mUseGlobalScattPow(false),mpGlobalScattPow(0),
225 VFN_DEBUG_MESSAGE(
"ZScatterer::ZScatterer():("<<
mName<<
")",5)
235 VFN_DEBUG_MESSAGE(
"ZScatterer::ZScatterer():("<<
mName<<
")",5)
239 Scatterer(old),m3DDisplayIndex(old.m3DDisplayIndex),
240 mNbAtom(0),mNbDummyAtom(0),
241 mPhi(old.mPhi),mChi(old.mChi),mPsi(old.mPsi),
242 mCenterAtomIndex(old.mCenterAtomIndex),
243 mPhiChiPsiMatrix(old.mPhiChiPsiMatrix),
244 mUseGlobalScattPow(false),mpGlobalScattPow(0),
247 VFN_DEBUG_ENTRY(
"ZScatterer::ZScatterer(&old):("<<
mName<<
")",10)
260 VFN_DEBUG_MESSAGE(
"ZScatterer::ZScatterer(&old):Copying atoms",10)
275 VFN_DEBUG_MESSAGE(
"ZScatterer::ZScatterer(&old):Copying param attributes",10)
281 this->
GetPar(&mChi). CopyAttributes(old.
GetPar(&(old.mChi)));
282 this->
GetPar(&mPsi). CopyAttributes(old.
GetPar(&(old.mPsi)));
283 VFN_DEBUG_MESSAGE(
"ZScatterer::ZScatterer(&old):Copying atoms param attributes",10)
296 VFN_DEBUG_EXIT(
"ZScatterer::ZScatterer(&old):("<<
mName<<
")",10)
299 ZScatterer::~ZScatterer()
301 VFN_DEBUG_MESSAGE(
"ZScatterer::~ZScatterer():("<<
mName<<
")",5)
308 VFN_DEBUG_MESSAGE(
"ZScatterer::CreateCopy()"<<
mName<<
")",5)
313 const static string className=
"ZScatterer";
318 const long atomBond,
const REAL bondLength,
319 const long atomAngle,
const REAL bondAngle,
320 const long atomDihedral,
const REAL dihedralAngle,
323 VFN_DEBUG_MESSAGE(
"ZScatterer::AddAtom():"<<name<<
"):"<<atomBond<<
" / "<<atomAngle<<
" / "
324 <<atomDihedral<<
" / "<<bondLength<<
","<<bondAngle<<
","<<dihedralAngle,10)
328 atomDihedral,dihedralAngle,
334 You are using the Global ScatteringPower approximation !!");
337 bool usedBond=
true,usedAngle=
true,usedDihed=
true;
343 sprintf(buf,
"%d-%d",(
int)
mNbAtom,(
int)atomBond);
347 gpRefParTypeScattConformBondLength,
348 REFPAR_DERIV_STEP_ABSOLUTE,
true,
false,usedBond,
false,1.);
353 sprintf(buf,
"%d-%d-%d",(
int)
mNbAtom,(
int)atomBond,(
int)atomAngle);
357 gpRefParTypeScattConformBondAngle,
358 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,usedAngle,
true,RAD2DEG,2*M_PI);
363 sprintf(buf,
"%d-%d-%d-%d",(
int)
mNbAtom,(
int)atomBond,(
int)atomAngle,(
int)atomDihedral);
367 gpRefParTypeScattConformDihedAngle,
368 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,usedDihed,
true,RAD2DEG,2*M_PI);
373 sprintf(buf,
"%d",(
int)
mNbAtom);
375 &(zatom->mOccupancy),0,1,
376 gpRefParTypeScattOccup,
377 REFPAR_DERIV_STEP_ABSOLUTE,
true,
true,
true,
false,1.,1.);
384 VFN_DEBUG_MESSAGE(
"ZScatterer::AddAtom():Registering...",2)
389 VFN_DEBUG_MESSAGE(
"ZScatterer::AddAtom():Adding to the ScattCompList...",2)
402 VFN_DEBUG_MESSAGE(
"ZScatterer::AddAtom():End",3)
424 VFN_DEBUG_MESSAGE(
"ZScatterer::Print()",5)
472 VFN_DEBUG_MESSAGE(
"ZScatterer::POVRayDescription()",5)
478 os <<
"// Description of ZScatterer :" << this->
GetName() <<endl;
489 if(mpAtom[i]->IsDummy())
continue;
490 os <<
" #declare colour_"<<mpAtom[i]->GetName()<<
"="<<mpAtom[i]->Colour()<<
";"<<endl;
493 if(
true==onlyIndependentAtoms)
495 CrystVector_REAL x(mNbAtom),y(mNbAtom),z(mNbAtom);
498 x(i)=mpAtom[i]->GetX();
499 y(i)=mpAtom[i]->GetY();
500 z(i)=mpAtom[i]->GetZ();
505 if(mpAtom[i]->IsDummy())
507 os <<
" // Skipping Dummy Atom :" << mpAtom[i]->GetName() <<endl<<endl;
510 os <<
" // Atom :" << mpAtom[i]->GetName() <<endl;
511 os <<
" sphere " << endl;
512 os <<
" { <"<<x(i)<<
","<<y(i)<<
","<<z(i)<<
">,"
513 << mpAtom[i]->GetRadius()/3<<endl;
514 os <<
" finish { ambient 0.2 diffuse 0.8 phong 1}" <<endl;
515 os <<
" pigment { colour colour_"<< mpAtom[i]->GetName() <<
" }" << endl;
518 int bond=ZBondAtom(i);
519 if((mpAtom[bond]->IsDummy()) || (i==0))
continue;
520 os <<
" cylinder"<<endl;
521 os <<
" { <"<<x(i)<<
","<<y(i)<<
","<<z(i)<<
">,"<<endl;
522 os <<
" <"<<x(bond)<<
","<<y(bond)<<
","<<z(bond)<<
">,"<<endl;
524 os <<
" pigment { colour Gray }"<<endl;
530 vector<CrystMatrix_REAL> xyzCoords;
532 vXYZCoords.push_back(this->GetCrystal().GetSpaceGroup().GetAllSymmetrics(mpAtom[i]->
GetX(),
536 const int nbSymmetrics=(vXYZCoords[0])->rows();
538 CrystMatrix_int translate(27,3);
567 CrystVector_REAL x(mNbAtom),y(mNbAtom),z(mNbAtom);
568 CrystVector_REAL xSave,ySave,zSave;
569 for(
int i=0;i<nbSymmetrics;i++)
573 x(j)=vXYZCoords[j](i,0);
574 y(j)=vXYZCoords[j](i,1);
575 z(j)=vXYZCoords[j](i,2);
581 x(0) = fmod((
float) x(0),(
float)1);
if(x(0)<0) x(0)+=1.;
582 y(0) = fmod((
float) y(0),(
float)1);
if(y(0)<0) y(0)+=1.;
583 z(0) = fmod((
float) z(0),(
float)1);
if(z(0)<0) z(0)+=1.;
594 const REAL limit =0.1;
595 for(
int j=0;j<translate.rows();j++)
603 if( (x(0)>(-limit)) && (x(0)<(1+limit))
604 &&(y(0)>(-limit)) && (y(0)<(1+limit))
605 &&(z(0)>(-limit)) && (z(0)<(1+limit)))
609 os <<
" // Symmetric&Translated #" << symNum++ <<endl;
613 if(mpAtom[i]->IsDummy())
615 os <<
" // Skipping Dummy Atom :" << mpAtom[i]->GetName() <<endl<<endl;
618 os <<
" // Atom :" << mpAtom[i]->GetName() <<endl;
619 os <<
" sphere " << endl;
620 os <<
" { <"<<x(i)<<
","<<y(i)<<
","<<z(i)<<
">,"
621 << mpAtom[i]->GetRadius()/3<<endl;
622 os <<
" finish { ambient 0.2 diffuse 0.8 phong 1}" <<endl;
623 os <<
" pigment { colour colour_"<< mpAtom[i]->GetName() <<
" }" << endl;
626 int bond=ZBondAtom(i);
627 if((mpAtom[bond]->IsDummy()) || (i==0))
continue;
628 os <<
" cylinder"<<endl;
629 os <<
" { <"<<x(i)<<
","<<y(i)<<
","<<z(i)<<
">,"<<endl;
630 os <<
" <"<<x(bond)<<
","<<y(bond)<<
","<<z(bond)<<
">,"<<endl;
632 os <<
" pigment { colour Gray }"<<endl;
647 const REAL xMin,
const REAL xMax,
648 const REAL yMin,
const REAL yMax,
649 const REAL zMin,
const REAL zMax,
650 const bool displayEnantiomer,
651 const bool displayNames,
652 const bool hideHydrogens)
const
655 VFN_DEBUG_ENTRY(
"ZScatterer::GLInitDisplayList()",4)
658 VFN_DEBUG_EXIT(
"ZScatterer::GLInitDisplayList():No ZAtom to display !",4)
662 if(displayEnantiomer==
true) en=-1;
670 GLfloat colour_bond[]= { 0.5, .5, .5, 1.0 };
671 GLfloat colour_side[]= { 0.0, .0, .0, 1.0 };
672 const GLfloat colour0[] = {0.0f, 0.0f, 0.0f, 0.0f};
674 GLUquadricObj* pQuadric = gluNewQuadric();
676 if(
true==onlyIndependentAtoms)
679 CrystVector_REAL x,y,z;
694 if(hideHydrogens && (
mZAtomRegistry.GetObj(n1).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
695 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,
698 glTranslatef(x(n1)*en, y(n1), z(n1));
700 ->GetRadius()/3.,10,10);
708 if(hideHydrogens && (
mZAtomRegistry.GetObj(n1).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
709 if(hideHydrogens && (
mZAtomRegistry.GetObj(n2).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
711 glTranslatef(x(n1)*en, y(n1), z(n1));
712 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colour_bond);
713 GLUquadricObj *quadobj = gluNewQuadric();
714 glColor3f(1.0f,1.0f,1.0f);
715 const REAL height= sqrt( (x(n2)-x(n1))*(x(n2)-x(n1))
716 +(y(n2)-y(n1))*(y(n2)-y(n1))
717 +(z(n2)-z(n1))*(z(n2)-z(n1)));
718 glRotatef(180,(x(n2)-x(n1))*en,y(n2)-y(n1),z(n2)-z(n1)+height);
719 gluCylinder(quadobj,.1,.1,height,10,1 );
720 gluDeleteQuadric(quadobj);
727 REAL x1,y1,z1,x2,y2,z2,xn,yn,zn,xc,yc,zc;
747 glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
750 glBegin(GL_TRIANGLES);
751 if((xn*xc+yn*yc+zn*zc)>0) glNormal3f(xn*en, yn, zn);
752 else glNormal3f(-xn*en, -yn, -zn);
753 glVertex3f(x(n1)*en,y(n1),z(n1));
754 glVertex3f(x(n2)*en,y(n2),z(n2));
755 glVertex3f(x(n3)*en,y(n3),z(n3));
757 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colour_side);
758 glBegin(GL_LINE_LOOP);
759 glVertex3f(x(n1)*en,y(n1),z(n1));
760 glVertex3f(x(n2)*en,y(n2),z(n2));
761 glVertex3f(x(n3)*en,y(n3),z(n3));
767 REAL x1,y1,z1,x2,y2,z2,xn,yn,zn,xc,yc,zc;
788 glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
791 glBegin(GL_TRIANGLES);
792 if((xn*xc+yn*yc+zn*zc)>0) glNormal3f(xn*en, yn, zn);
793 else glNormal3f(-xn*en, -yn, -zn);
794 glVertex3f(x(n1)*en,y(n1),z(n1));
795 glVertex3f(x(n2)*en,y(n2),z(n2));
796 glVertex3f(x(n3)*en,y(n3),z(n3));
797 glVertex3f(x(n4)*en,y(n4),z(n4));
799 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colour_side);
800 glBegin(GL_LINE_LOOP);
801 glVertex3f(x(n1)*en,y(n1),z(n1));
802 glVertex3f(x(n2)*en,y(n2),z(n2));
803 glVertex3f(x(n3)*en,y(n3),z(n3));
804 glVertex3f(x(n4)*en,y(n4),z(n4));
815 if(hideHydrogens && (
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
816 const float r=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[0];
817 const float g=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[1];
818 const float b=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[2];
820 glTranslatef(x(k)*en, y(k), z(k));
823 GLfloat colourChar [] = {1.0, 1.0, 1.0, 1.0};
824 if((r>0.8)&&(g>0.8)&&(b>0.8))
830 glMaterialfv(GL_FRONT, GL_AMBIENT, colour0);
831 glMaterialfv(GL_FRONT, GL_DIFFUSE, colour0);
832 glMaterialfv(GL_FRONT, GL_SPECULAR, colour0);
833 glMaterialfv(GL_FRONT, GL_EMISSION, colourChar);
834 glMaterialfv(GL_FRONT, GL_SHININESS,colour0);
835 glRasterPos3f(0.0f, 0.0f, 0.0f);
840 const GLfloat colourAtom [] = {r, g, b, 1.0};
841 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colourAtom);
842 glMaterialfv(GL_FRONT, GL_SPECULAR, colour0);
843 glMaterialfv(GL_FRONT, GL_EMISSION, colour0);
844 glMaterialfv(GL_FRONT, GL_SHININESS, colour0);
845 glPolygonMode(GL_FRONT, GL_FILL);
847 mZAtomRegistry.GetObj(k).GetScatteringPower()->GetRadius()/3.,10,10);
850 if((0!=
mZAtomRegistry.GetObj(bond).GetScatteringPower()) && (k>0))
852 glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,colour_bond);
853 GLUquadricObj *quadobj = gluNewQuadric();
854 glColor3f(1.0f,1.0f,1.0f);
855 const REAL height= sqrt( (x(bond)-x(k))*(x(bond)-x(k))
856 +(y(bond)-y(k))*(y(bond)-y(k))
857 +(z(bond)-z(k))*(z(bond)-z(k)));
858 glRotatef(180,(x(bond)-x(k))*en,y(bond)-y(k),z(bond)-z(k)+height);
859 gluCylinder(quadobj,.1,.1,height,10,1 );
860 gluDeleteQuadric(quadobj);
869 VFN_DEBUG_ENTRY(
"ZScatterer::GLInitDisplayList():Show all symmetrics",3)
870 vector<CrystMatrix_REAL> vXYZCoords;
879 vXYZCoords.push_back(this->
GetCrystal().GetSpaceGroup().
880 GetAllSymmetrics(x0,y0,z0,
false,
false,
false));
883 CrystMatrix_int translate(27,3);
913 CrystVector_REAL xSave,ySave,zSave;
914 const int nbSymmetrics=vXYZCoords[0].rows();
915 for(
int i=0;i<nbSymmetrics;i++)
917 VFN_DEBUG_ENTRY(
"ZScatterer::GLInitDisplayList():Symmetric#"<<i,3)
920 x(j)=vXYZCoords[j](i,0);
921 y(j)=vXYZCoords[j](i,1);
922 z(j)=vXYZCoords[j](i,2);
928 x(0) = fmod((
float) x(0),(
float)1);
if(x(0)<0) x(0)+=1.;
929 y(0) = fmod((
float) y(0),(
float)1);
if(y(0)<0) y(0)+=1.;
930 z(0) = fmod((
float) z(0),(
float)1);
if(z(0)<0) z(0)+=1.;
944 for(
int j=0;j<translate.rows();j++)
949 if( (x(0)>xMin) && (x(0)<xMax)
950 &&(y(0)>yMin) && (y(0)<yMax)
951 &&(z(0)>zMin) && (z(0)<zMax))
959 REAL x1,y1,z1,x2,y2,z2,xn,yn,zn,xc,yc,zc;
981 glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,
983 glBegin(GL_TRIANGLES);
984 if((xn*xc+yn*yc+zn*zc)>0) glNormal3f( xn*en, yn, zn);
985 else glNormal3f(-xn*en, -yn, -zn);
987 glVertex3f(x(n1)*en,y(n1),z(n1));
988 glVertex3f(x(n2)*en,y(n2),z(n2));
989 glVertex3f(x(n3)*en,y(n3),z(n3));
991 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colour_side);
992 glBegin(GL_LINE_LOOP);
993 glVertex3f(x(n1)*en,y(n1),z(n1));
994 glVertex3f(x(n2)*en,y(n2),z(n2));
995 glVertex3f(x(n3)*en,y(n3),z(n3));
1004 if(hideHydrogens && (
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
1005 const float r=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[0];
1006 const float g=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[1];
1007 const float b=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[2];
1009 glTranslatef(x(k)*en, y(k), z(k));
1012 GLfloat colourChar [] = {1.0, 1.0, 1.0, 1.0};
1013 if((r>0.8)&&(g>0.8)&&(b>0.8))
1015 colourChar[0] = 0.5;
1016 colourChar[1] = 0.5;
1017 colourChar[2] = 0.5;
1019 glMaterialfv(GL_FRONT, GL_AMBIENT, colour0);
1020 glMaterialfv(GL_FRONT, GL_DIFFUSE, colour0);
1021 glMaterialfv(GL_FRONT, GL_SPECULAR, colour0);
1022 glMaterialfv(GL_FRONT, GL_EMISSION, colourChar);
1023 glMaterialfv(GL_FRONT, GL_SHININESS,colour0);
1024 glRasterPos3f(0.0f, 0.0f, 0.0f);
1029 const GLfloat colourAtom [] = {r, g, b, 1.0};
1030 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colourAtom);
1031 glMaterialfv(GL_FRONT, GL_SPECULAR, colour0);
1032 glMaterialfv(GL_FRONT, GL_EMISSION, colour0);
1033 glMaterialfv(GL_FRONT, GL_SHININESS, colour0);
1034 glPolygonMode(GL_FRONT, GL_FILL);
1036 mZAtomRegistry.GetObj(k).GetScatteringPower()->GetRadius()/3.,10,10);
1037 glRasterPos3f(0,0,0);
1040 if((0!=
mZAtomRegistry.GetObj(bond).GetScatteringPower()) && (k>0))
1042 glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,colour_bond);
1043 GLUquadricObj *quadobj = gluNewQuadric();
1044 glColor3f(1.0f,1.0f,1.0f);
1045 const REAL height= sqrt( (x(bond)-x(k))*(x(bond)-x(k))
1046 +(y(bond)-y(k))*(y(bond)-y(k))
1047 +(z(bond)-z(k))*(z(bond)-z(k)));
1048 glRotatef(180,(x(bond)-x(k))*en,y(bond)-y(k),z(bond)-z(k)+height);
1049 gluCylinder(quadobj,.1,.1,height,10,1 );
1050 gluDeleteQuadric(quadobj);
1061 VFN_DEBUG_EXIT(
"ZScatterer::GLInitDisplayList():Symmetric#"<<i,3)
1063 VFN_DEBUG_EXIT(
"ZScatterer::GLInitDisplayList():Show all symmetrics",3)
1065 gluDeleteQuadric(pQuadric);
1066 VFN_DEBUG_EXIT(
"ZScatterer::GLInitDisplayList()",4)
1072 VFN_DEBUG_MESSAGE(
"ZScatterer::SetUseGlobalScatteringPower(bool):"<<this->
GetName()<<
":"<<useIt,5)
1102 CrystVector_uint & groupIndex,
1103 unsigned int &first)
const
1107 unsigned int posIndex=0;
1108 unsigned int orientIndex=0;
1109 VFN_DEBUG_MESSAGE(
"ZScatterer::GetGeneGroup()",4)
1111 for(
long j=0;j<this->
GetNbPar();j++)
1116 if(posIndex==0) posIndex=first++;
1117 groupIndex(i)=posIndex;
1120 if(this->
GetPar(j).GetType()->IsDescendantFromOrSameAs(gpRefParTypeScattOrient))
1122 if(orientIndex==0) orientIndex=first++;
1123 groupIndex(i)=orientIndex;
1125 else groupIndex(i)= first++;
1148 if(0!=mpZMoveMinimizer)
delete mpZMoveMinimizer;
1154 std::vector<std::string> SplitString(
const std::string &s)
1156 const string delim(
" ");
1157 std::vector<std::string> v;
1161 int n=str.find_first_of(delim);
1162 while( n != (
int) str.npos)
1167 v.push_back(str.substr(0,n));
1169 str= str.substr(n+1);
1170 n=str.find_first_of(delim);
1172 if(str.length() > 0) v.push_back(str);
1190 void ReadFHLine(
const char*buf,
const unsigned int nb,
string &symbol,
1191 int &n1,
float &v1,
int &n2,
float &v2,
int &n3,
float &v3)
1193 string sbuf=string(buf);
1194 std::vector<std::string> v=SplitString(sbuf);
1197 if(v.size()>0) symbol=v[0];
1198 else symbol=string(buf).substr(0,2);
1206 n1=(
unsigned int) atoi(v[1].c_str());
1211 symbol=string(buf).substr(0,2);
1212 n1=(int) atoi(
string(buf).substr(2,3).c_str());
1215 cout<<
"ReadFHLine():"<<buf<<
"#"<<symbol<<
"/"<<n1<<
"/"<<v1<<
";"<<v.size()<<endl;
1216 VFN_DEBUG_MESSAGE(
"ReadFHLine():#"<<symbol<<
"/"<<n1<<
"/"<<v1,10);
1224 n1=(int) atoi(v[1].c_str());
1226 n2=(int) atoi(v[3].c_str());
1231 symbol=sbuf.substr(0,2);
1232 n1=(int) atoi(sbuf.substr(2,3).c_str());
1234 n2=(int) atoi(sbuf.substr(11,3).c_str());
1237 VFN_DEBUG_MESSAGE(
"ReadFHLine():#"<<symbol<<
"/"<<n1<<
"/"<<v1<<
"/"<<n2<<
"/"<<v2,10);
1244 n1=(int) atoi(v[1].c_str());
1246 n2=(int) atoi(v[3].c_str());
1248 n3=(int) atoi(v[5].c_str());
1256 symbol=sbuf.substr(0,2);
1257 n1=(int) atoi(sbuf.substr(2,3).c_str());
1259 n2=(int) atoi(sbuf.substr(11,3).c_str());
1261 n3=(int) atoi(sbuf.substr(22,3).c_str());
1264 VFN_DEBUG_MESSAGE(
"ReadFHLine():#"<<symbol<<
"/"<<n1<<
"/"<<v1<<
"/"<<n2<<
"/"<<v2<<
"/"<<n3<<
"/"<<v3,10);
1272 const char c=is.peek();
1273 if ( (c <
'0') || (c >
'9') )
1275 cout<<
"ZScatterer::ImportFenskeHallZMatrix()"
1276 <<
":getting rid of first line..."<<endl;
1277 is.getline(buf,100);
1283 while(!isgraph(is.peek())) is.get(c);
1295 string symbol, atomName,bondAtomName,angleAtomName,dihedAtomName,junk;
1296 int bondAtom=0,angleAtom=0,dihedAtom=0;
1297 float bond=0,angle=0,dihed=0;
1302 is >> atomName >> symbol >> junk;
1303 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<2<<
",name:"<<atomName
1304 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1308 is.getline(buf,100);
1309 ReadFHLine(buf,1,symbol,bondAtom,bond,angleAtom,angle,dihedAtom,dihed);
1313 (symbol,
"ScatteringPowerAtom",
true);
1316 cout<<
"Scattering power"<<symbol<<
"not found, creating it..."<<endl;
1320 (symbol,
"ScatteringPowerAtom");
1329 sprintf(buf,
"%d",1);
1330 this->
AddAtom(symbol+(
string)buf,
1340 is >> atomName >> symbol >> bondAtomName >> bond;
1341 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<2<<
",name:"<<atomName
1342 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1346 is.getline(buf,100);
1347 ReadFHLine(buf,2,symbol,bondAtom,bond,angleAtom,angle,dihedAtom,dihed);
1352 (symbol,
"ScatteringPowerAtom",
true);
1355 cout<<
"Scattering power"<<symbol<<
"not found, creating it..."<<endl;
1359 (symbol,
"ScatteringPowerAtom");
1365 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1375 sprintf(buf,
"%d",2);
1376 this->
AddAtom(symbol+(
string)buf,
1386 is >> atomName >> symbol >>
1387 bondAtomName >> bond >>
1388 angleAtomName >> angle;
1389 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<2<<
",name:"<<atomName
1390 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1394 is.getline(buf,100);
1395 ReadFHLine(buf,3,symbol,bondAtom,bond,angleAtom,angle,dihedAtom,dihed);
1400 (symbol,
"ScatteringPowerAtom",
true);
1403 cout<<
"Scattering power"<<symbol<<
"not found, creating it..."<<endl;
1407 (symbol,
"ScatteringPowerAtom");
1410 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<3<<
",name:"<<atomName
1411 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1415 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1420 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1425 angleAtom,angle*DEG2RAD,
1430 sprintf(buf,
"%d",3);
1431 this->
AddAtom(symbol+(
string)buf,
1434 angleAtom-1,angle*DEG2RAD,
1438 for(
int i=3;i<nbAtoms;i++)
1442 is >> atomName >> symbol >>
1443 bondAtomName >> bond >>
1444 angleAtomName >> angle >>
1445 dihedAtomName >> dihed;
1446 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<i<<
",name:"<<atomName
1447 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1451 is.getline(buf,100);
1452 ReadFHLine(buf,i+1,symbol,bondAtom,bond,angleAtom,angle,dihedAtom,dihed);
1456 (symbol,
"ScatteringPowerAtom",
true);
1459 cout<<
"Scattering power"<<symbol<<
"not found, creating it..."<<endl;
1463 (symbol,
"ScatteringPowerAtom");
1469 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<i<<
",name:"<<atomName
1470 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1473 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1477 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1481 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1486 angleAtom,angle*DEG2RAD,
1487 dihedAtom,dihed*DEG2RAD);
1491 sprintf(buf,
"%d",i+1);
1492 this->
AddAtom(symbol+(
string)buf,
1495 angleAtom-1,angle*DEG2RAD,
1496 dihedAtom-1,dihed*DEG2RAD);
1535 VFN_DEBUG_ENTRY(
"ZScatterer::GlobalOptRandomMove()",3)
1536 TAU_PROFILE(
"ZScatterer::GlobalOptRandomMove()",
"void ()",TAU_DEFAULT);
1540 if((
mNbAtom>=10) && ((rand()/(REAL)RAND_MAX)<.02)
1543 TAU_PROFILE_TIMER(timer1,\
1544 "ZScatterer::GlobalOptRandomMoveSmart1(prepare ref par & mutate)"\
1546 TAU_PROFILE_TIMER(timer2,\
1547 "ZScatterer::GlobalOptRandomMoveSmart2(optimize if necessary)"\
1549 TAU_PROFILE_START(timer1);
1551 CrystVector_long dihed(
mNbAtom);
1559 if( !(par->IsFixed()) )
1566 TAU_PROFILE_STOP(timer1);
1567 VFN_DEBUG_EXIT(
"ZScatterer::GlobalOptRandomMove():End",3)
1571 if(0==mpZMoveMinimizer)
1576 for(
int i=0; i<this->
GetNbPar();i++) mpZMoveMinimizer->
AddPar(this->GetPar(i));
1581 const int atom=dihed((
int) (rand()/((REAL)RAND_MAX+1)*nbDihed));
1583 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): Changing atom #"<<atom ,3)
1585 par=&(this->
GetPar(&mPsi));
1588 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): initial value:"<<par->
GetHumanValue() ,3)
1590 mpZMoveMinimizer->RecordConformation();
1592 const int moveType= rand()%3;
1596 CrystVector_REAL weight(mNbAtom);
1601 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove():Move only one atom",3)
1620 mpZMoveMinimizer->
GetPar(&
mPhi).SetIsFixed(
false);
1621 if(!(this->
GetPar(&mChi).IsFixed()))
1622 mpZMoveMinimizer->
GetPar(&mChi).SetIsFixed(
false);
1623 if( !(this->
GetPar(&mPsi).IsFixed()) && (atom!=2))
1624 mpZMoveMinimizer->
GetPar(&mPsi).SetIsFixed(
false);
1626 mpZMoveMinimizer->
GetPar(&
mXYZ(0)).SetIsFixed(
false);
1628 mpZMoveMinimizer->
GetPar(&
mXYZ(1)).SetIsFixed(
false);
1630 mpZMoveMinimizer->
GetPar(&
mXYZ(2)).SetIsFixed(
false);
1635 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove():Move before the rotated bond",3)
1655 mpZMoveMinimizer->
GetPar(&
mPhi).SetIsFixed(
false);
1656 if(!(this->
GetPar(&mChi).IsFixed()))
1657 mpZMoveMinimizer->
GetPar(&mChi).SetIsFixed(
false);
1658 if( !(this->
GetPar(&mPsi).IsFixed()) && (atom!=2))
1659 mpZMoveMinimizer->
GetPar(&mPsi).SetIsFixed(
false);
1662 mpZMoveMinimizer->
GetPar(&
mXYZ(0)).SetIsFixed(
false);
1664 mpZMoveMinimizer->
GetPar(&
mXYZ(1)).SetIsFixed(
false);
1666 mpZMoveMinimizer->
GetPar(&
mXYZ(2)).SetIsFixed(
false);
1679 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove():Move after the bond (translate)",3)
1686 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove():Move after the bond(nothing to do)",3)
1693 mpZMoveMinimizer->SetZAtomWeight(weight);
1699 case 0: change=-120*DEG2RAD;
break;
1700 case 1: change= -90*DEG2RAD;
break;
1701 case 2: change= 90*DEG2RAD;
break;
1702 case 3: change= 120*DEG2RAD;
break;
1703 default:change= 180*DEG2RAD;
break;
1709 *2*(rand()/(REAL)RAND_MAX-0.5)*mutationAmplitude*16;
1711 TAU_PROFILE_STOP(timer1);
1712 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): mutation:"<<change*RAD2DEG,3)
1733 TAU_PROFILE_START(timer2);
1734 if(tmp<1) mpZMoveMinimizer->MinimizeChange(100);
1735 else if(tmp<5) mpZMoveMinimizer->MinimizeChange(200);
1736 else mpZMoveMinimizer->MinimizeChange(500);
1737 TAU_PROFILE_STOP(timer2);
1740 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): final value:"<<par->
GetHumanValue(),3)
1746 CrystVector_long dihed(mNbAtom);
1754 if( !(par->IsFixed()) )
1760 const int atom=dihed((
int) (rand()/((REAL)RAND_MAX+1)*nbDihed));
1762 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): Changing atom #"<<atom ,10)
1764 par=&(this->
GetPar(&mPsi));
1770 if( (rand()/(REAL)RAND_MAX)<.1)
1774 case 0: par->
Mutate(-120*!DEG2RAD);
break;
1775 case 1: par->
Mutate( -90*!DEG2RAD);
break;
1776 case 2: par->
Mutate( 90*!DEG2RAD);
break;
1777 case 3: par->
Mutate( 120*!DEG2RAD);
break;
1778 default:par->
Mutate( 180*!DEG2RAD);
break;
1783 *2*(rand()/(REAL)RAND_MAX-0.5)*mutationAmplitude*8);
1784 const REAL change=
mZAtomRegistry.GetObj(atom).GetZDihedralAngle()-old;
1808 VFN_DEBUG_EXIT(
"ZScatterer::GlobalOptRandomMove():End",3)
1815 VFN_DEBUG_ENTRY(
"ZScatterer::UpdateCoordinates():"<<this->
GetName(),3)
1816 TAU_PROFILE(
"ZScatterer::UpdateCoordinates()",
"void ()",TAU_DEFAULT);
1821 CrystMatrix_REAL phiMatrix(3,3),chiMatrix(3,3),psiMatrix(3,3);
1822 phiMatrix= cos(
mPhi) , -sin(
mPhi) , 0,
1826 chiMatrix= cos(mChi) ,0 ,-sin(mChi),
1828 sin(mChi) ,0 ,cos(mChi);
1830 psiMatrix= 1 , 0 , 0,
1831 0 ,cos(mPsi) ,-sin(mPsi),
1832 0 ,sin(mPsi) ,cos(mPsi);
1846 VFN_DEBUG_MESSAGE(
"->Atom #0:"<<
mXCoord(0)<<
" : "<<mYCoord(0)<<
" : "<<mZCoord(0),1)
1853 VFN_DEBUG_MESSAGE(
"->Atom #1:"<<
mXCoord(1)<<
" : "<<mYCoord(1)<<
" : "<<mZCoord(1),1)
1863 VFN_DEBUG_MESSAGE(
"->Atom #2:"<<
mXCoord(2)<<
" : "<<mYCoord(2)<<
" : "<<mZCoord(2),1)
1865 for(
int i=1;i<3;i++)
1869 const REAL y=mYCoord(i);
1870 const REAL z=mZCoord(i);
1877 REAL xa,ya,za,xb,yb,zb,xd,yd,zd,cosph,sinph,costh,sinth,coskh,sinkh,cosa,sina;
1878 REAL xpd,ypd,zpd,xqd,yqd,zqd;
1879 REAL rbc,xyb,yza,tmp,xpa,ypa,zqa;
1882 REAL dist,angle,dihed;
1893 yb = mYCoord(nb) - mYCoord(na);
1894 zb = mZCoord(nb) - mZCoord(na);
1896 rbc= sqrt(xb*xb + yb*yb + zb*zb);
1902 +
") have the same coordinates (d<1e-5): aborting.");
1909 if( fabs(cosa) >= 0.999999 )
1912 mYCoord(i)=mYCoord(na)+cosa*dist*rbc*yb;
1913 mZCoord(i)=mZCoord(na)+cosa*dist*rbc*zb;
1914 VFN_DEBUG_MESSAGE(
"->Atom #"<<i<<
":"<<
mXCoord(i)<<
" : "<<mYCoord(i)<<
" : " <<mZCoord(i)<<
"(colinear)",1)
1919 ya = mYCoord(nc) - mYCoord(na);
1920 za = mZCoord(nc) - mZCoord(na);
1922 yd = dist*sina*cos(dihed);
1923 zd = -dist*sina*sin(dihed);
1925 xyb = sqrt(xb*xb + yb*yb);
1928 tmp = za; za = -xa; xa = tmp;
1929 tmp = zb; zb = -xb; xb = tmp;
1930 xyb = sqrt(xb*xb + yb*yb);
1937 xpa = costh*xa + sinth*ya;
1938 ypa = costh*ya - sinth*xa;
1940 cosph = sqrt(1.0 - sinph*sinph);
1941 zqa = cosph*za - sinph*xpa;
1942 yza = sqrt(ypa*ypa + zqa*zqa);
1949 ypd = coskh*yd - sinkh*zd;
1950 zpd = coskh*zd + sinkh*yd;
1958 xpd = cosph*xd - sinph*zpd;
1959 zqd = cosph*zpd + sinph*xd;
1960 xqd = costh*xpd - sinth*ypd;
1961 yqd = costh*ypd + sinth*xpd;
1966 mYCoord(i)=mYCoord(na) + yqd;
1967 mZCoord(i)=mZCoord(na) + xqd;
1971 mYCoord(i)=mYCoord(na) + yqd;
1972 mZCoord(i)=mZCoord(na) + zqd;
1974 VFN_DEBUG_MESSAGE(
"->Atom #"<<i<<
":"<<
mXCoord(i)<<
" : "<<mYCoord(i)<<
" : " <<mZCoord(i),1)
1994 VFN_DEBUG_EXIT(
"ZScatterer::UpdateCoordinates()"<<this->
GetName(),3)
1999 VFN_DEBUG_ENTRY(
"ZScatterer::UpdateScattCompList()"<<this->
GetName(),3)
2021 VFN_DEBUG_MESSAGE(
"ZScatterer::UpdateScattCompList()->Global Scatterer:End",3)
2027 VFN_DEBUG_MESSAGE(
"ZScatterer::UpdateScattCompList(bool):Finishing"<<
mNbAtom<<
","<<
mNbDummyAtom,3)
2047 VFN_DEBUG_EXIT(
"ZScatterer::UpdateScattCompList()"<<this->
GetName(),3)
2052 VFN_DEBUG_MESSAGE(
"ZScatterer::InitRefParList():"<<this->
GetName(),5)
2058 gpRefParTypeScattTranslX,
2059 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,1.,1.);
2065 gpRefParTypeScattTranslY,
2066 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,1.,1.);
2072 gpRefParTypeScattTranslZ,
2073 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,1.,1.);
2079 gpRefParTypeScattOccup,
2080 REFPAR_DERIV_STEP_ABSOLUTE,
true,
true,
true,
false,1.,1.);
2088 gpRefParTypeScattOrient,
2089 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,RAD2DEG,2*M_PI);
2095 gpRefParTypeScattOrient,
2096 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,RAD2DEG,2*M_PI);
2102 gpRefParTypeScattOrient,
2103 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,RAD2DEG,2*M_PI);
2110 bool usedBond=
true,usedAngle=
true,usedDihed=
true;
2111 if(i<1) usedBond=
false;
2112 if(i<2) usedAngle=
false;
2113 if(i<3) usedDihed=
false;
2115 sprintf(buf,
"%d-%d",(
int)i,(
int)(
mZAtomRegistry.GetObj(i).GetZBondAtom()));
2120 gpRefParTypeScattConformBondLength,
2121 REFPAR_DERIV_STEP_ABSOLUTE,
true,
false,usedBond,
false,1.);
2126 sprintf(buf,
"%d-%d-%d",(
int)i,(
int)(
mZAtomRegistry.GetObj(i).GetZBondAtom()),
2130 gpRefParTypeScattConformBondAngle,
2131 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,usedAngle,
true,RAD2DEG,2*M_PI);
2136 sprintf(buf,
"%d-%d-%d-%d",(
int)i,(
int)(
mZAtomRegistry.GetObj(i).GetZBondAtom()),
2141 gpRefParTypeScattConformDihedAngle,
2142 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,usedDihed,
true,RAD2DEG,2*M_PI);
2148 sprintf(buf,
"%d",(
int)i);
2151 gpRefParTypeScattOccup,
2152 REFPAR_DERIV_STEP_ABSOLUTE,
true,
true,
true,
false,1.,1.);
2160 #ifdef __WX__CRYST__
2165 return mpWXCrystObj;
2176 const REAL x,
const REAL y,
const REAL z,
2179 const REAL ligandPopu,
2180 const REAL phi,
const REAL chi,
const REAL psi):
2181 ZScatterer(name,cryst,x,y,z,phi,chi,psi),mPolyhedraType(type)
2183 VFN_DEBUG_MESSAGE(
"ZPolyhedron::ZPolyhedron(..)",5)
2185 const string name_=name+
"_";
2186 const string name_central=name_+centralAtomSymbol->
GetName();
2187 const string name_periph=name_+periphAtomSymbol->
GetName();
2188 switch(mPolyhedraType)
2192 REAL ang=2*asin(sqrt(2./3.));
2193 this ->AddAtom (name_central, centralAtomSymbol,
2198 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2199 0,centralPeriphDist,
2203 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2204 0,centralPeriphDist,
2208 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2209 0,centralPeriphDist,
2213 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2214 0,centralPeriphDist,
2227 this ->AddAtom (name_central, centralAtomSymbol,
2232 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2233 0,centralPeriphDist,
2237 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2238 0,centralPeriphDist,
2242 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2243 0,centralPeriphDist,
2247 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2248 0,centralPeriphDist,
2252 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2253 0,centralPeriphDist,
2257 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2258 0,centralPeriphDist,
2275 this ->AddAtom (name_central, centralAtomSymbol,
2280 this ->AddAtom (name+
"_X",0,
2285 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2286 0,centralPeriphDist,
2290 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2291 0,centralPeriphDist,
2295 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2296 0,centralPeriphDist,
2300 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2301 0,centralPeriphDist,
2313 this ->AddAtom (name_central, centralAtomSymbol,
2318 this ->AddAtom (name+
"_X",0,
2323 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2324 0,centralPeriphDist,
2328 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2329 0,centralPeriphDist,
2333 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2334 0,centralPeriphDist,
2338 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2339 0,centralPeriphDist,
2343 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2344 0,centralPeriphDist,
2348 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2349 0,centralPeriphDist,
2353 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2354 0,centralPeriphDist,
2358 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2359 0,centralPeriphDist,
2365 case ANTIPRISM_TETRAGONAL:
2367 this ->AddAtom (name_central, centralAtomSymbol,
2372 this ->AddAtom (name+
"_X",0,
2377 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2378 0,centralPeriphDist,
2382 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2383 0,centralPeriphDist,
2387 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2388 0,centralPeriphDist,
2392 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2393 0,centralPeriphDist,
2397 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2398 0,centralPeriphDist,
2402 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2403 0,centralPeriphDist,
2407 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2408 0,centralPeriphDist,
2412 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2413 0,centralPeriphDist,
2419 case PRISM_TETRAGONAL_MONOCAP:
2421 this ->AddAtom (name_central, centralAtomSymbol,
2426 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2427 0,centralPeriphDist,
2431 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2432 0,centralPeriphDist,
2436 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2437 0,centralPeriphDist,
2441 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2442 0,centralPeriphDist,
2446 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2447 0,centralPeriphDist,
2451 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2452 0,centralPeriphDist,
2456 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2457 0,centralPeriphDist,
2461 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2462 0,centralPeriphDist,
2466 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2467 0,centralPeriphDist,
2473 case PRISM_TETRAGONAL_DICAP:
2475 this ->AddAtom (name_central, centralAtomSymbol,
2480 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2481 0,centralPeriphDist,
2485 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2486 0,centralPeriphDist,
2490 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2491 0,centralPeriphDist,
2495 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2496 0,centralPeriphDist,
2500 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2501 0,centralPeriphDist,
2505 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2506 0,centralPeriphDist,
2510 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2511 0,centralPeriphDist,
2515 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2516 0,centralPeriphDist,
2520 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2521 0,centralPeriphDist,
2525 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2526 0,centralPeriphDist,
2532 case PRISM_TRIGONAL:
2534 const REAL ang=55.*DEG2RAD;
2535 const REAL ang2=120.*DEG2RAD;
2536 this ->AddAtom (name_central, centralAtomSymbol,
2541 this ->AddAtom (name+
"_X",0,
2546 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2547 0,centralPeriphDist,
2551 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2552 0,centralPeriphDist,
2556 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2557 0,centralPeriphDist,
2561 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2562 0,centralPeriphDist,
2566 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2567 0,centralPeriphDist,
2571 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2572 0,centralPeriphDist,
2578 case PRISM_TRIGONAL_TRICAPPED:
2580 const REAL ang=55.*DEG2RAD;
2581 const REAL ang2=120.*DEG2RAD;
2582 this ->AddAtom (name_central, centralAtomSymbol,
2587 this ->AddAtom (name+
"_X",0,
2592 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2593 0,centralPeriphDist,
2597 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2598 0,centralPeriphDist,
2602 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2603 0,centralPeriphDist,
2607 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2608 0,centralPeriphDist,
2612 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2613 0,centralPeriphDist,
2617 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2618 0,centralPeriphDist,
2622 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2623 0,centralPeriphDist,
2627 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2628 0,centralPeriphDist,
2632 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2633 0,centralPeriphDist,
2641 const REAL ang=acos(sqrt(.2));
2642 const REAL ang2=M_PI*2./5.;
2643 this ->AddAtom (name_central, centralAtomSymbol,
2648 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2649 0,centralPeriphDist,
2653 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2654 0,centralPeriphDist,
2658 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2659 0,centralPeriphDist,
2663 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2664 0,centralPeriphDist,
2668 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2669 0,centralPeriphDist,
2673 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2674 0,centralPeriphDist,
2678 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2679 0,centralPeriphDist,
2683 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2684 0,centralPeriphDist,
2688 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2689 0,centralPeriphDist,
2693 this ->AddAtom (name_periph+
"9",periphAtomSymbol,
2694 0,centralPeriphDist,
2698 this ->AddAtom (name_periph+
"10",periphAtomSymbol,
2699 0,centralPeriphDist,
2703 this ->AddAtom (name_periph+
"11",periphAtomSymbol,
2704 0,centralPeriphDist,
2710 case TRIANGLE_PLANE:
2712 this ->AddAtom (name_central, centralAtomSymbol,
2717 this ->AddAtom (name+
"_X",0,
2722 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2723 0,centralPeriphDist,
2727 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2728 0,centralPeriphDist,
2732 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2733 0,centralPeriphDist,
2743 default :
throw ObjCrystException(
"ZPolyhedron::ZPolyhedron():Unknown Polyhedra type !");
2752 VFN_DEBUG_MESSAGE(
"ZPolyhedron::ZPolyhedron():End:"<<
mName<<
")",5)
2760 VFN_DEBUG_MESSAGE(
"ZPolyhedron::CreateCopy()"<<
mName<<
")",5)
2770 GlobalScatteringPower::GlobalScatteringPower():mpZScatterer(0)
2772 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GlobalScatteringPower():"<<
mName,5)
2775 GlobalScatteringPower::GlobalScatteringPower(
const ZScatterer &scatt):mpZScatterer(0)
2777 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GlobalScatteringPower(&scatt):"<<
mName,5)
2781 GlobalScatteringPower::GlobalScatteringPower(const GlobalScatteringPower& old):mpZScatterer(0)
2783 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GlobalScatteringPower(&old):"<<
mName,5)
2784 this->Init(*(old.mpZScatterer));
2787 GlobalScatteringPower::~GlobalScatteringPower()
2789 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::~GlobalScatteringPower():"<<
mName,5)
2790 if(mpZScatterer!=0) delete mpZScatterer;
2794 void GlobalScatteringPower::Init()
2803 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::Init(&Scatt):"<<
mName,5)
2804 if(mpZScatterer!=0)
delete mpZScatterer;
2806 mpZScatterer->SetUseGlobalScatteringPower(
false);
2807 mpZScatterer->SetName(scatt.
GetName()+
"_GlobalCopy");
2814 mDynPopCorrIndex += (*tmp)(i).mpScattPow->GetDynPopCorrIndex();
2819 const int spgSymPosIndex)
const
2822 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetScatteringFactor():"<<
mName,10)
2823 TAU_PROFILE(
"GlobalScatteringPower::GetScatteringFactor()",
"void ()",TAU_DEFAULT);
2828 CrystVector_REAL sf(data.
GetNbRefl()),rsf,isf;
2835 cryst.SetUseDynPopCorr(
false);
2837 pData->
SetName(
"GlobalScatteringPowerData!");
2838 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetScatteringFactor():No DEBUG Messages",5)
2839 VFN_DEBUG_LOCAL_LEVEL(10)
2841 const long nbStep=4;
2843 for(
int i=-nbStep;i<=nbStep;i++)
2845 mpZScatterer->SetChi(i*M_PI/2/nbStep);
2846 for(
int j=-nbStep;j<=nbStep;j++)
2848 mpZScatterer->SetPhi(j*M_PI/2/nbStep);
2849 for(
int k=-nbStep;k<=nbStep;k++)
2852 mpZScatterer->SetPsi(k*M_PI/2/nbStep);
2862 rsf*= cos(mpZScatterer->GetPhi());
2863 norm += cos(mpZScatterer->GetPhi());
2870 VFN_DEBUG_LOCAL_LEVEL(-1)
2872 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetScatteringFactor():"<<
mName<<
":End.",10)
2881 sf += (*pList)(i).mpScattPow->GetForwardScatteringFactor(type);
2886 const int spgSymPosIndex)
const
2888 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetTemperatureFactor(data):"<<
mName,5)
2889 CrystVector_REAL temp(data.
GetNbRefl());
2895 const int spgSymPosIndex)
const
2897 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetResonantScattFactReal(data):"<<
mName,5)
2898 CrystMatrix_REAL res(1,1);
2904 const int spgSymPosIndex)
const
2906 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetResonantScattFactImag(data):"<<
mName,5)
2907 CrystMatrix_REAL res(1,1);
2916 void GlobalScatteringPower::InitRefParList()
const CrystVector_REAL & GetZCoord() const
Get the list of all ZAtom cartesian x coordinates.
CrystVector_REAL GetLatticePar() const
Lattice parameters (a,b,c,alpha,beta,gamma) as a 6-element vector in Angstroems and radians...
CrystVector_int mComponentIndex
Index of atoms in the ScatteringComponentList.
const CrystVector_REAL & GetFhklCalcImag() const
Access to imaginary part of F(hkl)calc.
const REAL & GetZBondLength() const
Const access to bondlength parameter.
const CrystVector_REAL & GetYCoord() const
Get the list of all ZAtom cartesian x coordinates.
void SetScatteringPower(const ScatteringPower *)
Set the ScatteringPower.
unsigned int GetCenterAtomIndex() const
Get the index of the central atom (around which the rotation is made)
ZScatterer(const string &name, Crystal &cryst, const REAL x=0., const REAL y=0., const REAL z=0., const REAL phi=0., const REAL chi=0., const REAL psi=0.)
ZScatterer constructor.
void UpdateCoordinates() const
Update the atom coordinates (in real units, in Angstroems).
void AddAtom(const string &name, const ScatteringPower *pow, const long atomBond, const REAL bondLength, const long atomAngle, const REAL bondAngle, const long atomDihedral, const REAL dihedralAngle, const REAL popu=1.)
Add an atom to the Zscatterer.
void AddPar(const RefinablePar &newRefPar)
Add a refinable parameter.
void ReadFHLine(const char *buf, const unsigned int nb, string &symbol, int &n1, float &v1, int &n2, float &v2, int &n3, float &v3)
Function to parse one line from a Fenske-Hall zmatrix file.
REAL GetZAtomY(const int i) const
Get the Y fractionnal coordinate of atom i.
virtual REAL GetForwardScatteringFactor(const RadiationType) const
Get the scattering factor at (0,0,0).
const RefinableObjClock & GetClockLatticePar() const
last time the Lattice parameters were changed
CrystMatrix_REAL mPhiChiPsiMatrix
Rotation matrix for the orientation of the scatterer.
void SetLimitsRelative(const string &parName, const REAL min, const REAL max)
Change the limits for a given parameter, giving relative new limits (eg giving -.1 and +...
virtual CrystVector_REAL GetTemperatureFactor(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the temperature factor for all reflections of a given ScatteringData object.
virtual void Optimize(long &nbSteps, const bool silent=false, const REAL finalcost=0, const REAL maxTime=-1)
Launch optimization (a single run) for N steps.
const RefinableObjClock & GetClockScatterer() const
Last time anything in the scatterer was changed (atoms, positions, scattering power) ...
float string2floatC(const string &s)
Function to convert a substring to a floating point value, imposing a C locale (using '...
void OrthonormalToFractionalCoords(REAL &x, REAL &y, REAL &z) const
Get fractional cartesian coordinates for a set of (x,y,z) orthonormal coordinates.
void SetZAngle(const int i, const REAL)
Access to the angle parameter, for the i-th row in the Z-Matrix.
long GetNbComponent() const
Number of components.
REAL GetZAtomZ(const int i) const
Get the Z fractionnal coordinate of atom i.
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
void FractionalToOrthonormalCoords(REAL &x, REAL &y, REAL &z) const
Get orthonormal cartesian coordinates for a set of (x,y,z) fractional coordinates.
CrystVector_REAL mXYZ
coordinates of the scatterer (or of its center..)
void FixAllPar()
Fix All parameters.
const CrystVector_REAL & GetXCoord() const
Get the list of all ZAtom cartesian x coordinates.
void SetZBondLength(const int i, const REAL)
Access to bondlength parameter, for the i-th row in the Z-Matrix.
ZScatterer * mpScatt
the ZScatterer in which this atom is included.
ScatteringComponentList mScattCompList
The list of scattering components.
virtual void InitRefParList()
Prepare refinable parameters for the scatterer object.
void Click()
Record an event for this clock (generally, the 'time' an object has been modified, or some computation has been made)
wxCryst class for ZScatterer objects
long GetNbPar() const
Total number of refinable parameter in the object.
RefinableObjClock mClockCoord
Last time the cartesian coordinates were computed.
void SetChi(const REAL)
Access to chi parameter (overall orientation of the scatterer)
virtual string GetComponentName(const int i) const
Name for the i-th component of this scatterer.
RefinablePar & GetPar(const long i)
Access all parameters in the order they were inputted.
void Print() const
Print the list of Scattering components. For debugging.
Class to minimize conformation changes for random moves.
virtual REAL GetLogLikelihood() const
Get -log(likelihood) of the current configuration for the object.
virtual void SetCrystal(Crystal &crystal)
Set the crystal for this experiment.
const REAL & GetZAngle() const
Const access to the angle parameter.
void Print() const
Print a single line of information about this scatterer.
void Mutate(const REAL mutateValue)
Add the given amount to the parameter current value.
long mCenterAtomIndex
Index of the atom used as a pivot (the scatterer is rotated around this atom).
Class to compute structure factors for a set of reflections and a Crystal.
void SetOccupancy(const REAL)
Access to the dihedral angle parameter.
virtual CrystMatrix_REAL GetResonantScattFactReal(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the real part of the resonant scattering factor.
long GetZBondAtom() const
Index of the 1st atom used to define the atom in the Z-Matrix (the one from which the bondlength is c...
const REAL & GetHumanValue() const
Current value of parameter, scaled if necessary (for angles) to a human-understandable value...
long GetZDihedralAngleAtom() const
Index of the 3rd atom used to define the atom in the Z-Matrix (the one from which the dihedral angle ...
virtual int GetNbComponent() const
Number of components in the scatterer (eg number of point scatterers)
Generic Refinable Object.
REAL GetZBondLength(const int i) const
Const access to bondlength parameter, for the i-th row in the Z-Matrix.
void SetZDihedralAngle(const int i, const REAL)
Access to the dihedral angle parameter, for the i-th row in the Z-Matrix.
CrystVector_REAL mXCoord
Storage for Cartesian coordinates.
void ResetParList()
Re-init the list of refinable parameters, removing all parameters.
void AddScatterer(Scatterer *scatt)
Add a scatterer to the crystal.
void Reset()
Reset the list.
REAL GetZ() const
Z coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
Format vector as horiz array:
long mNbDummyAtom
Number of "dummy" atoms in the structure.
void SetPhi(const REAL)
Access to phi parameter (overall orientation of the scatterer)
Abstract base class for all objects in wxCryst.
virtual CrystVector_REAL GetScatteringFactor(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the Scattering factor for all reflections of a given ScatteringData object.
const REAL & GetOccupancy() const
Const access to the ocupancy parameter.
string mName
Name for this RefinableObject. Should be unique, at least in the same scope.+.
const ZScatterer & GetZScatterer() const
Get the ZScatterer associated to this ZAtom.
void ExportFenskeHallZMatrix(ostream &os)
Export to Fenske-Hall ZMatrix file.
ObjRegistry< ZAtom > mZAtomRegistry
Registry for ZAtoms in this Scatterer.
virtual ZPolyhedron * CreateCopy() const
const ScatteringPower * mpScattPow
The ScatteringPower corresponding to this atom.
REAL mPhi
Angles giving the orientation of the ZScatterer (stored in radian)
void SetZAngle(const REAL)
Access to the angle parameter.
string mName
Name for this atom.
Class to store POV-Ray output options.
Class for individual atoms in a ZScatterer Object.
virtual void SetUseGlobalScatteringPower(const bool useIt)
use a Global scattering power for this scatterer ?
long mAtomBond
The index (in the ZScatterer) of the atoms which are used to define the position of this atom...
RefinableObjClock mClockScattCompList
void UpdateScattCompList() const
Update the scattering component list, ie compute all atom positions from the bonds/angles/dihedral an...
void AssignClock(RefinableObjClock &clock)
REAL GetX() const
X coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
void ImportFenskeHallZMatrix(istream &is, bool named=false)
Import "Fenske-Hall" ZMatrix file (fhz in the babel program http://www.eyesopen.com/babel.html\ example: use "./babel -ipdb foo.pdb -ofhz foo.fhz -d", to convert a pdb file to a Z-Matrix file (the -d removes hydrogen atoms)
CrystMatrix_long m3DDisplayIndex
For 3D display of the structure, bonds, triangular and quadric faces can be displayed.
virtual CrystMatrix_REAL GetResonantScattFactImag(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the imaginary part of the resonant scattering factor.
virtual void GLInitDisplayList(const bool onlyIndependentAtoms=false, const REAL xMin=-.1, const REAL xMax=1.1, const REAL yMin=-.1, const REAL yMax=1.1, const REAL zMin=-.1, const REAL zMax=1.1, const bool displayEnantiomer=false, const bool displayNames=false, const bool hideHydrogens=false) const
bool mUseGlobalScattPow
Does the ZScatterer use a global scattering power ?
virtual void EndOptimization()
This should be called by any optimization class at the end of an optimization.
REAL mOccupancy
Occupancy : 0 <= occ <= 1 For a multi-atom scatterer (polyhedron,..), this is the overall occupancy o...
virtual const ScatteringComponentList & GetScatteringComponentList() const
Get the list of all scattering components for this scatterer.
long mNbAtom
Total number of atoms in the structure.
long GetZAngleAtom() const
Index of the 2nd atom used to define the atom in the Z-Matrix (the one from which the angle is calcul...
REAL GetPhi() const
Access to phi parameter (overall orientation of the scatterer)
ObjRegistry< ScatteringPower > & GetScatteringPowerRegistry()
Get the registry of ScatteringPower included in this Crystal.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
const Crystal & GetCrystal() const
Const access to the data's crystal.
void SetZDihedralAngle(const REAL)
Access to the dihedral angle parameter.
const CrystVector_REAL & GetFhklCalcReal() const
Access to real part of F(hkl)calc.
virtual ScatteringData * CreateCopy() const =0
So-called virtual copy constructor.
void SetCrystal(Crystal &)
Set the crystal in which is included this Scatterer.
long GetZBondAtom(const int i) const
Index of the 1st atom used to define the i-th atom in the Z-Matrix (the one from which the bondlength...
ZScatterer: the basic type of complex scatterers, where atom positions are defined using a standard "...
virtual void GetGeneGroup(const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
Get the gene group assigned to each parameter.
const Crystal & GetCrystal() const
In which crystal is this Scatterer included ?
bool IsDescendantFromOrSameAs(const RefParType *type) const
Returns true if the parameter is a descendant of 'type'.
Exception class for ObjCryst++ library.
virtual void EndOptimization()
This should be called by any optimization class at the end of an optimization.
long GetNbRefl() const
Return the number of reflections in this experiment.
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
The Scattering Power for an Atom.
void SetCenterAtomIndex(const unsigned int)
Set the index of the central atom (around which the rotation is made)
Generic class for parameters of refinable objects.
const REAL & GetZDihedralAngle() const
Const access to the dihedral angle parameter.
virtual const string & GetName() const
Name of the object.
REAL GetChi() const
Access to chi parameter (overall orientation of the scatterer)
REAL mBondLength
Bond length, angle and dihedral angle.
REAL GetGlobalOptimStep() const
Maximum step to use during Global Optimization algorithms.
virtual REAL GetRadius() const
Return the physical radius of this type of scatterer (for 3D display purposes).
REAL GetZAngle(const int i) const
Const access to the angle parameter, for the i-th row in the Z-Matrix.
RadiationType
Type of radiation used.
REAL GetValue() const
of the parameter.
Crystal class: Unit cell, spacegroup, scatterers.
void SetPsi(const REAL)
Access to psi parameter (overall orientation of the scatterer)
void Init()
Initialization of the object, used by all constructors, and operator=.
REAL GetY() const
Y coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
const ObjRegistry< ZAtom > & GetZAtomRegistry() const
Access to the registry of ZAtoms.
REAL GetPsi() const
Access to psi parameter (overall orientation of the scatterer)
REAL GetZDihedralAngle(const int i) const
Const access to the dihedral angle parameter, for the i-th row in the Z-Matrix.
RefinableObjClock mClockScatterer
Last time anything (number of atoms, positions, scattering power) was changed.
class of refinable parameter types.
list of scattering positions in a crystal, associated with the corresponding occupancy and a pointer ...
virtual ostream & POVRayDescription(ostream &os, const CrystalPOVRayOptions &options) const
ZPolyhedron(const RegularPolyhedraType type, Crystal &cryst, const REAL x, const REAL y, const REAL z, const string &name, const ScatteringPower *centralAtomPow, const ScatteringPower *periphAtomPow, const REAL centralPeriphDist, const REAL ligandPopu=1, const REAL phi=0., const REAL chi=0., const REAL psi=0.)
ZPolyhedron constructor.
GlobalScatteringPower * mpGlobalScattPow
the global scattering power used, if mUseGlobalScattPow=true
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
Generic type of scatterer: can be an atom, or a more complex assembly of atoms.
void AddScatteringPower(ScatteringPower *scattPow)
Add a ScatteringPower for this Crystal.
long GetZDihedralAngleAtom(const int i) const
Index of the 3rd atom used to define the i-th atom in the Z-Matrix (the one from which the dihedral a...
int mOptimizationDepth
Is the object being refined or optimized ? if mOptimizationDepth=0, no optimization is taking place...
Crystal * mpCryst
The crystal in which the Scatterer is This is needed so that we can know which scattering powers are ...
REAL GetZAtomX(const int i) const
Get the X fractionnal coordinate of atom i.
ZPolyhedron: a Scatterer to describe polyhedras such as octahedron, tetrahedron, square plane...
virtual ZScatterer * CreateCopy() const
void SetZBondLength(const REAL)
Access to bondlength parameter.
const ScatteringPower * GetScatteringPower() const
ScatteringPower for this atom.
long GetZAngleAtom(const int i) const
Index of the 2nd atom used to define the i-th atom in the Z-Matrix (the one from which the angle is c...
virtual void SetName(const string &name)
Name of the object.
Abstract Base Class to describe the scattering power of any Scatterer component in a crystal...