Force constant model speedup
Description
Several optimizations related to cluster space building and in particular enforcing of rotational sum rules.
Summary of changes
-
hiphive/core/atoms.py-
spos_to_atom: sped up arithmetic by using NumPy arrays instead of python loop
-
- hiphive/core/rotational_constraints.py
-
_create_Huang_constraintand_create_Born_Huang_constraint: sped up matrix construction by using NumPy arrays and SciPy sparse matrices instead of SymPy sparse matrices -
enforce_rotational_sum_rules: removed the conversion from SymPy matrices to SciPy matrices since the constraint functions now return SciPy matrices directly
-
-
hiphive/core/utilities.py-
nullspace: sped up construction of nullspace vectors by initializing vectors as emptySparseMatrixinstead of converting them toSparseMatrixafter building them as lists of lists. The calls to_neware now faster
-
-
hiphive/force_constant_model.py-
get_fcs_sensing: added argument option to return sensing matrix as sparse (SciPy coo_matrix). Default option is False, so existing code using this function should not be affected
-
-
hiphive/force_constants.py-
_sanity_check_dict: sped up sanity check by using a NumPy array instead of a python loop
-
-
hiphive/utilities.py-
extract_parameters: added an option to use a sparse iterative least squares solver, which reduces runtime for large systems where NumPy'slinalg.lstsqbecomes inefficient
-
Edited by Patrik Wallin Hybelius