whitespace
This commit is contained in:
@ -51,7 +51,7 @@ code, launched separately from LAMMPS, in which case the mdi plugin
|
|||||||
command is not used.
|
command is not used.
|
||||||
|
|
||||||
See the Howto MDI doc page for a discussion of all the different ways
|
See the Howto MDI doc page for a discussion of all the different ways
|
||||||
2 or more codes can interact via MDI.
|
2 or more codes can interact via MDI.
|
||||||
|
|
||||||
The examples/mdi directory has examples which use LAMMPS in 4
|
The examples/mdi directory has examples which use LAMMPS in 4
|
||||||
different modes: as a driver using an engine as either a stand-alone
|
different modes: as a driver using an engine as either a stand-alone
|
||||||
@ -241,7 +241,7 @@ commands are supported, as documented above: <ENERGY, <FORCES, <KE,
|
|||||||
The *mdi plugin* command is used to make LAMMPS operate as an MDI
|
The *mdi plugin* command is used to make LAMMPS operate as an MDI
|
||||||
driver which loads an MDI engine as a plugin library. It is typically
|
driver which loads an MDI engine as a plugin library. It is typically
|
||||||
used in an input script after LAMMPS has setup the system it is going
|
used in an input script after LAMMPS has setup the system it is going
|
||||||
to model consistent with the engine code.
|
to model consistent with the engine code.
|
||||||
|
|
||||||
The *name* argument specifies which plugin library to load. A name
|
The *name* argument specifies which plugin library to load. A name
|
||||||
like "lammps" is converted to a filename liblammps.so. The path for
|
like "lammps" is converted to a filename liblammps.so. The path for
|
||||||
|
|||||||
@ -551,13 +551,13 @@ void MDIEngine::mdi_commands()
|
|||||||
|
|
||||||
// node at POST_FORCE location in timestep
|
// node at POST_FORCE location in timestep
|
||||||
// only used if fix MDI/ENGINE is instantiated
|
// only used if fix MDI/ENGINE is instantiated
|
||||||
// two register callbacks allow LAMMPS to interact more easily
|
// two register callbacks allow LAMMPS to interact more easily
|
||||||
// with drivers which don't know LAMMPS control flow
|
// with drivers which don't know LAMMPS control flow
|
||||||
|
|
||||||
MDI_Register_node("@FORCES");
|
MDI_Register_node("@FORCES");
|
||||||
MDI_Register_callback("@FORCES",">FORCES");
|
MDI_Register_callback("@FORCES",">FORCES");
|
||||||
MDI_Register_callback("@FORCES",">+FORCES");
|
MDI_Register_callback("@FORCES",">+FORCES");
|
||||||
MDI_Register_command("@FORCES","<@");
|
MDI_Register_command("@FORCES","<@");
|
||||||
MDI_Register_command("@FORCES","<COORDS");
|
MDI_Register_command("@FORCES","<COORDS");
|
||||||
MDI_Register_command("@FORCES","<ENERGY");
|
MDI_Register_command("@FORCES","<ENERGY");
|
||||||
MDI_Register_command("@FORCES","<FORCES");
|
MDI_Register_command("@FORCES","<FORCES");
|
||||||
@ -614,7 +614,7 @@ void MDIEngine::mdi_md()
|
|||||||
// delete the instance before this method returns
|
// delete the instance before this method returns
|
||||||
|
|
||||||
modify->add_fix("MDI_ENGINE_INTERNAL all MDI/ENGINE");
|
modify->add_fix("MDI_ENGINE_INTERNAL all MDI/ENGINE");
|
||||||
FixMDIEngine *mdi_fix =
|
FixMDIEngine *mdi_fix =
|
||||||
(FixMDIEngine *) modify->get_fix_by_id("MDI_ENGINE_INTERNAL");
|
(FixMDIEngine *) modify->get_fix_by_id("MDI_ENGINE_INTERNAL");
|
||||||
mdi_fix->mdi_engine = this;
|
mdi_fix->mdi_engine = this;
|
||||||
|
|
||||||
@ -622,7 +622,7 @@ void MDIEngine::mdi_md()
|
|||||||
|
|
||||||
update->whichflag = 1;
|
update->whichflag = 1;
|
||||||
timer->init_timeout();
|
timer->init_timeout();
|
||||||
|
|
||||||
update->nsteps = 1;
|
update->nsteps = 1;
|
||||||
update->beginstep = update->firststep = update->ntimestep;
|
update->beginstep = update->firststep = update->ntimestep;
|
||||||
update->endstep = update->laststep = update->ntimestep + update->nsteps;
|
update->endstep = update->laststep = update->ntimestep + update->nsteps;
|
||||||
@ -648,9 +648,9 @@ void MDIEngine::mdi_md()
|
|||||||
update->laststep += 1;
|
update->laststep += 1;
|
||||||
update->endstep = update->laststep;
|
update->endstep = update->laststep;
|
||||||
output->next = update->ntimestep + 1;
|
output->next = update->ntimestep + 1;
|
||||||
|
|
||||||
update->integrate->run(1);
|
update->integrate->run(1);
|
||||||
|
|
||||||
if (strcmp(mdicmd,"@COORDS") != 0 &&
|
if (strcmp(mdicmd,"@COORDS") != 0 &&
|
||||||
strcmp(mdicmd,"@FORCES") != 0 &&
|
strcmp(mdicmd,"@FORCES") != 0 &&
|
||||||
strcmp(mdicmd,"@ENDSTEP") != 0) break;
|
strcmp(mdicmd,"@ENDSTEP") != 0) break;
|
||||||
@ -690,7 +690,7 @@ void MDIEngine::md()
|
|||||||
|
|
||||||
update->whichflag = 1;
|
update->whichflag = 1;
|
||||||
timer->init_timeout();
|
timer->init_timeout();
|
||||||
|
|
||||||
update->nsteps = nsteps;
|
update->nsteps = nsteps;
|
||||||
update->beginstep = update->firststep = update->ntimestep;
|
update->beginstep = update->firststep = update->ntimestep;
|
||||||
update->endstep = update->laststep = update->ntimestep + update->nsteps;
|
update->endstep = update->laststep = update->ntimestep + update->nsteps;
|
||||||
@ -735,7 +735,7 @@ void MDIEngine::mdi_optg()
|
|||||||
// delete the instance before this method returns
|
// delete the instance before this method returns
|
||||||
|
|
||||||
modify->add_fix("MDI_ENGINE_INTERNAL all MDI/ENGINE");
|
modify->add_fix("MDI_ENGINE_INTERNAL all MDI/ENGINE");
|
||||||
FixMDIEngine *mdi_fix =
|
FixMDIEngine *mdi_fix =
|
||||||
(FixMDIEngine *) modify->get_fix_by_id("MDI_ENGINE_INTERNAL");
|
(FixMDIEngine *) modify->get_fix_by_id("MDI_ENGINE_INTERNAL");
|
||||||
mdi_fix->mdi_engine = this;
|
mdi_fix->mdi_engine = this;
|
||||||
|
|
||||||
@ -851,11 +851,11 @@ void MDIEngine::optg()
|
|||||||
void MDIEngine::evaluate()
|
void MDIEngine::evaluate()
|
||||||
{
|
{
|
||||||
int flag_create = flag_natoms | flag_types;
|
int flag_create = flag_natoms | flag_types;
|
||||||
int flag_other = flag_cell | flag_cell_displ | flag_charges |
|
int flag_other = flag_cell | flag_cell_displ | flag_charges |
|
||||||
flag_coords | flag_velocities;
|
flag_coords | flag_velocities;
|
||||||
|
|
||||||
// create or update system if requested
|
// create or update system if requested
|
||||||
|
|
||||||
if (flag_create) create_system();
|
if (flag_create) create_system();
|
||||||
else if (flag_other) {
|
else if (flag_other) {
|
||||||
if (flag_cell || flag_cell_displ) adjust_box();
|
if (flag_cell || flag_cell_displ) adjust_box();
|
||||||
@ -1215,7 +1215,7 @@ void MDIEngine::receive_tolerance()
|
|||||||
niterate = static_cast<int> (params[2]);
|
niterate = static_cast<int> (params[2]);
|
||||||
max_eval = static_cast<int> (params[3]);
|
max_eval = static_cast<int> (params[3]);
|
||||||
|
|
||||||
if (etol < 0.0 || ftol < 0.0 || niterate < 0 || max_eval < 0)
|
if (etol < 0.0 || ftol < 0.0 || niterate < 0 || max_eval < 0)
|
||||||
error->all(FLERR,"MDI received invalid toleranace parameters");
|
error->all(FLERR,"MDI received invalid toleranace parameters");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1378,7 +1378,7 @@ void MDIEngine::send_labels()
|
|||||||
|
|
||||||
// use atomID to index into ordered ibuf1
|
// use atomID to index into ordered ibuf1
|
||||||
|
|
||||||
tagint *tag = atom->tag;
|
tagint *tag = atom->tag;
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class MDIEngine : protected Pointers {
|
|||||||
int *sys_types;
|
int *sys_types;
|
||||||
double *sys_charges,*sys_coords,*sys_velocities;
|
double *sys_charges,*sys_coords,*sys_velocities;
|
||||||
double sys_cell[9],sys_cell_displ[3];
|
double sys_cell[9],sys_cell_displ[3];
|
||||||
|
|
||||||
int nsteps; // timesteps for MD
|
int nsteps; // timesteps for MD
|
||||||
double etol,ftol; // 4 minimization params for OPTG
|
double etol,ftol; // 4 minimization params for OPTG
|
||||||
int niterate,max_eval;
|
int niterate,max_eval;
|
||||||
@ -82,7 +82,7 @@ class MDIEngine : protected Pointers {
|
|||||||
char *id_ke,*id_pe,*id_press; // computes invoked by MDI
|
char *id_ke,*id_pe,*id_press; // computes invoked by MDI
|
||||||
class Compute *ke,*pe,*press;
|
class Compute *ke,*pe,*press;
|
||||||
|
|
||||||
class Irregular *irregular; // irregular comm if new COORDS
|
class Irregular *irregular; // irregular comm if new COORDS
|
||||||
// are highly displaced
|
// are highly displaced
|
||||||
|
|
||||||
// class methods
|
// class methods
|
||||||
|
|||||||
@ -73,7 +73,7 @@ MDIPlugin::MDIPlugin(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
|
|
||||||
// error checks
|
// error checks
|
||||||
|
|
||||||
if (!mdi_arg || !infile_arg || !lammps_command)
|
if (!mdi_arg || !infile_arg || !lammps_command)
|
||||||
error->all(FLERR,"MDI plugin must specify mdi, infile, command keywords");
|
error->all(FLERR,"MDI plugin must specify mdi, infile, command keywords");
|
||||||
|
|
||||||
// build full plugin_args string for args to plugin library
|
// build full plugin_args string for args to plugin library
|
||||||
@ -110,14 +110,14 @@ MDIPlugin::MDIPlugin(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
with the plugin
|
with the plugin
|
||||||
---------------------------------------------------------------------- */
|
---------------------------------------------------------------------- */
|
||||||
|
|
||||||
int MDIPlugin::plugin_wrapper(void *pmpicomm, MDI_Comm mdicomm,
|
int MDIPlugin::plugin_wrapper(void *pmpicomm, MDI_Comm mdicomm,
|
||||||
void *vptr)
|
void *vptr)
|
||||||
{
|
{
|
||||||
MPI_Comm mpicomm = *(MPI_Comm *) pmpicomm;
|
MPI_Comm mpicomm = *(MPI_Comm *) pmpicomm;
|
||||||
MDIPlugin *ptr = (MDIPlugin *) vptr;
|
MDIPlugin *ptr = (MDIPlugin *) vptr;
|
||||||
LAMMPS *lammps = ptr->lmp;
|
LAMMPS *lammps = ptr->lmp;
|
||||||
char *lammps_command = ptr->lammps_command;
|
char *lammps_command = ptr->lammps_command;
|
||||||
|
|
||||||
// set FixMDIAimd mdicomm to driver's mdicomm passed to this callback
|
// set FixMDIAimd mdicomm to driver's mdicomm passed to this callback
|
||||||
|
|
||||||
FixMDIAimd *aimdptr = (FixMDIAimd *) (ptr->fixptr);
|
FixMDIAimd *aimdptr = (FixMDIAimd *) (ptr->fixptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user