Commit bc0ff0db authored by julient31's avatar julient31
Browse files

Commit2 JT 092319

- added enum to min.h (for norm choice)
- completed doc min_modify
- corrected torque tol issue in spin/min
parent 56e1a052
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -86,6 +86,9 @@ all atoms

:c,image(Eqs/norm_max.jpg) 

For the min styles {spin}, {spin/cg} and {spin/lbfgs}, the force
norm is replaced by the spin-torque norm.

Keywords {alpha_damp} and {discrete_factor} only make sense when
a "min_spin"_min_spin.html command is declared. 
Keyword {alpha_damp} defines an analog of a magnetic Gilbert
+1 −0
Original line number Diff line number Diff line
@@ -51,4 +51,5 @@ dump 1 all custom 50 dump.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3

min_style	spin/lbfgs
# min_modify 	line spin_cubic discrete_factor 10.0
min_modify	norm max
minimize        1.0e-15 1.0e-10 10000 1000
+5 −14
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ void MinSpin::reset_vectors()
int MinSpin::iterate(int maxiter)
{
  bigint ntimestep;
  double fmdotfm,fmsq,fmsqall;
  double fmdotfm,fmsq;
  int flag,flagall;

  for (int iter = 0; iter < maxiter; iter++) {
@@ -163,20 +163,11 @@ int MinSpin::iterate(int maxiter)
    // magnetic torque tolerance criterion
    // sync across replicas if running multi-replica minimization

    fmdotfm = fmsq = fmsqall = 0.0;
    fmdotfm = fmsq = 0.0;
    if (update->ftol > 0.0) {
      if (normstyle == 1) {		// max torque norm
	fmsq = max_torque();
	fmsqall = fmsq;
	if (update->multireplica == 0)
	  MPI_Allreduce(&fmsq,&fmsqall,1,MPI_INT,MPI_MAX,universe->uworld);
      } else {				// Euclidean torque norm
	fmsq = total_torque();
	fmsqall = fmsq;
	if (update->multireplica == 0)
	  MPI_Allreduce(&fmsq,&fmsqall,1,MPI_INT,MPI_SUM,universe->uworld);
      }
      fmdotfm = fmsqall*fmsqall;
      if (normstyle == MAX) fmsq = max_torque();	// max norm
      else fmsq = total_torque();			// Euclidean 2-norm
      fmdotfm = fmsq*fmsq;
      if (update->multireplica == 0) {
        if (fmdotfm < update->ftol*update->ftol) return FTOL;
      } else {
+5 −15
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ static const char cite_minstyle_spin_cg[] =

#define DELAYSTEP 5


/* ---------------------------------------------------------------------- */

MinSpinCG::MinSpinCG(LAMMPS *lmp) :
@@ -183,7 +182,7 @@ int MinSpinCG::iterate(int maxiter)
{
  int nlocal = atom->nlocal;
  bigint ntimestep;
  double fmdotfm,fmsq,fmsqall;
  double fmdotfm,fmsq;
  int flag, flagall;
  double **sp = atom->sp;
  double der_e_cur_tmp = 0.0;
@@ -269,20 +268,11 @@ int MinSpinCG::iterate(int maxiter)
    // magnetic torque tolerance criterion
    // sync across replicas if running multi-replica minimization

    fmdotfm = fmsq = fmsqall = 0.0;
    fmdotfm = fmsq = 0.0;
    if (update->ftol > 0.0) {
      if (normstyle == 1) {		// max torque norm
	fmsq = max_torque();
	fmsqall = fmsq;
	if (update->multireplica == 0)
	  MPI_Allreduce(&fmsq,&fmsqall,1,MPI_INT,MPI_MAX,universe->uworld);
      } else {				// Euclidean torque norm
	fmsq = total_torque();
	fmsqall = fmsq;
	if (update->multireplica == 0)
	  MPI_Allreduce(&fmsq,&fmsqall,1,MPI_INT,MPI_SUM,universe->uworld);
      }
      fmdotfm = fmsqall*fmsqall;
      if (normstyle == MAX) fmsq = max_torque();	// max norm
      else fmsq = total_torque();			// Euclidean 2-norm
      fmdotfm = fmsq*fmsq;
      if (update->multireplica == 0) {
        if (fmdotfm < update->ftol*update->ftol) return FTOL;
      } else {
+5 −15
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ static const char cite_minstyle_spin_lbfgs[] =

#define DELAYSTEP 5


/* ---------------------------------------------------------------------- */

MinSpinLBFGS::MinSpinLBFGS(LAMMPS *lmp) :
@@ -192,7 +191,7 @@ int MinSpinLBFGS::iterate(int maxiter)
{
  int nlocal = atom->nlocal;
  bigint ntimestep;
  double fmdotfm,fmsq,fmsqall;
  double fmdotfm,fmsq;
  int flag, flagall;
  double **sp = atom->sp;
  double der_e_cur_tmp = 0.0;
@@ -284,20 +283,11 @@ int MinSpinLBFGS::iterate(int maxiter)
    // magnetic torque tolerance criterion
    // sync across replicas if running multi-replica minimization

    fmdotfm = fmsq = fmsqall = 0.0;
    fmdotfm = fmsq = 0.0;
    if (update->ftol > 0.0) {
      if (normstyle == 1) {		// max torque norm
	fmsq = max_torque();
	fmsqall = fmsq;
	if (update->multireplica == 0)
	  MPI_Allreduce(&fmsq,&fmsqall,1,MPI_INT,MPI_MAX,universe->uworld);
      } else {				// Euclidean torque norm
	fmsq = total_torque();
	fmsqall = fmsq;
	if (update->multireplica == 0)
	  MPI_Allreduce(&fmsq,&fmsqall,1,MPI_INT,MPI_SUM,universe->uworld);
      }
      fmdotfm = fmsqall*fmsqall;
      if (normstyle == MAX) fmsq = max_torque();	// max norm
      else fmsq = total_torque();			// Euclidean 2-norm
      fmdotfm = fmsq*fmsq;
      if (update->multireplica == 0) {
        if (fmdotfm < update->ftol*update->ftol) return FTOL;
      } else {
Loading