From 2dcbc805ba62ec2045f6a581ccc9beb115ef1a1f Mon Sep 17 00:00:00 2001 From: Christian Negre Date: Thu, 23 Feb 2017 18:20:02 -0700 Subject: [PATCH] min latte partially fixed --- examples/latte/data.sucrose_non_opt.lmp | 63 +++++++++++++++++++++++++ examples/latte/data.water | 41 ++++++++++++++++ examples/latte/in.latte.sucrose.min | 42 +++++++++++++++++ examples/latte/in.latte.water | 40 ++++++++++++++++ examples/latte/in.latte.water.min | 41 ++++++++++++++++ lib/latte/README | 4 +- src/LATTE/fix_latte.cpp | 12 ++++- src/LATTE/fix_latte.h | 1 + 8 files changed, 240 insertions(+), 4 deletions(-) create mode 100644 examples/latte/data.sucrose_non_opt.lmp create mode 100644 examples/latte/data.water create mode 100644 examples/latte/in.latte.sucrose.min create mode 100644 examples/latte/in.latte.water create mode 100644 examples/latte/in.latte.water.min diff --git a/examples/latte/data.sucrose_non_opt.lmp b/examples/latte/data.sucrose_non_opt.lmp new file mode 100644 index 0000000000..a96a19eddb --- /dev/null +++ b/examples/latte/data.sucrose_non_opt.lmp @@ -0,0 +1,63 @@ + LAMMPS Description + + 45 atoms + + 3 atom types + + 0.0000000000000000 18.917000000000002 xlo xhi + 0.0000000000000000 17.350999999999999 ylo yhi + 0.0000000000000000 15.472000000000000 zlo zhi + + Masses + + 1 15.994915008544922 + 2 12.000000000000000 + 3 1.0078250169754028 + + Atoms + + 1 1 1 0.0 11.47359 7.39174 7.26456 + 2 1 2 0.0 12.66159 8.24474 7.53356 + 3 1 3 0.0 13.49759 7.72474 7.00656 + 4 1 2 0.0 12.92859 8.18374 9.02956 + 5 1 1 0.0 13.69659 9.10274 10.46556 + 6 1 2 0.0 12.83959 10.10474 6.64056 + 7 1 3 0.0 13.24359 10.33074 7.58456 + 8 1 1 0.0 13.17359 9.67874 5.60956 + 9 1 2 0.0 11.20559 10.26374 6.86456 + 10 1 3 0.0 11.22159 11.15674 6.18156 + 11 1 1 0.0 10.78559 10.69674 8.19156 + 12 1 2 0.0 10.23459 9.20474 6.34356 + 13 1 3 0.0 9.23359 9.62574 6.11656 + 14 1 1 0.0 10.73959 8.65074 5.08856 + 15 1 2 0.0 10.18759 8.08774 7.38056 + 16 1 3 0.0 10.03259 8.49174 8.42656 + 17 1 1 0.0 9.22959 7.03374 7.08156 + 18 1 2 0.0 7.79359 7.27874 7.34356 + 19 1 1 0.0 7.44259 8.64274 6.96956 + 20 1 2 0.0 7.01059 9.43674 8.13856 + 21 1 3 0.0 5.95059 9.74974 7.96256 + 22 1 2 0.0 7.08359 8.51474 9.35656 + 23 1 3 0.0 8.19359 8.08474 9.80956 + 24 1 1 0.0 5.86059 8.56174 10.14056 + 25 1 2 0.0 7.34259 7.10674 8.80356 + 26 1 3 0.0 6.37259 6.54074 8.80556 + 27 1 1 0.0 8.32159 6.38474 9.58156 + 28 1 2 0.0 7.89859 10.67174 8.17156 + 29 1 1 0.0 6.06859 12.11474 7.59256 + 30 1 2 0.0 7.47359 7.05174 5.99256 + 31 1 1 0.0 5.66359 6.54374 6.50656 + 32 1 3 0.0 12.00659 8.11374 9.61556 + 33 1 3 0.0 13.35859 7.21774 9.30856 + 34 1 3 0.0 13.67759 8.46774 11.22956 + 35 1 3 0.0 12.44459 9.34474 5.00556 + 36 1 3 0.0 11.54859 11.18274 8.59756 + 37 1 3 0.0 11.00959 7.71574 5.30056 + 38 1 3 0.0 5.09459 8.45474 9.52056 + 39 1 3 0.0 7.92859 6.23074 10.47756 + 40 1 3 0.0 8.53259 10.62974 7.23156 + 41 1 3 0.0 8.58159 10.63874 9.05856 + 42 1 3 0.0 6.42359 13.37374 7.86056 + 43 1 3 0.0 7.58559 6.90074 4.62256 + 44 1 3 0.0 7.35159 5.27974 6.61456 + 45 1 3 0.0 5.22759 6.18974 5.69256 diff --git a/examples/latte/data.water b/examples/latte/data.water new file mode 100644 index 0000000000..1a1e4d9e0b --- /dev/null +++ b/examples/latte/data.water @@ -0,0 +1,41 @@ + LAMMPS Description + + 24 atoms + + 2 atom types + + 0.0000000000000000 6.2670000000000003 xlo xhi + 0.0000000000000000 6.2670000000000003 ylo yhi + 0.0000000000000000 6.2670000000000003 zlo zhi + + Masses + + 1 15.994915008544922 + 2 1.0078250169754028 + + Atoms + + 1 1 1 0.0 3.08800 3.70000 3.12400 + 2 1 2 0.0 4.05800 3.70000 3.12400 + 3 1 2 0.0 2.76400 3.13200 3.84100 + 4 1 1 0.0 2.47000 0.39000 1.36000 + 5 1 2 0.0 1.54000 0.37000 1.73000 + 6 1 2 0.0 2.48000 0.00000 0.44000 + 7 1 1 0.0 1.99300 0.41700 5.25000 + 8 1 2 0.0 2.39300 1.32700 5.16000 + 9 1 2 0.0 0.99300 0.49700 5.31000 + 10 1 1 0.0 2.05300 6.09700 3.48000 + 11 1 2 0.0 2.12300 5.20700 3.02000 + 12 1 2 0.0 1.11300 0.17000 3.40000 + 13 1 1 0.0 4.90000 5.37700 2.14000 + 14 1 2 0.0 5.51000 6.17700 2.18000 + 15 1 2 0.0 3.95000 5.68700 2.21000 + 16 1 1 0.0 0.92000 3.82700 0.56000 + 17 1 2 0.0 0.00000 3.54700 0.27000 + 18 1 2 0.0 1.23000 4.59700 0.00000 + 19 1 1 0.0 0.89000 2.03700 3.41000 + 20 1 2 0.0 0.72000 2.86700 2.87000 + 21 1 2 0.0 1.79000 1.66700 3.19000 + 22 1 1 0.0 4.45000 4.61700 5.43000 + 23 1 2 0.0 4.75000 3.89700 4.81000 + 24 1 2 0.0 4.06000 4.21700 6.26000 diff --git a/examples/latte/in.latte.sucrose.min b/examples/latte/in.latte.sucrose.min new file mode 100644 index 0000000000..dc0879861a --- /dev/null +++ b/examples/latte/in.latte.sucrose.min @@ -0,0 +1,42 @@ +# simple water model with LATTE + +units metal +atom_style full +atom_modify sort 0 0.0 # turn off sorting of the coordinates + +#read_data data.water +read_data data.sucrose_non_opt.lmp + +# replicate system if requested + +variable x index 1 +variable y index 1 +variable z index 1 + +variable nrep equal v_x*v_y*v_z +if "${nrep} > 1" then "replicate $x $y $z" + +# initialize system + +velocity all create 0.0 87287 loop geom + +pair_style zero 1.0 +pair_coeff * * + +neighbor 1.0 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.00025 + +fix 1 all nve + +fix 2 all latte NULL +fix_modify 2 energy yes + +thermo_style custom step temp pe etotal + +# minimization + +thermo 1 +min_style cg +minimize 1.0e-9 1.0e-9 1000 1000 diff --git a/examples/latte/in.latte.water b/examples/latte/in.latte.water new file mode 100644 index 0000000000..1ab9fcaafe --- /dev/null +++ b/examples/latte/in.latte.water @@ -0,0 +1,40 @@ +# simple water model with LATTE + +units metal +atom_style full +atom_modify sort 0 0.0 # turn off sorting of the coordinates + +read_data data.water + +# replicate system if requested + +variable x index 1 +variable y index 1 +variable z index 1 + +variable nrep equal v_x*v_y*v_z +if "${nrep} > 1" then "replicate $x $y $z" + +# initialize system + +velocity all create 0.0 87287 loop geom + +pair_style zero 1.0 +pair_coeff * * + +neighbor 1.0 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.00025 + +fix 1 all nve + +fix 2 all latte NULL +fix_modify 2 energy yes + +thermo_style custom step temp pe etotal + +# dynamics + +thermo 10 +run 100 diff --git a/examples/latte/in.latte.water.min b/examples/latte/in.latte.water.min new file mode 100644 index 0000000000..5bf261547a --- /dev/null +++ b/examples/latte/in.latte.water.min @@ -0,0 +1,41 @@ +# simple water model with LATTE + +units metal +atom_style full +atom_modify sort 0 0.0 # turn off sorting of the coordinates + +read_data data.water + +# replicate system if requested + +variable x index 1 +variable y index 1 +variable z index 1 + +variable nrep equal v_x*v_y*v_z +if "${nrep} > 1" then "replicate $x $y $z" + +# initialize system + +velocity all create 0.0 87287 loop geom + +pair_style zero 1.0 +pair_coeff * * + +neighbor 1.0 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.00025 + +fix 1 all nve + +fix 2 all latte NULL +fix_modify 2 energy yes + +thermo_style custom step temp pe etotal + +# minimization + +thermo 1 +min_style fire +minimize 1.0e-9 1.0e-9 1000 1000 diff --git a/lib/latte/README b/lib/latte/README index 3acd85095a..4166d03166 100644 --- a/lib/latte/README +++ b/lib/latte/README @@ -20,7 +20,7 @@ follow these steps: - Set the MAKELIB flag to ON in makefile.CHOICES and finally, build the code with the make command. -Note that if you unpack and build LATTE in this directory, if you +Note that if you unpack and build LATTE in this directory and you download a new LAMMPS tarball, the files you have added here will be lost. So you likely want to build it somewhere else. The recommended place is the home directory. @@ -28,7 +28,7 @@ place is the home directory. To build LAMMPS with the LATTE library you should follow the following instructions: -- makefile.lammps.* to makefile.lammps in the /lammps/lib/latte directory. +- copy makefile.lammps.* to makefile.lammps in the /lammps/lib/latte directory. - Change the path, flags and compilers on the makefile.lammps according to your compilers, architecture and the LATTE location. diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index 19a1e78603..ba9804de0d 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -45,7 +45,8 @@ using namespace FixConst; extern "C" { void latte(int *, int *, double *, int *, int *, - double *, double *, double *, double *, int*, double *, double *, double *); + double *, double *, double *, double *, int*, + double *, double *, double *); } #define INVOKED_PERATOM 8 @@ -282,7 +283,7 @@ void FixLatte::post_force(int vflag) int maxiter = -1; latte(flags,&natoms,coords,type,&ntypes,mass,boxlo,boxhi, - forces,&maxiter, &latte_energy, &atom->v[0][0],&update->dt); + forces,&maxiter,&latte_energy,&atom->v[0][0],&update->dt); // sum LATTE forces to LAMMPS (Coulombic) forces @@ -297,6 +298,13 @@ void FixLatte::post_force(int vflag) } } +/* ---------------------------------------------------------------------- */ + +void FixLatte::min_post_force(int vflag) +{ + post_force(vflag); +} + /* ---------------------------------------------------------------------- integrate electronic degrees of freedom ------------------------------------------------------------------------- */ diff --git a/src/LATTE/fix_latte.h b/src/LATTE/fix_latte.h index d0f2fdea3e..d6b75d52f4 100644 --- a/src/LATTE/fix_latte.h +++ b/src/LATTE/fix_latte.h @@ -36,6 +36,7 @@ class FixLatte : public Fix { void initial_integrate(int); void pre_reverse(int, int); void post_force(int); + void min_post_force(int); void final_integrate(); void reset_dt(); double compute_scalar();