Repository navigation
Crystal lattice and co. - #36
Conversation
…thods of the class
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #36 +/- ##
===========================================
+ Coverage 92.65% 95.40% +2.75%
===========================================
Files 9 14 +5
Lines 572 1307 +735
Branches 92 129 +37
===========================================
+ Hits 530 1247 +717
- Misses 36 52 +16
- Partials 6 8 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
I looked a bit at the new code and found three functionality issues:
from easyimaging.sample_model import AtomSite, Atoms, Lattice
L = Lattice.cubic(3.0, atom_sites=[AtomSite(Atoms.Fe, 0, 0, 0, 300)])
d = L.to_dict()
print(d['atom_sites'])
# shows {'@module': 'easyscience.base_classes.easy_list', '@class': 'EasyList', '@version': '2.5.1'} <- no sites
print(d['length_b']['fixed'])
# shows False <- the link to length_a is gone (should be True for cubic!)
Lattice.from_dict(d)
# TypeError: atom_sites must be a list of AtomSite objects.
from easyimaging.sample_model import Lattice, Atoms
from easyimaging.sample_model.crystals import body_centered_cubic
print('unique_name' in Lattice(3, 4, 5, unique_name='Mine').to_dict()) # True
print('unique_name' in Lattice.cubic(3.0, unique_name='Mine2').to_dict()) # False
print('unique_name' in Lattice.hexagonal(3.0, 5.0, unique_name='Mine3').to_dict()) # False
print('unique_name' in body_centered_cubic(2.87, Atoms.Fe, 300, unique_name='my_bcc').to_dict()) # False
from easyimaging.sample_model import Atoms
from easyimaging.sample_model.crystals import body_centered_cubic
print(body_centered_cubic(2.87, Atoms.Fe, 300).unique_name) # 'Fe BCC Lattice_0'
print(body_centered_cubic(2.87, 'Fe', 300).unique_name) # 'Unknown BCC Lattice_0' |
| - [Lattice](sample_model/lattice.md) - The crystallographic unit cell of | ||
| the sample model. | ||
| - [AtomSite](sample_model/atom_site.md) - The atomic sites of a | ||
| crystallographic lattice. | ||
| - [Atoms](sample_model/atoms.md) - The atomic species occupying an atomic | ||
| site. | ||
| - [crystals](sample_model/crystals) - A module containing convenience |
There was a problem hiding this comment.
shouldn't the links have sample_model prefix removed? We're already in sample_models...
| lattice.length_c.make_dependent_on('length_a', {'length_a': lattice.length_a}) | ||
| return lattice |
There was a problem hiding this comment.
we should probably also set alpha=90.0 etc.
Also, tie all the angles to alpha
There was a problem hiding this comment.
Hmm, that would still allow alpha to be fitted, which is weird. I think it's better to create an internal Parameter and tie all the angles to that Parameter, thereby "locking" them.
| Create a hexagonal close-packed (HCP) lattice with four atom sites. | ||
|
|
There was a problem hiding this comment.
You create a lattice with two atoms only...
There was a problem hiding this comment.
Haha, I haven't gone through these docstrings yet. These are still just Claudes auto-generated docstrings 🙃
…maging-lib into MWP_sample_model_2
…Atoms list to docs with markdown-exec
|
Ready for a re-review. Addressed all comments except for the creation of weird lattices, which will be handled by a validator which will be implemented when I actually have a calculator . . . |
This still holds. I guess you're just waiting for 3.0 to be merged? This of course is a non-issue there. |
This PR adds the crystal Lattice class and related classes to my sample_model module.