Closed mdforti closed 1 year ago
In a similar manner, I am also getting this warnings,
/scratch/AnacondaEnvironments/anaconda3/envs/nomad/lib/python3.9/site-packages/ase/cell.py:97: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
cell = np.array(cell, float)
and
/scratch/AnacondaEnvironments/anaconda3/envs/nomad/lib/python3.9/site-packages/ase/atoms.py:424: UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
a = np.array(a, dtype, order='C')
but still need to track down the origin - the warning message do not show the exact line causing this and warnings filter in my scripts are not working for some reason.
Thanks @mdforti for reporting these!
Indeed you are right in both cases. We can handle these two issues (#71 and #72) in one go. I would, however, do slight changes to your suggested fixes:
get_number_of_atoms
, we can simply use len(atoms)
as suggested in the ASE docs.array.to(ureg.angstrom)._magnitude
, we can use array.to(ureg.angstrom).magnitude
, which is the public attribute for getting the unitless numpy array.I will prepare a fix and let you know.
This is now fixed in the develop
branch by this commit.
Usage of ase.Atoms.get_number_of_atoms() as for example in
https://github.com/nomad-coe/nomad/blob/develop/nomad/normalizing/common.py#L153
raises a warning:
on a fresh install of nomad package. for example:
https://github.com/nomad-coe/nomad/blob/develop/nomad/normalizing/common.py#L153
this fixes:
https://github.com/nomad-coe/nomad/compare/develop...mdforti:nomad:develop