1 /* -*- c++ -*- ---------------------------------------------------------- 2 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator 3 https://www.lammps.org/, Sandia National Laboratories 4 Steve Plimpton, sjplimp@sandia.gov 5 6 Copyright (2003) Sandia Corporation. Under the terms of Contract 7 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains 8 certain rights in this software. This software is distributed under 9 the GNU General Public License. 10 11 See the README file in the top-level LAMMPS directory. 12 ------------------------------------------------------------------------- */ 13 14 #ifndef LMP_ONE_MOLECULE_H 15 #define LMP_ONE_MOLECULE_H 16 17 #include "pointers.h" 18 19 namespace LAMMPS_NS { 20 21 class Molecule : protected Pointers { 22 public: 23 char *id; // template id of this molecule, same for all molecules in set 24 int nset; // if first in set, # of molecules in this set 25 // else 0 if not first in set 26 int last; // 1 if last molecule in set, else 0 27 28 // number of atoms,bonds,etc in molecule 29 // nibody,ndbody = # of integer/double fields in body 30 31 int natoms; 32 int nbonds, nangles, ndihedrals, nimpropers; 33 int ntypes, nmolecules, nfragments; 34 int nbondtypes, nangletypes, ndihedraltypes, nimpropertypes; 35 int nibody, ndbody; 36 37 // max bond,angle,etc per atom 38 39 int bond_per_atom, angle_per_atom, dihedral_per_atom, improper_per_atom; 40 int maxspecial; 41 42 // 1 if attribute defined in file, 0 if not 43 44 int xflag, typeflag, moleculeflag, fragmentflag, qflag, radiusflag, rmassflag; 45 int bondflag, angleflag, dihedralflag, improperflag; 46 int nspecialflag, specialflag; 47 int shakeflag, shakeflagflag, shakeatomflag, shaketypeflag; 48 int bodyflag, ibodyflag, dbodyflag; 49 50 // 1 if attribute defined or computed, 0 if not 51 52 int centerflag, massflag, comflag, inertiaflag; 53 54 // 1 if molecule fields require atom IDs 55 56 int tag_require; 57 58 // attributes 59 60 double **x; // displacement of each atom from origin 61 int *type; // type of each atom 62 tagint *molecule; // molecule of each atom 63 double *q; // charge on each atom 64 double *radius; // radius of each atom 65 double *rmass; // mass of each atom 66 67 int *num_bond; // bonds, angles, dihedrals, impropers for each atom 68 int **bond_type; 69 tagint **bond_atom; 70 71 int *num_angle; 72 int **angle_type; 73 tagint **angle_atom1, **angle_atom2, **angle_atom3; 74 75 int *num_dihedral; 76 int **dihedral_type; 77 tagint **dihedral_atom1, **dihedral_atom2, **dihedral_atom3, **dihedral_atom4; 78 79 int *num_improper; 80 int **improper_type; 81 tagint **improper_atom1, **improper_atom2, **improper_atom3, **improper_atom4; 82 83 int **nspecial; 84 tagint **special; 85 86 int *shake_flag; 87 tagint **shake_atom; 88 int **shake_type; 89 90 class AtomVecBody *avec_body; 91 int *ibodyparams; // integer and double body params 92 double *dbodyparams; 93 94 // fragment info 95 96 int **fragmentmask; // nfragments by natoms 97 std::vector<std::string> fragmentnames; 98 99 double center[3]; // geometric center of molecule 100 double masstotal; // total mass of molecule 101 double com[3]; // center of mass of molecule 102 double itensor[6]; // moments of inertia of molecule 103 double inertia[3]; // principal moments of inertia of molecule 104 double ex[3], ey[3], ez[3]; // principal axes of molecule in space coords 105 double quat[4]; // quaternion for orientation of molecule 106 107 double maxradius; // max radius of any atom in molecule 108 double molradius; // radius of molecule from geometric center 109 // including finite-size particle radii 110 int comatom; // index (1-Natom) of atom closest to COM 111 double maxextent; // furthest any atom in molecule is from comatom 112 113 double **dx; // displacement of each atom relative to center 114 double **dxcom; // displacement of each atom relative to COM 115 double **dxbody; // displacement of each atom relative to COM 116 // in body frame (diagonalized interia tensor) 117 118 double *quat_external; // orientation imposed by external class 119 // e.g. FixPour or CreateAtoms 120 121 Molecule(class LAMMPS *, int, char **, int &); 122 ~Molecule(); 123 void compute_center(); 124 void compute_mass(); 125 void compute_com(); 126 void compute_inertia(); 127 int findfragment(const char *); 128 void check_attributes(int); 129 130 private: 131 int me; 132 FILE *fp; 133 int *count; 134 int toffset, boffset, aoffset, doffset, ioffset; 135 int autospecial; 136 double sizescale; 137 138 void read(int); 139 void coords(char *); 140 void types(char *); 141 void molecules(char *); 142 void fragments(char *); 143 void charges(char *); 144 void diameters(char *); 145 void masses(char *); 146 void bonds(int, char *); 147 void angles(int, char *); 148 void dihedrals(int, char *); 149 void impropers(int, char *); 150 void nspecial_read(int, char *); 151 void special_read(char *); 152 void special_generate(); 153 void shakeflag_read(char *); 154 void shakeatom_read(char *); 155 void shaketype_read(char *); 156 void body(int, int, char *); 157 158 void initialize(); 159 void allocate(); 160 void deallocate(); 161 162 void readline(char *); 163 std::string parse_keyword(int, char *); 164 void skip_lines(int, char *, const std::string &); 165 166 // void print(); 167 }; 168 169 } // namespace LAMMPS_NS 170 171 #endif 172 173 /* ERROR/WARNING messages: 174 175 E: Illegal ... command 176 177 Self-explanatory. Check the input script syntax and compare to the 178 documentation for the command. You can use -echo screen as a 179 command-line option when running LAMMPS to see the offending line. 180 181 E: Molecule template ID must be alphanumeric or underscore characters 182 183 Self-explanatory. 184 185 E: Insufficient Jacobi rotations for rigid molecule 186 187 Eigensolve for rigid body was not sufficiently accurate. 188 189 E: Unexpected end of molecule file 190 191 Self-explanatory. 192 193 E: Molecule file z center-of-mass must be 0.0 for 2d 194 195 Self-explanatory. 196 197 E: Molecule file requires atom style body 198 199 Self-explanatory. 200 201 E: Invalid header in molecule file 202 203 UNDOCUMENTED 204 205 E: No count or invalid atom count in molecule file 206 207 The number of atoms must be specified. 208 209 E: Invalid bond count in molecule file 210 211 Self-explanatory. 212 213 E: Invalid angle count in molecule file 214 215 Self-explanatory. 216 217 E: Invalid dihedral count in molecule file 218 219 Self-explanatory. 220 221 E: Invalid improper count in molecule file 222 223 Self-explanatory. 224 225 E: Molecule file has bonds but no nbonds setting 226 227 Self-explanatory. 228 229 E: Molecule file has angles but no nangles setting 230 231 Self-explanatory. 232 233 E: Molecule file has dihedrals but no ndihedrals setting 234 235 Self-explanatory. 236 237 E: Molecule file has impropers but no nimpropers setting 238 239 Self-explanatory. 240 241 E: Molecule file has fragments but no nfragments setting 242 243 Self-explanatory. 244 245 E: Molecule file shake flags not before shake atoms 246 247 The order of the two sections is important. 248 249 E: Molecule file shake flags not before shake bonds 250 251 The order of the two sections is important. 252 253 E: Molecule file has body params but no setting for them 254 255 Self-explanatory. 256 257 E: Unknown section in molecule file 258 259 Self-explanatory. 260 261 E: Molecule file needs both Special Bond sections 262 263 Self-explanatory. 264 265 E: Molecule file has special flags but no bonds 266 267 Self-explanatory. 268 269 E: Molecule file shake info is incomplete 270 271 All 3 SHAKE sections are needed. 272 273 E: Molecule file has no Body Integers section 274 275 Self-explanatory. 276 277 E: Molecule file has no Body Doubles section 278 279 Self-explanatory. 280 281 E: Molecule file has no Fragments section 282 283 Self-explanatory. 284 285 E: Cannot auto-generate special bonds before simulation box is defined 286 287 UNDOCUMENTED 288 289 E: Molecule natoms must be 1 for body particle 290 291 Self-explanatory. 292 293 E: Molecule sizescale must be 1.0 for body particle 294 295 Self-explanatory. 296 297 E: Invalid Coords section in molecule file 298 299 Self-explanatory. 300 301 E: Molecule file z coord must be 0.0 for 2d 302 303 Self-explanatory. 304 305 E: Invalid Types section in molecule file 306 307 Self-explanatory. 308 309 E: Invalid atom type in molecule file 310 311 Atom types must range from 1 to specified # of types. 312 313 E: Invalid Charges section in molecule file 314 315 Self-explanatory. 316 317 E: Invalid Diameters section in molecule file 318 319 Self-explanatory. 320 321 E: Invalid atom diameter in molecule file 322 323 Diameters must be >= 0.0. 324 325 E: Invalid Masses section in molecule file 326 327 Self-explanatory. 328 329 E: Invalid atom mass in molecule file 330 331 Masses must be > 0.0. 332 333 E: Invalid Bonds section in molecule file 334 335 Self-explanatory. 336 337 E: Invalid atom ID in Bonds section of molecule file 338 339 Self-explanatory. 340 341 E: Invalid bond type in Bonds section of molecule file 342 343 Self-explanatory. 344 345 E: Invalid Angles section in molecule file 346 347 Self-explanatory. 348 349 E: Invalid atom ID in Angles section of molecule file 350 351 Self-explanatory. 352 353 E: Invalid angle type in Angles section of molecule file 354 355 Self-explanatory. 356 357 E: Invalid Dihedrals section in molecule file 358 359 Self-explanatory. 360 361 E: Invalid atom ID in dihedrals section of molecule file 362 363 Self-explanatory. 364 365 E: Invalid dihedral type in dihedrals section of molecule file 366 367 Self-explanatory. 368 369 E: Invalid Impropers section in molecule file 370 371 Self-explanatory. 372 373 E: Invalid atom ID in impropers section of molecule file 374 375 Self-explanatory. 376 377 E: Invalid improper type in impropers section of molecule file 378 379 Self-explanatory. 380 381 E: Invalid molecule ID in molecule file 382 383 Molecule ID must be a non-zero positive integer. 384 385 E: Invalid Molecules section in molecule file 386 387 Self-explanatory. 388 389 E: Invalid atom ID in Fragments section of molecule file 390 391 Self-explanatory. 392 393 E: Invalid Special Bond Counts section in molecule file 394 395 Self-explanatory. 396 397 E: Molecule file special list does not match special count 398 399 The number of values in an atom's special list does not match count. 400 401 E: Invalid special atom index in molecule file 402 403 Self-explanatory. 404 405 E: Molecule auto special bond generation overflow 406 407 Counts exceed maxspecial setting for other atoms in system. 408 409 E: Invalid Shake Flags section in molecule file 410 411 UNDOCUMENTED 412 413 E: Invalid shake flag in molecule file 414 415 Self-explanatory. 416 417 E: Invalid shake atom in molecule file 418 419 Self-explanatory. 420 421 E: Invalid shake type data in molecule file 422 423 UNDOCUMENTED 424 425 E: Invalid shake bond type in molecule file 426 427 Self-explanatory. 428 429 E: Invalid shake angle type in molecule file 430 431 Self-explanatory. 432 433 E: Too few values in body section of molecule file 434 435 Self-explanatory. 436 437 E: Too many values in body section of molecule file 438 439 Self-explanatory. 440 441 W: Molecule attributes do not match system attributes 442 443 An attribute is specified (e.g. diameter, charge) that is 444 not defined for the specified atom style. 445 446 E: Molecule topology type exceeds system topology type 447 448 The number of bond, angle, etc types in the molecule exceeds the 449 system setting. See the create_box command for how to specify these 450 values. 451 452 E: Molecule topology/atom exceeds system topology/atom 453 454 The number of bonds, angles, etc per-atom in the molecule exceeds the 455 system setting. See the create_box command for how to specify these 456 values. 457 458 W: Molecule has bond topology but no special bond settings 459 460 This means the bonded atoms will not be excluded in pair-wise 461 interactions. 462 463 E: Cannot open molecule file %s 464 465 The specified file cannot be opened. Check that the path and name are 466 correct. 467 468 */ 469