#include "common.h"
#include "NamdTypes.h"
#include "Vector.h"
#include "PDB.h"
#include "Molecule.h"
Go to the source code of this file.
◆ mat_multiply_vec()
◆ read_binary_coors()
void read_binary_coors |
( |
char * |
fname, |
|
|
PDB * |
pdbobj |
|
) |
| |
Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.
Definition at line 34 of file NamdOneTools.C.
void set_all_positions(Vector *)
◆ read_binary_file()
void read_binary_file |
( |
const char * |
fname, |
|
|
Vector * |
vels, |
|
|
int |
n |
|
) |
| |
Definition at line 52 of file NamdOneTools.C.
References endi(), Fclose(), Fopen(), iINFO(), iout, iWARN(), and NAMD_die().
Referenced by WorkDistrib::createAtomLists(), and read_binary_coors().
58 iout <<
iINFO <<
"Reading from binary file " << fname <<
"\n" <<
endi;
61 if ( (fp =
Fopen(fname,
"rb")) == NULL)
64 sprintf(errmsg,
"Unable to open binary file %s", fname);
69 if (fread(&filen,
sizeof(
int32), 1, fp) != (
size_t)1)
72 sprintf(errmsg,
"Error reading binary file %s", fname);
79 memcpy(lenbuf, (
const char *)&filen, 4);
81 tmpc = lenbuf[0]; lenbuf[0] = lenbuf[3]; lenbuf[3] = tmpc;
82 tmpc = lenbuf[1]; lenbuf[1] = lenbuf[2]; lenbuf[2] = tmpc;
83 if ( ! memcmp((
const char *)&filen, lenbuf, 4) ) {
84 iout <<
iWARN <<
"Number of atoms in binary file " << fname <<
85 " is palindromic, assuming same endian.\n" <<
endi;
92 memcpy((
char *)&filen, lenbuf, 4);
97 sprintf(errmsg,
"Incorrect atom count in binary file %s", fname);
101 if (fread(data,
sizeof(
Vector), n, fp) != (
size_t)n)
104 sprintf(errmsg,
"Error reading binary file %s", fname);
111 iout <<
iWARN <<
"Converting binary file " << fname <<
"\n" <<
endi;
113 char *cdata = (
char *) data;
114 for ( i=0; i<3*n; ++i, cdata+=8 ) {
115 char tmp0, tmp1, tmp2, tmp3;
116 tmp0 = cdata[0]; tmp1 = cdata[1];
117 tmp2 = cdata[2]; tmp3 = cdata[3];
118 cdata[0] = cdata[7]; cdata[1] = cdata[6];
119 cdata[2] = cdata[5]; cdata[3] = cdata[4];
120 cdata[7] = tmp0; cdata[6] = tmp1;
121 cdata[5] = tmp2; cdata[4] = tmp3;
std::ostream & iINFO(std::ostream &s)
std::ostream & endi(std::ostream &s)
std::ostream & iWARN(std::ostream &s)
FILE * Fopen(const char *filename, const char *mode)
void NAMD_die(const char *err_msg)
◆ vec_rotation_matrix()
Definition at line 132 of file NamdOneTools.C.
References Vector::length(), PI, Vector::x, xx, xy, Vector::y, yy, yz, Vector::z, zx, and zz.
Referenced by ComputeRestraints::doForce().
144 for (
int i = 0; i < 9; ++i ) m[i] = 0.0;
145 m[0] = m[4] = m[8] = 1.0;
218 m[0] = (one_c *
xx) + c;
219 m[1] = (one_c *
xy) - zs;
220 m[2] = (one_c *
zx) + ys;
222 m[3] = (one_c *
xy) + zs;
223 m[4] = (one_c *
yy) + c;
224 m[5] = (one_c *
yz) - xs;
226 m[6] = (one_c *
zx) - ys;
227 m[7] = (one_c *
yz) + xs;
228 m[8] = (one_c *
zz) + c;
NAMD_HOST_DEVICE BigReal length(void) const