-
Notifications
You must be signed in to change notification settings - Fork 115
[WIP] Add auto_ncl to VaspJob
#369
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
Draft
mkhorton
wants to merge
2
commits into
materialsproject:master
Choose a base branch
from
mkhorton:patch-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,8 +80,10 @@ def __init__( | |
| backup=True, | ||
| auto_npar=False, | ||
| auto_gamma=True, | ||
| auto_ncl=True, | ||
| settings_override=None, | ||
| gamma_vasp_cmd=None, | ||
| ncl_vasp_cmd=None, | ||
| copy_magmom=False, | ||
| auto_continue=False, | ||
| update_incar=False, | ||
|
|
@@ -114,10 +116,19 @@ def __init__( | |
| auto_gamma (bool): Whether to automatically check if run is a | ||
| Gamma 1x1x1 run, and whether a Gamma optimized version of | ||
| VASP exists with ".gamma" appended to the name of the VASP | ||
| executable (typical setup in many systems). If so, run the | ||
| executable or with "gamma" replacing "std" in the name of | ||
| the VASP executable (typical setup in many systems). If so, run the | ||
| gamma optimized version of VASP instead of regular VASP. You | ||
| can also specify the gamma vasp command using the | ||
| gamma_vasp_cmd argument if the command is named differently. | ||
| auto_ncl (bool): Whether to automatically check if run is a | ||
| non-collinear run, and whether a non-collinear version of | ||
| VASP exists with ".ncl" appended to the name of the VASP | ||
| executable or "ncl" replacing "std" in the name of the VASP | ||
| executable (typical setup in many systems). If so, run the | ||
| the non-collinear version of VASP instead of regular VASP. You | ||
| can also specify the ncl vasp command using the ncl_vasp_cmd | ||
| argument if the command is named differently. | ||
| settings_override ([dict]): An ansible style list of dict to | ||
| override changes. For example, to set ISTART=1 for subsequent | ||
| runs and to copy the CONTCAR to the POSCAR, you will provide:: | ||
|
|
@@ -129,6 +140,10 @@ def __init__( | |
| auto_gamma is True. Should follow the list style of | ||
| subprocess. Defaults to None, which means ".gamma" is added | ||
| to the last argument of the standard vasp_cmd. | ||
| ncl_vasp_cmd (str): Command for non-collinear vasp version when | ||
| auto_ncl is True. Should follow the list style of subprocess. | ||
| Defaults to none, which means "ncl" will replace "std" in | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VASP ships as vasp_ncl so that should probably be what is used. |
||
| the last argument of the standard vasp_cmd. | ||
| copy_magmom (bool): Whether to copy the final magmom from the | ||
| OUTCAR to the next INCAR. Useful for multi-relaxation runs | ||
| where the CHGCAR and WAVECAR are sometimes deleted (due to | ||
|
|
@@ -153,7 +168,9 @@ def __init__( | |
| self.settings_override = settings_override | ||
| self.auto_npar = auto_npar | ||
| self.auto_gamma = auto_gamma | ||
| self.auto_ncl = auto_ncl | ||
| self.gamma_vasp_cmd = tuple(gamma_vasp_cmd) if gamma_vasp_cmd else None | ||
| self.ncl_vasp_cmd = tuple(ncl_vasp_cmd) if ncl_vasp_cmd else None | ||
| self.copy_magmom = copy_magmom | ||
| self.auto_continue = auto_continue | ||
| self.update_incar = update_incar | ||
|
|
@@ -265,6 +282,15 @@ def run(self, directory="./"): | |
| cmd = self.gamma_vasp_cmd | ||
| elif which(cmd[-1] + ".gamma"): | ||
| cmd[-1] += ".gamma" | ||
| if self.auto_ncl: | ||
| vi = VaspInput.from_directory(directory) | ||
| if vi["INCAR"].get("LNONCOLLINEAR") or vi["INCAR"].get("LSORBIT"): | ||
| if self.ncl_vasp_cmd is not None and which(self.ncl_vasp_cmd[-1]): # pylint: disable=E1136 | ||
| cmd = self.ncl_vasp_cmd | ||
| elif which(cmd[-1] + ".ncl"): | ||
| cmd[-1] += ".ncl" | ||
| elif which(cmd[-1].replace("std", "ncl")): | ||
| cmd[-1] = cmd[-1].replace("std", "ncl") | ||
| logger.info(f"Running {' '.join(cmd)}") | ||
| with ( | ||
| open(os.path.join(directory, self.output_file), "w") as f_std, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@mkhorton: I think this is very smart to do, seeing as VASP ships it this way (and not with
.gamma). I don't see the change made to the source code though, so if that's the case, just a head's up!