Skip to content

Commit 081aedb

Browse files
authored
Merge pull request #19 from MobleyLab/runtime-improve
Runtime improve
2 parents 63bc2c3 + 446a358 commit 081aedb

File tree

5 files changed

+45
-18
lines changed

5 files changed

+45
-18
lines changed

make_absolute_top_solvent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import parmed as pmd
2-
from SeparatedTopologies import ligand_files as lf
3-
from SeparatedTopologies import rot_bonds as rotbond
2+
import ligand_files as lf
3+
import rot_bonds as rotbond
44
import mdtraj as md
55
import numpy as np
66

make_septop.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,45 @@ def combine_ligands_top(top_A, top_B, septop, ligand='LIG'):
4242

4343
return
4444

45-
def make_section_dictionary(text):
45+
def make_section_dictionaries(text):
4646
# Create dictionary of different section of the topology file
4747

48+
diclist = []
49+
4850
dic = {}
4951
start_section = False
5052

51-
for index, line in enumerate(text):
53+
index=0
54+
while index < len(text):
55+
line = text[index]
56+
5257
# '[ ' marks the start of a section
5358
if '[ ' in line:
54-
if not start_section and index == 0:
59+
if not start_section: #and index == 0:
5560
start_section = True
5661
key = line
5762
dic[key] = []
63+
index+=1
64+
65+
# reset for next section dictionary
5866
else:
5967
# break if already next section
60-
break
68+
diclist.append(dic)
69+
dic = {}
70+
start_section=False
71+
6172
elif start_section:
6273
# append all the lines that belong to that section
6374
dic[key].append(line)
75+
index+=1
76+
77+
else:
78+
index+=1
79+
80+
# append the last section to the diclist
81+
diclist.append(dic)
6482

65-
return dic
83+
return diclist
6684

6785

6886
def create_A_and_B_state_ligand(line, A_B_state='vdwq_q', lig = 1):
@@ -239,9 +257,18 @@ def create_top(in_top, out_top, gamma, A_B_state_ligA, A_B_state_ligB, in_top_A,
239257
count = 0
240258
outtext = []
241259
section = 0
242-
while count < end_text:
243-
# Create dictionary of different sections
244-
dic = make_section_dictionary(text[count:])
260+
261+
262+
# print text does print out the proper file
263+
#print(text)
264+
265+
diclist = make_section_dictionaries(text)
266+
267+
for dic in diclist:
268+
# Create dictionary of different sections
269+
#dic = make_section_dictionary(text[count:])
270+
271+
#print(dic)
245272

246273
count += 1
247274

prep_SepTop_complex.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from SeparatedTopologies import make_septop as ms
2-
from SeparatedTopologies import boresch_restraints as br
3-
from SeparatedTopologies import combine_coordinates as ac
1+
import make_septop as ms
2+
import boresch_restraints as br
3+
import combine_coordinates as ac
44
import os
55
import parmed as pmd
66

prep_SepTop_solvent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from SeparatedTopologies import make_septop as ms
2-
from SeparatedTopologies import boresch_restraints as br
3-
from SeparatedTopologies import combine_coordinates as ac
4-
from SeparatedTopologies import distance_solvent as ds
1+
import make_septop as ms
2+
import boresch_restraints as br
3+
import combine_coordinates as ac
4+
import distance_solvent as ds
55
import os
66
import parmed as pmd
77

prep_solvent_absolute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import parmed as pmd
2-
from SeparatedTopologies import solvent as so
2+
import make_absolute_top_solvent as so
33

44
#Name of project directory
55
dir = ''

0 commit comments

Comments
 (0)