-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from JuDFTteam/release-0.14.0
🚀 Release `0.14.0`
- Loading branch information
Showing
64 changed files
with
1,663 additions
and
90 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" | ||
Import all the command groups to include in the cli | ||
""" | ||
from . import (fleur_schema, parse, plot, tools) | ||
from . import (convert_inpgen, fleur_schema, parse, plot, tools) |
This file contains 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
CLI commands for converting common structure definition formats to fleur inpgen files | ||
""" | ||
from .root import cli | ||
import click | ||
|
||
from pathlib import Path | ||
import os | ||
|
||
from masci_tools.cmdline.utils import echo | ||
|
||
try: | ||
import pymatgen | ||
from pymatgen.core import Structure | ||
except ImportError: | ||
pymatgen = None | ||
|
||
try: | ||
import ase | ||
from ase.io import read, write | ||
except ImportError: | ||
ase = None | ||
|
||
|
||
@cli.command('convert-inpgen') | ||
@click.argument('input-file', type=click.Path(exists=True, path_type=Path, resolve_path=True)) | ||
@click.argument('output-file', type=click.Path(path_type=Path, resolve_path=True)) | ||
@click.option('-c', | ||
'--converter', | ||
type=click.Choice(['ase', 'pymatgen']), | ||
help='Which library is used to read in the given file format', | ||
default='pymatgen') | ||
def convert_inpgen(input_file, output_file, converter): | ||
"""Convert the given file to an fleur inpgen file | ||
""" | ||
|
||
input_file = os.fspath(input_file) | ||
output_file = os.fspath(output_file) | ||
|
||
if converter == 'ase': | ||
if ase is None: | ||
echo.echo_critical('ase is not installed. Please install the packages ase and ase-fleur') | ||
|
||
atoms = read(input_file) | ||
write(output_file, atoms, format='fleur-inpgen') | ||
elif converter == 'pymatgen': | ||
if pymatgen is None: | ||
echo.echo_critical('pymatgen is not installed. Please install the packages pymatgen and pymatgen-io-fleur') | ||
|
||
struc = Structure.from_file(os.fspath(input_file)) | ||
struc.to(output_file, fmt='fleur-inpgen') |
This file contains 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
This file contains 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
Oops, something went wrong.