@@ -1102,7 +1102,8 @@ def make_upccgsd_ansatz(self,
1102
1102
assume_real : bool = True ,
1103
1103
hcb_optimization : bool = None ,
1104
1104
spin_adapt_singles : bool = True ,
1105
- neglect_z = False ,
1105
+ neglect_z : bool = False ,
1106
+ mix_sd : bool = False ,
1106
1107
* args , ** kwargs ):
1107
1108
"""
1108
1109
UpGCCSD Ansatz similar as described by Lee et. al.
@@ -1127,6 +1128,10 @@ def make_upccgsd_ansatz(self,
1127
1128
assume_real
1128
1129
assume a real wavefunction (that is always the case if the reference state is real)
1129
1130
reduces potential gradient costs from 4 to 2
1131
+ mix_sd
1132
+ Changes the ordering from first all doubles and then all singles excitations (DDDDD....SSSS....) to
1133
+ a mixed order (DS-DS-DS-DS-...) where one DS pair acts on the same MOs. Useful to consider when systems
1134
+ with high electronic correlation and system high error associated with the no Trotterized UCC.
1130
1135
Returns
1131
1136
-------
1132
1137
UpGCCSD ansatz
@@ -1167,7 +1172,8 @@ def make_upccgsd_ansatz(self,
1167
1172
raise Exception (
1168
1173
"name={}, Singles can't be realized without mapping back to the standard encoding leave S or HCB out of the name" .format (
1169
1174
name ))
1170
-
1175
+ if hcb_optimization and mix_sd :
1176
+ raise TequilaException ("Mixed SD can not be employed together with HCB Optimization" )
1171
1177
# convenience
1172
1178
S = "S" in name .upper ()
1173
1179
D = "D" in name .upper ()
@@ -1178,7 +1184,8 @@ def make_upccgsd_ansatz(self,
1178
1184
if include_reference :
1179
1185
U = self .prepare_reference ()
1180
1186
U += self .make_upccgsd_layer (include_singles = S , include_doubles = D , indices = indices , assume_real = assume_real ,
1181
- label = (label , 0 ), spin_adapt_singles = spin_adapt_singles , * args , ** kwargs )
1187
+ label = (label , 0 ), mix_sd = mix_sd , spin_adapt_singles = spin_adapt_singles , * args ,
1188
+ ** kwargs )
1182
1189
else :
1183
1190
U = QCircuit ()
1184
1191
if include_reference :
@@ -1197,12 +1204,14 @@ def make_upccgsd_ansatz(self,
1197
1204
1198
1205
for k in range (1 , order ):
1199
1206
U += self .make_upccgsd_layer (include_singles = S , include_doubles = D , indices = indices , label = (label , k ),
1200
- spin_adapt_singles = spin_adapt_singles , neglect_z = neglect_z )
1207
+ spin_adapt_singles = spin_adapt_singles , neglect_z = neglect_z , mix_sd = mix_sd )
1201
1208
1202
1209
return U
1203
1210
1204
- def make_upccgsd_layer (self , indices , include_singles = True , include_doubles = True , assume_real = True , label = None ,
1205
- spin_adapt_singles : bool = True , angle_transform = None , mix_sd = False , neglect_z = False , * args ,
1211
+ def make_upccgsd_layer (self , indices , include_singles : bool = True , include_doubles : bool = True ,
1212
+ assume_real : bool = True , label = None ,
1213
+ spin_adapt_singles : bool = True , angle_transform = None , mix_sd : bool = False ,
1214
+ neglect_z : bool = False , * args ,
1206
1215
** kwargs ):
1207
1216
U = QCircuit ()
1208
1217
for idx in indices :
@@ -1220,7 +1229,7 @@ def make_upccgsd_layer(self, indices, include_singles=True, include_doubles=True
1220
1229
indices = ((2 * idx [0 ], 2 * idx [1 ]), (2 * idx [0 ] + 1 , 2 * idx [1 ] + 1 )),
1221
1230
assume_real = assume_real , ** kwargs )
1222
1231
if include_singles and mix_sd :
1223
- U += self .make_upccgsd_singles (indices = [idx ], assume_real = assume_real , label = label ,
1232
+ U += self .make_upccgsd_singles (indices = [( idx ,) ], assume_real = assume_real , label = label ,
1224
1233
spin_adapt_singles = spin_adapt_singles , angle_transform = angle_transform ,
1225
1234
neglect_z = neglect_z )
1226
1235
0 commit comments