FOX/ObjCryst++  1.10.X (development)
ObjCryst::ScatteringPowerSphere Class Reference

\ brief ScatteringPower for a spherical particule More...

+ Inheritance diagram for ObjCryst::ScatteringPowerSphere:
+ Collaboration diagram for ObjCryst::ScatteringPowerSphere:

Public Member Functions

 ScatteringPowerSphere ()
 Default constructor.
 
 ScatteringPowerSphere (const string &name, const REAL radius, const REAL bIso=1.0)
 constructor More...
 
 ScatteringPowerSphere (const ScatteringPowerSphere &old)
 
void Init (const string &name, const REAL radius, const REAL bIso=1.0)
 
virtual const string & GetClassName () const
 Name for this class ("RefinableObj", "Crystal",...). More...
 
virtual CrystVector_REAL GetScatteringFactor (const ScatteringData &data, const int spgSymPosIndex=0) const
 Get the Scattering factor for all reflections of a given ScatteringData object. More...
 
virtual REAL GetForwardScatteringFactor (const RadiationType) const
 Get the scattering factor at (0,0,0). More...
 
virtual CrystVector_REAL GetTemperatureFactor (const ScatteringData &data, const int spgSymPosIndex=0) const
 Get the temperature factor for all reflections of a given ScatteringData object. More...
 
virtual CrystMatrix_REAL GetResonantScattFactReal (const ScatteringData &data, const int spgSymPosIndex=0) const
 Get the real part of the resonant scattering factor. More...
 
virtual CrystMatrix_REAL GetResonantScattFactImag (const ScatteringData &data, const int spgSymPosIndex=0) const
 Get the imaginary part of the resonant scattering factor. More...
 
REAL GetRadius () const
 Return the physical radius of this type of scatterer (for 3D display purposes). More...
 
virtual void Print () const
 
virtual void XMLOutput (ostream &os, int indent=0) const
 Output to stream in well-formed XML. More...
 
virtual void XMLInput (istream &is, const XMLCrystTag &tag)
 Input From stream. More...
 
- Public Member Functions inherited from ObjCryst::ScatteringPower
 ScatteringPower (const ScatteringPower &old)
 
virtual void operator= (const ScatteringPower &rhs)
 
virtual bool IsScatteringFactorAnisotropic () const
 Is the scattering factor anisotropic ?
 
virtual bool IsTemperatureFactorAnisotropic () const
 Is the thermic factor anisotropic ?
 
virtual bool IsResonantScatteringAnisotropic () const
 Are the resonant scattering terms anisotropic ?
 
virtual const string & GetSymbol () const
 Symbol for this Scattering power (the atom name for atoms) More...
 
REAL GetBiso () const
 Returns the isotropic temperature B factor. More...
 
REAL & GetBiso ()
 Returns the isotropic temperature B factor. More...
 
virtual void SetBiso (const REAL newB)
 Sets the isotropic temperature B factor. More...
 
REAL GetBij (const size_t &i, const size_t &j) const
 Returns the anisotropic temperature B factor for (i, j) pair. More...
 
REAL GetBij (const size_t &idx) const
 Returns the anisotropic temperature B factor for given index. More...
 
virtual void SetBij (const size_t &i, const size_t &j, const REAL newB)
 Sets the anisotropic temperature B factor for (i, j) pair. More...
 
virtual void SetBij (const size_t &idx, const REAL newB)
 Sets the anisotropic temperature B factor for given index. More...
 
bool IsIsotropic () const
 Returns true if the scattering power is isotropic, else false.
 
long GetDynPopCorrIndex () const
 Get the number identifying this kind of scatterer, used to decide whether two scatterers are equivalent, for the dynamical occupancy correction. More...
 
long GetNbScatteringPower () const
 Total number of ScatteringPower object.
 
const RefinableObjClockGetLastChangeClock () const
 ObjCrystClock time when the last modification was made to the object.
 
const string & GetColourName () const
 Get the (POV-Ray) name associated to the color (if any)
 
const float * GetColourRGB () const
 Get the float[3] array of RGB components defining the colour of this scattering power.
 
