git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8498 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
@ -50,7 +50,7 @@ extern "C" {
|
||||
} plugin_reginfo_t;
|
||||
|
||||
// callback function for plugin registration.
|
||||
static int plugin_register_cb(void *v, vmdplugin_t *p)
|
||||
static int plugin_register_cb(void *v, vmdplugin_t *p)
|
||||
{
|
||||
plugin_reginfo_t *r = static_cast<plugin_reginfo_t *>(v);
|
||||
// make sure we have the proper plugin type (native reader)
|
||||
@ -63,10 +63,10 @@ extern "C" {
|
||||
}
|
||||
|
||||
/* periodic table of elements for translation of ordinal to atom type */
|
||||
static const char *pte_label[] = {
|
||||
static const char *pte_label[] = {
|
||||
"X", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne",
|
||||
"Na", "Mg", "Al", "Si", "P" , "S", "Cl", "Ar", "K", "Ca", "Sc",
|
||||
"Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge",
|
||||
"Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge",
|
||||
"As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc",
|
||||
"Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe",
|
||||
"Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb",
|
||||
@ -79,22 +79,22 @@ extern "C" {
|
||||
static const int nr_pte_entries = sizeof(pte_label) / sizeof(char *);
|
||||
|
||||
/* corresponding table of masses. */
|
||||
static const float pte_mass[] = {
|
||||
/* X */ 0.00000, 1.00794, 4.00260, 6.941, 9.012182, 10.811,
|
||||
/* C */ 12.0107, 14.0067, 15.9994, 18.9984032, 20.1797,
|
||||
static const float pte_mass[] = {
|
||||
/* X */ 0.00000, 1.00794, 4.00260, 6.941, 9.012182, 10.811,
|
||||
/* C */ 12.0107, 14.0067, 15.9994, 18.9984032, 20.1797,
|
||||
/* Na */ 22.989770, 24.3050, 26.981538, 28.0855, 30.973761,
|
||||
/* S */ 32.065, 35.453, 39.948, 39.0983, 40.078, 44.955910,
|
||||
/* Ti */ 47.867, 50.9415, 51.9961, 54.938049, 55.845, 58.9332,
|
||||
/* Ni */ 58.6934, 63.546, 65.409, 69.723, 72.64, 74.92160,
|
||||
/* Se */ 78.96, 79.904, 83.798, 85.4678, 87.62, 88.90585,
|
||||
/* Ni */ 58.6934, 63.546, 65.409, 69.723, 72.64, 74.92160,
|
||||
/* Se */ 78.96, 79.904, 83.798, 85.4678, 87.62, 88.90585,
|
||||
/* Zr */ 91.224, 92.90638, 95.94, 98.0, 101.07, 102.90550,
|
||||
/* Pd */ 106.42, 107.8682, 112.411, 114.818, 118.710, 121.760,
|
||||
/* Te */ 127.60, 126.90447, 131.293, 132.90545, 137.327,
|
||||
/* Pd */ 106.42, 107.8682, 112.411, 114.818, 118.710, 121.760,
|
||||
/* Te */ 127.60, 126.90447, 131.293, 132.90545, 137.327,
|
||||
/* La */ 138.9055, 140.116, 140.90765, 144.24, 145.0, 150.36,
|
||||
/* Eu */ 151.964, 157.25, 158.92534, 162.500, 164.93032,
|
||||
/* Eu */ 151.964, 157.25, 158.92534, 162.500, 164.93032,
|
||||
/* Er */ 167.259, 168.93421, 173.04, 174.967, 178.49, 180.9479,
|
||||
/* W */ 183.84, 186.207, 190.23, 192.217, 195.078, 196.96655,
|
||||
/* Hg */ 200.59, 204.3833, 207.2, 208.98038, 209.0, 210.0, 222.0,
|
||||
/* W */ 183.84, 186.207, 190.23, 192.217, 195.078, 196.96655,
|
||||
/* Hg */ 200.59, 204.3833, 207.2, 208.98038, 209.0, 210.0, 222.0,
|
||||
/* Fr */ 223.0, 226.0, 227.0, 232.0381, 231.03588, 238.02891,
|
||||
/* Np */ 237.0, 244.0, 243.0, 247.0, 247.0, 251.0, 252.0, 257.0,
|
||||
/* Md */ 258.0, 259.0, 262.0, 261.0, 262.0, 266.0, 264.0, 269.0,
|
||||
@ -103,24 +103,24 @@ extern "C" {
|
||||
|
||||
/*
|
||||
* corresponding table of VDW radii.
|
||||
* van der Waals radii are taken from A. Bondi,
|
||||
* J. Phys. Chem., 68, 441 - 452, 1964,
|
||||
* except the value for H, which is taken from R.S. Rowland & R. Taylor,
|
||||
* J.Phys.Chem., 100, 7384 - 7391, 1996. Radii that are not available in
|
||||
* van der Waals radii are taken from A. Bondi,
|
||||
* J. Phys. Chem., 68, 441 - 452, 1964,
|
||||
* except the value for H, which is taken from R.S. Rowland & R. Taylor,
|
||||
* J.Phys.Chem., 100, 7384 - 7391, 1996. Radii that are not available in
|
||||
* either of these publications have RvdW = 2.00 <20>.
|
||||
* The radii for Ions (Na, K, Cl, Ca, Mg, and Cs are based on the CHARMM27
|
||||
* The radii for Ions (Na, K, Cl, Ca, Mg, and Cs are based on the CHARMM27
|
||||
* Rmin/2 parameters for (SOD, POT, CLA, CAL, MG, CES) by default.
|
||||
*/
|
||||
static const float pte_vdw_radius[] = {
|
||||
/* X */ 1.5, 1.2, 1.4, 1.82, 2.0, 2.0,
|
||||
/* C */ 1.7, 1.55, 1.52, 1.47, 1.54,
|
||||
static const float pte_vdw_radius[] = {
|
||||
/* X */ 1.5, 1.2, 1.4, 1.82, 2.0, 2.0,
|
||||
/* C */ 1.7, 1.55, 1.52, 1.47, 1.54,
|
||||
/* Na */ 1.36, 1.18, 2.0, 2.1, 1.8,
|
||||
/* S */ 1.8, 2.27, 1.88, 1.76, 1.37, 2.0,
|
||||
/* Ti */ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
|
||||
/* Ni */ 1.63, 1.4, 1.39, 1.07, 2.0, 1.85,
|
||||
/* Se */ 1.9, 1.85, 2.02, 2.0, 2.0, 2.0,
|
||||
/* Se */ 1.9, 1.85, 2.02, 2.0, 2.0, 2.0,
|
||||
/* Zr */ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
|
||||
/* Pd */ 1.63, 1.72, 1.58, 1.93, 2.17, 2.0,
|
||||
/* Pd */ 1.63, 1.72, 1.58, 1.93, 2.17, 2.0,
|
||||
/* Te */ 2.06, 1.98, 2.16, 2.1, 2.0,
|
||||
/* La */ 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
|
||||
/* Eu */ 2.0, 2.0, 2.0, 2.0, 2.0,
|
||||
@ -166,7 +166,7 @@ extern "C" {
|
||||
case 8: return 1.3; /* O */
|
||||
case 9: return 1.2; /* F */
|
||||
case 15: return 1.5; /* P */
|
||||
case 16: return 1.9; /* S */
|
||||
case 16: return 1.9; /* S */
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -177,13 +177,13 @@ extern "C" {
|
||||
{
|
||||
int i;
|
||||
char atom[3];
|
||||
|
||||
|
||||
/* zap string */
|
||||
atom[0] = (char) 0;
|
||||
atom[1] = (char) 0;
|
||||
atom[2] = (char) 0;
|
||||
/* if we don't have a null-pointer, there must be at least two
|
||||
* chars, which is all we need. we convert to the capitalization
|
||||
/* if we don't have a null-pointer, there must be at least two
|
||||
* chars, which is all we need. we convert to the capitalization
|
||||
* convention of the table above during assignment. */
|
||||
if (label != NULL) {
|
||||
atom[0] = (char) toupper((int) label[0]);
|
||||
@ -191,12 +191,12 @@ extern "C" {
|
||||
}
|
||||
/* discard numbers in atom label */
|
||||
if (isdigit(atom[1])) atom[1] = (char) 0;
|
||||
|
||||
|
||||
for (i=0; i < nr_pte_entries; ++i) {
|
||||
if ( (pte_label[i][0] == atom[0])
|
||||
&& (pte_label[i][1] == atom[1]) ) return i;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -217,12 +217,12 @@ extern "C" {
|
||||
|
||||
if (ind < 1)
|
||||
return 0; /* no non-whitespace characters */
|
||||
|
||||
|
||||
for (i=0; i < nr_pte_entries; ++i) {
|
||||
if ((toupper(pte_label[i][0]) == atom[0]) && (toupper(pte_label[i][1]) == atom[1]))
|
||||
if ((toupper(pte_label[i][0]) == atom[0]) && (toupper(pte_label[i][1]) == atom[1]))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -246,7 +246,7 @@ extern "C" {
|
||||
dirhandle_t *d;
|
||||
int len;
|
||||
|
||||
if (dirname == NULL)
|
||||
if (dirname == NULL)
|
||||
return NULL;
|
||||
d = new dirhandle_t;
|
||||
|
||||
@ -275,9 +275,9 @@ extern "C" {
|
||||
static char *my_readdir(dirhandle_t *d)
|
||||
{
|
||||
if (FindNextFile(d->h, &(d->fd))) {
|
||||
return d->fd.cFileName;
|
||||
return d->fd.cFileName;
|
||||
}
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// close directory handle
|
||||
@ -298,10 +298,10 @@ extern "C" {
|
||||
|
||||
// report error message from dlopen
|
||||
static const char *my_dlerror(void) {
|
||||
static CHAR szBuf[80];
|
||||
static CHAR szBuf[80];
|
||||
DWORD dw = GetLastError();
|
||||
|
||||
sprintf(szBuf, "my_dlopen failed: GetLastError returned %u\n", dw);
|
||||
sprintf(szBuf, "my_dlopen failed: GetLastError returned %u\n", dw);
|
||||
return szBuf;
|
||||
}
|
||||
|
||||
@ -645,7 +645,7 @@ int MolfileInterface::open(const char *name, int *natoms)
|
||||
if (!_plugin || !_dso || !natoms)
|
||||
return E_FILE;
|
||||
molfile_plugin_t *p = static_cast<molfile_plugin_t *>(_plugin);
|
||||
|
||||
|
||||
if (_mode & M_WRITE)
|
||||
_ptr = p->open_file_write(name,_type,*natoms);
|
||||
else if (_mode & M_READ)
|
||||
@ -688,7 +688,7 @@ int MolfileInterface::structure()
|
||||
optflags |= (_props & P_CHRG) ? MOLFILE_CHARGE : 0;
|
||||
optflags |= (_props & P_RADS) ? MOLFILE_RADIUS : 0;
|
||||
optflags |= (_props & P_ATMN) ? MOLFILE_ATOMICNUMBER : 0;
|
||||
|
||||
|
||||
molfile_atom_t *a = static_cast<molfile_atom_t *>(_info);
|
||||
p->write_structure(_ptr,optflags,a);
|
||||
} else if (_mode & M_RSTRUCT) {
|
||||
@ -743,7 +743,7 @@ int MolfileInterface::timestep(float *coords, float *vels,
|
||||
molfile_plugin_t *p = static_cast<molfile_plugin_t *>(_plugin);
|
||||
molfile_timestep_t *t = new molfile_timestep_t;
|
||||
int rv;
|
||||
|
||||
|
||||
if (_mode & M_WRITE) {
|
||||
t->coords = coords;
|
||||
t->velocities = vels;
|
||||
@ -845,7 +845,7 @@ static int read_int_property(molfile_atom_t &a, const int propid)
|
||||
|
||||
PROPUPDATE(MolfileInterface::P_RESI,resid,prop);
|
||||
PROPUPDATE(MolfileInterface::P_ATMN,atomicnumber,prop);
|
||||
|
||||
|
||||
PROPUPDATE((MolfileInterface::P_ATMN|MolfileInterface::P_NAME),
|
||||
name,sprop);
|
||||
PROPUPDATE((MolfileInterface::P_ATMN|MolfileInterface::P_TYPE),
|
||||
@ -896,7 +896,7 @@ static const char *read_string_property(molfile_atom_t &a,
|
||||
// floating point props
|
||||
static int write_atom_property(molfile_atom_t &a,
|
||||
const int propid,
|
||||
const float prop)
|
||||
const float prop)
|
||||
{
|
||||
int plist = MolfileInterface::P_NONE;
|
||||
PROPUPDATE(MolfileInterface::P_OCCP,occupancy,prop);
|
||||
@ -910,7 +910,7 @@ static int write_atom_property(molfile_atom_t &a,
|
||||
// double precision floating point props
|
||||
static int write_atom_property(molfile_atom_t &a,
|
||||
const int propid,
|
||||
const double prop)
|
||||
const double prop)
|
||||
{
|
||||
return write_atom_property(a,propid,static_cast<float>(prop));
|
||||
}
|
||||
@ -918,7 +918,7 @@ static int write_atom_property(molfile_atom_t &a,
|
||||
// integer and derived props
|
||||
static int write_atom_property(molfile_atom_t &a,
|
||||
const int propid,
|
||||
const int prop)
|
||||
const int prop)
|
||||
{
|
||||
int plist = MolfileInterface::P_NONE;
|
||||
PROPUPDATE(MolfileInterface::P_RESI,resid,prop);
|
||||
@ -935,7 +935,7 @@ static int write_atom_property(molfile_atom_t &a,
|
||||
// integer and derived props
|
||||
static int write_atom_property(molfile_atom_t &a,
|
||||
const int propid,
|
||||
const char *prop)
|
||||
const char *prop)
|
||||
{
|
||||
int plist = MolfileInterface::P_NONE;
|
||||
PROPSTRCPY(MolfileInterface::P_NAME,name,prop);
|
||||
@ -1078,13 +1078,13 @@ int MolfileInterface::property(int propid, double *prop)
|
||||
_props |= write_atom_property(a[IDX],P_CHAI,buf)
|
||||
|
||||
// set/get atom integer property
|
||||
int MolfileInterface::property(int propid, int idx, int *prop)
|
||||
int MolfileInterface::property(int propid, int idx, int *prop)
|
||||
{
|
||||
if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms))
|
||||
return P_NONE;
|
||||
|
||||
molfile_atom_t *a = static_cast<molfile_atom_t *>(_info);
|
||||
|
||||
|
||||
if (_mode & M_WSTRUCT) {
|
||||
char buf[64];
|
||||
|
||||
@ -1103,13 +1103,13 @@ int MolfileInterface::property(int propid, int idx, int *prop)
|
||||
}
|
||||
|
||||
// set/get per type integer property
|
||||
int MolfileInterface::property(int propid, int *types, int *prop)
|
||||
int MolfileInterface::property(int propid, int *types, int *prop)
|
||||
{
|
||||
if ((_info == NULL) || (types == NULL) || (prop == NULL))
|
||||
return P_NONE;
|
||||
|
||||
molfile_atom_t *a = static_cast<molfile_atom_t *>(_info);
|
||||
|
||||
|
||||
if (_mode & M_WSTRUCT) {
|
||||
char buf[64];
|
||||
|
||||
@ -1132,13 +1132,13 @@ int MolfileInterface::property(int propid, int *types, int *prop)
|
||||
}
|
||||
|
||||
// set/get per atom integer property
|
||||
int MolfileInterface::property(int propid, int *prop)
|
||||
int MolfileInterface::property(int propid, int *prop)
|
||||
{
|
||||
if ((_info == NULL) || (prop == NULL))
|
||||
return P_NONE;
|
||||
|
||||
molfile_atom_t *a = static_cast<molfile_atom_t *>(_info);
|
||||
|
||||
|
||||
if (_mode & M_WSTRUCT) {
|
||||
char buf[64];
|
||||
|
||||
@ -1150,7 +1150,7 @@ int MolfileInterface::property(int propid, int *prop)
|
||||
sprintf(buf,"%d",prop[i]);
|
||||
INT_TO_STRING_BODY(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_mode & M_RSTRUCT) {
|
||||
@ -1169,7 +1169,7 @@ int MolfileInterface::property(int propid, int idx, char *prop)
|
||||
return P_NONE;
|
||||
|
||||
molfile_atom_t *a = static_cast<molfile_atom_t *>(_info);
|
||||
|
||||
|
||||
if (_mode & M_WSTRUCT) {
|
||||
_props |= write_atom_property(a[idx], propid, prop);
|
||||
}
|
||||
@ -1187,7 +1187,7 @@ int MolfileInterface::property(int propid, int *types, char **prop)
|
||||
return P_NONE;
|
||||
|
||||
molfile_atom_t *a = static_cast<molfile_atom_t *>(_info);
|
||||
|
||||
|
||||
if (_mode & M_WSTRUCT) {
|
||||
for (int i=0; i < _natoms; ++i) {
|
||||
_props |= write_atom_property(a[i], propid, prop[types[i]]);
|
||||
@ -1208,7 +1208,7 @@ int MolfileInterface::property(int propid, char **prop)
|
||||
return P_NONE;
|
||||
|
||||
molfile_atom_t *a = static_cast<molfile_atom_t *>(_info);
|
||||
|
||||
|
||||
if (_mode & M_WSTRUCT) {
|
||||
for (int i=0; i < _natoms; ++i) {
|
||||
_props |= write_atom_property(a[i], propid, prop[i]);
|
||||
@ -1221,5 +1221,3 @@ int MolfileInterface::property(int propid, char **prop)
|
||||
|
||||
return _props;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user