more debugging on plugin mode

This commit is contained in:
Steve Plimpton
2022-04-04 10:30:12 -06:00
parent 294dcc5f93
commit 4fadf4c830
4 changed files with 17 additions and 5 deletions

View File

@ -137,9 +137,13 @@ def perform_tasks(world,mdicomm,dummy):
if mode == "eval":
pass
elif mode == "run":
print("SENDING INIT_MD")
mdi.MDI_Send_command("@INIT_MD",mdicomm)
print("SENDING NITERATE")
mdi.MDI_Send_command(">NITERATE",mdicomm)
print("SENDING NITERATE data nsteps")
mdi.MDI_Send(nsteps,1,mdi.MDI_INT,mdicomm)
print("SENDING DEFAULT")
mdi.MDI_Send_command("@DEFAULT",mdicomm)
elif mode == "min":
mdi.MDI_Send_command("@INIT_OPTG",mdicomm)

View File

@ -131,6 +131,7 @@ The function executes a single command from an external MDI driver.
int lammps_execute_mdi_command(const char *command, MDI_Comm comm, void *class_obj)
{
printf("LIB wrapper command %s\n",command);
MDIEngine *mdi_engine = (MDIEngine *) class_obj;
return mdi_engine->execute_command(command,comm);
}

View File

@ -186,12 +186,16 @@ void MDIEngine::mdi_engine(int narg, char **arg)
// top-level mdi engine only recognizes three nodes
// DEFAULT, INIT_MD, INIT_OPTG
printf("MAIN LOOP pre engine_node DEF\n");
engine_node("@DEFAULT");
printf("MAIN LOOP post engine_node DEF\n");
// MDI commands for dynamics or minimization
if (strcmp(mdicmd,"@INIT_MD") == 0) {
printf("MAIN LOOP pre mdi_md\n");
mdi_md();
printf("MAIN LOOP post mdi_md\n");
if (exit_command) break;
} else if (strcmp(mdicmd,"@INIT_OPTG") == 0) {
@ -251,6 +255,8 @@ void MDIEngine::engine_node(const char *node)
// read the next command from the driver
// all procs call this, but only proc 0 receives the command
printf("PRE MDI RECV_command: node eng/drv: %s/%s\n",node_engine,node_driver);
ierr = MDI_Recv_command(mdicmd,mdicomm);
if (ierr) error->all(FLERR,"MDI: Unable to receive command from driver");
@ -258,6 +264,8 @@ void MDIEngine::engine_node(const char *node)
MPI_Bcast(mdicmd,MDI_COMMAND_LENGTH,MPI_CHAR,0,world);
printf("POST MDI RECV_command: node eng/drv: %s/%s\n",mdicmd);
// execute the command
execute_command(mdicmd,mdicomm);
@ -306,6 +314,8 @@ int MDIEngine::execute_command(const char *command, MDI_Comm mdicomm)
// receives first, sends second, node commands third
// ---------------------------------------
printf("ABOUT to process command %s\n",command);
if (strcmp(command,">CELL") == 0) {
receive_cell();
@ -607,7 +617,9 @@ void MDIEngine::mdi_md()
niterate = -1;
printf("PRE @INIT_MD\n");
engine_node("@INIT_MD");
printf("POST @INIT_MD %s\n",mdicmd);
if (strcmp(mdicmd,"EXIT") == 0) return;
// add an instance of fix MDI/ENGINE

View File

@ -172,9 +172,6 @@ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr)
lammps_mpi_init();
if (ptr) ptr_argument_warning();
printf("LAMMPS instantiate argc %d argv[1] %s argv[2] %s\n",
argc,argv[1],argv[2]);
#ifdef LAMMPS_EXCEPTIONS
try
{
@ -186,9 +183,7 @@ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr)
if (ptr) *ptr = nullptr;
}
#else
printf("PRE-INSTANTIATE\n");
lmp = new LAMMPS(argc, argv, comm);
printf("POST-INSTANTIATE %p\n",lmp);
if (ptr) *ptr = (void *) lmp;
#endif
return (void *) lmp;