ASE Workshop Chalmers, November 19-22, 2019
Jens Jørgen Mortensen, CAMd, Department of Physics, Technical University of Denmark
It all started with Dacapo (a Fortran USPP plane-wave DFT code):
S. R. Bahn and K. W. Jacobsen, An object-oriented scripting interface to a legacy electronic structure code, Comput. Sci. Eng., Vol. 4, 56-66, 2002, https://dx.doi.org/10.1109/5992.998641
from Simulations.Dacapo import * mysim = Simulation() mysim.bands = ElectronicBands(9) mysim.config = ListOfAtoms( atoms=[Atom(Mg_GGA, Vector([0, 0, 0]))], unitcell=BravaisLattice( [[-1.425, 1.425, 1.425], [1.425, -1.425, 1.425], [1.425, 1.425, -1.425]]) mysim.plancut = PlaneWaveCutoff(340) mysim.Execute()
Problems with ASE-1:
After many discussions and meetings, ASE-2.0 was created from scratch.
ASE-3.19: ~40 calculators
Problems with ASE-2:
Rewrite from scratch or adapt current code base?
279 contributors so far ...
Thank you!
Let's do it right:
Think of a contribution like a puppy: you might view it as this cute, wonderful thing you're giving me while I'm looking at it as over a decade of feeding, walking, and vet bills. -- Brett Cannon
Alternatives:
Merge requests: 1245 merged, 195 closed and 47 open.
Keeping ASE going is more work that most people think!
There are many bigger projects necessary in order to keep ASE moving in the right direction. Example: Calculators!
"If you have found ASE to be useful in your work, research or company, please consider making a donation to the project commensurate with your resources. Any amount helps! All donations will be used strictly to fund the development of ASE’s open source software, documentation and community."
A simple example from ASE's code:
import re def strip_number(s): """Split string to number and the rest. >>> strip_number('2Au') 2 """ m = re.match('[0-9]*', s) return int(m.group() or 1), s[m.end():] x = strip_number('12Cu') * 2.5
See also: https://gitlab.com/ase/ase-workshop-discussion/issues/2
import re from typing import Tuple def strip_number(s: str) -> Tuple[int, str]: m = re.match('[0-9]*', s) return int(m.group() or 1), s[m.end():] x = strip_number('12Cu') * 2.5
$ mypy hint.py hint.py:6: error: Item "None" of "Optional[Match[str]]" has no attribute "group" hint.py:6: error: Item "None" of "Optional[Match[str]]" has no attribute "end" hint.py:8: error: Unsupported operand types for * ("Tuple[int, str]" and "float") Found 3 errors in 1 file (checked 1 source file)
import re from typing import Tuple def strip_number(s: str) -> Tuple[int, str]: m = re.match('[0-9]*', s) assert m is not None return int(m.group() or 1), s[m.end():] x = strip_number('12Cu')[0] * 2.5
$ mypy hint.py Success: no issues found in 1 source file
we can do it gradually
it's documentation that mypy can check for us
code is read a lot more than written
make it easier for new contributors
improved editor-completion
find bugs for us
lead to simpler code
wait for ASE to drop Python 3.5:
... number = [] # type: List[int] number: List[int] = []
Table of Contents | t |
---|---|
Exposé | ESC |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide next slide | c |
Notes | 2 |
Help | h |