/* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- This file is part of the MGPT implementation. See further comments in pair_mgpt.cpp and pair_mgpt.h. ------------------------------------------------------------------------- */ #include "mgpt_splinetab.h" static void trisolve(int n,double A[][3],double y[]) { /* Backward elimination */ for(int i = n-1; i>0; i--) { double q = A[i-1][2] / A[i][1]; A[i-1][1] = A[i-1][1] - q*A[i][0]; y[i-1] = y[i-1] - q*y[i]; } /* Forward substitution */ y[0] = y[0] / A[0][1]; for(int i = 1; i n-1) idx = n-1; xhat = xhat - idx; p = C[idx]; if(0) { *y = p[0] + xhat*(p[1] + xhat*(p[2] + xhat*p[3])); *dy = p[1] + xhat*(2*p[2] + xhat*3*p[3]); *d2y = 2*p[2] + xhat*6*p[3]; *dy *= dxinv; *d2y *= dxinv*dxinv; } else { t1 = p[2] + xhat*p[3]; t2 = p[1] + xhat*t1; t3 = t1 + xhat*p[3]; *y = p[0] + xhat*t2; *dy = (t2 + xhat*t3)*dxinv; *d2y = 2.0*(t3 + xhat*p[3])*(dxinv*dxinv); } }