3838 description = "final state for this transition" ,
3939)
4040
41+ def mistis_trans_info_param_builder (dcts ):
42+ default = 'volume-interface-set' # TODO: make this flexible?
43+ trans_info = []
44+ volume_compiler = compiler_for ("volume" )
45+ interface_set_compiler = compiler_for ('interface_set' )
46+ for dct in dcts :
47+ dct = dct .copy ()
48+ dct ['type' ] = dct .get ('type' , default )
49+ initial_state = volume_compiler (dct .pop ('initial_state' ))
50+ final_state = volume_compiler (dct .pop ('final_state' ))
51+ interface_set = interface_set_compiler (dct )
52+ trans_info .append ((initial_state , interface_set , final_state ))
53+
54+ return trans_info
55+
56+
57+ MISTIS_INTERFACE_SETS_PARAM = Parameter (
58+ 'interface_sets' , mistis_trans_info_param_builder ,
59+ json_type = json_type_list (json_type_ref ('interface-set' )),
60+ description = 'interface sets for MISTIS'
61+ )
4162
42- build_interface_set = InterfaceSetPlugin (
63+ # this is reused in the simple single TIS setup
64+ VOLUME_INTERFACE_SET_PARAMS = [
65+ Parameter ('cv' , compiler_for ('cv' ), json_type = json_type_ref ('cv' ),
66+ description = ("the collective variable for this interface "
67+ "set" )),
68+ Parameter ('minvals' , custom_eval ,
69+ json_type = json_type_list (json_type_eval ("Float" )),
70+ description = ("minimum value(s) for interfaces in this"
71+ "interface set" )),
72+ Parameter ('maxvals' , custom_eval ,
73+ json_type = json_type_list (json_type_eval ("Float" )),
74+ description = ("maximum value(s) for interfaces in this"
75+ "interface set" )),
76+ ]
77+
78+
79+ VOLUME_INTERFACE_SET_PLUGIN = InterfaceSetPlugin (
4380 builder = Builder ('openpathsampling.VolumeInterfaceSet' ),
44- parameters = [
45- Parameter ('cv' , compiler_for ('cv' ), json_type = json_type_ref ('cv' ),
46- description = ("the collective variable for this interface "
47- "set" )),
48- Parameter ('minvals' , custom_eval ,
49- json_type = json_type_list (json_type_eval ("Float" )),
50- description = ("minimum value(s) for interfaces in this"
51- "interface set" )),
52- Parameter ('maxvals' , custom_eval ,
53- json_type = json_type_list (json_type_eval ("Float" )),
54- description = ("maximum value(s) for interfaces in this"
55- "interface set" )),
56- ],
57- name = 'interface-set' ,
81+ parameters = VOLUME_INTERFACE_SET_PARAMS ,
82+ name = 'volume-interface-set' ,
5883 description = "Interface set used in transition interface sampling." ,
5984)
6085
6186
6287def mistis_trans_info (dct ):
6388 dct = dct .copy ()
64- transitions = dct .pop ('transitions' )
65- volume_compiler = compiler_for ('volume' )
66- trans_info = [
67- (
68- volume_compiler (trans ['initial_state' ]),
69- build_interface_set (trans ['interfaces' ]),
70- volume_compiler (trans ['final_state' ])
71- )
72- for trans in transitions
73- ]
74- dct ['trans_info' ] = trans_info
89+ dct ['trans_info' ] = dct .pop ('interface_sets' )
7590 return dct
7691
7792
78- def tis_trans_info (dct ):
79- # remap TIS into MISTIS format
80- dct = dct .copy ()
81- initial_state = dct .pop ('initial_state' )
82- final_state = dct .pop ('final_state' )
83- interface_set = dct .pop ('interfaces' )
84- dct ['transitions' ] = [{'initial_state' : initial_state ,
85- 'final_state' : final_state ,
86- 'interfaces' : interface_set }]
87- return mistis_trans_info (dct )
88-
89-
9093TPS_NETWORK_PLUGIN = NetworkCompilerPlugin (
9194 builder = Builder ('openpathsampling.TPSNetwork' ),
9295 parameters = [INITIAL_STATES_PARAM , FINAL_STATES_PARAM ],
@@ -96,18 +99,27 @@ def tis_trans_info(dct):
9699)
97100
98101
99- # MISTIS_NETWORK_PLUGIN = NetworkCompilerPlugin(
100- # parameters=[Parameter('trans_info', mistis_trans_info)],
101- # builder=Builder('openpathsampling.MISTISNetwork'),
102- # name='mistis'
103- # )
102+ MISTIS_NETWORK_PLUGIN = NetworkCompilerPlugin (
103+ parameters = [MISTIS_INTERFACE_SETS_PARAM ],
104+ builder = Builder ('openpathsampling.MISTISNetwork' ,
105+ remapper = mistis_trans_info ),
106+ name = 'mistis'
107+ )
104108
109+ def single_tis_builder (initial_state , final_state , cv , minvals , maxvals ):
110+ import openpathsampling as paths
111+ interface_set = paths .VolumeInterfaceSet (cv , minvals , maxvals )
112+ return paths .MISTISNetwork ([
113+ (initial_state , interface_set , final_state )
114+ ])
115+
116+ TIS_NETWORK_PLUGIN = NetworkCompilerPlugin (
117+ builder = single_tis_builder ,
118+ parameters = ([INITIAL_STATE_PARAM , FINAL_STATE_PARAM ]
119+ + VOLUME_INTERFACE_SET_PARAMS ),
120+ name = 'tis'
121+ )
105122
106- # TIS_NETWORK_PLUGIN = NetworkCompilerPlugin(
107- # builder=Builder('openpathsampling.MISTISNetwork'),
108- # parameters=[Parameter('trans_info', tis_trans_info)],
109- # name='tis'
110- # )
111123
112124# old names not yet replaced in testing THESE ARE WHY WE'RE DOUBLING! GET
113125# RID OF THEM! (also, use an is-check)
0 commit comments