3.3. Calculator
- class fitsnap3lib.calculators.calculator.Calculator(name, pt, config)
Class for allocating, calculating, and collating descriptors.
- allocate_per_config(data: list)
Allocate shared arrays for total number of atoms. This is only needed when doing big A matrix fits (need number of atoms) or nonlinear fits.
- Parameters
data – List of data dictionaries.
- collect_distributed_lists(allgather: bool = False)
Gathers all the distributed lists on each proc to the root proc. For each distributed list (fitsnap dicts) this will create a concatenated list on the root proc. We use this function in fitsnap.py after processing configs.
- Parameters
allgather – Whether to gather lists on all nodes or just the head node.
- create_a()
Allocate shared arrays for calculator.
- create_dicts(nconfigs)
Create dictionaries for certain distributed lists. Each list should be of size nconfigs of a single proc.
- Parameters
nconfigs – int number of configs on this proc.
3.3.1. LammpsBase
- class fitsnap3lib.calculators.lammps_base.LammpsBase(name, pt, config)
- create_a()
Allocate shared arrays for calculator.
- preprocess_allocate(nconfigs: int)
Allocate arrays to be used by this proc. These arrays have size nconfigs.
- Parameters
nconfigs – number of configs on this proc
- process_configs(data, i)
Calculate descriptors for a given configuration. Action of this function is altered by certain attributes.
- Parameters
transpose_trick – Don’t touch shared arrays in _collect_lammps() if true. Instead store smaller matrices self.aw, self.bw.
- process_single(data, i=0)
Calculate descriptors on a single configuration without touching the shraed arrays.
- Parameters
data – dictionary of structural and fitting info for a configuration in fitsnap data dictionary format.
i – integer index which is optional, mainly for debugging purposes.
- Returns
A matrix of descriptors depending on settings declared in CALCULATOR. If bikflag is 0 (default) then A has 1 and 0s in the first column since it is ready to fit with linear solvers; the descriptors are also divided by no. atoms in this case. If bikflag is 1, then A is simply an unaltered per-atom descriptor matrix.
b vector of truths
w vector of weights