SIRIUS
SIRIUS copied to clipboard
add size check / simplify vec_from_str
Use std::stof
, std::stod
in vec_from_str
, these function throw an error if an element cannot be converted. Afaik the istream_iterator will just stop at the first non-convertible element (std::stod
throws std::invalid_argument
).
Also adding some cosmetic changes which were lost in the review of https://github.com/electronic-structure/SIRIUS/pull/980
-
is_upf_file
, only check last 4 characters (not the entire upf file passed as string) -
static_cast
instead of c-style cast - add sanity check for d_ion matrix size
cscs-ci run default
cscs-ci run default
@abussy I changed a bit logic for is_upf_file(). Can you please check if this version or my version is better?
Where can I find your version @toxa81 ?
Where can I find your version @toxa81 ?
In the merge conflict src/unit_cell/atom_type.cpp
@abussy I changed a bit logic for is_upf_file(). Can you please check if this version or my version is better?
I have no strong opinion on this tbh, both implementations seem functional to me
@toxa81 My version avoided to check the entire string (which might be an entire UPF file of several MB). Seems better to me to only check the last 4 characters.
@toxa81 My version avoided to check the entire string (which might be an entire UPF file of several MB). Seems better to me to only check the last 4 characters.
It was breaking for zero size input string. I didn't think of a large byte string that is not a file name.
@simonpintarelli I changed is_upf_file().. hopefully for better :)