Merge lp://qastaging/~jochym/elastic/mixin into lp://qastaging/elastic
Status: | Merged |
---|---|
Approved by: | Paweł T. Jochym |
Approved revision: | no longer in the source branch. |
Merge reported by: | Paweł T. Jochym |
Merged at revision: | not available |
Proposed branch: | lp://qastaging/~jochym/elastic/mixin |
Merge into: | lp://qastaging/elastic |
Diff against target: |
140 lines (+55/-20) 1 file modified
elastic.py (+55/-20) |
To merge this branch: | bzr merge lp://qastaging/~jochym/elastic/mixin |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paweł T. Jochym | Approve | ||
Review via email:
|
Commit message
Implementation of the mixin design pattern for the elastic module. It becomes a plug-in for the Atoms class.
The backward compatibility class Crystal(Atoms) provides for the old code to run without change.
Description of the change
Backward-compatible change in the implementation of the code.
The mixin design pattern is implemented by making __Crystal a base class of the Atoms ase class with just a little bit of trickery to get the constructor of the Atoms class to call the __Crystal class constructor. The (empty) Crystal(Atoms) class is provided to let the 3.0 code run without change. The documentation still needs updating.
Current usage style is (in this order!):
imprort ase
import elastic
After this sequence the ase.Atoms class gets additional methods for elastic tensor calculations.
I (obviously) think it is a good idea ;)