[lammps-users] new fix question

Hello everyone,

I have created a new fix that modifies the way the equations of motion are integrated. During the course of the simulation I’m interested in monitoring variables that are created inside this fix. I followed the way other fixes such as msd, rdf, com create a file to output results

At the beginning of the fix where the inputs to the fix are read:

MPI_Comm_rank(world,&me);
if (me == 0) {
fp = fopen(arg[4],“w”);
if (fp == NULL) {
char str[128];
sprintf(str,“Cannot open fix ttm file %s”,arg[4]);
error->one(str);
}
}

This new fix has initial_integrate() and final_integrate(). I want to get some variables from initial_integrate() using

if (me == 0) fprintf(fp,"%d %g %g\n",natoms[iregion],Tph[iregion],Te[iregion])

where natoms[iregion], Tph[iregion] and Te[iregion] are the quantities I want to obtain in my log file for that fix and correspond to arrays that are calculated in the fix (so actually the above line is inside a loop that starts from iregion = 1).

So far I get an error: Address not mapped.

any suggestions?
thanks
Jaime Sanchez

LAMMPS has a mechanism is place for fixes to provide one or
more quantities for thermo_style custom to print out. The
thermo command accesses them as f_ID[n] and your fix
just needs to include a thermo(int) method to return
the requested value.

Steve

Thanks for the input Steve. Actually I was able to figure out the way to create this log file directly from the new fix.

Jaime