@@ -92,6 +92,7 @@ def modify_top(
92
92
gro : Optional [str ] = None ,
93
93
residuetypes : Optional [str ] = None ,
94
94
radicals : Optional [list [int ]] = None ,
95
+ search_amber_rad : bool = True ,
95
96
):
96
97
"""Modify topology in various ways.
97
98
@@ -115,7 +116,11 @@ def modify_top(
115
116
non-amber atom types.
116
117
radicals
117
118
Radicals in the system PRIOR to removing hydrogens with the removeH
118
- option. One based.
119
+ option. One based. Can be detected automatically in amber topologies.
120
+ search_amber_rad
121
+ Automatic radical search only implemented for amber. If you do use
122
+ another ff, set this to false, and provide a list of radicals
123
+ manually, if necessary.
119
124
"""
120
125
121
126
top_path = Path (topology ).with_suffix (".top" ).resolve ()
@@ -154,7 +159,7 @@ def modify_top(
154
159
print ("Reading topology.." , end = "" )
155
160
top = Topology (
156
161
read_top (top_path ),
157
- radicals = " " .join (radicals ),
162
+ radicals = " " .join (radicals ) if search_amber_rad else None ,
158
163
residuetypes_path = residuetypes_path ,
159
164
)
160
165
print ("Done" )
@@ -264,6 +269,15 @@ def get_modify_top_cmdline_args() -> argparse.Namespace:
264
269
"compatible gro/top file pair. Output analog to top." ,
265
270
type = str ,
266
271
)
272
+ parser .add_argument (
273
+ "-a" ,
274
+ "--search_amber_rad" ,
275
+ action = "store_true" ,
276
+ help = "Automatic radical search only implemented for amber. If you do"
277
+ "use another ff, set this to false, and provide a list of radicals"
278
+ "manually, if necessary." ,
279
+ default = True ,
280
+ )
267
281
parser .add_argument (
268
282
"-t" ,
269
283
"--residuetypes" ,
@@ -285,13 +299,14 @@ def entry_point_modify_top():
285
299
args = get_modify_top_cmdline_args ()
286
300
287
301
modify_top (
288
- args .top ,
289
- args .out ,
290
- args .parameterize ,
291
- args .removeH ,
292
- args .gro ,
293
- args .residuetypes ,
294
- args .radicals ,
302
+ topology = args .top ,
303
+ out = args .out ,
304
+ parameterize = args .parameterize ,
305
+ removeH = args .removeH ,
306
+ gro = args .gro ,
307
+ residuetypes = args .residuetypes ,
308
+ radicals = args .radicals ,
309
+ search_amber_rad = args .search_amber_rad ,
295
310
)
296
311
297
312
0 commit comments