IMP logo
IMP Reference Guide  2.20.0
The Integrative Modeling Platform
make_cfg.py
1 #!/usr/bin/env python
2 from __future__ import print_function
3 import IMP
4 from IMP.npctransport import create_range, Configuration
5 import sys
6 
7 if len(sys.argv) > 1:
8  outfile = sys.argv[1]
9 else:
10  outfile = IMP.create_temporary_file_name("config", "pb")
11 
12 
13 def get_basic_config():
14  config = Configuration()
15  IMP.npctransport.set_default_configuration(config)
16  config.statistics_fraction.lower = 0.9
17  # config.dump_interval = 1
18  config.interaction_k.lower = 10
19  config.interaction_range.lower = 1
20  # create_range(config.backbone_k, .2, 1, 10
21  config.backbone_k.lower = 1
22  # config.time_step_factor.lower = 0.3
23  config.time_step_factor.lower = 3
24  # create_range(config.rest_length_factor, .5, 1, 10)
25  config.excluded_volume_k.lower = 20
26  config.nonspecific_range.lower = 2
27  config.nonspecific_k.lower = 0.01
28  config.slack.lower = 8
29  config.number_of_trials = 1
30  config.dump_interval_ns = 0.1
31  config.simulation_time_ns = 500
32  # increased dynamic viscosity relative to water?
33  config.angular_D_factor.lower = 0.3
34  config.statistics_interval_ns = 0.05
35 
36  # simulation bounding volumes:
37  config.box_is_on.lower = 1
38  config.box_side.lower = 400
39  config.slab_is_on.lower = 0
40  config.slab_thickness.lower = 150
41  config.tunnel_radius.lower = 75
42  return config
43 
44 
45 def add_interactions_for_fg(fg_name,
46  k_kap_lower,
47  k_kap_upper=0, # relevant only if k_kap_steps > 1
48  k_kap_steps=1):
49  interactionFG_KAP = IMP.npctransport.add_interaction(
50  config, name0=fg_name, name1="my_kap", interaction_k=k_kap_lower,
51  interaction_range=2)
52  if k_kap_steps > 1:
53  create_range(interactionFG_KAP.interaction_k,
54  k_kap_lower, k_kap_upper,
55  steps=k_kap_steps)
56  # interactionFG_CRAP = IMP.npctransport.add_interaction(
57  # config, name0=fg_name, name1="my_crap", interaction_k=0,
58  # interaction_range=0)
59 
60 
61 # ********* MAIN: *********
62 try:
63  import google.protobuf
64 except ImportError:
65  print('npctransport python module requires the python protobuf package.\n'
66  'One way to install the protobuf python package is using pip '
67  '- "pip install protobuf" on a local'
68  ' python installation, see documentation of pip.')
69  exit(-1)
70 config = get_basic_config()
71 config.dump_interval_ns = 1
72 config.simulation_time_ns = 0.01
73 config.box_is_on.lower = 1
74 config.box_side.lower = 200
75 config.slab_is_on.lower = 0
76 config.slab_thickness.lower = 150
77 config.tunnel_radius.lower = 90
78 
79 fg = IMP.npctransport.add_fg_type(config,
80  type_name="my_fg",
81  number_of_beads=4,
82  number=1,
83  radius=6,
84  interactions=1,
85  rest_length_factor=1.5)
86 kap = IMP.npctransport.add_float_type(config,
87  type_name="my_kap",
88  number=1,
89  radius=25,
90  interactions=12)
91 nonspecifics = IMP.npctransport.add_float_type(config,
92  type_name="my_crap",
93  number=1,
94  radius=25,
95  interactions=0)
96 ###########
97 # fg with kaps / craps
98 add_interactions_for_fg("my_fg",
99  k_kap_lower=1,
100  k_kap_upper=20,
101  k_kap_steps=15)
102 #############
103 
104 # non-specific attraction
105 config.nonspecific_range.lower = 1.0
106 config.nonspecific_k.lower = 1.5
107 # create_range(config.nonspecific_range, 0.1, 2, steps=3)
108 # create_range(config.nonspecific_k, 0.1, 10, steps=5)
109 
110 # internal FG-FG
111 interactionFG_FG = IMP.npctransport.add_interaction(config,
112  name0="my_fg",
113  name1="my_fg",
114  interaction_k=1.5,
115  interaction_range=2)
116 ##############
117 create_range(interactionFG_FG.interaction_k, 1, 20, steps=15)
118 ##############
119 
120 # dump to file
121 f = open(outfile, "wb")
122 f.write(config.SerializeToString())
123 print(config)
std::string create_temporary_file_name(std::string prefix="imp_temp", std::string suffix="")
Create a temporary file.