Commit 883f6d1e authored by julient31's avatar julient31
Browse files

Commit1 JT 072619

- corrected warnings in cg and lbfgs
- removed unused variables in spin/dipole pair styles
parent f9ed12be
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -512,7 +512,8 @@ void MinSpinOSO_CG::rodrigues_rotation(const double *upp_tr, double *out)
void MinSpinOSO_CG::vm3(const double *m, const double *v, double *out)
{
  for(int i = 0; i < 3; i++){
    out[i] *= 0.0;
    //out[i] *= 0.0;
    out[i] = 0.0;
    for(int j = 0; j < 3; j++)
    out[i] += *(m + 3 * j + i) * v[j];
  }
@@ -627,7 +628,8 @@ int MinSpinOSO_CG::awc(double der_phi_0, double phi_0, double der_phi_j, double
  double sigma = 0.9;

  if ((phi_j<=phi_0+eps*fabs(phi_0)) &&
      ((2.0*delta-1.0) * der_phi_0>=der_phi_j>=sigma*der_phi_0))
      ((2.0*delta-1.0) * der_phi_0>=der_phi_j) &&
      (der_phi_j>=sigma*der_phi_0))
    return 1;
  else
    return 0;
+6 −6
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ static const char cite_minstyle_spin_oso_lbfgs[] =
/* ---------------------------------------------------------------------- */

MinSpinOSO_LBFGS::MinSpinOSO_LBFGS(LAMMPS *lmp) :
  Min(lmp), g_old(NULL), g_cur(NULL), p_s(NULL), ds(NULL), dy(NULL), rho(NULL), sp_copy(NULL)
  Min(lmp), g_old(NULL), g_cur(NULL), p_s(NULL), rho(NULL), ds(NULL), dy(NULL), sp_copy(NULL)
{
  if (lmp->citeme) lmp->citeme->add(cite_minstyle_spin_oso_lbfgs);
  nlocal_max = 0;
@@ -345,7 +345,6 @@ void MinSpinOSO_LBFGS::calc_search_direction()
  double sq_global = 0.0;
  double yy_global = 0.0;
  double yr_global = 0.0;
  double beta_global = 0.0;

  int m_index = local_iter % num_mem; // memory index
  int c_ind = 0;
@@ -520,8 +519,6 @@ void MinSpinOSO_LBFGS::advance_spins()
{
  int nlocal = atom->nlocal;
  double **sp = atom->sp;
  double **fm = atom->fm;
  double tdampx, tdampy, tdampz;
  double rot_mat[9]; // exponential of matrix made of search direction
  double s_new[3];

@@ -648,7 +645,8 @@ void MinSpinOSO_LBFGS::rodrigues_rotation(const double *upp_tr, double *out)
void MinSpinOSO_LBFGS::vm3(const double *m, const double *v, double *out)
{
  for(int i = 0; i < 3; i++){
    out[i] *= 0.0;
    //out[i] *= 0.0;
    out[i] = 0.0;
    for(int j = 0; j < 3; j++)
    out[i] += *(m + 3 * j + i) * v[j];
  }
@@ -762,7 +760,9 @@ int MinSpinOSO_LBFGS::awc(double der_phi_0, double phi_0, double der_phi_j, doub
  double delta = 0.1;
  double sigma = 0.9;

  if ((phi_j<=phi_0+eps*fabs(phi_0)) && ((2.0*delta-1.0) * der_phi_0>=der_phi_j>=sigma*der_phi_0))
  if ((phi_j<=phi_0+eps*fabs(phi_0)) && 
     ((2.0*delta-1.0) * der_phi_0>=der_phi_j) &&
     (der_phi_j>=sigma*der_phi_0))
    return 1;
  else
    return 0;
+10 −10
Original line number Diff line number Diff line
@@ -37,10 +37,9 @@ class MinSpinOSO_LBFGS: public Min {
    int ireplica,nreplica; 	// for neb
    double *spvec;		// variables for atomic dof, as 1d vector
    double *fmvec;		// variables for atomic dof, as 1d vector
    double *g_cur;  	// current gradient vector
    double *g_old;  		// gradient vector at previous step
    double *g_cur;  		// current gradient vector
    double *p_s;  		// search direction vector
    double **sp_copy;   // copy of the spins
    int local_iter;     	// for neb
    int nlocal_max;		// max value of nlocal (for size of lists)

@@ -59,9 +58,10 @@ class MinSpinOSO_LBFGS: public Min {
    int use_line_search; 	// use line search or not.
    double maxepsrot;

    double *rho;        // estimation of curvature
    double **ds;	// change in rotation matrix between two iterations, da
    double **dy;        // change in gradients between two iterations, dg
    double *rho;        // estimation of curvature
    double **sp_copy;	// copy of the spins
    int num_mem;        // number of stored steps
    bigint last_negative;
};
+1 −1
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ void PairSpinDipoleCut::compute(int eflag, int vflag)
void PairSpinDipoleCut::compute_single_pair(int ii, double fmi[3])
{
  int j,jnum,itype,jtype,ntypes; 
  int *ilist,*jlist,*numneigh,**firstneigh;  
  int *jlist,*numneigh,**firstneigh;  
  double rsq,rinv,r2inv,r3inv,local_cut2;
  double xi[3],rij[3],eij[3],spi[4],spj[4];

+1 −4
Original line number Diff line number Diff line
@@ -355,10 +355,9 @@ void PairSpinDipoleLong::compute(int eflag, int vflag)

void PairSpinDipoleLong::compute_single_pair(int ii, double fmi[3])
{
  //int i,j,jj,jnum,itype,jtype;  
  int j,jj,jnum,itype,jtype,ntypes; 
  int k,locflag;
  int *ilist,*jlist,*numneigh,**firstneigh;  
  int *jlist,*numneigh,**firstneigh;  
  double r,rinv,r2inv,rsq,grij,expm2,t,erfc;
  double local_cut2,pre1,pre2,pre3;
  double bij[4],xi[3],rij[3],eij[3],spi[4],spj[4];
@@ -368,7 +367,6 @@ void PairSpinDipoleLong::compute_single_pair(int ii, double fmi[3])
  double **sp = atom->sp;	
  double **fm_long = atom->fm_long;

  ilist = list->ilist;
  numneigh = list->numneigh;
  firstneigh = list->firstneigh;
  
@@ -406,7 +404,6 @@ void PairSpinDipoleLong::compute_single_pair(int ii, double fmi[3])
    // computation of the exchange interaction
    // loop over neighbors of atom i
      
    //i = ilist[ii];
    xi[0] = x[ii][0];
    xi[1] = x[ii][1];
    xi[2] = x[ii][2];