atomicrex  0.1
An advanced atomistic model building tool
Public Types | Public Member Functions | Friends | List of all members
atomicrex::FitJob Class Reference

Public Types

enum  TolerancePreset { Uniform, Balanced, AccurateEnergies }
 Specifies presets for tolerance parameters. More...
 

Public Member Functions

 FitJob ()
 Constructor.
 
 ~FitJob ()
 Destructor.
 
const FPStringname () const
 Returns the user-defined name of this job.
 
double getDefaultPropertyTolerance (FitProperty *property)
 Returns the default tolerance for the given property based on the selected tolerance preset.
 
int numAtomTypes () const
 Returns the number of atom types used in this job.
 
bool addAtomType (const FPString &name, double mass=0.0, int atomicNumber=0)
 Adds a new atom type to the job.
 
const FPStringatomTypeName (int i) const
 Returns the name of the i-th atom type.
 
double atomTypeMass (int i) const
 
int atomTypeAtomicNumber (int i) const
 
int atomTypeIndex (const FPString &s) const
 Returns the index of the atom type.
 
double maximumCutoff () const
 Returns the maximum cutoff radius of all potentials used by this job.
 
const std::vector< Potential * > & potentials () const
 Returns the list of all potentials used in this job.
 
const std::vector< AtomicStructure * > & structures () const
 Returns the list of all atomic structures used for fitting.
 
const std::vector< AtomicStructure * > & referencedStructures () const
 
void addReferencedStructure (AtomicStructure *structure)
 Add a structure to the list of referenced structures.
 
const std::vector< AtomicStructure * > & unreferencedStructures () const
 
void addUnreferencedStructure (AtomicStructure *structure)
 Add a structure to the list of unreferenced structures.
 
const std::vector< DerivedProperty * > & derivedProperties ()
 Returns the list of all derived properties.
 
const std::vector< FitProperty * > & fitProperties ()
 Returns the global list of active properties which are included in the fit and which need to be computed.
 
FitGrouprootGroup ()
 Returns the root node of the property group tree.
 
ScalarFitPropertygetScalarFitProperty (const FPString &id)
 
AtomicStructuregetAtomicStructure (const FPString &id)
 
DerivedPropertygetDerivedProperty (const FPString &id)
 
const Matrix3 * lookupDeformation (const FPString &deformationId) const
 Returns the deformation with the given id. Returns NULL if no such deformation has been defined.
 
bool fittingEnabled () const
 Returns whether fitting will be performed.
 
std::shared_ptr< MinimizerfitMinimizer ()
 Returns the minimizer.
 
void performFitting ()
 Performs the actual fitting by minimizing the residual.
 
void printPotentialDOFList (bool printFullDOFList)
 Outputs the current values of all DOFs of the potentials. More...
 
void printFittingProperties ()
 Outputs the list of properties being fitted.
 
bool potentialValidationEnabled () const
 Returns whether validation of the force/energy calculation routines has been requested by the user.
 
void validatePotentials ()
 Performs a check of the energy/force calculation routines using numerical differentiation.
 
int numActiveDOF () const
 Returns the total number of active degrees of freedom.
 
void packDOF (double *destination)
 Packs the values of all degrees of freedom into a linear vector, which can be passed to the minimizer routine. More...
 
void packDOF (std::vector< double > &destination)
 Packs the values of all degrees of freedom into a linear vector, which can be passed to the minimizer routine. More...
 
void unpackDOF (const double *source)
 Unpacks the values of all degrees of freedom from a linear vector. More...
 
void unpackDOF (const std::vector< double > &source)
 Unpacks the values of all degrees of freedom from a linear vector. More...
 
void parse (const FPString &file)
 Parses the job description from the XML file. More...
 
int parseAtomTypeAttribute (XML::Element element, const char *attributeName)
 Returns the atom type index of the species specified in the given element attribute. More...
 
int parseAtomTypeElement (XML::Element element, const char *elementName)
 Returns the atom type index of the species specified in the given element. More...
 
std::vector< int > parseAtomTypesAttribute (XML::Element element, const char *attributeName)
 Returns the list of atom types corresponding to the species specified in the given element attribute. More...
 
ScalarFitPropertyparseScalarFitPropertyAttribute (XML::Element element, const char *attributeName)
 Returns the ScalarFitProperty specified in the given element attribute. More...
 
double calculateResidual (FitProperty::ResidualNorm norm=FitProperty::UserDefined)
 Calculates the total residual, i.e. the objective function to be minimized during fitting. More...
 
void prepareFitting ()
 Prepares a list of all degrees of freedom and properties that are to be fitted.
 

Friends

class FitGroup
 
class AtomicStructure
 
class DerivedProperty
 

Member Enumeration Documentation

◆ TolerancePreset

Specifies presets for tolerance parameters.

Enumerator
Uniform 

All tolerances are 1.0.

Balanced 

Specifies a balanced unit based assignment of tolerance parameters.

