ase_uhal.committee_calculators.MACEHALCalculator#
- class ase_uhal.committee_calculators.MACEHALCalculator(mace_calculator, committee_size, prior_weight, num_layers=-1, invariants_only=True, batch_size=None, **kwargs)[source]#
- __init__(mace_calculator, committee_size, prior_weight, num_layers=-1, invariants_only=True, batch_size=None, **kwargs)#
- Parameters:
mace_calculator (mace.calculators.MACECalculator object) – MACE architecture to use to define a MACE descriptor
committee_size (int) – Number of members in the linear committee
prior_weight (float) – Weight corresponding to the prior matrix in the linear system
num_layers (int (default: -1)) – Number of layers in the MACE model to keep for descriptor evaluation Default of -1 uses all but the readout layer (equivalent to MACECalculator.get_descriptors() default)
invariants_only (bool) – Whether to only keep the invariants partition of the descriptor vector, see MACECalculator.get_descriptors for more details
batch_size (int) – Batch size to use for descriptor gradient evaluation. Lower batch size reduces overhead. If batch_size > len(atoms), then len(atoms) is used as the batch size instead
**kwargs (Keyword Args) – Extra keywork arguments fed to
TorchCommitteeCalculator
- resample_committee(committee_size=None)#
Resample the committee, based on the states of self.likelihood and self.sqrt_prior Populates self.committee_weights based on the newly sampled committee
- Parameters:
committee_size (int, optional) – New size of the committee, if supplied. By default, a committee of size self.n_comm is drawn
- select_structure(atoms)#
- sync()#
- get_descriptor_energy(atoms=None)#
Get “descriptor energy”, which is the average of descriptor vectors in the structure
Returns an array of length self.n_desc
- get_descriptor_forces(atoms=None)#
Get “descriptor forces”, which are the derivatives w.r.t atomic positions of the total descriptor energy
Returns an array of shape (self.n_desc, Nats, 3)
- get_descriptor_stress(atoms=None)#
Get “descriptor stresses”, which are the stress analogues to the total descriptor energy
Returns an array of shape (self.n_desc, 3, 3)
- get_committee_energies(atoms=None)#
Get energy predictions by each member of the committee
Returns an array of length self.n_comm
- get_committee_forces(atoms=None)#
Get force predictions by each member of the committee
Returns an array of shape (self.n_comm, Nats, 3)
- get_committee_stresses(atoms=None)#
Get stress predictions by each member of the committee
Returns an array of shape (self.n_comm, 3, 3)
- get_bias_energy(atoms=None)#
- get_bias_forces(atoms=None)#
- get_bias_stress(atoms=None)#
Methods
__init__(mace_calculator, committee_size, ...)band_structure()Create band-structure object for plotting.
calculate(atoms, properties, system_changes)Calculation for descriptor properties, committee properties, normal properties, and HAL properties
calculate_numerical_forces(atoms[, d])Calculate numerical forces using finite difference.
calculate_numerical_stress(atoms[, d, voigt])Calculate numerical stress using finite difference.
calculate_properties(atoms, properties)This method is experimental; currently for internal use.
calculation_required(atoms, properties)check_state(atoms[, tol])Check for any system changes since last calculation.
export_properties()get_atoms()get_bias_energy([atoms])get_bias_forces([atoms])get_bias_stress([atoms])get_charges([atoms])get_committee_energies([atoms])Get energy predictions by each member of the committee
get_committee_forces([atoms])Get force predictions by each member of the committee
get_committee_stresses([atoms])Get stress predictions by each member of the committee
get_default_parameters()get_descriptor_energy([atoms])Get "descriptor energy", which is the average of descriptor vectors in the structure
get_descriptor_forces([atoms])Get "descriptor forces", which are the derivatives w.r.t atomic positions of the total descriptor energy
get_descriptor_stress([atoms])Get "descriptor stresses", which are the stress analogues to the total descriptor energy
get_dipole_moment([atoms])get_forces([atoms])get_magnetic_moment([atoms])get_magnetic_moments([atoms])Calculate magnetic moments projected onto atoms.
get_potential_energies([atoms])get_potential_energy([atoms, force_consistent])get_property(name[, atoms, allow_calculation])Overload of Calculator.get_property, converts from torch tensors to numpy arrays Allows for torch tensors to be stored in self.results between calls to self.calculate
get_stress([atoms])get_stresses([atoms])the calculator should return intensive stresses, i.e., such that stresses.sum(axis=0) == stress
read(label)Read atoms, parameters and calculated properties from output file.
read_atoms(restart, **kwargs)resample_committee([committee_size])Resample the committee, based on the states of self.likelihood and self.sqrt_prior Populates self.committee_weights based on the newly sampled committee
reset()Clear all information from old calculation.
select_structure(atoms)set(**kwargs)Set parameters like set(key1=value1, key2=value2, ...).
set_label(label)Set label and convert label to directory and prefix.
sync()todict([skip_default])Obtain a dictionary of parameter information
Attributes
default_parametersDefault parameters
directorydiscard_results_on_any_changeWhether we purge the results following any change in the set() method.
energy_weightforces_weightignored_changesProperties of Atoms which we ignore for the purposes of cache
implemented_propertiesProperties calculator can handle (energy, forces, ...)
labelnamestress_weighttorch_device