@@ -177,7 +177,7 @@ def build_particles(_context=None, _buffer=None, _offset=None, _capacity=None,
177177 assert line is not None
178178 assert mode == 'normalized_transverse'
179179 if isinstance (at_element , str ):
180- at_element = line .element_names .index (at_element )
180+ at_element = line ._element_names_unique .index (at_element )
181181 assert R_matrix is None # Not clear if it is at the element or at start machine
182182 if particle_on_co is not None :
183183 assert particle_on_co ._xobject .at_element == 0
@@ -200,15 +200,15 @@ def build_particles(_context=None, _buffer=None, _offset=None, _capacity=None,
200200 at_element < expected_at_element and
201201 all ([xt ._is_aperture (line .element_dict [nn ], line )
202202 or xt ._behaves_like_drift (line .element_dict [nn ], line )
203- for nn in line .element_names [at_element :expected_at_element ]])), (
203+ for nn in line ._element_names_unique [at_element :expected_at_element ]])), (
204204 "`match_at_s` can only be placed in the drifts downstream of the "
205205 "specified `at_element`. No active element can be present in between."
206206 )
207207 (tracker_rmat , _
208208 ) = xt .twiss ._build_auxiliary_tracker_with_extra_markers (
209209 tracker = line .tracker , at_s = [match_at_s ],
210210 marker_prefix = 'xpart_rmat_' )
211- at_element_line_rmat = tracker_rmat .line .element_names .index (
211+ at_element_line_rmat = tracker_rmat .line ._element_names_unique .index (
212212 'xpart_rmat_0' )
213213 line_rmat = tracker_rmat .line
214214 else :
@@ -227,7 +227,7 @@ def build_particles(_context=None, _buffer=None, _offset=None, _capacity=None,
227227 (at_element_line_rmat if at_element_line_rmat is not None else 0 ))
228228
229229 # This is not initialized by get_twiss_init
230- tw_state .particle_on_co .at_element = line_rmat .element_names .index (
230+ tw_state .particle_on_co .at_element = line_rmat ._element_names_unique .index (
231231 tw_state .element_name )
232232
233233 WW = tw_state .W_matrix
0 commit comments