void SetColour (const string &colorName)
 Set the colour from the associated POV-Ray name.
 
void SetColour (const float r, const float g, const float b)
 Set the colour from RGB components (all between 0 and 1.)
 
virtual void GetGeneGroup (const RefinableObj &obj, CrystVector_uint &groupIndex, unsigned int &firstGroup) const
 Get the gene group assigned to each parameter. More...
 
REAL GetMaximumLikelihoodPositionError () const
 Maximum Likelihood: get the estimated error (sigma) on the positions for this kind of element. More...
 
void SetMaximumLikelihoodPositionError (const REAL mle)
 Maximum Likelihood: set the estimated error (sigma) on the positions for this kind of element. More...
 
REAL GetMaximumLikelihoodNbGhostAtom () const
 Maximum Likelihood: get the number of ghost elements per asymmetric unit.
 
void SetMaximumLikelihoodNbGhostAtom (const REAL nb)
 Maximum Likelihood: set the number of ghost elements per asymmetric unit.
 
const RefinableObjClockGetMaximumLikelihoodParClock () const
 Get the clock value for the last change on the maximum likelihood parameters (positionnal error, number of ghost atoms). More...
 
virtual REAL GetFormalCharge () const
 
virtual void SetFormalCharge (const REAL charge)
 
- Public Member Functions inherited from ObjCryst::RefinableObj
 RefinableObj ()
 Constructor.
 
 RefinableObj (const bool internalUseOnly)
 Constructor. More...
 
 RefinableObj (const RefinableObj &old)
 Defined not implemented... More...
 
virtual ~RefinableObj ()
 Destructor.
 
virtual const string & GetName () const
 Name of the object.
 
virtual void SetName (const string &name)
 Name of the object.
 
void operator= (const RefinableObj &old)
 Defined not implemented... More...
 
void PrepareForRefinement () const
 Find which parameters are used and not fixed, for a refinement /optimization. More...
 
void FixAllPar ()
 Fix All parameters.
 
void UnFixAllPar ()
 UnFix All parameters.
 
void SetParIsFixed (const long parIndex, const bool fix)
 Fix/un-fix one parameter from its #.
 
void SetParIsFixed (const string &parName, const bool fix)
 Fix/un-fix one parameter from its name.
 
void SetParIsFixed (const RefParType *type, const bool fix)
 Fix/un-fix one family of parameters.
 
void SetParIsUsed (const string &parName, const bool use)
 Set whether a parameter is used.
 
void SetParIsUsed (const RefParType *type, const bool use)
 Set whether a family of parameters is used.
 
long GetNbPar () const
 Total number of refinable parameter in the object. More...
 
long GetNbParNotFixed () const
 Total number of non-fixed parameters. Is initialized by PrepareForRefinement()
 
RefinableParGetPar (const long i)
 Access all parameters in the order they were inputted.
 
const RefinableParGetPar (const long i) const
 Access all parameters in the order they were inputted.
 
RefinableParGetPar (const string &name)
 Access all parameters from their name.
 
const RefinableParGetPar (const string &name) const
 Access all parameters from their name.
 
RefinableParGetPar (const REAL *)
 Access parameter from its adress.
 
const RefinableParGetPar (const REAL *) const
 Access parameter from its adress.
 
RefinableParGetParNotFixed (const long i)
 Access all parameters in the order they were inputted, skipping fixed parameters. More...
 
const RefinableParGetParNotFixed (const long i) const
 Access all parameters in the order they were inputed, skipping fixed parameters. More...
 
void AddPar (const RefinablePar &newRefPar)
 Add a refinable parameter. More...
 
void AddPar (RefinablePar *newRefPar)
 Add a refinable parameter. More...
 
void AddPar (RefinableObj &newRefParList, const bool copyParam=false)
 Add all the parameters in another RefinableObj. More...
 
vector< RefinablePar * >::iterator RemovePar (RefinablePar *refPar)
 Remove a refinable parameter. More...
 
unsigned long CreateParamSet (const string name="") const
 Save the current set of refined values in a new set. More...
 
void ClearParamSet (const unsigned long id) const
 Erase the param set with the given id, releasing memory.
 
