diff --git a/.vscode/settings.json b/.vscode/settings.json index 52c8c6c1ea..97f4ca980b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,16 @@ { "files.associations": { "cmath": "cpp", - "complex": "cpp" + "complex": "cpp", + "fm_exp.c": "cpp", + "al_zhou.c": "cpp", + "cu_zhou.c": "cpp", + "w_zhou.c": "cpp", + "mpi.c": "cpp", + "chrono": "cpp", + "limits": "cpp", + "lmp2radii.c": "cpp", + "sockets.c": "cpp", + "*.tcc": "cpp" } } \ No newline at end of file diff --git a/src/min.cpp b/src/min.cpp index 6c1006a82d..3a3dbe2bd7 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -55,13 +55,13 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp) searchflag = 0; linestyle = 1; - DELAYSTEP = 20; - DT_GROW = 1.1; - DT_SHRINK = 0.5; - ALPHA0 = 0.25; - ALPHA_SHRINK = 0.99; - TMAX = 2.0; - TMIN = 0.02; + delaystep = 20; + dt_grow = 1.1; + dt_shrink = 0.5; + alpha0 = 0.25; + alpha_shrink = 0.99; + tmax = 2.0; + tmin = 0.02; elist_global = elist_atom = NULL; vlist_global = vlist_atom = NULL; @@ -651,49 +651,33 @@ void Min::modify_params(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); dmax = force->numeric(FLERR,arg[iarg+1]); iarg += 2; - /* Wolfram - Hack: define some new parameters - DELAYSTEP 5 - DT_GROW 1.1 - DT_SHRINK 0.5 - ALPHA0 0.1 - ALPHA_SHRINK 0.99 - TMAX 10.0 - */ } else if (strcmp(arg[iarg],"fire_delaystep") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - DELAYSTEP = force->numeric(FLERR,arg[iarg+1]); - if (comm->me == 0 && screen) fprintf(screen,"DELAYSTEP: %d \n", DELAYSTEP); + delaystep = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"fire_dt_grow") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - DT_GROW = force->numeric(FLERR,arg[iarg+1]); - if (comm->me == 0 && screen) fprintf(screen,"DT_GROW: %.8f \n", DT_GROW); + dt_grow = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"fire_dt_shrink") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - DT_SHRINK = force->numeric(FLERR,arg[iarg+1]); - if (comm->me == 0 && screen) fprintf(screen,"DT_SHRINK: %.8f \n", DT_SHRINK); + dt_shrink = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"fire_alpha0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - ALPHA0 = force->numeric(FLERR,arg[iarg+1]); - if (comm->me == 0 && screen) fprintf(screen,"ALPHA0: %.8f \n", ALPHA0); + alpha0 = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"fire_alpha_shrink") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - ALPHA_SHRINK = force->numeric(FLERR,arg[iarg+1]); - if (comm->me == 0 && screen) fprintf(screen,"ALPHA_SHRINK: %.8f \n", ALPHA_SHRINK); + alpha_shrink = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"fire_tmax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - TMAX = force->numeric(FLERR,arg[iarg+1]); - if (comm->me == 0 && screen) fprintf(screen,"TMAX: %.8f \n", TMAX); + tmax = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"fire_tmin") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - TMAX = force->numeric(FLERR,arg[iarg+1]); - if (comm->me == 0 && screen) fprintf(screen,"TMIN: %.8f \n", TMAX); + tmin = force->numeric(FLERR,arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"line") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); diff --git a/src/min.h b/src/min.h index e4ffa7c6f9..d12d614d4e 100644 --- a/src/min.h +++ b/src/min.h @@ -58,11 +58,10 @@ class Min : protected Pointers { double dmax; // max dist to move any atom in one step int linestyle; // 0 = backtrack, 1 = quadratic, 2 = forcezero -/* Wolframs include of FIRE parameters */ - int DELAYSTEP; // FIRE parameters - double DT_GROW,DT_SHRINK; - double ALPHA0,ALPHA_SHRINK; - double TMAX,TMIN; + int delaystep; // minium steps of dynamics (adaptglok) + double dt_grow,dt_shrink; // timestep increase, decrease (adaptglok) + double alpha0,alpha_shrink; // mixing velocities+forces coefficient (adaptglok) + double tmax,tmin; // timestep max, min (adaptglok) int nelist_global,nelist_atom; // # of PE,virial computes to check int nvlist_global,nvlist_atom; diff --git a/src/min_adaptglok.cpp b/src/min_adaptglok.cpp index f2b920eabd..af63e2c1fa 100644 --- a/src/min_adaptglok.cpp +++ b/src/min_adaptglok.cpp @@ -38,9 +38,9 @@ void MinAdaptGlok::init() Min::init(); dt = dtinit = update->dt; - dtmax = TMAX * dt; - dtmin = TMIN * dt; - alpha = ALPHA0; + dtmax = tmax * dt; + dtmin = tmin * dt; + alpha = alpha0; last_negative = ntimestep_fire = update->ntimestep; } @@ -117,7 +117,7 @@ int MinAdaptGlok::iterate(int maxiter) // v = (1-alpha) v + alpha |v| Fhat // |v| = length of v, Fhat = unit f // The modificatin of v is made wihtin the Verlet integration, after v update - // if more than DELAYSTEP since v dot f was negative: + // if more than delaystep since v dot f was negative: // increase timestep and decrease alpha if (vdotfall > 0.0) { @@ -151,14 +151,14 @@ int MinAdaptGlok::iterate(int maxiter) if (fdotfall <= 1e-20) scale2 = 0.0; else scale2 = alpha * sqrt(vdotvall/fdotfall); - if (ntimestep - last_negative > DELAYSTEP) { - dt = MIN(dt*DT_GROW,dtmax); + if (ntimestep - last_negative > delaystep) { + dt = MIN(dt*dt_grow,dtmax); update->dt = dt; - alpha *= ALPHA_SHRINK; + alpha *= alpha_shrink; } // else (v dot f) <= 0 - // if more than DELAYSTEP since starting the relaxation: + // if more than delaystep since starting the relaxation: // reset alpha // if dt > dtmin: // decrease timestep @@ -168,10 +168,10 @@ int MinAdaptGlok::iterate(int maxiter) } else { last_negative = ntimestep; // Limit decrease of timestep - if (ntimestep - ntimestep_fire > DELAYSTEP) { - alpha = ALPHA0; + if (ntimestep - ntimestep_fire > delaystep) { + alpha = alpha0; if (dt > dtmin) { - dt *= DT_SHRINK; + dt *= dt_shrink; update->dt = dt; } } @@ -265,10 +265,10 @@ int MinAdaptGlok::iterate(int maxiter) neval++; // energy tolerance criterion - // only check after DELAYSTEP elapsed since velocties reset to 0 + // only check after delaystep elapsed since velocties reset to 0 // sync across replicas if running multi-replica minimization - if (update->etol > 0.0 && ntimestep-last_negative > DELAYSTEP) { + if (update->etol > 0.0 && ntimestep-last_negative > delaystep) { if (update->multireplica == 0) { if (fabs(ecurrent-eprevious) < update->etol * 0.5*(fabs(ecurrent) + fabs(eprevious) + EPS_ENERGY)) { diff --git a/test/lmp_mpi b/test/lmp_mpi deleted file mode 100755 index e91a4a7632..0000000000 Binary files a/test/lmp_mpi and /dev/null differ diff --git a/test/test.bsh b/test/test.bsh index 2b3d1cc32b..312e732036 100755 --- a/test/test.bsh +++ b/test/test.bsh @@ -1,6 +1,9 @@ #!/bin/bash -l -mpirun -np 1 lmp_mpi -i $1 +mpirun -np 2 $1 -i $2 -gnu="set title 'LAMMPS'; set xlabel 'nfc'; set ylabel 'forces';unset logs y; pl [0:] 'log.lammps' u 1:2 w lp t 'LAMMPS', '../../imd/test/fire_silicon-vac_6x6x6x5.431.eng' u 1:2 w lp t 'IMD'" +#gnu="set title 'LAMMPS'; set xlabel 'nfc'; set ylabel 'forces';unset logs y; pl [0:] 'log.lammps' u 1:2 w lp t 'LAMMPS', '../../imd/test/fire_silicon-vac_6x6x6x5.431.eng' u 1:2 w lp t 'IMD'" +#gnu="set title 'LAMMPS'; set xlabel 'nfc'; set ylabel 'forces';set logs y; pl [0:] 'log.lammps' u 1:4 w lp t 'LAMMPS', '../../imd/test/fire_silicon-vac_6x6x6x5.431.eng' u 1:5 w lp t 'IMD'" +#gnu="set title 'LAMMPS'; set xlabel 'nfc'; set ylabel 'forces';set logs y; pl [0:] 'log.lammps' u 1:4 w lp t 'LAMMPS'" +gnu="set title 'LAMMPS'; set xlabel 'nfc'; set ylabel 'forces';set logs y; pl [0:] 'log.lammps' u 1:4 w l t 'Velocity-Verlet', 'log.euler.lammps' u 1:4 w l t 'Euler'" echo -e $gnu | gnuplot -persist diff --git a/test/test_1.lmp b/test/test_1.lmp index 196d477420..7e6a7f9ad6 100644 --- a/test/test_1.lmp +++ b/test/test_1.lmp @@ -5,10 +5,11 @@ atom_style atomic processors * * * #lattice diamond 5.431 -#region box block 0 6 0 6 0 6 units lattice +#region box block 0 30 0 16 0 16 units lattice #create_box 1 box #create_atoms 1 box -#group vac id 169 +#group vac id 169 185 1369 158 111 297 +#group vac id 169 185 1369 158 111 297 #delete_atoms group vac #write_data silicon-vac_6x6x6x5.431.ldata @@ -26,18 +27,14 @@ variable peratom equal pe/atoms thermo 1 thermo_style custom step dt time fnorm fmax pe v_peratom ke temp +thermo_modify flush yes #thermo_modify format float %1.18e timestep 0.001 -#velocity all create 3.0 456789123 -#fix 1 all nve -#run 1 -#unfix 1 +min_style adaptglok +min_modify fire_delaystep 20 fire_dt_grow 1.1 fire_dt_shrink 0.5 & + fire_alpha0 0.25 fire_alpha_shrink 0.99 fire_tmax 2.0 +minimize 0.0 1e-8 10000 10000 -min_style adaptglok -minimize 0.0 1e-8 1000 10000 -run 0 -#fix 1 all nve -#run 20