26 #include "ObjCryst/ObjCryst/ScatteringPowerSphere.h"
27 #include "ObjCryst/Quirks/VFNStreamFormat.h"
30 #include "ObjCryst/wxCryst/wxScatteringPowerSphere.h"
43 cout<<
"Creating scattering power for fullerene"<<endl;
44 this->
Init(
"C60",3.56,1.0);
51 this->
Init(name,radius,bIso);
57 ScatteringPowerSphere::~ScatteringPowerSphere()
77 if(this->
GetNbPar()==0) this->InitRefParList();
82 const static string className=
"ScatteringPowerSphere";
87 const int spgSymPosIndex)
const
94 CrystMatrix_REAL phiMatrix(3,3),chiMatrix(3,3),psiMatrix(3,3);
95 phiMatrix= cos(mPhi) , -sin(mPhi) , 0,
96 sin(mPhi) , cos(mPhi) , 0,
99 chiMatrix= cos(mChi) ,0 ,-sin(mChi),
101 sin(mChi) ,0 ,cos(mChi);
103 psiMatrix= 1 , 0 , 0,
104 0 ,cos(mPsi) ,-sin(mPsi),
105 0 ,sin(mPsi) ,cos(mPsi);
107 CrystMatrix_REAL phiChiPsiMatrix=product(chiMatrix,product(phiMatrix,psiMatrix));
109 a=phiChiPsiMatrix(0,0)*mAxisLengthX+phiChiPsiMatrix(0,1)*mAxisLengthY+phiChiPsiMatrix(0,2)*mAxisLengthZ;
110 b=phiChiPsiMatrix(1,0)*mAxisLengthX+phiChiPsiMatrix(1,1)*mAxisLengthY+phiChiPsiMatrix(1,2)*mAxisLengthZ;
111 c=phiChiPsiMatrix(2,0)*mAxisLengthX+phiChiPsiMatrix(2,1)*mAxisLengthY+phiChiPsiMatrix(2,2)*mAxisLengthZ;
112 const REAL *pX=data.
GetReflX().data();
113 const REAL *pY=data.
GetReflY().data();
114 const REAL *pZ=data.
GetReflZ().data();
118 *pSF++ = 2*M_PI * ( *pX++ * a + *pY++ * b + *pZ++ * c );
122 *pSF = sin(*pSF) / *pSF;
131 *pSF = sin(*pSF) / *pSF;
144 const int spgSymPosIndex)
const
146 VFN_DEBUG_MESSAGE(
"ScatteringPowerSphere::GetTemperatureFactor(&data):"<<
mName,3)
148 CrystVector_REAL stolsq(data.
GetNbRefl());
153 #ifdef __VFN_VECTOR_USE_BLITZ__
155 #define STOLSQ stolsq
158 #define STOLSQ (*sstolsq)
161 const REAL *sstolsq=stolsq.data();
163 for(
long ii=0;ii<sf.numElements();ii++)
167 SF=exp(-
mBiso*STOLSQ);
169 #ifdef __VFN_VECTOR_USE_BLITZ__
183 const int spgSymPosIndex)
const
185 CrystMatrix_REAL fprime(1,1);
191 const int spgSymPosIndex)
const
193 CrystMatrix_REAL fsecond(1,1);
200 void ScatteringPowerSphere::Print()
const
207 VFN_DEBUG_ENTRY(
"ScatteringPowerSphere::XMLOutput():"<<this->
GetName(),5)
208 for(
int i=0;i<indent;i++) os <<
" " ;
210 tag.AddAttribute(
"Name",
mName);
213 for(
int i=0;i<=indent;i++) os <<
" " ;
217 for(
int i=0;i<=indent;i++) os <<
" " ;
221 for(
int i=0;i<=indent;i++) os <<
" " ;
227 tag2.SetIsEndTag(
true);
230 tag.SetIsEndTag(
true);
231 for(
int i=0;i<indent;i++) os <<
" " ;
233 VFN_DEBUG_EXIT(
"ScatteringPowerSphere::XMLOutput():"<<this->
GetName(),5)
238 VFN_DEBUG_ENTRY(
"ScatteringPowerSphere::XMLInput():"<<this->
GetName(),5)
240 for(
unsigned int i=0;i<tagg.GetNbAttribute();i++)
242 if(
"Name"==tagg.GetAttributeName(i)) this->
SetName(tagg.GetAttributeValue(i));
243 if(
"Symbol"==tagg.GetAttributeName(i)) symbol=tagg.GetAttributeValue(i);
249 if((
"ScatteringPowerSphere"==tag.GetName())&&tag.IsEndTag())
251 VFN_DEBUG_EXIT(
"ScatteringPowerSphere::Exit():"<<this->
GetName(),5)
254 if(
"RGBColour"==tag.GetName())
261 if(
"Par"==tag.GetName())
263 for(
unsigned int i=0;i<tag.GetNbAttribute();i++)
265 if(
"Name"==tag.GetAttributeName(i))
276 void ScatteringPowerSphere::InitRefParList()
280 gpRefParTypeScattPow,REFPAR_DERIV_STEP_RELATIVE,
281 true,
true,
true,
false);
282 tmp.SetDerivStep(1e-3);
283 tmp.SetGlobalOptimStep(.1);
288 RefinablePar tmp(
"Biso",&
mBiso,0.1,5.,
289 gpRefParTypeScattPowTemperatureIso,REFPAR_DERIV_STEP_ABSOLUTE,
290 true,
true,
true,
false);
291 tmp.SetDerivStep(1e-3);
292 tmp.SetGlobalOptimStep(.5);
300 WXCrystObjBasic* ScatteringPowerSphere::WXCreate(wxWindow* parent)
303 mpWXCrystObj=
new WXScatteringPowerSphere(parent,
this);
virtual void XMLOutput(ostream &os, int indent=0) const
Output to stream in well-formed XML.
virtual long GetNbReflBelowMaxSinThetaOvLambda() const
Recalc, and get the number of reflections which should be actually used, due to the maximuml sin(thet...
void AddPar(const RefinablePar &newRefPar)
Add a refinable parameter.
void SetColour(const string &colorName)
Set the colour from the associated POV-Ray name.
const CrystVector_REAL & GetSinThetaOverLambda() const
Return an array with for all reflections.
virtual const string & GetClassName() const
Name for this class ("RefinableObj", "Crystal",...).
virtual CrystVector_REAL GetTemperatureFactor(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the temperature factor for all reflections of a given ScatteringData object.
long GetNbPar() const
Total number of refinable parameter in the object.
void XMLInput(istream &is, const XMLCrystTag &tag)
XMLInput From stream.
RefinablePar & GetPar(const long i)
Access all parameters in the order they were inputted.
virtual CrystMatrix_REAL GetResonantScattFactImag(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the imaginary part of the resonant scattering factor.
Class to compute structure factors for a set of reflections and a Crystal.
ScatteringPowerSphere()
Default constructor.
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 CrystVector_REAL & GetReflZ() const
Return the 1D array of orthonormal z coordinates for all reflections (recipr. space) ...
\ brief ScatteringPower for a spherical particule
string mName
Name for this RefinableObject. Should be unique, at least in the same scope.+.
REAL mBiso
Isotropic temperature B-factor.
const CrystVector_REAL & GetReflY() const
Return the 1D array of orthonormal y coordinates for all reflections (recipr. space) ...
const CrystVector_REAL & GetReflX() const
Return the 1D array of orthonormal x coordinates for all reflections (recipr. space) ...
REAL GetRadius() const
Return the physical radius of this type of scatterer (for 3D display purposes).
virtual CrystMatrix_REAL GetResonantScattFactReal(const ScatteringData &data, const int spgSymPosIndex=0) const
Get the real part of the resonant scattering factor.
float mColourRGB[3]
Colour for this ScatteringPower using RGB.
RefinableObjClock mClock
Clock.
void Init()
Initialization of the object, used by all constructors, and operator=.
virtual void XMLInput(istream &is, const XMLCrystTag &tag)
Input From stream.
virtual REAL GetForwardScatteringFactor(const RadiationType) const
Get the scattering factor at (0,0,0).
long GetNbRefl() const
Return the number of reflections in this experiment.
The namespace which includes all objects (crystallographic and algorithmic) in ObjCryst++.
Generic class for parameters of refinable objects.
REAL mRadius
Radius of the sphere.
virtual const string & GetName() const
Name of the object.
RadiationType
Type of radiation used.
class to input or output a well-formatted xml beginning or ending tag.
virtual void SetName(const string &name)
Name of the object.
void XMLOutput(ostream &os, const string &name, int indent=0) const
XMLOutput to stream in well-formed XML.