forked from lijiext/lammps
Commit1 JT 072619
- corrected warnings in cg and lbfgs - removed unused variables in spin/dipole pair styles
This commit is contained in:
parent
f9ed12be4f
commit
883f6d1e8d
|
@ -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)
|
void MinSpinOSO_CG::vm3(const double *m, const double *v, double *out)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 3; i++){
|
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++)
|
for(int j = 0; j < 3; j++)
|
||||||
out[i] += *(m + 3 * j + i) * v[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;
|
double sigma = 0.9;
|
||||||
|
|
||||||
if ((phi_j<=phi_0+eps*fabs(phi_0)) &&
|
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;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -63,7 +63,7 @@ static const char cite_minstyle_spin_oso_lbfgs[] =
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
MinSpinOSO_LBFGS::MinSpinOSO_LBFGS(LAMMPS *lmp) :
|
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);
|
if (lmp->citeme) lmp->citeme->add(cite_minstyle_spin_oso_lbfgs);
|
||||||
nlocal_max = 0;
|
nlocal_max = 0;
|
||||||
|
@ -345,7 +345,6 @@ void MinSpinOSO_LBFGS::calc_search_direction()
|
||||||
double sq_global = 0.0;
|
double sq_global = 0.0;
|
||||||
double yy_global = 0.0;
|
double yy_global = 0.0;
|
||||||
double yr_global = 0.0;
|
double yr_global = 0.0;
|
||||||
double beta_global = 0.0;
|
|
||||||
|
|
||||||
int m_index = local_iter % num_mem; // memory index
|
int m_index = local_iter % num_mem; // memory index
|
||||||
int c_ind = 0;
|
int c_ind = 0;
|
||||||
|
@ -520,8 +519,6 @@ void MinSpinOSO_LBFGS::advance_spins()
|
||||||
{
|
{
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
double **sp = atom->sp;
|
double **sp = atom->sp;
|
||||||
double **fm = atom->fm;
|
|
||||||
double tdampx, tdampy, tdampz;
|
|
||||||
double rot_mat[9]; // exponential of matrix made of search direction
|
double rot_mat[9]; // exponential of matrix made of search direction
|
||||||
double s_new[3];
|
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)
|
void MinSpinOSO_LBFGS::vm3(const double *m, const double *v, double *out)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 3; i++){
|
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++)
|
for(int j = 0; j < 3; j++)
|
||||||
out[i] += *(m + 3 * j + i) * v[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 delta = 0.1;
|
||||||
double sigma = 0.9;
|
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;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -34,14 +34,13 @@ class MinSpinOSO_LBFGS: public Min {
|
||||||
void reset_vectors();
|
void reset_vectors();
|
||||||
int iterate(int);
|
int iterate(int);
|
||||||
private:
|
private:
|
||||||
int ireplica,nreplica; // for neb
|
int ireplica,nreplica; // for neb
|
||||||
double *spvec; // variables for atomic dof, as 1d vector
|
double *spvec; // variables for atomic dof, as 1d vector
|
||||||
double *fmvec; // 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_old; // gradient vector at previous step
|
double *g_cur; // current gradient vector
|
||||||
double *p_s; // search direction vector
|
double *p_s; // search direction vector
|
||||||
double **sp_copy; // copy of the spins
|
int local_iter; // for neb
|
||||||
int local_iter; // for neb
|
|
||||||
int nlocal_max; // max value of nlocal (for size of lists)
|
int nlocal_max; // max value of nlocal (for size of lists)
|
||||||
|
|
||||||
void advance_spins();
|
void advance_spins();
|
||||||
|
@ -54,14 +53,15 @@ class MinSpinOSO_LBFGS: public Min {
|
||||||
int awc(double, double, double, double);
|
int awc(double, double, double, double);
|
||||||
void make_step(double, double *);
|
void make_step(double, double *);
|
||||||
double max_torque();
|
double max_torque();
|
||||||
double der_e_cur; // current derivative along search dir.
|
double der_e_cur; // current derivative along search dir.
|
||||||
double der_e_pr; // previous derivative along search dir.
|
double der_e_pr; // previous derivative along search dir.
|
||||||
int use_line_search; // use line search or not.
|
int use_line_search; // use line search or not.
|
||||||
double maxepsrot;
|
double maxepsrot;
|
||||||
|
|
||||||
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 *rho; // estimation of curvature
|
||||||
|
double **ds; // change in rotation matrix between two iterations, da
|
||||||
|
double **dy; // change in gradients between two iterations, dg
|
||||||
|
double **sp_copy; // copy of the spins
|
||||||
int num_mem; // number of stored steps
|
int num_mem; // number of stored steps
|
||||||
bigint last_negative;
|
bigint last_negative;
|
||||||
};
|
};
|
||||||
|
|
|
@ -323,7 +323,7 @@ void PairSpinDipoleCut::compute(int eflag, int vflag)
|
||||||
void PairSpinDipoleCut::compute_single_pair(int ii, double fmi[3])
|
void PairSpinDipoleCut::compute_single_pair(int ii, double fmi[3])
|
||||||
{
|
{
|
||||||
int j,jnum,itype,jtype,ntypes;
|
int j,jnum,itype,jtype,ntypes;
|
||||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
int *jlist,*numneigh,**firstneigh;
|
||||||
double rsq,rinv,r2inv,r3inv,local_cut2;
|
double rsq,rinv,r2inv,r3inv,local_cut2;
|
||||||
double xi[3],rij[3],eij[3],spi[4],spj[4];
|
double xi[3],rij[3],eij[3],spi[4],spj[4];
|
||||||
|
|
||||||
|
|
|
@ -355,10 +355,9 @@ void PairSpinDipoleLong::compute(int eflag, int vflag)
|
||||||
|
|
||||||
void PairSpinDipoleLong::compute_single_pair(int ii, double fmi[3])
|
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 j,jj,jnum,itype,jtype,ntypes;
|
||||||
int k,locflag;
|
int k,locflag;
|
||||||
int *ilist,*jlist,*numneigh,**firstneigh;
|
int *jlist,*numneigh,**firstneigh;
|
||||||
double r,rinv,r2inv,rsq,grij,expm2,t,erfc;
|
double r,rinv,r2inv,rsq,grij,expm2,t,erfc;
|
||||||
double local_cut2,pre1,pre2,pre3;
|
double local_cut2,pre1,pre2,pre3;
|
||||||
double bij[4],xi[3],rij[3],eij[3],spi[4],spj[4];
|
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 **sp = atom->sp;
|
||||||
double **fm_long = atom->fm_long;
|
double **fm_long = atom->fm_long;
|
||||||
|
|
||||||
ilist = list->ilist;
|
|
||||||
numneigh = list->numneigh;
|
numneigh = list->numneigh;
|
||||||
firstneigh = list->firstneigh;
|
firstneigh = list->firstneigh;
|
||||||
|
|
||||||
|
@ -406,7 +404,6 @@ void PairSpinDipoleLong::compute_single_pair(int ii, double fmi[3])
|
||||||
// computation of the exchange interaction
|
// computation of the exchange interaction
|
||||||
// loop over neighbors of atom i
|
// loop over neighbors of atom i
|
||||||
|
|
||||||
//i = ilist[ii];
|
|
||||||
xi[0] = x[ii][0];
|
xi[0] = x[ii][0];
|
||||||
xi[1] = x[ii][1];
|
xi[1] = x[ii][1];
|
||||||
xi[2] = x[ii][2];
|
xi[2] = x[ii][2];
|
||||||
|
|
Loading…
Reference in New Issue