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