AccurateEnergies 

Specifies a unit based assignment that emphasizes energies.

Member Function Documentation

◆ atomTypeAtomicNumber()

int atomicrex::FitJob::atomTypeAtomicNumber ( int  i) const
inline

Returns the atomic of the i-th atom type. May be zero if not set.

◆ atomTypeMass()

double atomicrex::FitJob::atomTypeMass ( int  i) const
inline

Returns the mass of the i-th atom type. May be zero if not set.

◆ calculateResidual()

double atomicrex::FitJob::calculateResidual ( FitProperty::ResidualNorm  norm = FitProperty::UserDefined)

Calculates the total residual, i.e. the objective function to be minimized during fitting.

Parameters
normThe style to be used for computing the residual, see #FitProperty::ResidualNorm.

◆ getAtomicStructure()

AtomicStructure * atomicrex::FitJob::getAtomicStructure ( const FPString id)

Returns the atomic structure with the given ID. Return NULL if no such structure exists.

◆ getDerivedProperty()

DerivedProperty * atomicrex::FitJob::getDerivedProperty ( const FPString id)

Returns the derived property with the given ID. Return NULL if no such property exists.

◆ getScalarFitProperty()

ScalarFitProperty * atomicrex::FitJob::getScalarFitProperty ( const FPString id)

Returns the atomic structure with the given ID. Return NULL if no such structure exists.

◆ packDOF() [1/2]

void atomicrex::FitJob::packDOF ( double *  destination)

Packs the values of all degrees of freedom into a linear vector, which can be passed to the minimizer routine.

Parameters
destinationA pointer to a contiguous array of doubles that will receive the values of all the degrees of freedom.

◆ packDOF() [2/2]

void atomicrex::FitJob::packDOF ( std::vector< double > &  destination)
inline

Packs the values of all degrees of freedom into a linear vector, which can be passed to the minimizer routine.

Parameters
destinationA vector of doubles that will receive the values of all the degrees of freedom.

◆ parse()

void atomicrex::FitJob::parse ( const FPString file)

Parses the job description from the XML file.

Parameters
fileName of input file.

◆ parseAtomTypeAttribute()

int atomicrex::FitJob::parseAtomTypeAttribute ( XML::Element  element,
const char *  attributeName 
)

Returns the atom type index of the species specified in the given element attribute.

Throws exception if species has not been defined.

Parameters
elementXML::Element object to be parsed
attributeNameThe name of the attribute
Returns
atom type index as integer

◆ parseAtomTypeElement()

int atomicrex::FitJob::parseAtomTypeElement ( XML::Element  element,
const char *  elementName 
)

Returns the atom type index of the species specified in the given element.

Throws exception if species has not been defined.

Parameters
elementXML::Element object to be parsed
elementNameThe name of the element
Returns
atom type index as integer

◆ parseAtomTypesAttribute()

vector< int > atomicrex::FitJob::parseAtomTypesAttribute ( XML::Element  element,
const char *  attributeName 
)

Returns the list of atom types corresponding to the species specified in the given element attribute.

Throws exception if some species has not been defined.

Parameters
elementXML::Element object to be parsed
attributeNameThe name of the attribute
Returns
list of integers representing atom types

◆ parseScalarFitPropertyAttribute()

ScalarFitProperty * atomicrex::FitJob::parseScalarFitPropertyAttribute ( XML::Element  element,
const char *  attributeName 
)

Returns the ScalarFitProperty specified in the given element attribute.

Throws exception if property has not been defined.

Parameters
elementXML::Element object to be parsed
attributeNameThe name of the attribute
Returns
ScalarFitProperty specified in the element attribute

◆ printPotentialDOFList()

void atomicrex::FitJob::printPotentialDOFList ( bool  printFullDOFList)

Outputs the current values of all DOFs of the potentials.

Parameters
printFullDOFListControls whether inactive DOFs are also printed. This option is used once before fitting to report the full list of DOFs.

◆ referencedStructures()

const std::vector<AtomicStructure*>& atomicrex::FitJob::referencedStructures ( ) const
inline

Returns the list of all referenced atomic structures used for fitting. i.e. these structured need to be computed first as other structures depend on them.

◆ unpackDOF() [1/2]

void atomicrex::FitJob::unpackDOF ( const double *  source)

Unpacks the values of all degrees of freedom from a linear vector.

Parameters
sourceA pointer to a contiguous array of doubles that contains the values of all the degrees of freedom.

◆ unpackDOF() [2/2]

void atomicrex::FitJob::unpackDOF ( const std::vector< double > &  source)
inline

Unpacks the values of all degrees of freedom from a linear vector.

Parameters
sourceA vector of doubles that contains the values of all the degrees of freedom.

◆ unreferencedStructures()

const std::vector<AtomicStructure*>& atomicrex::FitJob::unreferencedStructures ( ) const
inline

Returns the list of all unreferenced atomic structures used for fitting. These structures can be computed without any particular order.


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