From 334842c207df9a70c53a1308ede4af9d76d4e9f6 Mon Sep 17 00:00:00 2001 From: lunamorrow Date: Tue, 18 Feb 2025 13:44:04 +1000 Subject: [PATCH 1/2] Ignore MDAnalysis PDB writer UserWarnings about missing formalcharge or chainID attributes so users do not have to worry about irrelevant warnings, as these datatypes are not required by PolyConf --- polyconf/polyconf/PDB.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/polyconf/polyconf/PDB.py b/polyconf/polyconf/PDB.py index 2a00895..25553f8 100644 --- a/polyconf/polyconf/PDB.py +++ b/polyconf/polyconf/PDB.py @@ -1,5 +1,5 @@ #!/usr/bin/env python - +import warnings import MDAnalysis as mda class PDB: @@ -53,6 +53,10 @@ def save(self, dummies="X*", fname="polymer", selectionString = None, gmx = Fals defaults to False :type gmx: bool, optional """ + # ignore MDAnalysis "UserWarning: Found no information for attr: 'formalcharges' Using default value of '0'" + warnings.simplefilter('ignore', category=UserWarning, lineno=1154) + # ignore MDAnalysis "UserWarning: Found missing chainIDs. Corresponding atoms will use value of 'X'" + warnings.simplefilter('ignore', category=UserWarning, lineno=1201) if selectionString: if gmx: self.select_atoms(f"{selectionString} and not name {dummies}").atoms._write(f"{fname}.gro") From 8f4e6917bf1f93457e58cb84dd3d563e3d04977a Mon Sep 17 00:00:00 2001 From: lunamorrow Date: Tue, 18 Feb 2025 14:25:13 +1000 Subject: [PATCH 2/2] Add bandaid fix to make sure that dihedral_solver() fails gracefully and doesn't loop forever if the first dihedral cannot be resolved --- polyconf/polyconf/Polymer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/polyconf/polyconf/Polymer.py b/polyconf/polyconf/Polymer.py index 5c6d925..f123f79 100644 --- a/polyconf/polyconf/Polymer.py +++ b/polyconf/polyconf/Polymer.py @@ -446,6 +446,7 @@ def dihedral_solver(self,pairlist,dummies='X*',cutoff=0.7,backwards_only=True): if i==0: # yes, and this is the first monomer failed=True done=True + i=-1 # force exit from while loops upon failure else: # yes, and this is not the first monomer #print(i,tries[i]) retry=True