From 2548e9523f6d94b6770a6f679c754203a90a47af Mon Sep 17 00:00:00 2001 From: Berk Onat <b.onat@warwick.ac.uk> Date: Tue, 12 Dec 2017 17:10:24 +0000 Subject: [PATCH] Update Readme file and main routine to match new improvements. --- README.md | 13 +++++++++++++ pymolfile/pymolfile.py | 18 +++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 9aea7d7..a24361e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,17 @@ # pymolfile + +#### Version: 0.0.3 +What is new? +* Added script to change printf/fprintf to stdout and stderr at C level on molfile plugins to make the package compatiable with NOMAD parsers. +* Added "nowarnings" option to OpenMolfile to prevent user warnings. + +Anything in mind for additional improvements? +* C level silencing modifications are mandatory. This might be optional with a setup.py parameter. +* pymolfile only supports read fucntions at plugins. Write functions might also be added to convert data to other formats. + +Needs precaution when using? +* Recursive initialization of OpenMolfile leads to breaks at trajectory class when an outer calling function fails (Ex: in MDDataAccess package) since trajectory file can still be open and can not be closed properly without a delete call. + #### Version: 0.0.2 Python interface for molfile plugins. diff --git a/pymolfile/pymolfile.py b/pymolfile/pymolfile.py index 7396a23..f1dcaa5 100644 --- a/pymolfile/pymolfile.py +++ b/pymolfile/pymolfile.py @@ -512,9 +512,10 @@ class OpenMolfile(object): self.kwords["silent"]) #libpymolfile.molfile_finish() else: - warnings.warn("Pymolfile can not find a plugin to open the '" + - self.kwords["topology_format"] + "' file format of the file " + - self.kwords["topology"]) + if self.kwords["nowarnings"] is True: + warnings.warn("Pymolfile can not find a plugin to open the '" + + self.kwords["topology_format"] + "' file format of the file " + + self.kwords["topology"]) if self.fplugin[1][5] == 1: num_atoms = 0 @@ -531,8 +532,9 @@ class OpenMolfile(object): num_atoms, self.kwords["silent"]) else: - warnings.warn("Pymolfile can not find a plugin to open the '" + self.kwords["file_format"] + - "' file format of the file " + self.kwords["file_name"]) + if self.kwords["nowarnings"] is True: + warnings.warn("Pymolfile can not find a plugin to open the '" + self.kwords["file_format"] + + "' file format of the file " + self.kwords["file_name"]) def initialize_settings(self): #global MOLFILE_PLUGINS @@ -553,7 +555,8 @@ class OpenMolfile(object): "topology_format" : None, "topology_plugin" : None, "natoms" : None, - "silent" : False + "silent" : False, + "nowarnings" : False } #if not C_MOLFILE_PLUGINS: @@ -574,7 +577,8 @@ class OpenMolfile(object): "topology_format" : None, "topology_plugin" : None, "natoms" : None, - "silent" : False + "silent" : False, + "nowarnings" : False }) def __del__(self): -- GitLab