biod.pnpi.spb.ru
/
alexxy
/
gromacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into pygromacs
[alexxy/gromacs.git]
/
src
/
gromacs
/
gmxana
/
gmx_density.cpp
diff --git
a/src/gromacs/gmxana/gmx_density.c
b/src/gromacs/gmxana/gmx_density.cpp
similarity index 96%
rename from
src/gromacs/gmxana/gmx_density.c
rename to
src/gromacs/gmxana/gmx_density.cpp
index 29bd719c4380249654e5134386405de7e8543bce..f63db4e7f836c5f58fdfea6c380c8477c0137331 100644
(file)
--- a/
src/gromacs/gmxana/gmx_density.c
+++ b/
src/gromacs/gmxana/gmx_density.cpp
@@
-36,10
+36,10
@@
*/
#include "gmxpre.h"
*/
#include "gmxpre.h"
-#include <c
type.h
>
-#include <
math.
h>
-#include <
stdlib.h
>
-#include <
string.h
>
+#include <c
ctype
>
+#include <
cmat
h>
+#include <
cstdlib
>
+#include <
cstring
>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/trxio.h"
@@
-57,6
+57,7
@@
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
typedef struct {
#include "gromacs/utility/smalloc.h"
typedef struct {
@@
-75,7
+76,7
@@
int compare(void *a, void *b)
t_electron *tmp1, *tmp2;
tmp1 = (t_electron *)a; tmp2 = (t_electron *)b;
t_electron *tmp1, *tmp2;
tmp1 = (t_electron *)a; tmp2 = (t_electron *)b;
- return strcmp(tmp1->atomname, tmp2->atomname);
+ return st
d::st
rcmp(tmp1->atomname, tmp2->atomname);
}
int get_electrons(t_electron **eltab, const char *fn)
}
int get_electrons(t_electron **eltab, const char *fn)
@@
-204,7
+205,7
@@
void calc_electron_density(const char *fn, atom_id **index, int gnx[],
if (!*nslices)
{
if (!*nslices)
{
- *nslices =
(int)
(box[axis][axis] * 10); /* default value */
+ *nslices =
static_cast<int>
(box[axis][axis] * 10); /* default value */
fprintf(stderr, "\nDividing the box in %d slices\n", *nslices);
}
fprintf(stderr, "\nDividing the box in %d slices\n", *nslices);
}
@@
-265,11
+266,11
@@
void calc_electron_density(const char *fn, atom_id **index, int gnx[],
/* determine which slice atom is in */
if (bCenter)
{
/* determine which slice atom is in */
if (bCenter)
{
- slice =
floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2
;
+ slice =
static_cast<int>(std::floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2)
;
}
else
{
}
else
{
- slice = (z / (*slWidth));
+ slice =
static_cast<int>
(z / (*slWidth));
}
sought.nr_el = 0;
sought.atomname = gmx_strdup(*(top->atoms.atomname[index[n][i]]));
}
sought.nr_el = 0;
sought.atomname = gmx_strdup(*(top->atoms.atomname[index[n][i]]));
@@
-336,15
+337,12
@@
void calc_density(const char *fn, atom_id **index, int gnx[],
double invvol;
int natoms; /* nr. atoms in trj */
t_trxstatus *status;
double invvol;
int natoms; /* nr. atoms in trj */
t_trxstatus *status;
- int **slCount, /* nr. of atoms in one slice for a group */
- i, j, n, /* loop indices */
- ax1 = 0, ax2 = 0,
+ int i, n, /* loop indices */
nr_frames = 0, /* number of frames */
slice; /* current slice */
real t,
z;
real boxSz, aveBox;
nr_frames = 0, /* number of frames */
slice; /* current slice */
real t,
z;
real boxSz, aveBox;
- char *buf; /* for tmp. keeping atomname */
gmx_rmpbc_t gpbc = NULL;
if (axis < 0 || axis >= DIM)
gmx_rmpbc_t gpbc = NULL;
if (axis < 0 || axis >= DIM)
@@
-361,7
+359,7
@@
void calc_density(const char *fn, atom_id **index, int gnx[],
if (!*nslices)
{
if (!*nslices)
{
- *nslices =
(int)
(box[axis][axis] * 10); /* default value */
+ *nslices =
static_cast<int>
(box[axis][axis] * 10); /* default value */
fprintf(stderr, "\nDividing the box in %d slices\n", *nslices);
}
fprintf(stderr, "\nDividing the box in %d slices\n", *nslices);
}
@@
-422,11
+420,11
@@
void calc_density(const char *fn, atom_id **index, int gnx[],
/* determine which slice atom is in */
if (bCenter)
{
/* determine which slice atom is in */
if (bCenter)
{
- slice =
floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2
;
+ slice =
static_cast<int>(std::floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2)
;
}
else
{
}
else
{
- slice =
floor(z / (*slWidth
));
+ slice =
static_cast<int>(std::floor(z / (*slWidth)
));
}
/* Slice should already be 0<=slice<nslices, but we just make
}
/* Slice should already be 0<=slice<nslices, but we just make
@@
-504,6
+502,8
@@
void plot_density(double *slDensity[], const char *afile, int nslices,
xlabel = bRelative ? "Average coordinate (nm)" : "Coordinate (nm)";
}
xlabel = bRelative ? "Average coordinate (nm)" : "Coordinate (nm)";
}
+ GMX_RELEASE_ASSERT(dens_opt[0] != NULL, "Option setting inconsistency; dens_opt[0] is NULL");
+
switch (dens_opt[0][0])
{
case 'm': ylabel = "Density (kg m\\S-3\\N)"; break;
switch (dens_opt[0][0])
{
case 'm': ylabel = "Density (kg m\\S-3\\N)"; break;
@@
-724,7
+724,8
@@
int gmx_density(int argc, char *argv[])
}
else
{
}
else
{
- ncenter = 0;
+ ncenter = 0;
+ index_center = NULL;
}
fprintf(stderr, "\nSelect %d group%s to calculate density for:\n", ngrps, (ngrps > 1) ? "s" : "");
}
fprintf(stderr, "\nSelect %d group%s to calculate density for:\n", ngrps, (ngrps > 1) ? "s" : "");