24
24
import numpy as np
25
25
from scipy .optimize import linprog
26
26
27
- from atomdb .utils import DEFAULT_DATAPATH , DEFAULT_REMOTE , DEFAULT_DATASET , MULTIPLICITIES
28
27
from atomdb .periodic import element_number , element_symbol
29
28
from atomdb .species import load
29
+ from atomdb .utils import DEFAULT_DATAPATH , DEFAULT_DATASET , DEFAULT_REMOTE , MULTIPLICITIES
30
30
31
31
__all__ = [
32
32
"Promolecule" ,
@@ -566,6 +566,10 @@ def make_promolecule(
566
566
Promolecule instance.
567
567
568
568
"""
569
+ # Convert single coord [x, y, z] to list of coords [[x, y, z]]
570
+ coords = np .asarray (coords , dtype = float )
571
+ if coords .ndim == 1 :
572
+ coords = coords .reshape (1 , - 1 )
569
573
# Check coordinate units
570
574
if units is None or units .lower () == "bohr" :
571
575
coords = [coord / 1 for coord in coords ]
@@ -574,9 +578,12 @@ def make_promolecule(
574
578
else :
575
579
raise ValueError (f"Invalid `units` parameter '{ units } '; " "must be 'bohr' or 'angstrom'" )
576
580
581
+ # Convert single atnum to list of atnums [atnum]
582
+ if isinstance (atnums , (Integral , str )):
583
+ atnums = [atnums ]
577
584
# Get atomic symbols/numbers from inputs
578
- atoms = [element_symbol (atom ) for atom in atnums ]
579
585
atnums = [element_number (atom ) for atom in atnums ]
586
+ atoms = [element_symbol (atom ) for atom in atnums ]
580
587
581
588
# Handle default charge parameters
582
589
if charges is None :
0 commit comments