void SaveParamSet (const unsigned long id) const
 Save the current set of refined values over a previously-created set of saved values. More...
 
void RestoreParamSet (const unsigned long id)
 Restore a saved set of values. More...
 
const CrystVector_REAL & GetParamSet (const unsigned long setId) const
 Access one save refpar set. More...
 
CrystVector_REAL & GetParamSet (const unsigned long setId)
 Access one save refpar set. More...
 
REAL GetParamSet_ParNotFixedHumanValue (const unsigned long setId, const long parNumber) const
 Access the (human) value of one refined parameter in a saved set of parameters. More...
 
const void EraseAllParamSet ()
 Erase all saved refpar sets. More...
 
const string & GetParamSetName (const unsigned long setId) const
 Get the name associated to a refpar set. More...
 
void SetLimitsAbsolute (const string &parName, const REAL min, const REAL max)
 Change the limits for a given parameter, giving absolute new limits.
 
void SetLimitsAbsolute (const RefParType *type, const REAL min, const REAL max)
 Change the limits for a category of parameters, giving absolute new limits.
 
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 +.1 will set new limits at the current value + min and current value + max) Thus min should logically be <0 and max >0. More...
 
void SetLimitsRelative (const RefParType *type, const REAL min, const REAL max)
 Change the limits for a category of parameters, giving relative new limits (eg giving -.1 and +.1 will set new limits at the current value + min and current value + max). More...
 
void SetLimitsProportional (const string &parName, const REAL min, const REAL max)
 Change the limits for a given parameter, proportionnaly to the current value. More...
 
void SetLimitsProportional (const RefParType *type, const REAL min, const REAL max)
 Change the limits for a category of parameters, proportionnaly to their current value. More...
 
void SetGlobalOptimStep (const RefParType *type, const REAL step)
 Change the maximum step to use during Global Optimization algorithms.
 
ObjRegistry< RefinableObj > & GetSubObjRegistry ()
 Access to the registry of RefinableObj used by this object.
 
const ObjRegistry< RefinableObj > & GetSubObjRegistry () const
 Access to the registry of RefinableObj used by this object.
 
virtual void RegisterClient (RefinableObj &) const
 Register a new object using this object. More...
 
virtual void DeRegisterClient (RefinableObj &) const
 Deregister an object (which not any more) using this object.
 
virtual const ObjRegistry
< RefinableObj > & 
GetClientRegistry () const
 Get the list of clients.
 
virtual ObjRegistry
< RefinableObj > & 
GetClientRegistry ()
 Get the list of clients.
 
bool IsBeingRefined () const
 Is the object being refined ? (Can be refined by one algorithm at a time only.)
 
virtual void BeginOptimization (const bool allowApproximations=false, const bool enableRestraints=false)
 This should be called by any optimization class at the begining of an optimization. More...
 
virtual void EndOptimization ()
 This should be called by any optimization class at the end of an optimization. More...
 
virtual void SetApproximationFlag (const bool allow)
 Enable or disable numerical approximations. More...
 
virtual void RandomizeConfiguration ()
 Randomize Configuration (before a global optimization). More...
 
virtual void GlobalOptRandomMove (const REAL mutationAmplitude, const RefParType *type=gpRefParTypeObjCryst)
 Make a random move of the current configuration. More...
 
void BeginGlobalOptRandomMove ()
 Raise a flag, to be sure not to make a random change more than once in each RefinableObj. More...
 
virtual REAL GetLogLikelihood () const
 Get -log(likelihood) of the current configuration for the object. More...
 
virtual unsigned int GetNbLSQFunction () const
 Number of LSQ functions.
 
virtual const CrystVector_REAL & GetLSQCalc (const unsigned int) const
 Get the current calculated value for the LSQ function.
 
virtual const CrystVector_REAL & GetLSQObs (const unsigned int) const
 Get the observed values for the LSQ function.
 
virtual const CrystVector_REAL & GetLSQWeight (const unsigned int) const
 Get the weight values for the LSQ function.
 
virtual const CrystVector_REAL & GetLSQDeriv (const unsigned int, RefinablePar &)
 Get the first derivative values for the LSQ function, for a given parameter. More...
 
