Coverage for /builds/ase/ase/ase/optimize/precon/__init__.py: 100.00%

10 statements  

« prev     ^ index     » next       coverage.py v7.5.3, created at 2025-08-02 00:12 +0000

1# fmt: off 

2 

3""" 

4This module contains tools for preconditioned geometry optimisation. 

5 

6Code maintained by James Kermode <james.kermode@gmail.com> 

7Parts written by John Woolley, Letif Mones and Christoph Ortner. 

8 

9The preconditioned LBFGS optimizer implemented here is described in 

10the following publication: 

11 

12 D. Packwood, J. R. Kermode, L. Mones, N. Bernstein, J. Woolley, 

13 N. Gould, C. Ortner, and G. Csanyi, A universal preconditioner for 

14 simulating condensed phase materials, J. Chem. Phys. 144, 164109 (2016). 

15 DOI: https://doi.org/10.1063/1.4947024 

16 

17A preconditioned version of FIRE is also included, this is less well tested. 

18 

19Optional dependencies 

20--------------------- 

21 

22 - scipy, `pip install scipy` for efficient sparse linear algebra, 

23 important for large systems (>1000 atoms). 

24 - PyAMG, `pip install pyamg`, for iterative adaptive multi grid 

25 inversion of the preconditioner, again important for large systems. 

26""" 

27 

28from ase.optimize.ode import ODE12r 

29from ase.optimize.precon.fire import PreconFIRE 

30from ase.optimize.precon.lbfgs import PreconLBFGS 

31from ase.optimize.precon.precon import ( 

32 C1, 

33 FF, 

34 Exp, 

35 Exp_FF, 

36 Pfrommer, 

37 Precon, 

38 PreconImages, 

39 SplineFit, 

40 make_precon, 

41) 

42 

43 

44class PreconODE12r(ODE12r): 

45 """ 

46 Subclass of ase.optimize.ode.ODE12r with 'Exp' preconditioning on by default 

47 """ 

48 

49 def __init__(self, *args, **kwargs): 

50 if 'precon' not in kwargs: 

51 kwargs['precon'] = 'Exp' 

52 ODE12r.__init__(self, *args, **kwargs) 

53 

54 

55__all__ = ['make_precon', 'PreconImages', 'SplineFit', 

56 'Precon', 'Exp', 'C1', 'Pfrommer', 'FF', 'Exp_FF', 

57 'PreconLBFGS', 'PreconFIRE', 'PreconODE12r']