@@ -72,60 +72,60 @@ def default(cls, interface=None) -> SurfactantLayer:
72
72
@classmethod
73
73
def from_pars (
74
74
cls ,
75
- layer1_chemical_structure : str ,
76
- layer1_thickness : float ,
77
- layer1_solvent : Material ,
78
- layer1_solvation : float ,
79
- layer1_area_per_molecule : float ,
80
- layer1_roughness : float ,
81
- layer2_chemical_structure : str ,
82
- layer2_thickness : float ,
83
- layer2_solvent : Material ,
84
- layer2_solvation : float ,
85
- layer2_area_per_molecule : float ,
86
- layer2_roughness : float ,
75
+ top_layer_chemical_structure : str ,
76
+ top_layer_thickness : float ,
77
+ top_layer_solvent : Material ,
78
+ top_layer_solvation : float ,
79
+ top_layer_area_per_molecule : float ,
80
+ top_layer_roughness : float ,
81
+ bottom_layer_chemical_structure : str ,
82
+ bottom_layer_thickness : float ,
83
+ bottom_layer_solvent : Material ,
84
+ bottom_layer_solvation : float ,
85
+ bottom_layer_area_per_molecule : float ,
86
+ bottom_layer_roughness : float ,
87
87
name : str = 'EasySurfactantLayer' ,
88
88
interface = None ,
89
89
) -> SurfactantLayer :
90
90
"""
91
91
Constructor for the surfactant layer where the parameters are known,
92
- :py:attr:`layer1 ` is that which the neutrons interact with first.
92
+ :py:attr:`top_layer ` is that which the neutrons interact with first.
93
93
94
- :param layer1_chemical_structure : Chemical formula for first layer
95
- :param layer1_thickness : Thicknkess of first layer
96
- :param layer1_solvent : Solvent in first layer
97
- :param layer1_solvation : Fractional solvation of first layer by
98
- :py:attr:`layer1_solvent `
99
- :param layer1_area_per_molecule : Area per molecule of first layer
100
- :param layer1_roughness : Roughness of first layer
101
- :param layer2_chemical_structure : Chemical formula for second layer
102
- :param layer2_thickness : Thicknkess of second layer
103
- :param layer2_solvent : Solvent in second layer
104
- :param layer2_solvation : Fractional solvation of second layer by
105
- :py:attr:`layer2_solvent `
106
- :param layer2_area_per_molecule : Area per molecule of second layer
107
- :param layer2_roughness : Roughness of second layer
94
+ :param top_layer_chemical_structure : Chemical formula for first layer
95
+ :param top_layer_thickness : Thicknkess of first layer
96
+ :param top_layer_solvent : Solvent in first layer
97
+ :param top_layer_solvation : Fractional solvation of first layer by
98
+ :py:attr:`top_layer_solvent `
99
+ :param top_layer_area_per_molecule : Area per molecule of first layer
100
+ :param top_layer_roughness : Roughness of first layer
101
+ :param bottom_layer_chemical_structure : Chemical formula for second layer
102
+ :param bottom_layer_thickness : Thicknkess of second layer
103
+ :param bottom_layer_solvent : Solvent in second layer
104
+ :param bottom_layer_solvation : Fractional solvation of second layer by
105
+ :py:attr:`bottom_layer_solvent `
106
+ :param bottom_layer_area_per_molecule : Area per molecule of second layer
107
+ :param bottom_layer_roughness : Roughness of second layer
108
108
:param name: Name for surfactant layer
109
109
"""
110
- layer1 = LayerApm .from_pars (
111
- layer1_chemical_structure ,
112
- layer1_thickness ,
113
- layer1_solvent ,
114
- layer1_solvation ,
115
- layer1_area_per_molecule ,
116
- layer1_roughness ,
117
- name = name + ' Layer 1 ' ,
110
+ top_layer = LayerApm .from_pars (
111
+ top_layer_chemical_structure ,
112
+ top_layer_thickness ,
113
+ top_layer_solvent ,
114
+ top_layer_solvation ,
115
+ top_layer_area_per_molecule ,
116
+ top_layer_roughness ,
117
+ name = name + ' Top Layer ' ,
118
118
)
119
- layer2 = LayerApm .from_pars (
120
- layer2_chemical_structure ,
121
- layer2_thickness ,
122
- layer2_solvent ,
123
- layer2_solvation ,
124
- layer2_area_per_molecule ,
125
- layer2_roughness ,
126
- name = name + ' Layer 2 ' ,
119
+ bottom_layer = LayerApm .from_pars (
120
+ bottom_layer_chemical_structure ,
121
+ bottom_layer_thickness ,
122
+ bottom_layer_solvent ,
123
+ bottom_layer_solvation ,
124
+ bottom_layer_area_per_molecule ,
125
+ bottom_layer_roughness ,
126
+ name = name + ' Bottom Layer ' ,
127
127
)
128
- return cls ([layer1 , layer2 ], name , interface )
128
+ return cls ([top_layer , bottom_layer ], name , interface )
129
129
130
130
@property
131
131
def constrain_apm (self ) -> bool :
@@ -178,54 +178,56 @@ def constrain_solvent_roughness(self, solvent_roughness: Parameter):
178
178
def constain_multiple_contrast (
179
179
self ,
180
180
another_contrast : 'SurfactantLayer' ,
181
- layer1_thickness : bool = True ,
182
- layer2_thickness : bool = True ,
183
- layer1_area_per_molecule : bool = True ,
184
- layer2_area_per_molecule : bool = True ,
185
- layer1_fraction : bool = True ,
186
- layer2_fraction : bool = True ,
181
+ top_layer_thickness : bool = True ,
182
+ bottom_layer_thickness : bool = True ,
183
+ top_layer_area_per_molecule : bool = True ,
184
+ bottom_layer_area_per_molecule : bool = True ,
185
+ top_layer_fraction : bool = True ,
186
+ bottom_layer_fraction : bool = True ,
187
187
):
188
188
"""
189
189
Constrain structural parameters between surfactant layer objects.
190
190
191
191
:param another_contrast: The surfactant layer to constrain
192
192
"""
193
- if layer1_thickness :
194
- layer1_thickness_constraint = ObjConstraint (self .top_layer .thickness , '' , another_contrast .top_layer .thickness )
195
- another_contrast .top_layer .thickness .user_constraints [f'{ another_contrast .name } ' ] = layer1_thickness_constraint
196
- if layer2_thickness :
197
- layer2_thickness_constraint = ObjConstraint (
193
+ if top_layer_thickness :
194
+ top_layer_thickness_constraint = ObjConstraint (self .top_layer .thickness , '' , another_contrast .top_layer .thickness )
195
+ another_contrast .top_layer .thickness .user_constraints [f'{ another_contrast .name } ' ] = top_layer_thickness_constraint
196
+ if bottom_layer_thickness :
197
+ bottom_layer_thickness_constraint = ObjConstraint (
198
198
self .bottom_layer .thickness , '' , another_contrast .bottom_layer .thickness
199
199
)
200
- another_contrast .bottom_layer .thickness .user_constraints [f'{ another_contrast .name } ' ] = layer2_thickness_constraint
201
- if layer1_area_per_molecule :
202
- layer1_area_per_molecule_constraint = ObjConstraint (
200
+ another_contrast .bottom_layer .thickness .user_constraints [
201
+ f'{ another_contrast .name } '
202
+ ] = bottom_layer_thickness_constraint
203
+ if top_layer_area_per_molecule :
204
+ top_layer_area_per_molecule_constraint = ObjConstraint (
203
205
self .top_layer .area_per_molecule , '' , another_contrast .top_layer .area_per_molecule
204
206
)
205
207
another_contrast .top_layer .area_per_molecule .user_constraints [
206
208
f'{ another_contrast .name } '
207
- ] = layer1_area_per_molecule_constraint
208
- if layer2_area_per_molecule :
209
- layer2_area_per_molecule_constraint = ObjConstraint (
209
+ ] = top_layer_area_per_molecule_constraint
210
+ if bottom_layer_area_per_molecule :
211
+ bottom_layer_area_per_molecule_constraint = ObjConstraint (
210
212
self .bottom_layer .area_per_molecule , '' , another_contrast .bottom_layer .area_per_molecule
211
213
)
212
214
another_contrast .bottom_layer .area_per_molecule .user_constraints [
213
215
f'{ another_contrast .name } '
214
- ] = layer2_area_per_molecule_constraint
215
- if layer1_fraction :
216
- layer1_fraction_constraint = ObjConstraint (
216
+ ] = bottom_layer_area_per_molecule_constraint
217
+ if top_layer_fraction :
218
+ top_layer_fraction_constraint = ObjConstraint (
217
219
self .top_layer .material .fraction , '' , another_contrast .top_layer .material .fraction
218
220
)
219
221
another_contrast .top_layer .material .fraction .user_constraints [
220
222
f'{ another_contrast .name } '
221
- ] = layer1_fraction_constraint
222
- if layer2_fraction :
223
- layer2_fraction_constraint = ObjConstraint (
223
+ ] = top_layer_fraction_constraint
224
+ if bottom_layer_fraction :
225
+ bottom_layer_fraction_constraint = ObjConstraint (
224
226
self .bottom_layer .material .fraction , '' , another_contrast .bottom_layer .material .fraction
225
227
)
226
228
another_contrast .bottom_layer .material .fraction .user_constraints [
227
229
f'{ another_contrast .name } '
228
- ] = layer2_fraction_constraint
230
+ ] = bottom_layer_fraction_constraint
229
231
230
232
@property
231
233
def _dict_repr (self ) -> dict :
0 commit comments