virtual std::map< RefinablePar
*, CrystVector_REAL > & 
GetLSQ_FullDeriv (const unsigned int, std::set< RefinablePar * > &vPar)
 Get the first derivative for the LSQ function for each parameter supplied in a list. More...
 
void ResetParList ()
 Re-init the list of refinable parameters, removing all parameters. More...
 
virtual void UpdateDisplay () const
 If there is an interface, this should be automatically be called each time there is a 'new, significant' configuration to report. More...
 
unsigned int GetNbOption () const
 Number of Options for this object.
 
RefObjOptGetOption (const unsigned int i)
 Access to the options.
 
const RefObjOptGetOption (const unsigned int i) const
 const access to the options
 
void SetDeleteRefParInDestructor (const bool b)
 Set this object not to delete its list of parameters when destroyed. More...
 
const RefinableObjClockGetRefParListClock () const
 What was the last time a RefinablePar was added/removed ? More...
 
virtual REAL GetRestraintCost () const
 Get the restraint cost (overall penalty of all restraints) More...
 
void AddRestraint (Restraint *pNewRestraint)
 Add a new restraint. More...
 
vector< Restraint * >::iterator RemoveRestraint (Restraint *pRestraint)
 Remove a restraint from the list of known restraints. More...
 
virtual void TagNewBestConfig () const
 During a global optimization, tells the object that the current config is the latest "best" config. More...
 
const RefinableObjClockGetClockMaster () const
 This clocks records any change in the object. See refinableObj::mClockMaster.
 

Private Member Functions

virtual void InitRefParList ()
 
void Init ()
 Initialization of the object, used by all constructors, and operator=.
 

Private Attributes

REAL mBiso
 Isotropic temperature B-factor.
 
REAL mRadius
 Radius of the sphere.
 

Additional Inherited Members

- Protected Member Functions inherited from ObjCryst::ScatteringPower
virtual void InitRGBColour ()
 Get RGB Colour coordinates from Colour Name.
 
- Protected Member Functions inherited from ObjCryst::RefinableObj
long FindPar (const string &name) const
 Find a refinable parameter with a given name.
 
long FindPar (const REAL *) const
 Find a refinable parameter from the adress of its value.
 
void AddSubRefObj (RefinableObj &)
 
void RemoveSubRefObj (RefinableObj &)
 
void AddOption (RefObjOpt *opt)
 
virtual void Prepare ()
 
map< unsigned long, pair
< CrystVector_REAL, string >
>::iterator 
FindParamSet (unsigned long id) const
 Find a parameter set with a given id (and check if it is there)
 
- Protected Attributes inherited from ObjCryst::ScatteringPower
long mDynPopCorrIndex
 number identifying this kind of scatterer, for the dynamical occupancy correction. More...
 
REAL mBiso
 Temperature isotropic B factor.
 
bool mIsIsotropic
 Is the scattering isotropic ?
 
CrystVector_REAL mBeta
 Anisotropic Beta(ij) More...
 
CrystVector_REAL mB
 Anisotropic B(ij)
 
RefinableObjClock mClock
 Clock.
 
string mColourName
 Colour for this ScatteringPower (from POVRay)
 
float mColourRGB [3]
 Colour for this ScatteringPower using RGB.
 
REAL mMaximumLikelihoodPositionError
 estimated error (sigma) on the positions for this type of element.
 
RefinableObjClock mMaximumLikelihoodParClock
 
REAL mMaximumLikelihoodNbGhost
 Number of ghost atoms in the asymmetric unit. More...
 
REAL mFormalCharge
 Formal Charge. More...
 
- Protected Attributes inherited from ObjCryst::RefinableObj
string mName
 Name for this RefinableObject. Should be unique, at least in the same scope.+.
 
vector< RefinablePar * > mvpRefPar
 Vector of pointers to the refinable parameters.
 
vector< Restraint * > mvpRestraint
 Vector of pointers to the restraints for this object. More...
 
map< unsigned long, pair
< CrystVector_REAL, string > > 
mvpSavedValuesSet
 Map of (index,pointers to arrays) used to save sets of values for all parameters. More...
 
