git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15356 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2016-07-22 22:56:08 +00:00
parent cff65b956a
commit 87a6c1368f
3 changed files with 34 additions and 1 deletions

View File

@ -1,6 +1,8 @@
# LAMMPS multiple-machine -*- Makefile -*-
SHELL = /bin/bash
PYTHON = python
#.IGNORE:
# Definitions
@ -198,7 +200,7 @@ mpi-stubs:
# install LAMMPS shared lib and Python wrapper for Python usage
install-python:
@python ../python/install.py
@$(PYTHON) ../python/install.py
# Create a tarball of src dir and packages

View File

@ -28,6 +28,8 @@
#include "input.h"
#include "variable.h"
#include "modify.h"
#include "output.h"
#include "thermo.h"
#include "compute.h"
#include "fix.h"
#include "comm.h"
@ -149,9 +151,19 @@ void *lammps_extract_global(void *ptr, char *name)
if (strcmp(name,"xz") == 0) return (void *) &lmp->domain->xz;
if (strcmp(name,"yz") == 0) return (void *) &lmp->domain->yz;
if (strcmp(name,"natoms") == 0) return (void *) &lmp->atom->natoms;
if (strcmp(name,"nbonds") == 0) return (void *) &lmp->atom->nbonds;
if (strcmp(name,"nangles") == 0) return (void *) &lmp->atom->nangles;
if (strcmp(name,"ndihedrals") == 0) return (void *) &lmp->atom->ndihedrals;
if (strcmp(name,"nimpropers") == 0) return (void *) &lmp->atom->nimpropers;
if (strcmp(name,"nlocal") == 0) return (void *) &lmp->atom->nlocal;
if (strcmp(name,"ntimestep") == 0) return (void *) &lmp->update->ntimestep;
// NOTE: we cannot give access to the thermo "time" data by reference,
// as that is a recomputed property. only "atime" can be provided as pointer.
// please use lammps_get_thermo() defined below to access all supported
// thermo keywords by value
if (strcmp(name,"atime") == 0) return (void *) &lmp->update->atime;
return NULL;
}
@ -383,6 +395,23 @@ int lammps_set_variable(void *ptr, char *name, char *str)
return err;
}
/* ----------------------------------------------------------------------
return the current value of a thermo keyword as double.
unlike lammps_extract_global() this does not give access to the
storage of the data in question, and thus needs to be called
again to retrieve an updated value. The upshot is that it allows
accessing information that is only computed on-the-fly.
------------------------------------------------------------------------- */
double lammps_get_thermo(void *ptr, char *name)
{
LAMMPS *lmp = (LAMMPS *) ptr;
double dval;
lmp->output->thermo->evaluate_keyword(name,&dval);
return dval;
}
/* ----------------------------------------------------------------------
return the total number of atoms in the system
useful before call to lammps_get_atoms() so can pre-allocate vector

View File

@ -39,7 +39,9 @@ void *lammps_extract_fix(void *, char *, int, int, int, int);
void *lammps_extract_variable(void *, char *, char *);
int lammps_set_variable(void *, char *, char *);
double lammps_get_thermo(void *, char *);
int lammps_get_natoms(void *);
void lammps_gather_atoms(void *, char *, int, int, void *);
void lammps_scatter_atoms(void *, char *, int, int, void *);