Skip to content

Commit

Permalink
Merge pull request #1689 from gmatteo/master
Browse files Browse the repository at this point in the history
More informative error message if ase is not installed
  • Loading branch information
shyuep committed Dec 2, 2019
2 parents 5f255e1 + d58fc94 commit 3369633
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pymatgen/io/ase.py
@@ -1,8 +1,6 @@
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.


"""
This module provides conversion between the Atomic Simulation Environment
Atoms object and pymatgen Structure objects.
Expand Down Expand Up @@ -44,6 +42,9 @@ def get_atoms(structure, **kwargs):
"""
if not structure.is_ordered:
raise ValueError("ASE Atoms only supports ordered structures")
if not ase_loaded:
raise ImportError("AseAtomsAdaptor requires ase package.\n"
"Use `pip install ase` or `conda install ase -c conda-forge`")
symbols = [str(site.specie.symbol) for site in structure]
positions = [site.coords for site in structure]
cell = structure.lattice.matrix
Expand Down

0 comments on commit 3369633

Please sign in to comment.