long mNbRefParNotFixed
 Total of not-fixed parameters.
 
CrystVector_long mRefparNotFixedIndex
 Index of not-fixed parameters.
 
int mOptimizationDepth
 Is the object being refined or optimized ? if mOptimizationDepth=0, no optimization is taking place. More...
 
ObjRegistry< RefinableObjmSubObjRegistry
 Registry of RefinableObject needed for this object (owned by this object or not)
 
ObjRegistry< RefinableObjmClientObjRegistry
 Registry of RefinableObject using this object. More...
 
ObjRegistry< RefObjOptmOptionRegistry
 List of options for this object. More...
 
bool mDeleteRefParInDestructor
 If true (the default), then all RefinablePar will be deleted when the the object is deleted. More...
 
RefinableObjClock mRefParListClock
 Last time the RefinableParList was modified (a parameter added or removed).
 
bool mRandomMoveIsDone
 
CrystVector_REAL mLSQDeriv
 Temporary array used to return derivative values of the LSQ function for given parameters. More...
 
std::map< unsigned int,
std::map< RefinablePar
*, CrystVector_REAL > > 
mLSQ_FullDeriv
 Temporary map to return the derivative of the LSQ function versus a list of parameters. More...
 
RefinableObjClock mClockMaster
 Master clock, which is changed whenever the object has been altered. More...
 

Detailed Description

\ brief ScatteringPower for a spherical particule

This can be used to modelize the form factor of disordered (or low-resolution) of fullerene-type compounds, where all atoms are located on a sphere.

This actually modelizes a spherical distribution of a single electron, so to modelize C60 the occupancy must be set to 60*6.

Definition at line 41 of file ScatteringPowerSphere.h.

Constructor & Destructor Documentation

ObjCryst::ScatteringPowerSphere::ScatteringPowerSphere ( const string &  name,
const REAL  radius,
const REAL  bIso = 1.0 
)

constructor

Parameters
name: name of the ScatteringPower ('C60','France 98'...). The name can have any format
nbAtomthe number of atoms
biso: Isotropic thermic coefficient
AxisLengthX,AxisLengthY,AxisLengthZlength of the different main axis of the ellipsoid
symbolthe symbol of the element associated to this fullerene. By default it is assumed to be carbon

Definition at line 47 of file ScatteringPowerSphere.cpp.

Member Function Documentation

const string & ObjCryst::ScatteringPowerSphere::GetClassName ( ) const
virtual

Name for this class ("RefinableObj", "Crystal",...).

This is only useful to distinguish different classes when picking up objects from the RefinableObj Global Registry

Reimplemented from ObjCryst::ScatteringPower.

Definition at line 80 of file ScatteringPowerSphere.cpp.

REAL ObjCryst::ScatteringPowerSphere::GetForwardScatteringFactor ( const RadiationType  ) const
virtual

Get the scattering factor at (0,0,0).

Used for scatterer (electron, nucleus) density generation.

Implements ObjCryst::ScatteringPower.

Definition at line 138 of file ScatteringPowerSphere.cpp.

REAL ObjCryst::ScatteringPowerSphere::GetRadius ( ) const
virtual

Return the physical radius of this type of scatterer (for 3D display purposes).

Warning
this may be removed later.

Implements ObjCryst::ScatteringPower.

Definition at line 198 of file ScatteringPowerSphere.cpp.

CrystMatrix_REAL ObjCryst::ScatteringPowerSphere::GetResonantScattFactImag ( const ScatteringData data,
const int  spgSymPosIndex = 0 
) const
virtual

Get the imaginary part of the resonant scattering factor.

Returns
a matrix where each row corresponds to each wavelength (currently only monochromatic experiments are made so there is only one row), and each column corresponds to each reflection only if the scattering term is anisotropic, which is not the case so far...
Parameters
datathe ScatteringData object, giving access to all the reflections, and a list of wavelengths.
spgSymPosIndexif the ScatteringPower is anisotropic, then the different symmetrics will not have the same scattering power for all reflections. This parameter is the index of the symmetric position in the Spacegroup. If spgSymPosIndex=-1, the isotropic values are returned.
Warning
There is no anisotropic code yet, so spgSymPosIndex is simply ignored so far , but the design of this function is general for any anisotropic scattering.

