Skip to content

Commit

Permalink
add array to flare_atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
YuuuXie committed Oct 19, 2020
1 parent ff41ecd commit f577a67
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions flare/ase/atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,22 @@ def from_ase_atoms(atoms):
"info",
"velocities",
]

# The keywords are either the attr of atoms, or in dict atoms.arrays
kwargs = {}
for key in kw:
try:
kwargs[key] = getattr(atoms, key)
except:
if key in atoms.arrays:
kwargs[key] = atoms.arrays[key]
kwargs[key] = atoms.get_array(key)
kwargs["calculator"] = atoms.calc
return FLARE_Atoms(**kwargs)
new_atoms = FLARE_Atoms(**kwargs)

for key in atoms.arrays:
new_atoms.set_array(key, atoms.get_array(key))

return new_atoms

@property
def nat(self):
Expand Down

0 comments on commit f577a67

Please sign in to comment.