Writing Debug PDBs/GRO broken
Here we define open only if deferred file writing is true. However, that means open is undefined if it is not because open is declared as local variable. 

https://github.com/marrink-lab/vermouth-martinize/blob/16de64e3f391a6ee1d3ed91ddeaa7352eece8e2e/vermouth/pdb/pdb.py#L583-L586
diff --git a/vermouth/gmx/gro.py b/vermouth/gmx/gro.py
index c242a78..68d7fdb 100644
--- a/vermouth/gmx/gro.py
+++ b/vermouth/gmx/gro.py
@@ -142,6 +142,8 @@ def write_gro(system, file_name, precision=7, title='Martinized!', box=(0, 0, 0)
 
     if defer_writing:
         open = deferred_open
+    else:
+        from builtins import open
     with open(str(file_name), 'w') as out:
         out.write(title + '\\n')  # Title
         out.write(formatter.format('{}\\n', system.num_particles))  # number of atoms
diff --git a/vermouth/pdb/pdb.py b/vermouth/pdb/pdb.py
index 1add284..eb32875 100644
--- a/vermouth/pdb/pdb.py
+++ b/vermouth/pdb/pdb.py
@@ -582,5 +582,10 @@ def write_pdb(system, path, conect=True, omit_charges=True, nan_missing_pos=Fals
     """
     if defer_writing:
         open = deferred_open
+    else:
+        # This is needed since the variable assignment above declares `open` as
+        # a local variable, which means it won't be looked up from the global
+        # namespace any more.
+        from builtins import open
     with open(path, 'w') as out:
         out.write(write_pdb_string(system, conect, omit_charges, nan_missing_pos))
['vermouth/gmx/gro.py', 'vermouth/pdb/pdb.py']