Hi,
I have to somehow modify a C-code by introducing a new array.
We are in the chemical field: I have a small molecule (guest) inside the structure of a larger one (host).
The existing array stores the square of the distance between a specific class of atoms: they are host-guest molecule atoms that are separated by a set distance or by a shorter distance, but not those that are more distance from each other.
My final aim is to plot how many times (occurrences) these atoms are closer than the set distance, versus their actual distance.
If you think of a chart with X & Y axis, the X axis would be the distance, while the Y axis would be the occurrences.
The range of distances I am interested in is from 2 to 10 Armstrong; the X axis will basically have to be formed by as many "bins" as possible...if 8 Armstrong is the window (10 - 2 = 8), and each "bin" is 0.1 Armstrong, I will then have 80 "bins".
What my new array (that I will call guess_bin[90][20]) will have to do is take the squared distance (dist2), already provided, and find the bins for distance increment so that I will have data available to plot.
How can I make that array? Do I need a new loop? The thing that confuses me is these "bins" and how to create them. Please let me know if you need further info.
Thanks,
joe
PS: the first part of the code is where the existing stuff is defined (note that the dimensions of the existing array are defined elsewhere), and below is the other piece of code where the output file (.csv file) is defined.
if (need_monitors)
{
for (host_mon=0; host_mon<=num_host_mon; host_mon++)
{
host_ind = p_monitored->host_list[host_mon];
for (guest_mon=0; guest_mon<=num_guest_mon; guest_mon++)
{
guest_ind = p_monitored->guest_list[guest_mon];
p_guest = p_template+guest_ind;
dist2= atom_separation_squared(&pore[host_ind], p_guest, pbc);
/*** hardwired to contacts less than 4.0A ***/
if ( dist2 <= 16.0 )
{
p_monitored->entry[host_mon][guest_mon]++;
}
}
}
}
****************************************************************************************
if (need_monitors)
{
for (host_mon=0; host_mon<=num_host_mon; host_mon++)
{
host_ind = p_monitored->host_list[host_mon];
for (guest_mon=0; guest_mon<=num_guest_mon; guest_mon++)
{
guest_ind = p_monitored->guest_list[guest_mon];
fprintf(csv_fp,"%d, ",p_monitored->entry[host_mon][guest_mon]);
}
fprintf(csv_fp,"\n");
}
fclose(csv_fp);
}