-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Wrapper for Atomsk Structure Creation #260
Conversation
Nice! Is there a way to include dislocations? doesn't have to be this PR. |
Yes, it's not properly documented yet, but all atomsk flags are supported. For dislocations it would be something like pr.create.structure.atomsk.create('fcc', 3.6, 'Cu').duplicate(5, 1, 5).dislocation('0.498*box', '0.500*box', 'edge_add', 'Y', 'Z', 3.6, 0.217).build() where the last two numbers are the burgers vector and poisson ratio. |
The pattern is that all method calls on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, I'm happy (a) this happened so quickly, and (b) that you found an easy and direct way to bind things. A few discussion points follow.
with tempfile.TemporaryDirectory() as temp_dir: | ||
if self._structure is not None: | ||
write(os.path.join(temp_dir, "input.exyz"), self._structure, format="extxyz") | ||
proc = subprocess.run(["atomsk", *" ".join(self._options).split()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to do something about the dependencies. Is it sufficient to conda-install atomsk to get this running, or would I further need to modify the command line name after installation? Is atomsk available across all architectures? How can we ImportAlarm
something that's not a python package? Since we're working in atomistics
and not contrib
I'd like to get at least some of these answered before we merge...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing the conda package is enough, but there's only a linux build on conda, not sure if a windows build is possible. Using ImportAlarm
is not possible since it's not a python package, but I could modify the StructureFactory
to only export atomsk
if it is found in the PATH
.
pbc: [ True True True] | ||
cell: | ||
Cell([10.2, 3.6, 3.6]) | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copypasta examples to unit tests folder? Will need to be excluded from the CI until we get the dependencies better sorted, but should at least be there for local machines to run.
Tests and docstrings are in, so this is done from my side. @zhuochengXIE @LVC14C15 Can you have a look if this meets your needs (or is understandable at all)? |
Co-authored-by: Liam Huber <liam.huber@gmail.com>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Did not you do this in https://github.com/eisenforschung/pyiron_mpie/blob/master/pyiron_mpie/interactive/dislocation.py already? I thought we already had an atomsk wrapper, did not we? |
I found one place in |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Previously I used a feature introduced here that is not yet available in the conda version. I have therefore rewritting the part calling atomsk to avoid it. This is now done from my side, unless there's additional feature requests. |
To be future proof I would suggest to update the conda package - I opened a corresponding pull request here conda-forge/atomsk-feedstock#14 - the issues is that they no longer publish tagged releases on Github https://github.com/pierrehirel/atomsk/tags so in case anybody is in contact with the developer that is maybe something we can ask them for. |
I updated the conda package |
from pyiron_atomistics._tests import TestWithProject | ||
from pyiron_atomistics.atomistics.structure.factories.atomsk import AtomskFactory, AtomskError | ||
|
||
if shutil.which("atomsk") is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little uncomfortable hard-coding the executable name (e.g. what if someone has multiple atomsk versions installed and renames them accordingly?) but I don't think it needs to stop the merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, ideally this would somehow reuse the Executable
class that we have already for jobs, so you'd be able to configure your particular atomsk, but I'm drawing a blank how to actually do it right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Latest version is up on conda now. |
This reverts commit 3a6a247.
This will ensure it's only available when installed
I've made it so now, that the code is only exported in the |
It turned out to be quite simple, so I've added it here instead of a new repo. I'll brush up the docstrings a bit and add examples and tests I got from @zhuochengXIE, but the main funtionality is there.