	/** 3-particle S state laplacian in interparticle coordinates **/

/*K: laplacian */
/*A: John Gottschalk */
/*S: Universtiy of Western Australia	*/
/*D: April 1986 */
/*P: Three files, XSymbols, XLapdata and XDerivdata, are loaded. They are
	to be created by the user to taylor this file (XLaplacianS) to his/her
	needs. XSymbols should contain a list of any user-defined symbols 
	written in terms of interparticle coordinates. Usually these are
	best listed as assignments but sometimes entries in the form of
	substitutions are preferred. This will be necessary in situations	
	when the evaluation of differential operators ignores the 
	user-defined expressions and applies SMP's internal routines 
	instead. XLapdata should contain extra definitions for the Laplacian 
	operator, for example LapS[Log[r12 (2r^2-r12^2)^(1/2)-r1^2+r2^2]] : 0.
	XDerivdata should contain extra definitions needed for D[$$x] and 
	Dt[$$x]. In addition symbols which are constant with respect to 
	differentiation should be included in this file. */

LapS_:Tier

Loadonce[XSymbols]
Loadonce[XLapdata]
Loadonce[XDerivdata]

/*: LapS[$expr]
	applies the S-state 3-particle Laplacian operator to $expr. If
	$expr is not a single term, but is a group of terms added, divided
	or multiplied together, rules are used to apply the Laplacian to 
	the individual terms. */ 
LapS[$e]::(Dt[$e,{r1,2}]+Dt[$e,{r2,2}]+2 Dt[$e,{r12,2}] + 2/r1 Dt[$e,r1] \
+ 2/r2 Dt[$e,r2] + 4/r12 Dt[$e,r12] + \
 (r1^2-r2^2+r12^2)/r1/r12 Dt[Dt[$e,r1],r12]    + \
 (r2^2-r1^2+r12^2)/r2/r12 Dt[Dt[$e,r2],r12])

LapS[$e_=$e[0] = 'Mult] :: Ap[$f LapS[$g]+$g LapS[$f] + \
 2 Dt[$f,r1] Dt[$g,r1] + 2 Dt[$f,r2] Dt[$g,r2] + 4 Dt[$f,r12] Dt[$g,r12] + \
 (r1^2-r2^2+r12^2)/(r1 r12) (Dt[$f,r1] Dt[$g,r12] + Dt[$f,r12] Dt[$g,r1]) + \
 (r2^2-r1^2+r12^2)/(r2 r12) (Dt[$f,r2] Dt[$g,r12] + Dt[$f,r12] Dt[$g,r2]), \
 {$e[1],$e/$e[1]}]

LapS[$e_=($e[0] = 'Div) & ~P[Num[$e]=1]] :: Ap[$f LapS[$g]+$g LapS[$f] + \
 2 Dt[$f,r1] Dt[$g,r1] + 2 Dt[$f,r2] Dt[$g,r2] + 4 Dt[$f,r12] Dt[$g,r12] + \
 (r1^2-r2^2+r12^2)/(r1 r12) (Dt[$f,r1] Dt[$g,r12] + Dt[$f,r12] Dt[$g,r1]) + \
 (r2^2-r1^2+r12^2)/(r2 r12) (Dt[$f,r2] Dt[$g,r12] + Dt[$f,r12] Dt[$g,r2]), \
 {Num[$e],1/Den[$e]}]

LapS[$e_=$e[0] = 'Plus] :: Map[LapS,$e]
LapS[$x_=Nc[$x]~=1] :: LapS[$x/Nc[$x]] Nc[$x]

/* The following definitions are needed to show the coordinates (r1,r2,r12) 
	are independent. */
Dt[r2,r1]  : 0
Dt[r12,r1] : 0
Dt[r1,r12] : 0
Dt[r2,r12] : 0
Dt[r12,r2] : 0
Dt[r1,r2]  : 0

