Code Documentation

Basic Classes

class AtomicSystem

Class that holds information about the molecular system including atom types and spatial coordinates.

Public Functions

AtomicSystem(void)

Default constructor.

AtomicSystem(string, bool, bool, bool, double)

Constructor that creates the atomicsystem object from a coordinate file.

Parameters
  • filename – name of coordinate file

  • pbcx – boundary condition for x

  • pbcy – boundary condition for y

  • pbcz – boundary condition for z

  • skin – size of the skin around the box for used in neighbor list generation

void set_box_size(double, double, double, double, double, double)

Sets the boundaries of the box xmin, ymin, zmin, xmax, ymax, zmax.

double get_distance_component(Atom, Atom, int)

Calculates the x (=0), y (=1) or z (=2) component of the distance between two atoms.

Parameters
  • A – the first atom object.

  • B – the second atom object.

  • direction – the component of the distance to return 0=x, 1=y, 2=z

double get_square_distance(Atom, Atom)

Calculates the square distance between two atoms.

double get_square_distance(int, int)

Calculates the square distance between two atoms given by their index in the AtomicSystem.

vector<string> get_atom_types()

Finds unique atomic species and return them as a vector of atom names ordered by atomic numbers.

Atom get_atom(int)

Returns an Atom given by its index in the atomic system.

int get_n_atoms()

Returns the total number of atoms in the system.

class Atom

Class that holds information about an atom and its coordinates.

Public Functions

Atom(void)

Default constructor.

Atom(string, double, double, double)

Constructor that creates an Atom object from its name and coordinates.

Parameters
  • attype – name of atom (e.g. H, C, Si, Au, etc.)

  • cx – cartesian coordinates - x value

  • cy – cartesian coordinates - y value

  • cz – cartesian coordinates - z value

string get_atom_type()

Returns the name of this atom.

double get_x()

Returns the x coordinate of this atom.

double get_y()

Returns the y coordinate of this atom

double get_z()

Returns the z coordinate of this atom.

Neighbor Searching

class NeighborList

Class to generate and hold neighbor lists.

This will divide the box into bins and for a given atom, loop over atoms in neighboring bins to generate its neighbor list. This speeds up the process because it is no longer necessary to loop over all atoms in the system. Also, for additional speed up, the neighbor list is kept in a linked list.

Public Functions

NeighborList()

Default Constructor.

NeighborList(AtomicSystem&, double, int, int, int, int)

Creates a NeighborList object based on an AtomicSystem.

Parameters
  • asystem – reference to the atomic system for which the neighbor lists have to be generated.

  • cutoff – maximum distance for which two atoms are considered neighbors

  • nxb – number of bins in the x direction

  • nyb – number of bins in the y direction

  • nzb – number of bins in the z direction

void build()

Function that actually generates the neighbor list for each atom.

int *get_atoms_in_bin(int)

Returns a pointer to the list of atoms in given bin

int get_atoms_per_bin(int)

Returns the number of atoms in given bins.

int get_bin_number(double, double, double)

Retursn the bin number in which the atom with given x, y, and z coordinates belong.

int *get_neighboring_bins(int)

Returns the neighboring bins for a bin givne by its index.

int *get_neighbors(int)

Returns a pointer to the list of neighbors of an atom given by its index.

int *get_sorted_neighbors(int)

Returns a pointer to the neighbor list of a given atom sorted by distance.

int *get_sorted_neighbors(int, string)

Returns only atoms of a given type from the neighbor list of a given atom.

int *get_sorted_neighbors(int, vector<string>)

Returns only atoms of specific types from the neighbor list of a given atom.

int get_n_neighbors(int)

Returns the number of neighbors for a given atom.

int get_n_neighbors(int, string)

Returns the number of neighbors of a given type for a given atom.

int get_n_neighbors(int, vector<string>)

Returns the number of neighbors of given types for a given atom.

Input Parsing

struct fingerprintProperties

Structure to hold fingerprint parameters as provided by the user in the input file.

Public Members

string type

The type of fingerprint to compute (e.g. AGNI, Zernike, Behler-Parinello, etc.)

string calculate_derivatives

Values: yes or no.

int nderivatives

The number of derivatives to calculate.

Derivatives are calculated with respect to the central atom first, then wrt neighbor atoms ordered by increasing distance.

int ndirections

How many directions (x,y,z) to calculate derivatives for.

int *directions

Directions to calculate derivatives for 0=x, 1=y, 2=z.

string strategy

The strategy to use for incorporating multiple species in the fingerprint. Values: weighted or augmented.

string weight_type

For the “weighted” strategy, what type of weight to use (e.g. atomic number, elctronegativity, etc.)

double cutoff

In case of a local fingerprint, the cutoff to use.

bool is_box_size_provided

A boolean to save whether the box size is provided as part of the input file or not.

double *box_size

A pointer to the list that holds the dimensions of the box if they are provided in input file.

int natomtypes

The number of different species to consider for fingerprint generation.

string *atomtypes

A pointer to the list of atomic species for fingerprint generation.

Fingerprint Generation Utilities

class FingerprintGenerator

Class that handles fingerprint generation.

Public Functions

FingerprintGenerator(AtomicSystem&, fingerprintProperties)

Constructor that will instantiate the fingerprint calculator and perform the fingerprint generation

bool write2file(string, string)

Writes the fingerprint to a file in the same order as the atoms were given in the coordinates file

class GenericLocalCalculator

Class that holds a generic calculator to switch between actual fingerprint calculators.

Public Functions

GenericLocalCalculator(AtomicSystem&, fingerprintProperties)

Constructor based on the atomtic system and fingerprintProperties.

int get_size()

Returns the dimensionality of the fingerprint.

double *calculate_fingerprint(int, NeighborList&)

Will call the calculate_fingerprint function of the actual fingerprint calculator and returns the fingerprint

Fingerprint Calculators

All fingerprint calculator classes have the same constructor signature and expose a get_size and calculate_fingerprint functions to allow for easy switching between different types. The AGNI fingerprint calculator will be used here as an example.

class AGNICalculator

An AGNI fingerprint calculator.

Public Functions

AGNICalculator(AtomicSystem&, fingerprintProperties)

Constructor that instantiate an AGNI fingerprint object.

int get_size()

Returns the dimensionality of this AGNI fingerprint.

double *calculate_fingerprint(int, NeighborList&)

Function to calculate the fingerprint of an atom given its neighbor list.

Utility Functions

double cutoff_func(double, double)

Function that returns the value of the cutoff function given the cutoff value and the current distance