@@ -2654,23 +2654,26 @@ degenerately ordered (e.g. there are duplicates in the lists so that
26542654(* zero out integrals that don't conserve spin quantum numbers *)
26552655(* 1-body *)
26562656result = result /. SQM [OHead [op__ ],particleIndex [bra1_ String ,particleSpace [bra1space__ ,bra1spin_ particleSpin ],bra1rest_ ],particleIndex [ket1_ String ,particleSpace [ket1space__ ,ket1spin_ particleSpin ],ket1rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ],SQM [OHead [op ],particleIndex [bra1 ,particleSpace [bra1space ,bra1spin ],bra1rest ],particleIndex [ket1 ,particleSpace [ket1space ,ket1spin ],ket1rest ]],0 ];
2657- result = result /. SQS [particleIndex [bra1_ String ,particleSpace [bra1space__ , bra1spin_ particleSpin ], bra1rest_ ],particleIndex [ket1_ String ,particleSpace [ket1space__ , ket1spin_ particleSpin ], ket1rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ],SQS [particleIndex [bra1 ,particleSpace [bra1space , bra1spin ], bra1rest ],particleIndex [ket1 ,particleSpace [ket1space , ket1spin ], ket1rest ]],0 ];
2657+ result = result /. SQS [particleIndex [ket1_ String ,particleSpace [ket1space__ , ket1spin_ particleSpin ], ket1rest_ ],particleIndex [bra1_ String ,particleSpace [bra1space__ , bra1spin_ particleSpin ], bra1rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ],SQS [particleIndex [ket1 ,particleSpace [ket1space , ket1spin ], ket1rest ],particleIndex [bra1 ,particleSpace [bra1space , bra1spin ], bra1rest ]],0 ];
26582658result = result /. rhoIndex [particleIndex [bra1_ String ,particleSpace [bra1space__ ,bra1spin_ particleSpin ],bra1rest___ ],particleIndex [ket1_ String ,particleSpace [ket1space__ ,ket1spin_ particleSpin ],ket1rest___ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ],rhoIndex [particleIndex [bra1 ,particleSpace [bra1space ,bra1spin ],bra1rest ],particleIndex [ket1 ,particleSpace [ket1space ,ket1spin ],ket1rest ]],1 ];
26592659result = result /. deltaIndex [particleIndex [bra1_ String ,particleSpace [bra1space__ ,bra1spin_ particleSpin ],bra1rest___ ],particleIndex [ket1_ String ,particleSpace [ket1space__ ,ket1spin_ particleSpin ],ket1rest___ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ],rhoIndex [particleIndex [bra1 ,particleSpace [bra1space ,bra1spin ],bra1rest ],particleIndex [ket1 ,particleSpace [ket1space ,ket1spin ],ket1rest ]],0 ];
26602660(* 2-body ... N.B. SQM and SQS are canonically ordered, hence can just match spins within columns *)
26612661result = result /. SQM [OHead [label_ String ,indexSymm [0 ]],particleIndex [bra1_ String ,particleSpace [bra1space__ ,bra1spin_ particleSpin ],bra1rest_ ],particleIndex [bra2_ String ,particleSpace [bra2space__ ,bra2spin_ particleSpin ],bra2rest_ ],particleIndex [ket1_ String ,particleSpace [ket1space__ ,ket1spin_ particleSpin ],ket1rest_ ],particleIndex [ket2_ String ,particleSpace [ket2space__ ,ket2spin_ particleSpin ],ket2rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ]&& Ms [bra2spin ]== Ms [ket2spin ],SQM [OHead [label ,indexSymm [0 ]],particleIndex [bra1 ,particleSpace [bra1space ,bra1spin ],bra1rest ],particleIndex [bra2 ,particleSpace [bra2space ,bra2spin ],bra2rest ],particleIndex [ket1 ,particleSpace [ket1space ,ket1spin ],ket1rest ],particleIndex [ket2 ,particleSpace [ket2space ,ket2spin ],ket2rest ]],0 ];
2662- result = result /. SQS [particleIndex [bra1_ String ,particleSpace [bra1space__ , bra1spin_ particleSpin ], bra1rest_ ],particleIndex [bra2_ String ,particleSpace [bra2space__ , bra2spin_ particleSpin ], bra2rest_ ],particleIndex [ket1_ String ,particleSpace [ket1space__ , ket1spin_ particleSpin ], ket1rest_ ],particleIndex [ket2_ String ,particleSpace [ket2space__ , ket2spin_ particleSpin ], ket2rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ]&& Ms [bra2spin ]== Ms [ket2spin ],SQS [particleIndex [bra1 ,particleSpace [bra1space , bra1spin ], bra1rest ],particleIndex [bra2 ,particleSpace [bra2space , bra2spin ], bra2rest ],particleIndex [ket1 ,particleSpace [ket1space , ket1spin ], ket1rest ],particleIndex [ket2 ,particleSpace [ket2space , ket2spin ], ket2rest ]],0 ];
2662+ result = result /. SQS [particleIndex [ket1_ String ,particleSpace [ket1space__ , ket1spin_ particleSpin ], ket1rest_ ],particleIndex [ket2_ String ,particleSpace [ket2space__ , ket2spin_ particleSpin ], ket2rest_ ],particleIndex [bra2_ String ,particleSpace [bra2space__ , bra2spin_ particleSpin ], bra2rest_ ],particleIndex [bra1_ String ,particleSpace [bra1space__ , bra1spin_ particleSpin ], bra1rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ]&& Ms [bra2spin ]== Ms [ket2spin ],SQS [particleIndex [ket1 ,particleSpace [ket1space , ket1spin ], ket1rest ],particleIndex [ket2 ,particleSpace [ket2space , ket2spin ], ket2rest ],particleIndex [bra2 ,particleSpace [bra2space , bra2spin ], bra2rest ],particleIndex [bra1 ,particleSpace [bra1space , bra1spin ], bra1rest ]],0 ];
26632663(* 3-body ... N.B. see above *)
26642664result = result /. SQM [OHead [label_ String ,indexSymm [0 ]],particleIndex [bra1_ String ,particleSpace [bra1space__ ,bra1spin_ particleSpin ],bra1rest_ ],particleIndex [bra2_ String ,particleSpace [bra2space__ ,bra2spin_ particleSpin ],bra2rest_ ],
26652665particleIndex [bra3_ String ,particleSpace [bra3space__ ,bra3spin_ particleSpin ],bra3rest_ ],particleIndex [ket1_ String ,particleSpace [ket1space__ ,ket1spin_ particleSpin ],ket1rest_ ],particleIndex [ket2_ String ,particleSpace [ket2space__ ,ket2spin_ particleSpin ],ket2rest_ ],
26662666particleIndex [ket3_ String ,particleSpace [ket3space__ ,ket3spin_ particleSpin ],ket3rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ]&& Ms [bra2spin ]== Ms [ket2spin ]&& Ms [bra3spin ]== Ms [ket3spin ],SQM [OHead [label ,indexSymm [0 ]],particleIndex [bra1 ,particleSpace [bra1space ,bra1spin ],bra1rest ],particleIndex [bra2 ,particleSpace [bra2space ,bra2spin ],bra2rest ],
26672667particleIndex [bra3 ,particleSpace [bra3space ,bra3spin ],bra3rest ],particleIndex [ket1 ,particleSpace [ket1space ,ket1spin ],ket1rest ],particleIndex [ket2 ,particleSpace [ket2space ,ket2spin ],ket2rest ],
26682668particleIndex [ket3 ,particleSpace [ket3space ,ket3spin ],ket3rest ]],0 ];
2669- result = result /. SQS [particleIndex [bra1_ String ,particleSpace [bra1space__ ,bra1spin_ particleSpin ],bra1rest_ ],particleIndex [bra2_ String ,particleSpace [bra2space__ ,bra2spin_ particleSpin ],bra2rest_ ],
2670- particleIndex [bra3_ String ,particleSpace [bra3space__ ,bra3spin_ particleSpin ],bra3rest_ ],particleIndex [ket1_ String ,particleSpace [ket1space__ ,ket1spin_ particleSpin ],ket1rest_ ],particleIndex [ket2_ String ,particleSpace [ket2space__ ,ket2spin_ particleSpin ],ket2rest_ ],
2671- particleIndex [ket3_ String ,particleSpace [ket3space__ ,ket3spin_ particleSpin ],ket3rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ]&& Ms [bra2spin ]== Ms [ket2spin ]&& Ms [bra3spin ]== Ms [ket3spin ],SQS [particleIndex [bra1 ,particleSpace [bra1space ,bra1spin ],bra1rest ],particleIndex [bra2 ,particleSpace [bra2space ,bra2spin ],bra2rest ],
2672- particleIndex [bra3 ,particleSpace [bra3space ,bra3spin ],bra3rest ],particleIndex [ket1 ,particleSpace [ket1space ,ket1spin ],ket1rest ],particleIndex [ket2 ,particleSpace [ket2space ,ket2spin ],ket2rest ],
2673- particleIndex [ket3 ,particleSpace [ket3space ,ket3spin ],ket3rest ]],0 ];
2669+ result = result /. SQS [particleIndex [ket1_ String ,particleSpace [ket1space__ ,ket1spin_ particleSpin ],ket1rest_ ],
2670+ particleIndex [ket2_ String ,particleSpace [ket2space__ ,ket2spin_ particleSpin ],ket2rest_ ],
2671+ particleIndex [ket3_ String ,particleSpace [ket3space__ ,ket3spin_ particleSpin ],ket3rest_ ],
2672+ particleIndex [bra3_ String ,particleSpace [bra3space__ ,bra3spin_ particleSpin ],bra3rest_ ],
2673+ particleIndex [bra2_ String ,particleSpace [bra2space__ ,bra2spin_ particleSpin ],bra2rest_ ],
2674+ particleIndex [bra1_ String ,particleSpace [bra1space__ ,bra1spin_ particleSpin ],bra1rest_ ]]-> If [Ms [bra1spin ]== Ms [ket1spin ]&& Ms [bra2spin ]== Ms [ket2spin ]&& Ms [bra3spin ]== Ms [ket3spin ],SQS [particleIndex [ket1 ,particleSpace [ket1space ,ket1spin ],ket1rest ],particleIndex [ket2 ,particleSpace [ket2space ,ket2spin ],ket2rest ],
2675+ particleIndex [ket3 ,particleSpace [ket3space ,ket3spin ],ket3rest ],
2676+ particleIndex [bra3 ,particleSpace [bra3space ,bra3spin ],bra3rest ],particleIndex [bra2 ,particleSpace [bra2space ,bra2spin ],bra2rest ],particleIndex [bra1 ,particleSpace [bra1space ,bra1spin ],bra1rest ]],0 ];
26742677result = Expand [result ];
26752678
26762679If [ SeQuantDebugLevel >= 2 ,Print ["in spintrace: after zeroing out spin-nonconserving integrals = " ,TraditionalForm [result ]];
0 commit comments