C++ API

class strucXYZ
#include <mod_XYZ.h>

This class stores the x,y,z coordinates of the atoms and computes pairwise distances and angles.

Public Functions

strucXYZ()

Constructor.

void doReadXYZ(string input_file)

The function is used to read the input file.

Parameters:

input_file – The filename for the input

void doComputeDistances(double R_cut)

Function used to compute pairwise distances.

Parameters:

R_cut – The cutoff in Å for distances

void doComputeAngles(double R_cut)

Function to compute angles.

Parameters:

R_cut – The cutoff in Å for distances

inline int GetN_atoms() const

Function to return number of atoms.

Returns:

int

inline int GetN_times() const

Get number of atoms*.

Returns:

int

inline vector<vector<vector<double>>> GetPos() const

Get the Pos object.

Returns:

vector<vector<vector<double>>>

inline vector<vector<vector<vector<double>>>> GetDX() const

Get the position vectors.

Returns:

vector<vector<vector<vector<double>>>>

inline vector<vector<vector<double>>> GetDistance() const

Get the Distance object.

Returns:

vector<vector<vector<double>>>

inline vector<vector<vector<int>>> GetDistanceTYPE() const

Get the Distance T Y P E object.

Returns:

vector<vector<vector<int>>>

inline vector<vector<vector<vector<double>>>> GetAngle() const

Get the Angle object.

Returns:

vector<vector<vector<vector<double>>>>

inline vector<vector<vector<vector<int>>>> GetAngleTYPE() const

Get the Angle T Y P E object.

Returns:

vector<vector<vector<vector<int>>>>

inline vector<vector<int>> GetType() const

Get the Type object.

Returns:

vector<vector<int>>

Private Members

int N_atoms_

Get number of atoms

int N_times_

XXXX.

vector<vector<vector<double>>> pos_

Position vectors

vector<vector<vector<vector<double>>>> dx_
vector<vector<vector<double>>> distance_
vector<vector<vector<int>>> distanceTYPE_
vector<vector<int>> type_
vector<vector<vector<vector<double>>>> angles_
vector<vector<vector<vector<int>>>> anglesTYPE_
double L_[3][3] = {}

Lattice parameter values.

class XMAT
#include <mod_xmat.h>

This class is used to compute and manipulate the description matrix.

Public Functions

XMAT(const strucXYZ &xyz, double a_init, double a_end, double a_step, double b_init, double b_end, double b_step, int i_nature, int check2B, int N_l3B, int N_lNB)

Constructor for XMAT.

See also

strucXYZ

Parameters:
  • xyz – Object of class strucXYZ.

  • a_init – Minimum value for parameter a.

  • a_end – Max value for parameter a.

  • a_step – step size for parameter a.

  • b_init – Minimum value for parameter b.

  • b_end – Max value for parameter b.

  • b_step – step size for parameter b.

  • i_nature – type of potential used.

  • check2B – value for 2-body.

  • N_l3B – value for 3-body.

  • N_lNB – value for N-body.

void doXMAT(const strucXYZ &xyz, string output_file, double Rcut, double Rshort[3])

Generates XMAT.

Parameters:
  • xyz – Object of class strucXYZ.

  • output_file – filename for output.

  • Rcut – Cut-off value for 2-body.

  • Rshort – Cut-off value for N-body.

void doComputePot(vector<vector<double>> &Pot2B, vector<vector<double>> &Force2B, vector<double> r, int &i_func, vector<double> coeffS, double Rcut, double Rshort[3])

Generates potential.

Parameters:
  • Pot2B – Storage for 2B potential values

  • Force2B – Storage for 2B potential derivative values

  • r – One dimensional grid of interatomic distances

  • i_func – XXXX

  • coeffS – coefficiemt values after Lasso lars.

  • Rcut – Cut-off value for 2-body.

  • Rshort – Cut-off value for N-body.

inline int getCheck2B() const

Get the value for check2B_.

Returns:

int

inline int getN_l3B() const

Get the value for number of three-body.

Returns:

int

inline int getInat() const

get value for i_nature_

Returns:

int

inline vector<double> getA() const

a parameter values

Returns:

vector<double>

inline vector<double> getB() const

b parameter values

Returns:

vector<double>

Private Members

int i_nature_

Number for descriptor type

int check2B_

Check if two body required

int N_l3B_

m value for three body

int N_lNB_

l value for N-body body

vector<double> list_a_

List of function parameters for ‘a’

vector<double> list_b_

List of function parameters for ‘b’

Functions

string replace(std::string &str, const std::string &from, const std::string &to)

A search and replace function.

Parameters:
  • str – The input string.

  • from – Search sub-string.

  • to – Replacement sub-string.

Returns:

string

int whichTypeNB(int type_at, int type_distance)
Parameters:
  • type_at

  • type_distance

Returns:

int

string whichType3B(int type_3B, string type1, string type2)
Parameters:
  • type_3B

  • type1

  • type2

Returns:

string

string whichType3B_BIS(int type_3B, string type1, string type2)
Parameters:
  • type_3B

  • type1

  • type2

Returns:

string

double whichShort(double Rshort[3], int i_type)
Parameters:
  • Rshort

  • i_type

Returns:

double

vector<double> doReadCoeff(string input_file)

A function to read coefficients.

Parameters:

input_file – The filename with coefficients

Returns:

vector<double> A vector of coefficients

void doPrint2B(vector<double> r, vector<vector<double>> Pot2B, vector<vector<double>> Force2B)

Print two-body potential.

Parameters:
  • r – interatomic distance values.

  • Pot2B – Computed two-body potential values.

  • Force2B – Computed two-body force values

void doPrint3B(vector<double> r, vector<double> theta, vector<vector<vector<vector<double>>>> Pot3B, vector<vector<vector<vector<double>>>> Force3B)

Print three-body potential.

Parameters:
  • r – interatomic distance values.

  • Pot3B – Computed two-body potential values.

  • Force3B – Computed three-body force values.

Functions

double fcut(double rcut, double r)

The cut-off function definition.

Parameters:
  • rcut – The cut-off radii in Å.

  • r – The value of the distance.

Returns:

double The cut-off function value

double fcutD(double rcut, double r)

The derivative of function.

See also

fcut

Parameters:
  • rcut – The cut-off radii in Å

  • r – The value of distance at which derivative taken.

Returns:

double The cut-off function derivative value

double LJ(double sigma, double r)

The lennard-jones potential.

Parameters:
  • sigma – See lennard jones potential

  • r – Distance value

Returns:

double Function value

double LJ_D(double sigma, double r)

The derivative of lennard jones potential.

See also

LJ

Parameters:
  • sigma – See lennard jones potential

  • r – Distance value

Returns:

double Function value

double Gaus(double p, double q, double r)

Gaussian function.

Parameters:
  • p – Width of gaussian

  • q – Position of gaussian

  • r – Distance value

Returns:

double Derivative value

double Gaus_D(double p, double q, double r)

Derivative of gaussian function.

See also

Gaus

Parameters:
  • p – Width of gaussian.

  • q – Position of gaussian.

  • r – Distance value.

Returns:

double Derivative value

double expSW(double A, double B, double r)
double expSW_D(double A, double B, double r)
double doCalc(int i_nature, double r, double param1, double param2, double Rcut)

The function used to link potential function and user input.

Parameters:
  • i_nature – The integer value representing the choice of potential.

  • r – The distance value.

  • param1 – The first parameter of the chosen potential function.

  • param2 – The second parameter of the chosen potential function.

  • Rcut – The cut-off value for distance.

Returns:

double The calculated potential value.

double doCalcD(int i_nature, double r, double param1, double param2, double Rcut)

Returns the derivative of potential function.

Parameters:
  • i_nature – The integer value representing the choice of potential.

  • r – The distance value.

  • param1 – The first parameter of the chosen potential function.

  • param2 – The second parameter of the chosen potential function.

  • Rcut – The cut-off value for distance.

Returns:

double The calculated derivative value.

double doCalc_Short(int i_nature, double r, double param1, double param2, double Rcut, double Rshort)

The function is similar to.

See also

doCalcD but with an additional short range part.

Parameters:
  • i_nature – The integer value representing the choice of potential.

  • r – The distance value.

  • param1 – The first parameter of the chosen potential function.

  • param2 – The second parameter of the chosen potential function.

  • Rcut – The cut-off value for distance.

  • Rshort – The value of short-range distance for Nbody conribution.

Returns:

double The calculated potential value.

double doCalcD_Short(int i_nature, double r, double param1, double param2, double Rcut, double Rshort)

Returns derivative of.

See also

doCalc_Short

Parameters:
  • i_nature – The integer value representing the choice of potential.

  • r

  • param1 – The first parameter of the chosen potential function

  • param2 – The second parameter of the chosen potential function

  • Rcut – The cut-off value for distance

  • Rshort – The value of short-range distance for Nbody conribution.

Returns:

double The calculated derivative value

string whichPot(int i_nature)

Function to check the choice of potential given by user.

Parameters:

i_nature – The integer number.

Returns:

string The type of potential.