Implements ObjCryst::ScatteringPower.

Definition at line 190 of file ScatteringPowerSphere.cpp.

CrystMatrix_REAL ObjCryst::ScatteringPowerSphere::GetResonantScattFactReal ( const ScatteringData data,
const int  spgSymPosIndex = 0 
) const
virtual

Get the real part of the resonant scattering factor.

Returns
a matrix where each row corresponds to each wavelength (currently only monochromatic experiments are made so there is only one row), and each column corresponds to each reflection only if the scattering term is anisotropic, which is not the case so far...
Parameters
datathe ScatteringData object, giving access to all the reflections and a list of wavelengths).
spgSymPosIndexif the ScatteringPower is anisotropic, then the different symmetrics will not have the same scattering power for all reflections. This parameter is the index of the symmetric position in the Spacegroup. If spgSymPosIndex=-1, the isotropic values are returned.
Warning
There is no anisotropic code yet, so spgSymPosIndex is simply ignored so far , but the design of this function is general for any anisotropic scattering.

Implements ObjCryst::ScatteringPower.

Definition at line 182 of file ScatteringPowerSphere.cpp.

CrystVector_REAL ObjCryst::ScatteringPowerSphere::GetScatteringFactor ( const ScatteringData data,
const int  spgSymPosIndex = 0 
) const
virtual

Get the Scattering factor for all reflections of a given ScatteringData object.

Returns
a vector with the scattering factor for all reflections, in the same order as in the ScatteringData object. This format is independent of the radiation type (X-Ray, neutron..).
Parameters
datathe ScatteringData object, giving access to all the reflections.
spgSymPosIndexif the ScatteringPower is anisotropic, then the different symmetrics will not have the same scattering power for all reflections. This parameter is the index of the symmetric position in the Spacegroup. If spgSymPosIndex=-1, the isotropic values are returned.
Warning
There is no anisotropic code yet, so spgSymPosIndex is simply ignored so far , but the design of this function is general for any anisotropic scattering.

Implements ObjCryst::ScatteringPower.

Definition at line 86 of file ScatteringPowerSphere.cpp.

CrystVector_REAL ObjCryst::ScatteringPowerSphere::GetTemperatureFactor ( const ScatteringData data,
const int  spgSymPosIndex = 0 
) const
virtual

Get the temperature factor for all reflections of a given ScatteringData object.

Returns
a vector with the temperature factor for all reflections, in the same order as in the ScatteringData object.
Parameters
datathe ScatteringData object, giving access to all the reflections.
spgSymPosIndexif the ScatteringPower is anisotropic, then the different symmetrics will not have the same scattering power for all reflections. This parameter is the index of the symmetric position in the Spacegroup. If spgSymPosIndex=-1, the isotropic values are returned.
Warning
There is no anisotropic code yet, so spgSymPosIndex is simply ignored so far , but the design of this function is general for any anisotropic scattering.

Implements ObjCryst::ScatteringPower.

Definition at line 143 of file ScatteringPowerSphere.cpp.

void ObjCryst::ScatteringPowerSphere::XMLInput ( istream &  is,
const XMLCrystTag tag 
)
virtual

Input From stream.

Todo:
Add an bool XMLInputTag(is,tag) function to recognize all the tags from the stream. So that each inherited class can use the XMLInputTag function from its parent (ie take advantage of inheritance). The children class would first try to interpret the tag, then if unsuccessful would pass it to its parent (thus allowing overloading), etc...

Reimplemented from ObjCryst::RefinableObj.

Definition at line 236 of file ScatteringPowerSphere.cpp.

void ObjCryst::ScatteringPowerSphere::XMLOutput ( ostream &  os,
int  indent = 0 
) const
virtual

Output to stream in well-formed XML.

Todo:
Use inheritance.. as for XMLInputTag()...

Reimplemented from ObjCryst::RefinableObj.

Definition at line 205 of file ScatteringPowerSphere.cpp.


The documentation for this class was generated from the following files: