Skip to content

Commit f448eaf

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 87f9cfa + f29de65 commit f448eaf

File tree

5 files changed

+38
-26
lines changed

5 files changed

+38
-26
lines changed

GMXMMPBSA/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,8 +1274,16 @@ def get_iec2entropy(self, from_calc):
12741274
allowed_met = ['gb', 'pb', 'rism std', 'rism gf', 'rism pcplus', 'gbnsr6']
12751275
if self.INPUT['general']['interaction_entropy']:
12761276
self.calc_types.normal['ie'] = {}
1277+
if self.INPUT['ala']['alarun']:
1278+
self.calc_types.mutant['ie'] = {}
1279+
if not self.INPUT['ala']['mutant_only']:
1280+
self.calc_types.mut_norm['ie'] = {}
12771281
if self.INPUT['general']['c2_entropy']:
12781282
self.calc_types.normal['c2'] = {}
1283+
if self.INPUT['ala']['alarun']:
1284+
self.calc_types.mutant['c2'] = {}
1285+
if not self.INPUT['ala']['mutant_only']:
1286+
self.calc_types.mut_norm['c2'] = {}
12791287

12801288
for key in allowed_met:
12811289
if self.INPUT['general']['interaction_entropy']:

GMXMMPBSA/make_top.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,8 @@ def check_structures(self, com_str, rec_str=None, lig_str=None):
12761276
'based on the reference structure. Please check that the reference structure is '
12771277
'correct')
12781278
com_str.residues[c].chain = res.chain
1279+
# update the chain id (https://github.com/Valdes-Tresanco-MS/gmx_MMPBSA/issues/354)
1280+
self.resl[c].chain = res.chain
12791281
i = self.resl[c].id_index - 1
12801282
if self.resl[c].is_receptor():
12811283
rec_str.residues[i].chain = res.chain

GMXMMPBSA/output_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def write_outputs(app):
178178
final_output.add_section(ie_dict['mutant'][key].summary_output())
179179
ie_inconsistent = ie_dict['mutant'][key]['sigma'] > 3.6
180180

181-
if INPUT['ala']['alarun'] and not INPUT['mutant_only']:
181+
if INPUT['ala']['alarun'] and not INPUT['ala']['mutant_only']:
182182
final_output.writeline(f'Delta ( Mutant - Normal ) [ Δ(-TΔS) ]')
183183
final_output.writeline('ENTROPY RESULTS (INTERACTION ENTROPY):')
184184
for key in allowed_met:

GMXMMPBSA/utils.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -423,34 +423,36 @@ def get_indexes(com_ndx, rec_ndx=None, lig_ndx=None):
423423

424424

425425
def _get_dup_args(args):
426-
flags_values_list = []
427-
cv = []
428-
current_flag = None
429-
for o in args:
426+
flag_index = []
427+
flags = []
428+
429+
for i, o in enumerate(args):
430430
if o.startswith('-'):
431-
if current_flag:
432-
flags_values_list.append([current_flag, cv])
433-
current_flag = o
434-
cv = []
435-
else:
436-
cv.append(o)
431+
flag_index.append(i)
432+
flags.append(o)
437433

438434
opt_duplicates = []
439-
args_duplicates = []
440-
flags = [a[0] for a in flags_values_list]
441-
442-
for x in flags:
443-
if flags.count(x) > 1 and x not in opt_duplicates:
444-
opt_duplicates.append(x)
435+
flags_values = {}
436+
for i, f in enumerate(flags):
437+
if flags.count(f) > 1 and f not in opt_duplicates:
438+
opt_duplicates.append(f)
439+
if i == len(flags) - 1:
440+
flags_values[f] = [args[x] for x in range(flag_index[i] + 1, len(args))]
441+
print('tets')
442+
elif flag_index[i] - flag_index[i+1]:
443+
flags_values[f] = [args[x] for x in range(flag_index[i]+1, flag_index[i+1])]
444+
else:
445+
flags_values[f] = []
445446

446447
if opt_duplicates:
447448
GMXMMPBSA_ERROR('Several options are duplicated in the command-line...\n'
448449
f"Duplicated options:\n\t{', '.join(opt_duplicates)}")
449450

450-
flags_values_dict = dict(flags_values_list)
451+
args_duplicates = []
451452
unique_args = []
452453
inverted_args_dict = {}
453-
for k, v in flags_values_dict.items():
454+
for k, v in flags_values.items():
455+
# skip this options since they can share the same group number/name
454456
if k in ['-cg', '-rg', '-lg']:
455457
continue
456458
for a in v:
@@ -460,8 +462,8 @@ def _get_dup_args(args):
460462
else:
461463
args_duplicates.append([k, a])
462464

463-
text_out = '\n'.join([f"\t{inverted_args_dict[a]} {' '.join(flags_values_dict[inverted_args_dict[a]])} <---> "
464-
f"{k} {' '.join(flags_values_dict[k])}"
465+
text_out = '\n'.join([f"\t{inverted_args_dict[a]} {' '.join(flags_values[inverted_args_dict[a]])} <---> "
466+
f"{k} {' '.join(flags_values[k])}"
465467
for k, a in args_duplicates])
466468
if args_duplicates:
467469
GMXMMPBSA_ERROR('Several args are duplicated in the command-line...\n'
@@ -669,8 +671,7 @@ def selector(selection: str):
669671
for r in resl:
670672
rr = r.split('-')
671673
if len(rr) == 1:
672-
ci = rr[0].split(':')
673-
ri = [chain, int(ci[0]), ''] if len(ci) == 1 else [chain, int(ci[0]), ci[1]]
674+
ri = [chain, int(rr[0]), ''] if rr[0][-1] not in ascii_letters else [chain, int(rr[0][:-1]), rr[0][-1]]
674675
if ri in res_selections:
675676
logging.warning('Found duplicated residue in selection: CHAIN:{} RES_NUM:{} ICODE: '
676677
'{}'.format(*ri))

docs/input_file.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,8 @@ the same used for `print_res` variable in `&decomp` namelist.
710710
insertion code are contained in the range
711711

712712
**Individual selection**
713-
: `qm_residues="A/5,6:B,6:C,7` Will treat with quantum mechanic all mentioned residues except the
714-
residues A:6:A and A:6:D from chain A
713+
: `qm_residues="A/5,6B,6C,7` Will treat with quantum mechanic all mentioned residues except the
714+
residues 6A and 6D from chain A
715715

716716
**Multiple chain selection**
717717
: `qm_residues="A/5-10,100 B/34,56` Will treat with quantum mechanic residues 5 through 10, and 100 from
@@ -1877,7 +1877,8 @@ sufficient in most cases, however we have added several additional notations
18771877
contained in the range
18781878

18791879
**Individual selection**
1880-
: `print_res="A/5,6:B,6:C,7 B/25` Will print all mentioned residues except the residues A:6:A and A:6:D
1880+
: `print_res="A/5,6B,6C,7 B/25` Will print all mentioned residues except the residues 6A and
1881+
6D from chain A
18811882

18821883
=== "Wrong notation"
18831884
`print_res="A/5-6B,6D-7` Will end in error.

0 commit comments

Comments
 (0)