File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
openmmdl_simulation/scripts Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ talagayev, NDoering99
2626- Addition of ` CHARM2024 ` forcefield (2025-11-03, PR #163 )
2727
2828### Fixed
29+ - Fixed errors during only ` protein ` simulation (2026-01-22, PR #177 )
2930- Fixed errors during postprocessing in ` post_md_conversion.py ` (2026-01-21, PR #176 )
3031- Fixed 'warinings' import error for 'openmmdlsetup.py' (2026-01-18, PR #173 )
3132- Adjusted the water selection for ` Amber19 ` (2025-12-08, PR #166 )
Original file line number Diff line number Diff line change @@ -1078,6 +1078,9 @@ def write(self, string):
10781078 script .append ("smallMoleculeForceField = '%s'" % session ["smallMoleculeForceField" ])
10791079 script .append ("smallMoleculeForceFieldVersion = '%s'" % session ["smallMoleculeForceFieldVersion" ])
10801080 script .append ("sanitization = %s" % session ["ligandSanitization" ])
1081+ elif session ["sdfFile" ] == "" :
1082+ script .append ("smallMoleculeForceField = None" )
1083+ script .append ("smallMoleculeForceFieldVersion = None" )
10811084 water = session ["waterModel" ]
10821085 elif fileType == "amber" :
10831086 script .append ("""####### Add the Amber Files in the Folder with this Script ####### \n """ )
Original file line number Diff line number Diff line change @@ -104,6 +104,16 @@ def _has_pbc(ts):
104104 dims = np .asarray (dims [:3 ], dtype = float )
105105 return np .all (np .isfinite (dims )) and np .all (dims > 0.0 )
106106
107+ def _can_unwrap (ag ):
108+ """unwrap() needs fragments -> fragments needs bonds."""
109+ if ag .n_atoms == 0 :
110+ return False
111+ try :
112+ _ = ag .fragments # triggers NoDataError if no bonds
113+ return True
114+ except Exception :
115+ return False
116+
107117 def reimage_to_reference (mobile_ag , ref_ag ):
108118 """
109119 Translate mobile_ag so its COM is minimum-image to ref_ag COM.
@@ -185,12 +195,14 @@ def _apply_pre_alignment_transforms(u):
185195
186196 # Make protein whole, keep chains together
187197 if protein .n_atoms :
188- transforms .append (trans .unwrap (protein ))
198+ if _can_unwrap (protein ):
199+ transforms .append (trans .unwrap (protein ))
189200 transforms .append (reimage_segments_to_reference (protein ))
190201
191202 # Keep ligand in same protein image
192203 if lig .n_atoms and protein .n_atoms :
193- transforms .append (trans .unwrap (lig ))
204+ if _can_unwrap (lig ):
205+ transforms .append (trans .unwrap (lig ))
194206 transforms .append (reimage_to_reference (lig , protein ))
195207
196208 # Keep lipids around protein image (optional)
You can’t perform that action at this time.
0 commit comments