Closed arn-all closed 4 years ago
I'm for all of those suggestions.
I made changes to the atom_data load/dump style in preparation of an upcoming atomman 1.3.0 release.
If you have the time, can you test the new atom_data behavior with your files to see that it is correct or if you have any other improvement suggestions?
Hi,
I did different tests with my files, it all worked fine :
I just have two comments :
If we keep ignoring the Masses section of Lammps files (documentation) it would be good to specify it somewhere in the docs (maybe it's somewhere already ?). Parsing the mass section could be a possible improvement, though I'm not sure it's of great interest as those masses could be all taken from mendeleev's table.
The command am.load("atom_data", "")
throws UnboundLocalError: local variable 'i' referenced before assignment
instead of FileNotFoundError. Maybe it could be fixed in uber_open_rmode.py's __enter__.py
method with something like this, but I'm not familiar with the use of context managers so it might be a stupid idea :
file_exists = os.path.isfile(self.data)
if file_exists:
return True
else:
raise FileNotFoundError()
Anyway, THANKS for your work on that !
That's good!
For the masses, I'll make a separate issue and try to tag you on it. The real issue isn't that atom_data ignores the masses, but that atomman can't do anything with the mass values afterwards...
The empty string should now give a FileNotFoundError. With uber_open_rmode, it returns the given string (as a BytesIO) if the isfile(string) fails. This allows the string to be either a file name or a file's contents. The FileNotFoundError is thrown by load atom_data if the returned file-like object has only one line, which would indicate a name rather than content. This might not be perfect under all cases, but seems reasonable for most.
I'll close this one now.
Another improvement to the behaviour of am.load() that I'd like to work on :
Problem
When using am.load() with an incorrectly formatted file, or when providing it a filename that doesn't exist, the error message :
is not the one we'd expect for a missing file.
Steps to reproduce
Comments
load('atom_data')
function into two functions (or more !), in order to separate the data extraction and the creation of the atomman system. Tests and verification of the data integrity would become easier this way in my opinion. What do you think ?