Skip to content

Commit fbc6d49

Browse files
committed
Merge branch 'linker_length' of github.com:SpakowitzLab/chromo into linker_length
2 parents 18102eb + c3ec209 commit fbc6d49

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

chromo/mc/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ def _polymer_in_field(
156156
elif lt_schedule == "linear increase":
157157
lt_change = twist_schedule.linear_increase(mc_count, num_saves)
158158
elif lt_schedule == "increasing stepwise":
159-
lt_change = twist_schedule.increasing_stepwise(mc_count, num_saves)
159+
lt_change = twist_schedule.step_wise_increase(mc_count, num_saves)
160+
elif lt_schedule == "increasing sawtooth":
161+
lt_change = twist_schedule.increasing_sawtooth(mc_count, num_saves)
160162
elif lt_schedule == "no schedule":
161163
lt_change = twist_schedule.no_schedule()
162164
else:

chromo/run_simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
output_dir = 'output',
131131
mc_move_controllers = moves_to_use,
132132
temperature_schedule = "no schedule",
133-
lt_schedule = "linear increase"
133+
lt_schedule = "logarithmic increase"
134134
)
135135

136136
output_files = os.listdir(latest_sim)

chromo/twist_schedule.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def logarithmic_increase(current_step, total_steps):
3939
result = 0
4040
return result
4141

42-
4342
# for lp
4443
def linear_increase(current_step, total_steps):
4544
max_value = 100
@@ -73,8 +72,6 @@ def increasing_sawtooth(current_step, total_steps):
7372
section_division = np.floor(
7473
current_step / (total_steps / num_sections)) # 10.5 is the section from 20 total sections
7574
if section_division % 2 == 0:
76-
# we are in section 6
77-
# result = result + (current_step%num_sections) - section_division
7875
result = result + (current_step % num_sections) * 4 - section_division - 14
7976
else:
8077
result = result - (current_step % num_sections) * 2.5 - section_division + 46
@@ -86,6 +83,22 @@ def increasing_sawtooth(current_step, total_steps):
8683
result = 0
8784
return result
8885

86+
def increasing_sawtooth(current_step, total_steps):
87+
num_blocks = 10
88+
max_height = 100
89+
step_height = max_height/num_blocks # each step has a height of 10
90+
step_length = total_steps / num_blocks # so 20 is the length
91+
division = current_step/step_length # so if we are at snapshot 105 we get 5.11
92+
ceiling = np.ceil(division) # we are currently on the 6th step
93+
result = step_height * ceiling # this is the height we are at in the 6th block
94+
95+
num_sections = num_blocks * 2 #if we are at 105
96+
section_division = np.floor(current_step/(total_steps/num_sections)) # 10.5 is the section from 20 total sections
97+
if section_division%2 == 0:
98+
result = result + (current_step % num_sections) * 2 - section_division - 20
99+
else:
100+
result = result - (current_step%num_sections)*2 - section_division + 20
101+
return result
89102

90103
def no_schedule():
91104
return 100

chromo/util/temperature_schedule.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ def decreasing_stepwise(current_step, total_steps):
2525

2626
return value
2727
def logarithmic_decrease(current_step, total_steps):
28-
value = 1 - (0.9 ** (current_step / total_steps))
29-
return value
28+
if current_step == 0:
29+
return 1
30+
ratio = current_step/total_steps
31+
result = -1 * np.log(ratio/2)/5.5 -0.1
32+
if result > 1:
33+
result = 1
34+
if result < 0:
35+
result = 0
36+
return result
3037

3138
def linear_decrease(current_step, total_steps):
3239
slope = (0.1 - 1) / total_steps

slurm-32249165.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/scratch/users/ahirsch1/chromo_scratch/chromo/chromo/run_simulation.py:41: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
2+
binders = chromo.binders.make_binder_collection([null_binder]) # gets relevant binder information from binder specified

0 commit comments

Comments
 (0)