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"
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;}
92 const ZScatterer& ZAtom::GetZScatterer()
const{
return *mpScatt;}
94 void ZAtom::SetName(
const string& name) {mName=name;}
95 long ZAtom::GetZBondAtom()
const {
return mAtomBond;}
96 long ZAtom::GetZAngleAtom()
const {
return mAtomAngle;}
97 long ZAtom::GetZDihedralAngleAtom()
const {
return mAtomDihed;}
98 const REAL& ZAtom::GetZBondLength()
const {
return mBondLength;}
99 const REAL& ZAtom::GetZAngle()
const {
return mAngle;}
100 const REAL& ZAtom::GetZDihedralAngle()
const {
return mDihed;}
101 const REAL& ZAtom::GetOccupancy()
const {
return mOccupancy;}
104 void ZAtom::SetZBondLength(
const REAL bond) {mBondLength=bond;mpScatt->GetClockScatterer().Click();}
105 void ZAtom::SetZAngle(
const REAL angle) {mAngle=angle;mpScatt->GetClockScatterer().Click();}
106 void ZAtom::SetZDihedralAngle(
const REAL dihed) {mDihed=dihed;mpScatt->GetClockScatterer().Click();}
107 void ZAtom::SetOccupancy(
const REAL pop) {mOccupancy=pop;mpScatt->GetClockScatterer().Click();}
108 void ZAtom::SetScatteringPower(
const ScatteringPower* scatt) {mpScattPow=scatt;mpScatt->GetClockScatterer().Click();}
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)
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);
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 void ZScatterer::GLInitDisplayList(
const bool onlyIndependentAtoms,
648 const REAL xMin,
const REAL xMax,
649 const REAL yMin,
const REAL yMax,
650 const REAL zMin,
const REAL zMax,
651 const bool displayEnantiomer,
652 const bool displayNames,
653 const bool hideHydrogens,
654 const REAL fadeDistance,
655 const bool fullMoleculeInLimits)
const
657 VFN_DEBUG_ENTRY(
"ZScatterer::GLInitDisplayList()",4)
660 VFN_DEBUG_EXIT(
"ZScatterer::GLInitDisplayList():No ZAtom to display !",4)
664 if(displayEnantiomer==true) en=-1;
672 GLfloat colour_bond[]= { 0.5, .5, .5, 1.0 };
673 GLfloat colour_side[]= { 0.0, .0, .0, 1.0 };
674 const GLfloat colour0[] = {0.0f, 0.0f, 0.0f, 0.0f};
676 GLUquadricObj* pQuadric = gluNewQuadric();
678 if(
true==onlyIndependentAtoms)
681 CrystVector_REAL x,y,z;
696 if(hideHydrogens && (
mZAtomRegistry.GetObj(n1).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
697 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,
700 glTranslatef(x(n1)*en, y(n1), z(n1));
702 ->GetRadius()/3.,10,10);
710 if(hideHydrogens && (
mZAtomRegistry.GetObj(n1).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
711 if(hideHydrogens && (
mZAtomRegistry.GetObj(n2).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
713 glTranslatef(x(n1)*en, y(n1), z(n1));
714 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colour_bond);
715 GLUquadricObj *quadobj = gluNewQuadric();
716 glColor3f(1.0f,1.0f,1.0f);
717 const REAL height= sqrt( (x(n2)-x(n1))*(x(n2)-x(n1))
718 +(y(n2)-y(n1))*(y(n2)-y(n1))
719 +(z(n2)-z(n1))*(z(n2)-z(n1)));
720 glRotatef(180,(x(n2)-x(n1))*en,y(n2)-y(n1),z(n2)-z(n1)+height);
721 gluCylinder(quadobj,.1,.1,height,10,1 );
722 gluDeleteQuadric(quadobj);
729 REAL x1,y1,z1,x2,y2,z2,xn,yn,zn,xc,yc,zc;
749 glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
752 glBegin(GL_TRIANGLES);
753 if((xn*xc+yn*yc+zn*zc)>0) glNormal3f(xn*en, yn, zn);
754 else glNormal3f(-xn*en, -yn, -zn);
755 glVertex3f(x(n1)*en,y(n1),z(n1));
756 glVertex3f(x(n2)*en,y(n2),z(n2));
757 glVertex3f(x(n3)*en,y(n3),z(n3));
759 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colour_side);
760 glBegin(GL_LINE_LOOP);
761 glVertex3f(x(n1)*en,y(n1),z(n1));
762 glVertex3f(x(n2)*en,y(n2),z(n2));
763 glVertex3f(x(n3)*en,y(n3),z(n3));
769 REAL x1,y1,z1,x2,y2,z2,xn,yn,zn,xc,yc,zc;
790 glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE,
793 glBegin(GL_TRIANGLES);
794 if((xn*xc+yn*yc+zn*zc)>0) glNormal3f(xn*en, yn, zn);
795 else glNormal3f(-xn*en, -yn, -zn);
796 glVertex3f(x(n1)*en,y(n1),z(n1));
797 glVertex3f(x(n2)*en,y(n2),z(n2));
798 glVertex3f(x(n3)*en,y(n3),z(n3));
799 glVertex3f(x(n4)*en,y(n4),z(n4));
801 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colour_side);
802 glBegin(GL_LINE_LOOP);
803 glVertex3f(x(n1)*en,y(n1),z(n1));
804 glVertex3f(x(n2)*en,y(n2),z(n2));
805 glVertex3f(x(n3)*en,y(n3),z(n3));
806 glVertex3f(x(n4)*en,y(n4),z(n4));
817 if(hideHydrogens && (
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
818 const float r=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[0];
819 const float g=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[1];
820 const float b=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[2];
822 glTranslatef(x(k)*en, y(k), z(k));
825 GLfloat colourChar [] = {1.0, 1.0, 1.0, 1.0};
826 if((r>0.8)&&(g>0.8)&&(b>0.8))
832 glMaterialfv(GL_FRONT, GL_AMBIENT, colour0);
833 glMaterialfv(GL_FRONT, GL_DIFFUSE, colour0);
834 glMaterialfv(GL_FRONT, GL_SPECULAR, colour0);
835 glMaterialfv(GL_FRONT, GL_EMISSION, colourChar);
836 glMaterialfv(GL_FRONT, GL_SHININESS,colour0);
837 glRasterPos3f(0.0f, 0.0f, 0.0f);
842 const GLfloat colourAtom [] = {r, g, b, 1.0};
843 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colourAtom);
844 glMaterialfv(GL_FRONT, GL_SPECULAR, colour0);
845 glMaterialfv(GL_FRONT, GL_EMISSION, colour0);
846 glMaterialfv(GL_FRONT, GL_SHININESS, colour0);
847 glPolygonMode(GL_FRONT, GL_FILL);
849 mZAtomRegistry.GetObj(k).GetScatteringPower()->GetRadius()/3.,10,10);
852 if((0!=
mZAtomRegistry.GetObj(bond).GetScatteringPower()) && (k>0))
854 glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,colour_bond);
855 GLUquadricObj *quadobj = gluNewQuadric();
856 glColor3f(1.0f,1.0f,1.0f);
857 const REAL height= sqrt( (x(bond)-x(k))*(x(bond)-x(k))
858 +(y(bond)-y(k))*(y(bond)-y(k))
859 +(z(bond)-z(k))*(z(bond)-z(k)));
860 glRotatef(180,(x(bond)-x(k))*en,y(bond)-y(k),z(bond)-z(k)+height);
861 gluCylinder(quadobj,.1,.1,height,10,1 );
862 gluDeleteQuadric(quadobj);
871 VFN_DEBUG_ENTRY(
"ZScatterer::GLInitDisplayList():Show all symmetrics",3)
872 vector<CrystMatrix_REAL> vXYZCoords;
881 vXYZCoords.push_back(this->
GetCrystal().GetSpaceGroup().
882 GetAllSymmetrics(x0,y0,z0,
false,
false,
false));
885 CrystMatrix_int translate(27,3);
915 CrystVector_REAL xSave,ySave,zSave;
916 const int nbSymmetrics=vXYZCoords[0].rows();
917 for(
int i=0;i<nbSymmetrics;i++)
919 VFN_DEBUG_ENTRY(
"ZScatterer::GLInitDisplayList():Symmetric#"<<i,3)
922 x(j)=vXYZCoords[j](i,0);
923 y(j)=vXYZCoords[j](i,1);
924 z(j)=vXYZCoords[j](i,2);
930 x(0) = fmod((
float) x(0),(
float)1);
if(x(0)<0) x(0)+=1.;
931 y(0) = fmod((
float) y(0),(
float)1);
if(y(0)<0) y(0)+=1.;
932 z(0) = fmod((
float) z(0),(
float)1);
if(z(0)<0) z(0)+=1.;
946 for(
int j=0;j<translate.rows();j++)
951 if( (x(0)>xMin) && (x(0)<xMax)
952 &&(y(0)>yMin) && (y(0)<yMax)
953 &&(z(0)>zMin) && (z(0)<zMax))
961 REAL x1,y1,z1,x2,y2,z2,xn,yn,zn,xc,yc,zc;
983 glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,
985 glBegin(GL_TRIANGLES);
986 if((xn*xc+yn*yc+zn*zc)>0) glNormal3f( xn*en, yn, zn);
987 else glNormal3f(-xn*en, -yn, -zn);
989 glVertex3f(x(n1)*en,y(n1),z(n1));
990 glVertex3f(x(n2)*en,y(n2),z(n2));
991 glVertex3f(x(n3)*en,y(n3),z(n3));
993 glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colour_side);
994 glBegin(GL_LINE_LOOP);
995 glVertex3f(x(n1)*en,y(n1),z(n1));
996 glVertex3f(x(n2)*en,y(n2),z(n2));
997 glVertex3f(x(n3)*en,y(n3),z(n3));
1006 if(hideHydrogens && (
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetForwardScatteringFactor(RAD_XRAY)<1.5))
continue;
1007 const float r=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[0];
1008 const float g=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[1];
1009 const float b=
mZAtomRegistry.GetObj(k).GetScatteringPower()->GetColourRGB()[2];
1011 glTranslatef(x(k)*en, y(k), z(k));
1014 GLfloat colourChar [] = {1.0, 1.0, 1.0, 1.0};
1015 if((r>0.8)&&(g>0.8)&&(b>0.8))
1017 colourChar[0] = 0.5;
1018 colourChar[1] = 0.5;
1019 colourChar[2] = 0.5;
1021 glMaterialfv(GL_FRONT, GL_AMBIENT, colour0);
1022 glMaterialfv(GL_FRONT, GL_DIFFUSE, colour0);
1023 glMaterialfv(GL_FRONT, GL_SPECULAR, colour0);
1024 glMaterialfv(GL_FRONT, GL_EMISSION, colourChar);
1025 glMaterialfv(GL_FRONT, GL_SHININESS,colour0);
1026 glRasterPos3f(0.0f, 0.0f, 0.0f);
1031 const GLfloat colourAtom [] = {r, g, b, 1.0};
1032 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE,colourAtom);
1033 glMaterialfv(GL_FRONT, GL_SPECULAR, colour0);
1034 glMaterialfv(GL_FRONT, GL_EMISSION, colour0);
1035 glMaterialfv(GL_FRONT, GL_SHININESS, colour0);
1036 glPolygonMode(GL_FRONT, GL_FILL);
1038 mZAtomRegistry.GetObj(k).GetScatteringPower()->GetRadius()/3.,10,10);
1039 glRasterPos3f(0,0,0);
1042 if((0!=
mZAtomRegistry.GetObj(bond).GetScatteringPower()) && (k>0))
1044 glMaterialfv(GL_FRONT,GL_AMBIENT_AND_DIFFUSE,colour_bond);
1045 GLUquadricObj *quadobj = gluNewQuadric();
1046 glColor3f(1.0f,1.0f,1.0f);
1047 const REAL height= sqrt( (x(bond)-x(k))*(x(bond)-x(k))
1048 +(y(bond)-y(k))*(y(bond)-y(k))
1049 +(z(bond)-z(k))*(z(bond)-z(k)));
1050 glRotatef(180,(x(bond)-x(k))*en,y(bond)-y(k),z(bond)-z(k)+height);
1051 gluCylinder(quadobj,.1,.1,height,10,1 );
1052 gluDeleteQuadric(quadobj);
1063 VFN_DEBUG_EXIT(
"ZScatterer::GLInitDisplayList():Symmetric#"<<i,3)
1065 VFN_DEBUG_EXIT(
"ZScatterer::GLInitDisplayList():Show all symmetrics",3)
1067 gluDeleteQuadric(pQuadric);
1068 VFN_DEBUG_EXIT(
"ZScatterer::GLInitDisplayList()",4)
1074 VFN_DEBUG_MESSAGE(
"ZScatterer::SetUseGlobalScatteringPower(bool):"<<this->
GetName()<<
":"<<useIt,5)
1104 CrystVector_uint & groupIndex,
1105 unsigned int &first)
const
1109 unsigned int posIndex=0;
1110 unsigned int orientIndex=0;
1111 VFN_DEBUG_MESSAGE(
"ZScatterer::GetGeneGroup()",4)
1113 for(
long j=0;j<this->
GetNbPar();j++)
1118 if(posIndex==0) posIndex=first++;
1119 groupIndex(i)=posIndex;
1122 if(this->
GetPar(j).GetType()->IsDescendantFromOrSameAs(gpRefParTypeScattOrient))
1124 if(orientIndex==0) orientIndex=first++;
1125 groupIndex(i)=orientIndex;
1127 else groupIndex(i)= first++;
1150 if(0!=mpZMoveMinimizer)
delete mpZMoveMinimizer;
1156 std::vector<std::string> SplitString(
const std::string &s)
1158 const string delim(
" ");
1159 std::vector<std::string> v;
1163 int n=str.find_first_of(delim);
1164 while( n != (
int) str.npos)
1169 v.push_back(str.substr(0,n));
1171 str= str.substr(n+1);
1172 n=str.find_first_of(delim);
1174 if(str.length() > 0) v.push_back(str);
1192 void ReadFHLine(
const char*buf,
const unsigned int nb,
string &symbol,
1193 int &n1,
float &v1,
int &n2,
float &v2,
int &n3,
float &v3)
1195 string sbuf=string(buf);
1196 std::vector<std::string> v=SplitString(sbuf);
1199 if(v.size()>0) symbol=v[0];
1200 else symbol=string(buf).substr(0,2);
1208 n1=(
unsigned int) atoi(v[1].c_str());
1213 symbol=string(buf).substr(0,2);
1214 n1=(int) atoi(
string(buf).substr(2,3).c_str());
1217 cout<<
"ReadFHLine():"<<buf<<
"#"<<symbol<<
"/"<<n1<<
"/"<<v1<<
";"<<v.size()<<endl;
1218 VFN_DEBUG_MESSAGE(
"ReadFHLine():#"<<symbol<<
"/"<<n1<<
"/"<<v1,10);
1226 n1=(int) atoi(v[1].c_str());
1228 n2=(int) atoi(v[3].c_str());
1233 symbol=sbuf.substr(0,2);
1234 n1=(int) atoi(sbuf.substr(2,3).c_str());
1236 n2=(int) atoi(sbuf.substr(11,3).c_str());
1239 VFN_DEBUG_MESSAGE(
"ReadFHLine():#"<<symbol<<
"/"<<n1<<
"/"<<v1<<
"/"<<n2<<
"/"<<v2,10);
1246 n1=(int) atoi(v[1].c_str());
1248 n2=(int) atoi(v[3].c_str());
1250 n3=(int) atoi(v[5].c_str());
1258 symbol=sbuf.substr(0,2);
1259 n1=(int) atoi(sbuf.substr(2,3).c_str());
1261 n2=(int) atoi(sbuf.substr(11,3).c_str());
1263 n3=(int) atoi(sbuf.substr(22,3).c_str());
1266 VFN_DEBUG_MESSAGE(
"ReadFHLine():#"<<symbol<<
"/"<<n1<<
"/"<<v1<<
"/"<<n2<<
"/"<<v2<<
"/"<<n3<<
"/"<<v3,10);
1274 const char c=is.peek();
1275 if ( (c <
'0') || (c >
'9') )
1277 cout<<
"ZScatterer::ImportFenskeHallZMatrix()"
1278 <<
":getting rid of first line..."<<endl;
1279 is.getline(buf,100);
1285 while(!isgraph(is.peek())) is.get(c);
1297 string symbol, atomName,bondAtomName,angleAtomName,dihedAtomName,junk;
1298 int bondAtom=0,angleAtom=0,dihedAtom=0;
1299 float bond=0,angle=0,dihed=0;
1304 is >> atomName >> symbol >> junk;
1305 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<2<<
",name:"<<atomName
1306 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1310 is.getline(buf,100);
1311 ReadFHLine(buf,1,symbol,bondAtom,bond,angleAtom,angle,dihedAtom,dihed);
1315 (symbol,
"ScatteringPowerAtom",
true);
1318 cout<<
"Scattering power"<<symbol<<
"not found, creating it..."<<endl;
1322 (symbol,
"ScatteringPowerAtom");
1331 sprintf(buf,
"%d",1);
1332 this->
AddAtom(symbol+(
string)buf,
1342 is >> atomName >> symbol >> bondAtomName >> bond;
1343 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<2<<
",name:"<<atomName
1344 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1348 is.getline(buf,100);
1349 ReadFHLine(buf,2,symbol,bondAtom,bond,angleAtom,angle,dihedAtom,dihed);
1354 (symbol,
"ScatteringPowerAtom",
true);
1357 cout<<
"Scattering power"<<symbol<<
"not found, creating it..."<<endl;
1361 (symbol,
"ScatteringPowerAtom");
1367 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1377 sprintf(buf,
"%d",2);
1378 this->
AddAtom(symbol+(
string)buf,
1388 is >> atomName >> symbol >>
1389 bondAtomName >> bond >>
1390 angleAtomName >> angle;
1391 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<2<<
",name:"<<atomName
1392 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1396 is.getline(buf,100);
1397 ReadFHLine(buf,3,symbol,bondAtom,bond,angleAtom,angle,dihedAtom,dihed);
1402 (symbol,
"ScatteringPowerAtom",
true);
1405 cout<<
"Scattering power"<<symbol<<
"not found, creating it..."<<endl;
1409 (symbol,
"ScatteringPowerAtom");
1412 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<3<<
",name:"<<atomName
1413 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1417 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1422 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1427 angleAtom,angle*DEG2RAD,
1432 sprintf(buf,
"%d",3);
1433 this->
AddAtom(symbol+(
string)buf,
1436 angleAtom-1,angle*DEG2RAD,
1440 for(
int i=3;i<nbAtoms;i++)
1444 is >> atomName >> symbol >>
1445 bondAtomName >> bond >>
1446 angleAtomName >> angle >>
1447 dihedAtomName >> dihed;
1448 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<i<<
",name:"<<atomName
1449 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1453 is.getline(buf,100);
1454 ReadFHLine(buf,i+1,symbol,bondAtom,bond,angleAtom,angle,dihedAtom,dihed);
1458 (symbol,
"ScatteringPowerAtom",
true);
1461 cout<<
"Scattering power"<<symbol<<
"not found, creating it..."<<endl;
1465 (symbol,
"ScatteringPowerAtom");
1471 VFN_DEBUG_MESSAGE(
"ZScatterer::ImportFenskeHallZMatrix():#"<<i<<
",name:"<<atomName
1472 <<
", bond: "<<bondAtomName<<
", angle: "<<angleAtomName<<
", dihed: "<<dihedAtomName,10);
1475 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1479 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1483 +
string(
"when adding atom ")+atomName+
string(
": could not find atom: ")
1488 angleAtom,angle*DEG2RAD,
1489 dihedAtom,dihed*DEG2RAD);
1493 sprintf(buf,
"%d",i+1);
1494 this->
AddAtom(symbol+(
string)buf,
1497 angleAtom-1,angle*DEG2RAD,
1498 dihedAtom-1,dihed*DEG2RAD);
1552 VFN_DEBUG_ENTRY(
"ZScatterer::GlobalOptRandomMove()",3)
1553 TAU_PROFILE(
"ZScatterer::GlobalOptRandomMove()",
"void ()",TAU_DEFAULT);
1557 if((
mNbAtom>=10) && ((rand()/(REAL)RAND_MAX)<.02)
1560 TAU_PROFILE_TIMER(timer1,\
1561 "ZScatterer::GlobalOptRandomMoveSmart1(prepare ref par & mutate)"\
1563 TAU_PROFILE_TIMER(timer2,\
1564 "ZScatterer::GlobalOptRandomMoveSmart2(optimize if necessary)"\
1566 TAU_PROFILE_START(timer1);
1568 CrystVector_long dihed(
mNbAtom);
1576 if( !(par->IsFixed()) )
1583 TAU_PROFILE_STOP(timer1);
1584 VFN_DEBUG_EXIT(
"ZScatterer::GlobalOptRandomMove():End",3)
1588 if(0==mpZMoveMinimizer)
1593 for(
int i=0; i<this->
GetNbPar();i++) mpZMoveMinimizer->
AddPar(this->GetPar(i));
1598 const int atom=dihed((
int) (rand()/((REAL)RAND_MAX+1)*nbDihed));
1600 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): Changing atom #"<<atom ,3)
1602 par=&(this->
GetPar(&mPsi));
1605 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): initial value:"<<par->
GetHumanValue() ,3)
1607 mpZMoveMinimizer->RecordConformation();
1609 const int moveType= rand()%3;
1613 CrystVector_REAL weight(
mNbAtom);
1618 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove():Move only one atom",3)
1637 mpZMoveMinimizer->
GetPar(&
mPhi).SetIsFixed(
false);
1638 if(!(this->
GetPar(&mChi).IsFixed()))
1639 mpZMoveMinimizer->
GetPar(&mChi).SetIsFixed(
false);
1640 if( !(this->
GetPar(&mPsi).IsFixed()) && (atom!=2))
1641 mpZMoveMinimizer->
GetPar(&mPsi).SetIsFixed(
false);
1643 mpZMoveMinimizer->
GetPar(&
mXYZ(0)).SetIsFixed(
false);
1645 mpZMoveMinimizer->
GetPar(&
mXYZ(1)).SetIsFixed(
false);
1647 mpZMoveMinimizer->
GetPar(&
mXYZ(2)).SetIsFixed(
false);
1652 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove():Move before the rotated bond",3)
1672 mpZMoveMinimizer->
GetPar(&
mPhi).SetIsFixed(
false);
1673 if(!(this->
GetPar(&mChi).IsFixed()))
1674 mpZMoveMinimizer->
GetPar(&mChi).SetIsFixed(
false);
1675 if( !(this->
GetPar(&mPsi).IsFixed()) && (atom!=2))
1676 mpZMoveMinimizer->
GetPar(&mPsi).SetIsFixed(
false);
1679 mpZMoveMinimizer->
GetPar(&
mXYZ(0)).SetIsFixed(
false);
1681 mpZMoveMinimizer->
GetPar(&
mXYZ(1)).SetIsFixed(
false);
1683 mpZMoveMinimizer->
GetPar(&
mXYZ(2)).SetIsFixed(
false);
1696 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove():Move after the bond (translate)",3)
1703 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove():Move after the bond(nothing to do)",3)
1710 mpZMoveMinimizer->SetZAtomWeight(weight);
1716 case 0: change=-120*DEG2RAD;
break;
1717 case 1: change= -90*DEG2RAD;
break;
1718 case 2: change= 90*DEG2RAD;
break;
1719 case 3: change= 120*DEG2RAD;
break;
1720 default:change= 180*DEG2RAD;
break;
1726 *2*(rand()/(REAL)RAND_MAX-0.5)*mutationAmplitude*16;
1728 TAU_PROFILE_STOP(timer1);
1729 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): mutation:"<<change*RAD2DEG,3)
1750 TAU_PROFILE_START(timer2);
1751 if(tmp<1) mpZMoveMinimizer->MinimizeChange(100);
1752 else if(tmp<5) mpZMoveMinimizer->MinimizeChange(200);
1753 else mpZMoveMinimizer->MinimizeChange(500);
1754 TAU_PROFILE_STOP(timer2);
1757 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): final value:"<<par->
GetHumanValue(),3)
1763 CrystVector_long dihed(
mNbAtom);
1771 if( !(par->IsFixed()) )
1777 const int atom=dihed((
int) (rand()/((REAL)RAND_MAX+1)*nbDihed));
1779 VFN_DEBUG_MESSAGE(
"ZScatterer::GlobalOptRandomMove(): Changing atom #"<<atom ,10)
1781 par=&(this->
GetPar(&mPsi));
1787 if( (rand()/(REAL)RAND_MAX)<.1)
1791 case 0: par->
Mutate(-120*!DEG2RAD);
break;
1792 case 1: par->
Mutate( -90*!DEG2RAD);
break;
1793 case 2: par->
Mutate( 90*!DEG2RAD);
break;
1794 case 3: par->
Mutate( 120*!DEG2RAD);
break;
1795 default:par->
Mutate( 180*!DEG2RAD);
break;
1800 *2*(rand()/(REAL)RAND_MAX-0.5)*mutationAmplitude*8);
1801 const REAL change=
mZAtomRegistry.GetObj(atom).GetZDihedralAngle()-old;
1825 VFN_DEBUG_EXIT(
"ZScatterer::GlobalOptRandomMove():End",3)
1832 VFN_DEBUG_ENTRY(
"ZScatterer::UpdateCoordinates():"<<this->
GetName(),3)
1833 TAU_PROFILE(
"ZScatterer::UpdateCoordinates()",
"void ()",TAU_DEFAULT);
1838 CrystMatrix_REAL phiMatrix(3,3),chiMatrix(3,3),psiMatrix(3,3);
1839 phiMatrix= cos(
mPhi) , -sin(
mPhi) , 0,
1843 chiMatrix= cos(mChi) ,0 ,-sin(mChi),
1845 sin(mChi) ,0 ,cos(mChi);
1847 psiMatrix= 1 , 0 , 0,
1848 0 ,cos(mPsi) ,-sin(mPsi),
1849 0 ,sin(mPsi) ,cos(mPsi);
1863 VFN_DEBUG_MESSAGE(
"->Atom #0:"<<
mXCoord(0)<<
" : "<<mYCoord(0)<<
" : "<<mZCoord(0),1)
1870 VFN_DEBUG_MESSAGE(
"->Atom #1:"<<
mXCoord(1)<<
" : "<<mYCoord(1)<<
" : "<<mZCoord(1),1)
1880 VFN_DEBUG_MESSAGE(
"->Atom #2:"<<
mXCoord(2)<<
" : "<<mYCoord(2)<<
" : "<<mZCoord(2),1)
1882 for(
int i=1;i<3;i++)
1886 const REAL y=mYCoord(i);
1887 const REAL z=mZCoord(i);
1894 REAL xa,ya,za,xb,yb,zb,xd,yd,zd,cosph,sinph,costh,sinth,coskh,sinkh,cosa,sina;
1895 REAL xpd,ypd,zpd,xqd,yqd,zqd;
1896 REAL rbc,xyb,yza,tmp,xpa,ypa,zqa;
1899 REAL dist,angle,dihed;
1910 yb = mYCoord(nb) - mYCoord(na);
1911 zb = mZCoord(nb) - mZCoord(na);
1913 rbc= sqrt(xb*xb + yb*yb + zb*zb);
1919 +
") have the same coordinates (d<1e-5): aborting.");
1926 if( fabs(cosa) >= 0.999999 )
1929 mYCoord(i)=mYCoord(na)+cosa*dist*rbc*yb;
1930 mZCoord(i)=mZCoord(na)+cosa*dist*rbc*zb;
1931 VFN_DEBUG_MESSAGE(
"->Atom #"<<i<<
":"<<
mXCoord(i)<<
" : "<<mYCoord(i)<<
" : " <<mZCoord(i)<<
"(colinear)",1)
1936 ya = mYCoord(nc) - mYCoord(na);
1937 za = mZCoord(nc) - mZCoord(na);
1939 yd = dist*sina*cos(dihed);
1940 zd = -dist*sina*sin(dihed);
1942 xyb = sqrt(xb*xb + yb*yb);
1945 tmp = za; za = -xa; xa = tmp;
1946 tmp = zb; zb = -xb; xb = tmp;
1947 xyb = sqrt(xb*xb + yb*yb);
1954 xpa = costh*xa + sinth*ya;
1955 ypa = costh*ya - sinth*xa;
1957 cosph = sqrt(1.0 - sinph*sinph);
1958 zqa = cosph*za - sinph*xpa;
1959 yza = sqrt(ypa*ypa + zqa*zqa);
1966 ypd = coskh*yd - sinkh*zd;
1967 zpd = coskh*zd + sinkh*yd;
1975 xpd = cosph*xd - sinph*zpd;
1976 zqd = cosph*zpd + sinph*xd;
1977 xqd = costh*xpd - sinth*ypd;
1978 yqd = costh*ypd + sinth*xpd;
1983 mYCoord(i)=mYCoord(na) + yqd;
1984 mZCoord(i)=mZCoord(na) + xqd;
1988 mYCoord(i)=mYCoord(na) + yqd;
1989 mZCoord(i)=mZCoord(na) + zqd;
1991 VFN_DEBUG_MESSAGE(
"->Atom #"<<i<<
":"<<
mXCoord(i)<<
" : "<<mYCoord(i)<<
" : " <<mZCoord(i),1)
2011 VFN_DEBUG_EXIT(
"ZScatterer::UpdateCoordinates()"<<this->
GetName(),3)
2016 VFN_DEBUG_ENTRY(
"ZScatterer::UpdateScattCompList()"<<this->
GetName(),3)
2038 VFN_DEBUG_MESSAGE(
"ZScatterer::UpdateScattCompList()->Global Scatterer:End",3)
2044 VFN_DEBUG_MESSAGE(
"ZScatterer::UpdateScattCompList(bool):Finishing"<<
mNbAtom<<
","<<
mNbDummyAtom,3)
2064 VFN_DEBUG_EXIT(
"ZScatterer::UpdateScattCompList()"<<this->
GetName(),3)
2069 VFN_DEBUG_MESSAGE(
"ZScatterer::InitRefParList():"<<this->
GetName(),5)
2075 gpRefParTypeScattTranslX,
2076 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,1.,1.);
2082 gpRefParTypeScattTranslY,
2083 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,1.,1.);
2089 gpRefParTypeScattTranslZ,
2090 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,1.,1.);
2096 gpRefParTypeScattOccup,
2097 REFPAR_DERIV_STEP_ABSOLUTE,
true,
true,
true,
false,1.,1.);
2105 gpRefParTypeScattOrient,
2106 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,RAD2DEG,2*M_PI);
2112 gpRefParTypeScattOrient,
2113 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,RAD2DEG,2*M_PI);
2119 gpRefParTypeScattOrient,
2120 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,
true,
true,RAD2DEG,2*M_PI);
2127 bool usedBond=
true,usedAngle=
true,usedDihed=
true;
2128 if(i<1) usedBond=
false;
2129 if(i<2) usedAngle=
false;
2130 if(i<3) usedDihed=
false;
2132 sprintf(buf,
"%d-%d",(
int)i,(
int)(
mZAtomRegistry.GetObj(i).GetZBondAtom()));
2137 gpRefParTypeScattConformBondLength,
2138 REFPAR_DERIV_STEP_ABSOLUTE,
true,
false,usedBond,
false,1.);
2143 sprintf(buf,
"%d-%d-%d",(
int)i,(
int)(
mZAtomRegistry.GetObj(i).GetZBondAtom()),
2147 gpRefParTypeScattConformBondAngle,
2148 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,usedAngle,
true,RAD2DEG,2*M_PI);
2153 sprintf(buf,
"%d-%d-%d-%d",(
int)i,(
int)(
mZAtomRegistry.GetObj(i).GetZBondAtom()),
2158 gpRefParTypeScattConformDihedAngle,
2159 REFPAR_DERIV_STEP_ABSOLUTE,
false,
false,usedDihed,
true,RAD2DEG,2*M_PI);
2165 sprintf(buf,
"%d",(
int)i);
2168 gpRefParTypeScattOccup,
2169 REFPAR_DERIV_STEP_ABSOLUTE,
true,
true,
true,
false,1.,1.);
2177 #ifdef __WX__CRYST__
2182 return mpWXCrystObj;
2193 const REAL x,
const REAL y,
const REAL z,
2196 const REAL ligandPopu,
2197 const REAL phi,
const REAL chi,
const REAL psi):
2198 ZScatterer(name,cryst,x,y,z,phi,chi,psi),mPolyhedraType(type)
2200 VFN_DEBUG_MESSAGE(
"ZPolyhedron::ZPolyhedron(..)",5)
2202 const string name_=name+
"_";
2203 const string name_central=name_+centralAtomSymbol->
GetName();
2204 const string name_periph=name_+periphAtomSymbol->
GetName();
2205 switch(mPolyhedraType)
2209 REAL ang=2*asin(sqrt(2./3.));
2210 this ->AddAtom (name_central, centralAtomSymbol,
2215 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2216 0,centralPeriphDist,
2220 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2221 0,centralPeriphDist,
2225 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2226 0,centralPeriphDist,
2230 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2231 0,centralPeriphDist,
2244 this ->AddAtom (name_central, centralAtomSymbol,
2249 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2250 0,centralPeriphDist,
2254 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2255 0,centralPeriphDist,
2259 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2260 0,centralPeriphDist,
2264 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2265 0,centralPeriphDist,
2269 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2270 0,centralPeriphDist,
2274 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2275 0,centralPeriphDist,
2292 this ->AddAtom (name_central, centralAtomSymbol,
2297 this ->AddAtom (name+
"_X",0,
2302 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2303 0,centralPeriphDist,
2307 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2308 0,centralPeriphDist,
2312 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2313 0,centralPeriphDist,
2317 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2318 0,centralPeriphDist,
2330 this ->AddAtom (name_central, centralAtomSymbol,
2335 this ->AddAtom (name+
"_X",0,
2340 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2341 0,centralPeriphDist,
2345 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2346 0,centralPeriphDist,
2350 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2351 0,centralPeriphDist,
2355 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2356 0,centralPeriphDist,
2360 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2361 0,centralPeriphDist,
2365 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2366 0,centralPeriphDist,
2370 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2371 0,centralPeriphDist,
2375 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2376 0,centralPeriphDist,
2382 case ANTIPRISM_TETRAGONAL:
2384 this ->AddAtom (name_central, centralAtomSymbol,
2389 this ->AddAtom (name+
"_X",0,
2394 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2395 0,centralPeriphDist,
2399 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2400 0,centralPeriphDist,
2404 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2405 0,centralPeriphDist,
2409 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2410 0,centralPeriphDist,
2414 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2415 0,centralPeriphDist,
2419 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2420 0,centralPeriphDist,
2424 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2425 0,centralPeriphDist,
2429 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2430 0,centralPeriphDist,
2436 case PRISM_TETRAGONAL_MONOCAP:
2438 this ->AddAtom (name_central, centralAtomSymbol,
2443 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2444 0,centralPeriphDist,
2448 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2449 0,centralPeriphDist,
2453 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2454 0,centralPeriphDist,
2458 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2459 0,centralPeriphDist,
2463 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2464 0,centralPeriphDist,
2468 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2469 0,centralPeriphDist,
2473 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2474 0,centralPeriphDist,
2478 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2479 0,centralPeriphDist,
2483 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2484 0,centralPeriphDist,
2490 case PRISM_TETRAGONAL_DICAP:
2492 this ->AddAtom (name_central, centralAtomSymbol,
2497 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2498 0,centralPeriphDist,
2502 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2503 0,centralPeriphDist,
2507 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2508 0,centralPeriphDist,
2512 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2513 0,centralPeriphDist,
2517 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2518 0,centralPeriphDist,
2522 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2523 0,centralPeriphDist,
2527 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2528 0,centralPeriphDist,
2532 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2533 0,centralPeriphDist,
2537 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2538 0,centralPeriphDist,
2542 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2543 0,centralPeriphDist,
2549 case PRISM_TRIGONAL:
2551 const REAL ang=55.*DEG2RAD;
2552 const REAL ang2=120.*DEG2RAD;
2553 this ->AddAtom (name_central, centralAtomSymbol,
2558 this ->AddAtom (name+
"_X",0,
2563 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2564 0,centralPeriphDist,
2568 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2569 0,centralPeriphDist,
2573 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2574 0,centralPeriphDist,
2578 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2579 0,centralPeriphDist,
2583 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2584 0,centralPeriphDist,
2588 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2589 0,centralPeriphDist,
2595 case PRISM_TRIGONAL_TRICAPPED:
2597 const REAL ang=55.*DEG2RAD;
2598 const REAL ang2=120.*DEG2RAD;
2599 this ->AddAtom (name_central, centralAtomSymbol,
2604 this ->AddAtom (name+
"_X",0,
2609 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2610 0,centralPeriphDist,
2614 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2615 0,centralPeriphDist,
2619 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2620 0,centralPeriphDist,
2624 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2625 0,centralPeriphDist,
2629 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2630 0,centralPeriphDist,
2634 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2635 0,centralPeriphDist,
2639 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2640 0,centralPeriphDist,
2644 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2645 0,centralPeriphDist,
2649 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2650 0,centralPeriphDist,
2658 const REAL ang=acos(sqrt(.2));
2659 const REAL ang2=M_PI*2./5.;
2660 this ->AddAtom (name_central, centralAtomSymbol,
2665 this ->AddAtom (name_periph+
"0",periphAtomSymbol,
2666 0,centralPeriphDist,
2670 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2671 0,centralPeriphDist,
2675 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2676 0,centralPeriphDist,
2680 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2681 0,centralPeriphDist,
2685 this ->AddAtom (name_periph+
"4",periphAtomSymbol,
2686 0,centralPeriphDist,
2690 this ->AddAtom (name_periph+
"5",periphAtomSymbol,
2691 0,centralPeriphDist,
2695 this ->AddAtom (name_periph+
"6",periphAtomSymbol,
2696 0,centralPeriphDist,
2700 this ->AddAtom (name_periph+
"7",periphAtomSymbol,
2701 0,centralPeriphDist,
2705 this ->AddAtom (name_periph+
"8",periphAtomSymbol,
2706 0,centralPeriphDist,
2710 this ->AddAtom (name_periph+
"9",periphAtomSymbol,
2711 0,centralPeriphDist,
2715 this ->AddAtom (name_periph+
"10",periphAtomSymbol,
2716 0,centralPeriphDist,
2720 this ->AddAtom (name_periph+
"11",periphAtomSymbol,
2721 0,centralPeriphDist,
2727 case TRIANGLE_PLANE:
2729 this ->AddAtom (name_central, centralAtomSymbol,
2734 this ->AddAtom (name+
"_X",0,
2739 this ->AddAtom (name_periph+
"1",periphAtomSymbol,
2740 0,centralPeriphDist,
2744 this ->AddAtom (name_periph+
"2",periphAtomSymbol,
2745 0,centralPeriphDist,
2749 this ->AddAtom (name_periph+
"3",periphAtomSymbol,
2750 0,centralPeriphDist,
2760 default :
throw ObjCrystException(
"ZPolyhedron::ZPolyhedron():Unknown Polyhedra type !");
2769 VFN_DEBUG_MESSAGE(
"ZPolyhedron::ZPolyhedron():End:"<<
mName<<
")",5)
2777 VFN_DEBUG_MESSAGE(
"ZPolyhedron::CreateCopy()"<<
mName<<
")",5)
2787 GlobalScatteringPower::GlobalScatteringPower():mpZScatterer(0)
2789 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GlobalScatteringPower():"<<
mName,5)
2792 GlobalScatteringPower::GlobalScatteringPower(
const ZScatterer &scatt):mpZScatterer(0)
2794 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GlobalScatteringPower(&scatt):"<<
mName,5)
2798 GlobalScatteringPower::GlobalScatteringPower(const GlobalScatteringPower& old):mpZScatterer(0)
2800 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GlobalScatteringPower(&old):"<<
mName,5)
2801 this->Init(*(old.mpZScatterer));
2804 GlobalScatteringPower::~GlobalScatteringPower()
2806 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::~GlobalScatteringPower():"<<
mName,5)
2807 if(mpZScatterer!=0) delete mpZScatterer;
2820 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::Init(&Scatt):"<<
mName,5)
2821 if(mpZScatterer!=0)
delete mpZScatterer;
2823 mpZScatterer->SetUseGlobalScatteringPower(
false);
2824 mpZScatterer->SetName(scatt.
GetName()+
"_GlobalCopy");
2831 mDynPopCorrIndex += (*tmp)(i).mpScattPow->GetDynPopCorrIndex();
2836 const int spgSymPosIndex)
const
2839 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetScatteringFactor():"<<
mName,10)
2840 TAU_PROFILE(
"GlobalScatteringPower::GetScatteringFactor()",
"void ()",TAU_DEFAULT);
2845 CrystVector_REAL sf(data.
GetNbRefl()),rsf,isf;
2854 pData->
SetName(
"GlobalScatteringPowerData!");
2855 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetScatteringFactor():No DEBUG Messages",5)
2856 VFN_DEBUG_LOCAL_LEVEL(10)
2858 const long nbStep=4;
2860 for(
int i=-nbStep;i<=nbStep;i++)
2862 mpZScatterer->SetChi(i*M_PI/2/nbStep);
2863 for(
int j=-nbStep;j<=nbStep;j++)
2865 mpZScatterer->SetPhi(j*M_PI/2/nbStep);
2866 for(
int k=-nbStep;k<=nbStep;k++)
2869 mpZScatterer->SetPsi(k*M_PI/2/nbStep);
2879 rsf*= cos(mpZScatterer->GetPhi());
2880 norm += cos(mpZScatterer->GetPhi());
2887 VFN_DEBUG_LOCAL_LEVEL(-1)
2889 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetScatteringFactor():"<<
mName<<
":End.",10)
2898 sf += (*pList)(i).mpScattPow->GetForwardScatteringFactor(type);
2903 const int spgSymPosIndex)
const
2905 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetTemperatureFactor(data):"<<
mName,5)
2906 CrystVector_REAL temp(data.
GetNbRefl());
2912 const int spgSymPosIndex)
const
2914 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetResonantScattFactReal(data):"<<
mName,5)
2915 CrystMatrix_REAL res(1,1);
2921 const int spgSymPosIndex)
const
2923 VFN_DEBUG_MESSAGE(
"GlobalScatteringPower::GetResonantScattFactImag(data):"<<
mName,5)
2924 CrystMatrix_REAL res(1,1);
2933 void GlobalScatteringPower::InitRefParList()
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
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.
RadiationType
Type of radiation used.
float string2floatC(const string &s)
Function to convert a substring to a floating point value, imposing a C locale (using '.
Crystal class: Unit cell, spacegroup, scatterers.
void SetUseDynPopCorr(const int use)
Set the use of dynamical population correction (Crystal::mUseDynPopCorr).
void AddScatteringPower(ScatteringPower *scattPow)
Add a ScatteringPower for this Crystal.
ObjRegistry< ScatteringPower > & GetScatteringPowerRegistry()
Get the registry of ScatteringPower included in this Crystal.
void AddScatterer(Scatterer *scatt)
Add a scatterer to the crystal.
Exception class for ObjCryst++ library.
Class to store POV-Ray output options.
Generic type of scatterer: can be an atom, or a more complex assembly of atoms.
Crystal * mpCryst
The crystal in which the Scatterer is This is needed so that we can know which scattering powers are ...
const Crystal & GetCrystal() const
In which crystal is this Scatterer included ?
RefinableObjClock mClockScattCompList
CrystVector_REAL mXYZ
coordinates of the scatterer (or of its center..)
REAL GetX() const
X coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
REAL GetZ() const
Z coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
RefinableObjClock mClockScatterer
Last time anything (number of atoms, positions, scattering power) was changed.
void SetCrystal(Crystal &)
Set the crystal in which is included this Scatterer.
REAL mOccupancy
Occupancy : 0 <= occ <= 1 For a multi-atom scatterer (polyhedron,..), this is the overall occupancy o...
REAL GetY() const
Y coordinate (fractionnal) of the scatterer (for complex scatterers, this corresponds to the position...
Class to compute structure factors for a set of reflections and a Crystal.
virtual void SetCrystal(Crystal &crystal)
Set the crystal for this experiment.
virtual ScatteringData * CreateCopy() const =0
So-called virtual copy constructor.
const CrystVector_REAL & GetFhklCalcImag() const
Access to imaginary part of F(hkl)calc.
long GetNbRefl() const
Return the number of reflections in this experiment.
const Crystal & GetCrystal() const
Const access to the data's crystal.
const CrystVector_REAL & GetFhklCalcReal() const
Access to real part of F(hkl)calc.
Abstract Base Class to describe the scattering power of any Scatterer component in a crystal.
The Scattering Power for an Atom.
list of scattering positions in a crystal, associated with the corresponding occupancy and a pointer ...
void Reset()
Reset the list.
long GetNbComponent() const
Number of components.
void Print() const
Print the list of Scattering components. For debugging.
CrystVector_REAL GetLatticePar() const
Lattice parameters (a,b,c,alpha,beta,gamma) as a 6-element vector in Angstroems and radians.
void OrthonormalToFractionalCoords(REAL &x, REAL &y, REAL &z) const
Get fractional cartesian coordinates for a set of (x,y,z) orthonormal coordinates.
const RefinableObjClock & GetClockLatticePar() const
last time the Lattice parameters were changed
void FractionalToOrthonormalCoords(REAL &x, REAL &y, REAL &z) const
Get orthonormal cartesian coordinates for a set of (x,y,z) fractional coordinates.
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 REAL GetForwardScatteringFactor(const RadiationType) const
Get the scattering factor at (0,0,0).
virtual CrystMatrix_REAL GetResonantScattFactReal(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the real part of the resonant scattering factor.
void Init()
Initialization of the object, used by all constructors, and operator=.
virtual CrystMatrix_REAL GetResonantScattFactImag(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the imaginary part of the resonant scattering factor.
virtual REAL GetRadius() const
Return the physical radius of this type of scatterer (for 3D display purposes).
virtual CrystVector_REAL GetScatteringFactor(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the Scattering factor for all reflections of a given ScatteringData object.
Class for individual atoms in a ZScatterer Object.
REAL mBondLength
Bond length, angle and dihedral angle.
Class to minimize conformation changes for random moves.
virtual REAL GetLogLikelihood() const
Get -log(likelihood) of the current configuration for the object.
ZScatterer: the basic type of complex scatterers, where atom positions are defined using a standard "...
void ImportFenskeHallZMatrix(istream &is, bool named=false)
Import "Fenske-Hall" ZMatrix file (fhz in the babel program http://www.eyesopen.com/babel....
REAL GetZAtomX(const int i) const
Get the X fractionnal coordinate of atom i.
void SetZAngle(const int i, const REAL)
Access to the angle parameter, for the i-th row in the Z-Matrix.
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
void SetCenterAtomIndex(const unsigned int)
Set 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.
std::size_t size() const
STL access to registry of Zatom size.
virtual ZScatterer * CreateCopy() const
const ObjRegistry< ZAtom > & GetZAtomRegistry() const
Access to the registry of ZAtoms.
GlobalScatteringPower * mpGlobalScattPow
the global scattering power used, if mUseGlobalScattPow=true
REAL mPhi
Angles giving the orientation of the ZScatterer (stored in radian)
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...
REAL GetZAtomZ(const int i) const
Get the Z fractionnal coordinate of atom i.
virtual void InitRefParList()
Prepare refinable parameters for the scatterer object.
void ExportFenskeHallZMatrix(ostream &os)
Export to Fenske-Hall ZMatrix file.
RefinableObjClock mClockCoord
Last time the cartesian coordinates were computed.
long mCenterAtomIndex
Index of the atom used as a pivot (the scatterer is rotated around this atom).
virtual int GetNbComponent() const
Number of components in the scatterer (eg number of point scatterers)
CrystVector_REAL mXCoord
Storage for Cartesian coordinates.
const CrystVector_REAL & GetXCoord() const
Get the list of all ZAtom cartesian x coordinates.
REAL GetPhi() const
Access to phi parameter (overall orientation of the scatterer)
void SetZDihedralAngle(const int i, const REAL)
Access to the dihedral angle parameter, for the i-th row in the Z-Matrix.
virtual void EndOptimization()
This should be called by any optimization class at the end of an optimization.
virtual string GetComponentName(const int i) const
Name for the i-th component of this scatterer.
REAL GetPsi() const
Access to psi parameter (overall orientation of the scatterer)
void SetPhi(const REAL)
Access to phi parameter (overall orientation of the scatterer)
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...
REAL GetZAtomY(const int i) const
Get the Y fractionnal coordinate of atom i.
ObjRegistry< ZAtom > mZAtomRegistry
Registry for ZAtoms in this Scatterer.
REAL GetChi() const
Access to chi parameter (overall orientation of the scatterer)
REAL GetZAngle(const int i) const
Const access to the angle parameter, for the i-th row in the Z-Matrix.
virtual void GetGeneGroup(const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
Get the gene group assigned to each parameter.
bool mUseGlobalScattPow
Does the ZScatterer use a global scattering power ?
const CrystVector_REAL & GetZCoord() const
Get the list of all ZAtom cartesian x coordinates.
CrystMatrix_long m3DDisplayIndex
For 3D display of the structure, bonds, triangular and quadric faces can be displayed.
ScatteringComponentList mScattCompList
The list of scattering components.
void UpdateCoordinates() const
Update the atom coordinates (in real units, in Angstroems).
const CrystVector_REAL & GetYCoord() const
Get the list of all ZAtom cartesian x coordinates.
CrystVector_int mComponentIndex
Index of atoms in the ScatteringComponentList.
unsigned int GetCenterAtomIndex() const
Get the index of the central atom (around which the rotation is made)
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
void Print() const
Print a single line of information about this scatterer.
vector< ZAtom * >::const_iterator begin() const
low-level access to the underlying vector of ZAtom begin().
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.
virtual ostream & POVRayDescription(ostream &os, const CrystalPOVRayOptions &options) const
void SetChi(const REAL)
Access to chi parameter (overall orientation of the scatterer)
vector< ZAtom * >::const_iterator end() const
low-level access to the underlying vector of ZAtom end().
void SetZBondLength(const int i, const REAL)
Access to bondlength parameter, for the i-th row in the Z-Matrix.
void UpdateScattCompList() const
Update the scattering component list, ie compute all atom positions from the bonds/angles/dihedral an...
long mNbDummyAtom
Number of "dummy" atoms in the structure.
REAL GetZDihedralAngle(const int i) const
Const access to the dihedral angle parameter, for the i-th row in the Z-Matrix.
REAL GetZBondLength(const int i) const
Const access to bondlength parameter, for the i-th row in the Z-Matrix.
CrystMatrix_REAL mPhiChiPsiMatrix
Rotation matrix for the orientation of the scatterer.
void SetPsi(const REAL)
Access to psi parameter (overall orientation of the scatterer)
long mNbAtom
Total number of atoms in the structure.
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 SetUseGlobalScatteringPower(const bool useIt)
use a Global scattering power for this scatterer ?
virtual const ScatteringComponentList & GetScatteringComponentList() const
Get the list of all scattering components for this scatterer.
ZPolyhedron: a Scatterer to describe polyhedras such as octahedron, tetrahedron, square plane,...
virtual ZPolyhedron * CreateCopy() 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.
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.
class of refinable parameter types.
bool IsDescendantFromOrSameAs(const RefParType *type) const
Returns true if the parameter is a descendant of 'type'.
void Click()
Record an event for this clock (generally, the 'time' an object has been modified,...
Generic class for parameters of refinable objects.
REAL GetValue() const
of the parameter.
void CopyAttributes(const RefinablePar &)
Copy all attributes (limits, flags, etc...) from another RefinablePar object.
void AssignClock(RefinableObjClock &clock)
const REAL & GetHumanValue() const
Current value of parameter, scaled if necessary (for angles) to a human-understandable value.
void Mutate(const REAL mutateValue)
Add the given amount to the parameter current value.
REAL GetGlobalOptimStep() const
Maximum step to use during Global Optimization algorithms.
Generic Refinable Object.
virtual void EndOptimization()
This should be called by any optimization class at the end of an optimization.
void AddPar(const RefinablePar &newRefPar)
Add a refinable parameter.
virtual void SetName(const string &name)
Name of the object.
RefinablePar & GetPar(const long i)
Access all parameters in the order they were inputted.
virtual const string & GetName() const
Name of the object.
long GetNbPar() const
Total number of refinable parameter in the object.
void ResetParList()
Re-init the list of refinable parameters, removing all parameters.
int mOptimizationDepth
Is the object being refined or optimized ? if mOptimizationDepth=0, no optimization is taking place.
void FixAllPar()
Fix All parameters.
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 +....
string mName
Name for this RefinableObject. Should be unique, at least in the same scope.+.
virtual void GlobalOptRandomMove(const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
Make a random move of the current configuration.
Format vector as horiz array:
Abstract base class for all objects in wxCryst.
wxCryst class for ZScatterer objects