Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ for (n=0 ; n<analysis->num_frames ; n++)
*/

/* CURRENT - loop over all atoms - even duplicates so that we can record */
/* distance between an atom and it's periodic images (NB: correct for double counting) */
/* distance between an atom and its periodic images (NB: correct for double counting) */
for (i=0 ; i<analysis->num_atoms ; i++)
{
corei = g_slist_nth_data(model->cores, i);
Expand Down
26 changes: 26 additions & 0 deletions src/coords.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,32 @@ The GNU GPL can also be found at http://www.gnu.org
extern struct sysenv_pak sysenv;
extern struct elem_pak elements[];

#define DEBUG_CALC_CENTROID 0
/*************************************/
/* return centroid of selected atoms */
/*************************************/
void calc_centroid(gdouble *centroid, GSList *input)
{
GSList *list=NULL;
struct core_pak *core;

if (!input)
return;

VEC3SET(centroid, 0.0, 0.0, 0.0);
for (list=input ; list ; list=g_slist_next(list))
{
core = list->data;
ARR3ADD(centroid, core->x);
}

VEC3MUL(centroid, 1.0 / (gdouble) g_slist_length(input));

#if DEBUG_CALC_CENTROID
P3VEC("Centroid = ", centroid);
#endif
}

/**********************/
/* debugging routines */
/**********************/
Expand Down
1 change: 1 addition & 0 deletions src/coords.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,4 @@ GSList *connect_fragment_get(struct core_pak *,
struct model_pak *);
GSList *connect_neighbours(struct core_pak *) ;

void calc_centroid(gdouble *, GSList *);
18 changes: 14 additions & 4 deletions src/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ The GNU GPL can also be found at http://www.gnu.org
#include <sys/stat.h>
#include <sys/types.h>

#define GLIB_VERSION(major, minor, micro) \
(GLIB_MAJOR_VERSION > (major) || \
(GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \
(GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \
GLIB_MICRO_VERSION >= (micro)))

#include "gdis.h"
#include "coords.h"
#include "error.h"
Expand All @@ -56,9 +62,9 @@ The GNU GPL can also be found at http://www.gnu.org
extern struct sysenv_pak sysenv;
extern struct elem_pak elements[];

/***************************************/
/* setup the recognized file type list */
/***************************************/
/****************************************/
/* set up the recognized file type list */
/****************************************/
#define DEBUG_FILE_INIT 0
void file_init(void)
{
Expand Down Expand Up @@ -346,7 +352,7 @@ file_data = g_malloc(sizeof(struct file_pak));
file_data->id = QE;
file_data->group = QE;
file_data->menu = TRUE;
file_data->label = g_strdup("QE");
file_data->label = g_strdup("Quantum Espresso");
file_data->ext = NULL;
file_data->ext = g_slist_append(file_data->ext, "qein");
file_data->write_file = write_qe;
Expand Down Expand Up @@ -801,7 +807,11 @@ while (list)
name = list->data;
list = g_slist_next(list);

#if GLIB_VERSION(2, 7, 0)
if (!g_pattern_spec_match_string(ps, name))
#else
if (!g_pattern_match_string(ps, name))
#endif
{
files = g_slist_remove(files, name);
g_free(name);
Expand Down
3 changes: 3 additions & 0 deletions src/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ gint write_gmf(gchar *, struct model_pak *);
gint write_planes(gchar *, struct model_pak *);
gint write_marvin(gchar *, struct model_pak *);
gint write_xml(gchar *, struct model_pak *);
gint write_xsf(gchar *, struct model_pak *);
gint write_xtl(gchar *, struct model_pak *);
gint write_xyz(gchar *, struct model_pak *);
gint write_gms(gchar *, struct model_pak *);
Expand Down Expand Up @@ -142,6 +143,7 @@ gint read_marvin(gchar *, struct model_pak *);
gint read_mvnout(gchar *, struct model_pak *);
gint read_sout(gchar *, struct model_pak *);
gint read_xml(gchar *, struct model_pak *);
gint read_xsf(gchar *, struct model_pak *);
gint read_xtl(gchar *, struct model_pak *);
gint read_xyz(gchar *, struct model_pak *);
gint read_using_babel(gchar *, struct model_pak *);
Expand Down Expand Up @@ -189,6 +191,7 @@ gint read_qe_out_frame(FILE *, struct model_pak *);
gint read_xyz_frame(FILE *, struct model_pak *);
gint read_dlpoly_frame(FILE *, struct model_pak *);
gint read_dmol_frame(FILE *, struct model_pak *);
gint read_xsf_frame(FILE *, struct model_pak *);

/*NEW: track/update frames (TODO)*/
gint update_frame_uspex(gint idx,struct model_pak *model);
Expand Down
2 changes: 1 addition & 1 deletion src/file_cif.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ else
return(-1);
}
#if DEBUG_LOAD_CIF
printf("Found %d atom%c.\n", natom, (natom != 1?'s':''));
printf("Found %d atom%s\n", natom, (natom != 1 ? "s.":"."));
printf("Found %d symmetry matrices.\n", data->sginfo.order);
printf("Found %d model(s)\n", new);
printf("Periodicity is %d\n", data->periodic);
Expand Down
12 changes: 6 additions & 6 deletions src/file_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ extern struct elem_pak elements[];

/* meta data for computational chemistry archiving */

/*****************************************************************/
/* split a string containing units into it's raw value and units */
/*****************************************************************/
/****************************************************************/
/* split a string containing units into its raw value and units */
/****************************************************************/
void meta_parse_units(gchar **value, gchar **units, gchar *source)
{
gchar **buff;

buff = g_strsplit(source, " ", 2);

if (*buff+0)
*value = g_strdup(*(buff+0));
if (*buff)
*value = g_strdup(*(buff));
else
*value = NULL;

if (*buff+1)
if (g_strv_length(buff) == 2)
*units = g_strdup(*(buff+1));
else
*units = NULL;
Expand Down
Loading