| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#ifndef MOLECULE_H |
| 20 |
#define MOLECULE_H 1 |
| 21 |
#include <math.h> |
| 22 |
#if defined _MSC_VER && _MSC_VER == 1500 |
| 23 |
#ifndef fmin |
| 24 |
#define fmin(x, y) (((x) < (y)) ? (x) : (y)) |
| 25 |
#endif |
| 26 |
#ifndef fmax |
| 27 |
#define fmax(x, y) (((x) > (y)) ? (x) : (y)) |
| 28 |
#endif |
| 29 |
#ifndef round |
| 30 |
#define round(x) (x<0?ceil((x)-0.5):floor((x)+0.5)) |
| 31 |
#endif |
| 32 |
#endif |
| 33 |
#include <QString> |
| 34 |
#include <QStringList> |
| 35 |
#include <QList> |
| 36 |
#include <QtOpenGL> |
| 37 |
#include <QOpenGLShaderProgram> |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#include <QtCore> |
| 46 |
#ifndef M_PI |
| 47 |
#define M_PI 3.14159265358979323846 |
| 48 |
#endif |
| 49 |
#ifndef M_PIf |
| 50 |
#define M_PIf 3.14159265358979323846f |
| 51 |
#endif |
| 52 |
#define ATOM_STYLE_WALLS 1 |
| 53 |
#define ATOM_STYLE_RINGS 2 |
| 54 |
#define ATOM_STYLE_SPHERE 4 |
| 55 |
#define ATOM_STYLE_SOLID 8 |
| 56 |
#define ATOM_STYLE_WHITERING 16 |
| 57 |
#define ATOM_STYLE_NOLABEL 32 |
| 58 |
#define ATOM_STYLE_NOADP 64 |
| 59 |
#define ATOM_STYLE_PLAID 128 |
| 60 |
#define ATOM_STYLE_METAL 256 |
| 61 |
#include <QSettings> |
| 62 |
#ifndef GLAPIENTRY |
| 63 |
#if defined(_MSC_VER) || defined(__MINGW32__) |
| 64 |
#define GLAPIENTRY __stdcall |
| 65 |
#else |
| 66 |
#define GLAPIENTRY |
| 67 |
#endif |
| 68 |
#endif |
| 69 |
|
| 70 |
#ifndef GLAPIENTRYP |
| 71 |
#define GLAPIENTRYP GLAPIENTRY * |
| 72 |
#endif |
| 73 |
|
| 74 |
typedef void (GLAPIENTRYP GLU_func_ptr)(void); |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
struct V3 { |
| 79 |
double x |
| 80 |
,y |
| 81 |
,z |
| 82 |
; |
| 83 |
|
| 84 |
inline V3( void ){} |
| 85 |
inline V3( const double& _x, const double& _y, const double& _z ) : |
| 86 |
x(_x), y(_y), z(_z) |
| 87 |
|
| 88 |
{ |
| 89 |
; |
| 90 |
} |
| 91 |
inline V3& operator *= ( const double& d ){ |
| 92 |
x *= d; |
| 93 |
y *= d; |
| 94 |
z *= d; |
| 95 |
return *this; |
| 96 |
} |
| 97 |
inline V3& operator += ( const V3& v ){ |
| 98 |
x += v.x; |
| 99 |
y += v.y; |
| 100 |
z += v.z; |
| 101 |
return *this; |
| 102 |
} |
| 103 |
inline V3& operator += ( const double& v ){ |
| 104 |
x += v; |
| 105 |
y += v; |
| 106 |
z += v; |
| 107 |
return *this; |
| 108 |
} |
| 109 |
}; |
| 110 |
inline V3 operator + ( const V3& v1, const V3& v2 ) { |
| 111 |
V3 t; |
| 112 |
t.x = v1.x + v2.x; |
| 113 |
t.y = v1.y + v2.y; |
| 114 |
t.z = v1.z + v2.z; |
| 115 |
return t; |
| 116 |
} |
| 117 |
inline V3 operator - ( const V3& v1, const V3& v2 ) { |
| 118 |
V3 t; |
| 119 |
t.x = v1.x - v2.x; |
| 120 |
t.y = v1.y - v2.y; |
| 121 |
t.z = v1.z - v2.z; |
| 122 |
return t; |
| 123 |
} |
| 124 |
inline V3 operator * ( const V3& v, const double& d ) { |
| 125 |
V3 t; |
| 126 |
t.x = v.x*d; |
| 127 |
t.y = v.y*d; |
| 128 |
t.z = v.z*d; |
| 129 |
return t; |
| 130 |
} |
| 131 |
inline V3 operator * ( const double& d, const V3& v ) { |
| 132 |
V3 t; |
| 133 |
t.x = v.x*d; |
| 134 |
t.y = v.y*d; |
| 135 |
t.z = v.z*d; |
| 136 |
return t; |
| 137 |
} |
| 138 |
inline V3 operator % ( const V3& v1, const V3& v2 ) { |
| 139 |
V3 t; |
| 140 |
t.x = v1.y*v2.z - v2.y*v1.z; |
| 141 |
t.y = v1.z*v2.x - v2.z*v1.x; |
| 142 |
t.z = v1.x*v2.y - v2.x*v1.y; |
| 143 |
return t; |
| 144 |
} |
| 145 |
inline double operator * ( const V3& v1, const V3& v2 ) { |
| 146 |
return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z; |
| 147 |
} |
| 148 |
inline double Norm( const V3& v ) { |
| 149 |
return v.x*v.x + v.y*v.y + v.z*v.z; |
| 150 |
} |
| 151 |
inline double Distance( const V3& v1, const V3& v2 ) { |
| 152 |
return Norm(v1 - v2); |
| 153 |
} |
| 154 |
inline bool operator == (const V3& v1, const V3& v2 ) { |
| 155 |
|
| 156 |
return (Distance(v1,v2)<0.005); |
| 157 |
} |
| 158 |
inline V3& Normalize( V3 v ) { |
| 159 |
static V3 erg=V3(1,0,0); |
| 160 |
if (Norm(v)) erg= (v * (1.0/sqrt(Norm(v)))); |
| 161 |
return erg; |
| 162 |
} |
| 163 |
|
| 164 |
struct Matrix{ |
| 165 |
double m11, m21, m31, m12, m22, m32, m13, m23, m33; |
| 166 |
inline Matrix(void){} |
| 167 |
inline Matrix( const V3 &a, const V3 &b, const V3 &c): |
| 168 |
m11(a.x), m21(b.x), m31(c.x), |
| 169 |
m12(a.y), m22(b.y), m32(c.y), |
| 170 |
m13(a.z), m23(b.z), m33(c.z){;} |
| 171 |
inline Matrix( const double& x11, const double& x21, const double& x31, |
| 172 |
const double& x12, const double& x22, const double& x32, |
| 173 |
const double& x13, const double& x23, const double& x33): |
| 174 |
m11(x11), m21(x21), m31(x31), |
| 175 |
m12(x12), m22(x22), m32(x32), |
| 176 |
m13(x13), m23(x23), m33(x33){;} |
| 177 |
inline Matrix( const QMatrix4x4 &m44): |
| 178 |
m11(m44(0,0)), m21(m44(0,1)), m31(m44(0,2)), |
| 179 |
m12(m44(1,0)), m22(m44(1,1)), m32(m44(1,2)), |
| 180 |
m13(m44(2,0)), m23(m44(2,1)), m33(m44(2,2)) |
| 181 |
{;} |
| 182 |
inline Matrix( const QMatrix3x3 &m33): |
| 183 |
m11(m33(0,0)), m21(m33(0,1)), m31(m33(0,2)), |
| 184 |
m12(m33(1,0)), m22(m33(1,1)), m32(m33(1,2)), |
| 185 |
m13(m33(2,0)), m23(m33(2,1)), m33(m33(2,2)) |
| 186 |
{;} |
| 187 |
inline Matrix operator *= (const double a){ |
| 188 |
m11 *= a; |
| 189 |
m21 *= a; |
| 190 |
m31 *= a; |
| 191 |
|
| 192 |
m12 *= a; |
| 193 |
m22 *= a; |
| 194 |
m32 *= a; |
| 195 |
|
| 196 |
m13 *= a; |
| 197 |
m23 *= a; |
| 198 |
m33 *= a; |
| 199 |
return *this; |
| 200 |
} |
| 201 |
}; |
| 202 |
inline Matrix transponse (Matrix a){ |
| 203 |
return Matrix( |
| 204 |
a.m11, a.m12, a.m13, |
| 205 |
a.m21, a.m22, a.m23, |
| 206 |
a.m31, a.m32, a.m33); |
| 207 |
} |
| 208 |
inline double determinant (Matrix a){ |
| 209 |
return a.m11*a.m22*a.m33 - a.m11*a.m23*a.m32 - a.m12*a.m21*a.m33 + a.m12*a.m23*a.m31 +a.m13*a.m21*a.m32 -a.m13*a.m22*a.m31; |
| 210 |
} |
| 211 |
inline Matrix inverse (Matrix A){ |
| 212 |
double D = determinant(A); |
| 213 |
if (D==0) return A; |
| 214 |
D=1.0/D; |
| 215 |
return Matrix( |
| 216 |
D*(A.m22*A.m33-A.m23*A.m32), |
| 217 |
D*(A.m13*A.m32-A.m12*A.m33), |
| 218 |
D*(A.m21*A.m23-A.m13*A.m22), |
| 219 |
D*(A.m23*A.m31-A.m21*A.m33), |
| 220 |
D*(A.m11*A.m33-A.m13*A.m31), |
| 221 |
D*(A.m13*A.m21-A.m11*A.m23), |
| 222 |
D*(A.m21*A.m32-A.m22*A.m31), |
| 223 |
D*(A.m12*A.m31-A.m11*A.m32), |
| 224 |
D*(A.m11*A.m22-A.m12*A.m21) |
| 225 |
); |
| 226 |
} |
| 227 |
inline bool operator == (const Matrix &a,const Matrix &b){ |
| 228 |
return ((a.m11 == b.m11)&&(a.m21 == b.m21)&&(a.m31 == b.m31)&& |
| 229 |
(a.m12 == b.m12)&&(a.m22 == b.m22)&&(a.m23 == b.m23)&& |
| 230 |
(a.m13 == b.m13)&&(a.m32 == b.m32)&&(a.m33 == b.m33)); |
| 231 |
} |
| 232 |
inline Matrix operator * (const Matrix &a,const Matrix &b){ |
| 233 |
Matrix erg; |
| 234 |
erg.m11 = a.m11 * b.m11 + a.m21 * b.m12 + a.m31 * b.m13; |
| 235 |
erg.m21 = a.m11 * b.m21 + a.m21 * b.m22 + a.m31 * b.m23; |
| 236 |
erg.m31 = a.m11 * b.m31 + a.m21 * b.m32 + a.m31 * b.m33; |
| 237 |
|
| 238 |
erg.m12 = a.m12 * b.m11 + a.m22 * b.m12 + a.m32 * b.m13; |
| 239 |
erg.m22 = a.m12 * b.m21 + a.m22 * b.m22 + a.m32 * b.m23; |
| 240 |
erg.m32 = a.m12 * b.m31 + a.m22 * b.m32 + a.m32 * b.m33; |
| 241 |
|
| 242 |
erg.m13 = a.m13 * b.m11 + a.m23 * b.m12 + a.m33 * b.m13; |
| 243 |
erg.m23 = a.m13 * b.m21 + a.m23 * b.m22 + a.m33 * b.m23; |
| 244 |
erg.m33 = a.m13 * b.m31 + a.m23 * b.m32 + a.m33 * b.m33; |
| 245 |
return erg; |
| 246 |
} |
| 247 |
inline V3 operator * (const Matrix &a, const V3 &b){ |
| 248 |
V3 erg; |
| 249 |
erg.x = a.m11*b.x + a.m21*b.y + a.m31*b.z; |
| 250 |
erg.y = a.m12*b.x + a.m22*b.y + a.m32*b.z; |
| 251 |
erg.z = a.m13*b.x + a.m23*b.y + a.m33*b.z; |
| 252 |
return erg; |
| 253 |
} |
| 254 |
inline V3 operator * (const V3 &a, const Matrix &b){ |
| 255 |
V3 erg; |
| 256 |
erg.x = b.m11*a.x + b.m12*a.y + b.m13*a.z; |
| 257 |
erg.y = b.m21*a.x + b.m22*a.y + b.m23*a.z; |
| 258 |
erg.z = b.m31*a.x + b.m32*a.y + b.m33*a.z; |
| 259 |
return erg; |
| 260 |
} |
| 261 |
inline Matrix operator * (const Matrix &a,const double &b){ |
| 262 |
Matrix erg; |
| 263 |
erg.m11 = a.m11*b; |
| 264 |
erg.m21 = a.m21*b; |
| 265 |
erg.m31 = a.m31*b; |
| 266 |
|
| 267 |
erg.m12 = a.m12*b; |
| 268 |
erg.m22 = a.m22*b; |
| 269 |
erg.m32 = a.m32*b; |
| 270 |
|
| 271 |
erg.m13 = a.m13*b; |
| 272 |
erg.m23 = a.m23*b; |
| 273 |
erg.m33 = a.m33*b; |
| 274 |
return erg; |
| 275 |
} |
| 276 |
|
| 277 |
inline Matrix operator + (const Matrix &a, const Matrix &b){ |
| 278 |
Matrix erg; |
| 279 |
erg.m11 = a.m11+b.m11; |
| 280 |
erg.m21 = a.m21+b.m21; |
| 281 |
erg.m31 = a.m31+b.m31; |
| 282 |
|
| 283 |
erg.m12 = a.m12+b.m12; |
| 284 |
erg.m22 = a.m22+b.m22; |
| 285 |
erg.m32 = a.m32+b.m32; |
| 286 |
|
| 287 |
erg.m13 = a.m13+b.m13; |
| 288 |
erg.m23 = a.m23+b.m23; |
| 289 |
erg.m33 = a.m33+b.m33; |
| 290 |
return erg; |
| 291 |
} |
| 292 |
|
| 293 |
inline bool operator < (const Matrix &a, const Matrix &b){ |
| 294 |
return ( |
| 295 |
(a.m11<b.m11)&& |
| 296 |
(a.m21<b.m21)&& |
| 297 |
(a.m31<b.m31)&& |
| 298 |
(a.m12<b.m12)&& |
| 299 |
(a.m22<b.m22)&& |
| 300 |
(a.m32<b.m32)&& |
| 301 |
(a.m13<b.m13)&& |
| 302 |
(a.m23<b.m23)&& |
| 303 |
(a.m33<b.m33)); |
| 304 |
} |
| 305 |
|
| 306 |
typedef struct MyAtom{ |
| 307 |
|
| 308 |
QString Label; |
| 309 |
|
| 310 |
QString ResiClass; |
| 311 |
|
| 312 |
QString orginalLine; |
| 313 |
|
| 314 |
int molindex; |
| 315 |
|
| 316 |
int fixFlag; |
| 317 |
|
| 318 |
int symmGroup ; |
| 319 |
|
| 320 |
int sg; |
| 321 |
|
| 322 |
int scod; |
| 323 |
|
| 324 |
int auidx; |
| 325 |
|
| 326 |
int hidden; |
| 327 |
|
| 328 |
double sof_org; |
| 329 |
|
| 330 |
double sof; |
| 331 |
|
| 332 |
bool isIso; |
| 333 |
|
| 334 |
QString ufiso_org; |
| 335 |
|
| 336 |
Matrix uf; |
| 337 |
|
| 338 |
Matrix uc; |
| 339 |
|
| 340 |
V3 pos; |
| 341 |
|
| 342 |
V3 frac; |
| 343 |
|
| 344 |
double peakHeight; |
| 345 |
|
| 346 |
int resiNr; |
| 347 |
|
| 348 |
int an; |
| 349 |
|
| 350 |
int part; |
| 351 |
|
| 352 |
int style; |
| 353 |
|
| 354 |
int afixParent; |
| 355 |
|
| 356 |
int afix; |
| 357 |
|
| 358 |
GLdouble screenX; |
| 359 |
|
| 360 |
GLdouble screenY; |
| 361 |
QString toAtomString() const{ |
| 362 |
return QString("%1!%2!%3!%4!%5!%6!%7!%8!%9!%10!%11!%12!%13!%14!%15!%16!%17!%18!%19!%20!%21!%22!%23!%24!%25!%26!%27!%28!%29!%30!%31!%32!%33!%34!%35!%36!%37!%38!%39!%40!%41!%42!%43!%44!%45\n") |
| 363 |
.arg(Label,ResiClass,orginalLine) |
| 364 |
.arg(molindex) |
| 365 |
.arg(fixFlag) |
| 366 |
.arg(symmGroup) |
| 367 |
.arg(sg) |
| 368 |
.arg(scod) |
| 369 |
.arg(auidx) |
| 370 |
.arg(hidden) |
| 371 |
.arg(sof_org) |
| 372 |
.arg(sof) |
| 373 |
.arg(isIso) |
| 374 |
.arg(ufiso_org) |
| 375 |
.arg(uf.m11).arg(uf.m12).arg(uf.m13).arg(uf.m21).arg(uf.m22).arg(uf.m23).arg(uf.m31).arg(uf.m32).arg(uf.m33) |
| 376 |
.arg(uc.m11).arg(uc.m12).arg(uc.m13).arg(uc.m21).arg(uc.m22).arg(uc.m23).arg(uc.m31).arg(uc.m32).arg(uc.m33) |
| 377 |
.arg(pos.x).arg(pos.y).arg(pos.z) |
| 378 |
.arg(frac.x).arg(frac.y).arg(frac.z) |
| 379 |
.arg(peakHeight) |
| 380 |
.arg(resiNr) |
| 381 |
.arg(an) |
| 382 |
.arg(part) |
| 383 |
.arg(style) |
| 384 |
.arg(afixParent) |
| 385 |
.arg(afix) |
| 386 |
; |
| 387 |
} |
| 388 |
}MyAtom; |
| 389 |
inline bool operator == (const MyAtom &a1,const MyAtom &a2){ |
| 390 |
return ((a1.Label == a2.Label)&&(a1.resiNr == a2.resiNr)&&(a1.part == a2.part)&&(a1.symmGroup == a2.symmGroup)); |
| 391 |
} |
| 392 |
inline bool operator < (const MyAtom &a1, const MyAtom &a2){ |
| 393 |
return (a1.Label < a2.Label); |
| 394 |
} |
| 395 |
inline bool operator < (MyAtom &a1, MyAtom &a2){ |
| 396 |
return (a1.Label < a2.Label); |
| 397 |
} |
| 398 |
|
| 399 |
|
| 400 |
typedef struct MyBond{ |
| 401 |
|
| 402 |
MyAtom const *ato1; |
| 403 |
|
| 404 |
MyAtom const *ato2; |
| 405 |
|
| 406 |
double length; |
| 407 |
|
| 408 |
int a1; |
| 409 |
|
| 410 |
int a2; |
| 411 |
}MyBond; |
| 412 |
inline bool operator ==(const MyBond &a1,const MyBond &a2){ |
| 413 |
return ((a1.a1==a2.a1)&&(a1.a2==a2.a2))||((a1.a2==a2.a1)&&(a1.a1==a2.a2)); |
| 414 |
} |
| 415 |
|
| 416 |
typedef struct MyBind{ |
| 417 |
QString Lab1,Lab2; |
| 418 |
}MyBind; |
| 419 |
|
| 420 |
struct Vert { |
| 421 |
int faces[3]; |
| 422 |
V3 pos; |
| 423 |
}; |
| 424 |
|
| 425 |
typedef struct VPoly{ |
| 426 |
V3 mid,nor,verts0,verts1,color; |
| 427 |
int acol,intra; |
| 428 |
}VPoly; |
| 429 |
|
| 430 |
typedef struct PPoly{ |
| 431 |
V3 mid,nor,verts0,verts1; |
| 432 |
int colr,n; |
| 433 |
V3 glide; |
| 434 |
}PPoly; |
| 435 |
|
| 436 |
typedef QList<MyBond> Connection; |
| 437 |
typedef QList<MyAtom> CEnvironment; |
| 438 |
|
| 439 |
struct Cell { |
| 440 |
|
| 441 |
double a; |
| 442 |
|
| 443 |
double b; |
| 444 |
|
| 445 |
double c; |
| 446 |
|
| 447 |
double al; |
| 448 |
|
| 449 |
double be; |
| 450 |
|
| 451 |
double ga; |
| 452 |
|
| 453 |
double phi; |
| 454 |
|
| 455 |
double V; |
| 456 |
|
| 457 |
double as; |
| 458 |
|
| 459 |
double bs; |
| 460 |
|
| 461 |
double cs; |
| 462 |
|
| 463 |
|
| 464 |
double tau; |
| 465 |
|
| 466 |
double cosga; |
| 467 |
|
| 468 |
double cosal; |
| 469 |
|
| 470 |
double cosbe; |
| 471 |
|
| 472 |
double sinal; |
| 473 |
|
| 474 |
double sinbe; |
| 475 |
|
| 476 |
double singa; |
| 477 |
|
| 478 |
double tanga; |
| 479 |
double cosra; |
| 480 |
double cosrb; |
| 481 |
double cosrg; |
| 482 |
|
| 483 |
QList<Matrix> symmops; |
| 484 |
|
| 485 |
QList<V3> trans; |
| 486 |
|
| 487 |
int ns0; |
| 488 |
|
| 489 |
bool centered; |
| 490 |
|
| 491 |
bool centeric; |
| 492 |
|
| 493 |
QString Z; |
| 494 |
|
| 495 |
double wave; |
| 496 |
Matrix G,Gi; |
| 497 |
QMatrix3x3 Cholesky; |
| 498 |
}; |
| 499 |
|
| 500 |
struct SdmItem{ |
| 501 |
|
| 502 |
double d; |
| 503 |
|
| 504 |
int a1; |
| 505 |
|
| 506 |
int a2; |
| 507 |
|
| 508 |
int sn; |
| 509 |
V3 floorD; |
| 510 |
|
| 511 |
bool covalent; |
| 512 |
}; |
| 513 |
|
| 514 |
inline bool operator < (const SdmItem &a1, const SdmItem &a2){ |
| 515 |
return (a1.d<a2.d); |
| 516 |
} |
| 517 |
|
| 518 |
struct Tripel{ |
| 519 |
int n[3]; |
| 520 |
V3 midcenter; |
| 521 |
}; |
| 522 |
inline bool operator == (const Tripel& v1, const Tripel& v2 ) { |
| 523 |
return ((v1.n[0]==v2.n[0])&&(v1.n[1]==v2.n[1])&&(v1.n[2]==v2.n[2])); |
| 524 |
} |
| 525 |
|
| 526 |
struct Knopf{ |
| 527 |
|
| 528 |
QList<int> neighbors; |
| 529 |
}; |
| 530 |
class Ring; |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
class Molecule{ |
| 538 |
public: |
| 539 |
GLfloat fgc[4]; |
| 540 |
bool mist; |
| 541 |
QString theIconPath; |
| 542 |
float fibo,fibom1; |
| 543 |
GLfloat q_bondWidth = 1.0f; |
| 544 |
int fogrange; |
| 545 |
bool nopm1; |
| 546 |
bool highlightEquivalents; |
| 547 |
bool qbeforehkl; |
| 548 |
bool growQPeak; |
| 549 |
bool monoQrom; |
| 550 |
bool noQPeaksPlease; |
| 551 |
bool HFixSuitableAtomsOnly; |
| 552 |
QColor mQolor; |
| 553 |
double qboMin,qboMax; |
| 554 |
double exti,swat,osf; |
| 555 |
int hklf; |
| 556 |
double hklScale,hklSigmaScale,hklOmitSig,hklOmit2th,hklShellLow,hklShellHig; |
| 557 |
Matrix hklMat; |
| 558 |
QString titl; |
| 559 |
QString mynewnameis; |
| 560 |
int LOD; |
| 561 |
QOpenGLShaderProgram *g_Program,*saveProg; |
| 562 |
int g_program; |
| 563 |
Molecule(); |
| 564 |
int icocnt; |
| 565 |
int latt; |
| 566 |
int afix5(int idx); |
| 567 |
int afix5(const CEnvironment &atm, int idx); |
| 568 |
void setHBondMaxDist(double d); |
| 569 |
void setHBondMaxAngl(double w); |
| 570 |
int genSymCode(int s, int h, int k, int l); |
| 571 |
V3 applySymCode(const V3 &frac, int scode); |
| 572 |
double hbdist(); |
| 573 |
double hbangl(); |
| 574 |
QMatrix3x3 cholesky(); |
| 575 |
int installShader(); |
| 576 |
void Farbverlauf (GLfloat wrt,GLfloat min,GLfloat max); |
| 577 |
Cell cell; |
| 578 |
QString Fragments; |
| 579 |
QList<SdmItem> sdm; |
| 580 |
QList<SdmItem> envi_sdm; |
| 581 |
QList<SdmItem> contact; |
| 582 |
QList<Matrix> symmopsEQIV; |
| 583 |
QStringList labelEQIV; |
| 584 |
QList<V3> transEQIV; |
| 585 |
QMap<QString,int> eqivMap; |
| 586 |
QList<MyBind> freeatoms, |
| 587 |
bindatoms; |
| 588 |
QList<Knopf> knoepfe; |
| 589 |
QMap<int,int> bindPart; |
| 590 |
bool canbeDonor(int an); |
| 591 |
bool canbeAcceptor(int an); |
| 592 |
bool is2Dissordered4H(const MyAtom &atom); |
| 593 |
QList<int> theseAreAcceptors; |
| 594 |
QList<int> theseAreDonors; |
| 595 |
int adp, |
| 596 |
intern, |
| 597 |
bondColorStyle; |
| 598 |
double bondStrength; |
| 599 |
double qPeakRad; |
| 600 |
double beloRad; |
| 601 |
QColor beloColor; |
| 602 |
bool beloColorByDefden; |
| 603 |
bool beloLabels; |
| 604 |
Matrix rotarb(double *arr); |
| 605 |
Matrix rotarb(double angle, V3 &arr); |
| 606 |
void rotarb(Matrix &mat, double angle, V3 &arr); |
| 607 |
|
| 608 |
|
| 609 |
QOpenGLTexture *hbtex = nullptr; |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
int proba, |
| 615 |
tubes, |
| 616 |
dratom; |
| 617 |
|
| 618 |
QColor deuteriumColor; |
| 619 |
QColor atomColor(int an, bool isD=false); |
| 620 |
QColor AtomColor[109]; |
| 621 |
int AtomStyle[109]; |
| 622 |
double arad[109]; |
| 623 |
unsigned short Kovalenz_Radien[109]; |
| 624 |
int pseFontSize; |
| 625 |
double pmin, |
| 626 |
pmax; |
| 627 |
double lmin, |
| 628 |
lmax; |
| 629 |
QColor bondColor; |
| 630 |
|
| 631 |
QColor enviBondColor, |
| 632 |
enviHBColor, |
| 633 |
enviDefaultColor; |
| 634 |
CEnvironment asymm; |
| 635 |
CEnvironment showatoms; |
| 636 |
CEnvironment splitLeftAtoms; |
| 637 |
CEnvironment splitRightAtoms; |
| 638 |
CEnvironment selectedatoms; |
| 639 |
CEnvironment duplicateAtoms; |
| 640 |
CEnvironment legendAtoms; |
| 641 |
Connection showbonds; |
| 642 |
Connection splitLbonds; |
| 643 |
Connection splitRbonds; |
| 644 |
Connection lbonds; |
| 645 |
CEnvironment fitatoms; |
| 646 |
Connection fitbonds; |
| 647 |
Connection theH_Bonds; |
| 648 |
QStringList usedSymmetry; |
| 649 |
QString HumanSymmetry; |
| 650 |
|
| 651 |
QString ffmpegexe; |
| 652 |
int vorobas; |
| 653 |
QString voroMsg; |
| 654 |
MyAtom fromAtomString(const QString &s); |
| 655 |
V3 findGlide(V3 normal, V3 test, int n); |
| 656 |
V3 findGlide(V3 normal, V3 test, Matrix mat, V3 trans); |
| 657 |
QList<VPoly> vtriangles; |
| 658 |
double planeTransparence; |
| 659 |
QList<PPoly> ptriangles; |
| 660 |
QList<V3> axvecs; |
| 661 |
QList<int> axcols; |
| 662 |
QList<int> axoprs; |
| 663 |
QList<int> invoprs; |
| 664 |
QList<V3> invvecs; |
| 665 |
QList<int> dontshowSop; |
| 666 |
QList<int> dontshowSel; |
| 667 |
QList<QColor> symmColors; |
| 668 |
void spitze(V3 dir, V3 pos); |
| 669 |
void voronoij(CEnvironment au, int intat=-1); |
| 670 |
void drawVoronoi(V3 auge); |
| 671 |
void drawPlanes(); |
| 672 |
void drawAxses(); |
| 673 |
void drawInversionCenters(); |
| 674 |
double ueq(Matrix m); |
| 675 |
double averageUeq(); |
| 676 |
V3 intersectPoint(V3 rayVector, V3 rayPoint, V3 planeNormal, V3 planePoint, bool &ok); |
| 677 |
void make1Plane(V3 planeNormal, V3 pointOnPlane,V3 glide, int ac, int n); |
| 678 |
void findSymmElements(); |
| 679 |
void packPoint(const V3 &point, QList<V3> &wearein); |
| 680 |
void packLine(const V3 &p1,const V3 &p2, QList<V3> &wearein, int c,QList<int> &dc); |
| 681 |
void specialPts(const Matrix &mat, const V3 &trans, QList<V3> &points); |
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
QString nameSymmOp(Matrix m, int &fold, V3 &axis); |
| 686 |
QStringList sdmcompleter(); |
| 687 |
QList<SdmItem> computeSDM(CEnvironment au); |
| 688 |
void atoms(CEnvironment atom,int proba=50,double radscal=1.0); |
| 689 |
bool shaders_work; |
| 690 |
bool program_in_use; |
| 691 |
|
| 692 |
void shaderAtoms(CEnvironment atom,int proba=50, double radScal=1.0); |
| 693 |
void pappe(); |
| 694 |
void bonds(Connection bond, double radScal=1.0); |
| 695 |
void dbond(Connection bond,int ccode=0); |
| 696 |
void lbond(); |
| 697 |
void billBoard(); |
| 698 |
QString h_bonds(Connection bond,CEnvironment atoms); |
| 699 |
void h_bonds2(Connection bond,CEnvironment atoms); |
| 700 |
void h_bonds3(Connection bond,CEnvironment atoms); |
| 701 |
void unitCell(); |
| 702 |
Connection connecting(const CEnvironment &atom, bool eac=false); |
| 703 |
bool decodeSymmCard(const QString symmCard); |
| 704 |
bool decodeSymmCardEQIV(const QString symmCard); |
| 705 |
|
| 706 |
|
| 707 |
QString symmcode2human(QStringList brauchSymm); |
| 708 |
QString symmcode2human(QString brauchSymm); |
| 709 |
QString symmcode2human(QString brauchSymm, int j); |
| 710 |
QString symmcode2human(int s); |
| 711 |
QString symmCard2Code(QString symmCard); |
| 712 |
void frac2kart (V3 x, V3 & y); |
| 713 |
void kart2frac (V3 x, V3 & y); |
| 714 |
int getOZ(QString S1); |
| 715 |
double shortestDistance(QString sc); |
| 716 |
static double winkel(V3 a,V3 b); |
| 717 |
double dieder(V3 a,V3 b, V3 c); |
| 718 |
static V3 kreuzX(double x1,double y1,double z1,double x2,double y2,double z2) ; |
| 719 |
double fl(double x,double y, double z); |
| 720 |
double wl(V3 f2, V3 f1, V3 f3); |
| 721 |
void cellSetup(); |
| 722 |
void fuse(); |
| 723 |
void grow(); |
| 724 |
void grow_plus(); |
| 725 |
void fillCell(); |
| 726 |
void uniqueInCell(); |
| 727 |
void packer(QStringList brauchSymm); |
| 728 |
void packInLimits(double ami, double ama, double bmi, double bma, double cmi, double cma); |
| 729 |
CEnvironment packInLimits(CEnvironment &au, double ami, double ama, double bmi, double bma, double cmi, double cma); |
| 730 |
void applyLatticeCentro(int gitter); |
| 731 |
void Uf2Uo(const Matrix x, Matrix & y) ; |
| 732 |
void Usym (Matrix x,Matrix sym, Matrix & y); |
| 733 |
void USymCode(Matrix x,int scod, Matrix & y); |
| 734 |
double dimension(); |
| 735 |
double dimension(CEnvironment ce); |
| 736 |
void expandAt(int index); |
| 737 |
void expandAll(); |
| 738 |
void complete(); |
| 739 |
void enviSDM(double range); |
| 740 |
QString pse(int oz); |
| 741 |
void loadSettings(); |
| 742 |
void dodecaeder(GLfloat r); |
| 743 |
void icosaeder(GLfloat r); |
| 744 |
void triacontaeder(GLfloat r); |
| 745 |
void cube(GLfloat r); |
| 746 |
int maxmols(){return maxmol;} |
| 747 |
void newstructure(){maxmol=0;} |
| 748 |
const QStringList thepse(){return PSE;} |
| 749 |
int pseSize(){return PSE.size();} |
| 750 |
Matrix u2b(Matrix u); |
| 751 |
Matrix b2u(Matrix u); |
| 752 |
double * jacobi(const Matrix &uij, V3 &ev); |
| 753 |
void exportOBJ(QString fileName,const CEnvironment &atoms, const Connection &_bonds); |
| 754 |
|
| 755 |
int rankMySymmOp(Matrix m, V3 t); |
| 756 |
void message(const QString &); |
| 757 |
private: |
| 758 |
void neighborSort(Knopf &kn); |
| 759 |
bool checkExtensions(); |
| 760 |
double HAMax,HAWink; |
| 761 |
|
| 762 |
void hirsh(Connection bond); |
| 763 |
void sphere(int adp,int style=7); |
| 764 |
void mySphere(int bal); |
| 765 |
void myCylinder(int rod); |
| 766 |
void myCone(); |
| 767 |
void cylinder(double strength, double length); |
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
int maxmol; |
| 773 |
|
| 774 |
int lichtH; |
| 775 |
int whiteringH; |
| 776 |
int wallH; |
| 777 |
int ballH; |
| 778 |
int ringH; |
| 779 |
int openH; |
| 780 |
int adpsH; |
| 781 |
int Licht; |
| 782 |
int lodH; |
| 783 |
int fogH; |
| 784 |
int fograngeH; |
| 785 |
int bgH; |
| 786 |
|
| 787 |
QStringList PSE; |
| 788 |
}; |
| 789 |
|
| 790 |
class Ring{ |
| 791 |
private: |
| 792 |
bool complete; |
| 793 |
|
| 794 |
public: |
| 795 |
bool done; |
| 796 |
QList<Tripel> t; |
| 797 |
QList<int> members; |
| 798 |
V3 center; |
| 799 |
Ring(Tripel t1,Tripel t2){ |
| 800 |
complete=false; |
| 801 |
done=false; |
| 802 |
t.append(t1); |
| 803 |
t.append(t2); |
| 804 |
center = t1.midcenter + t2.midcenter; |
| 805 |
members.append(t1.n[1]); |
| 806 |
members.append(t1.n[0]); |
| 807 |
members.append(t1.n[2]); |
| 808 |
if (!members.contains(t2.n[1])) members.append(t2.n[1]); |
| 809 |
if (!members.contains(t2.n[0])) members.append(t2.n[0]); |
| 810 |
if (!members.contains(t2.n[2])) members.append(t2.n[2]); |
| 811 |
|
| 812 |
} |
| 813 |
~Ring(){ |
| 814 |
t.clear(); |
| 815 |
members.clear(); |
| 816 |
} |
| 817 |
|
| 818 |
bool isComplete(){ |
| 819 |
if (complete) return complete; |
| 820 |
complete = (members.size()==t.size()); |
| 821 |
if (complete) bringInOrder(); |
| 822 |
|
| 823 |
return complete; |
| 824 |
} |
| 825 |
|
| 826 |
V3 theCenter(){ |
| 827 |
return center*(1.0/t.size()); |
| 828 |
} |
| 829 |
|
| 830 |
void bringInOrder(){ |
| 831 |
|
| 832 |
|
| 833 |
members.clear(); |
| 834 |
members.append(t.at(0).n[0]); |
| 835 |
int loop=0; |
| 836 |
while (members.size()!=t.size()){ |
| 837 |
loop++; |
| 838 |
for (int i=0; i<t.size(); i++){ |
| 839 |
if ((members.last()==t.at(i).n[1])&&(!members.contains(t.at(i).n[0]))&&((members.size()+1==t.size())||(members.first()!=t.at(i).n[2]))) |
| 840 |
members.append(t.at(i).n[0]); else |
| 841 |
if ((members.last()==t.at(i).n[2])&&(!members.contains(t.at(i).n[0]))&&((members.size()+1==t.size())||(members.first()!=t.at(i).n[1]))) |
| 842 |
members.append(t.at(i).n[0]); |
| 843 |
} |
| 844 |
if (loop>50){ |
| 845 |
|
| 846 |
|
| 847 |
|
| 848 |
complete=false; |
| 849 |
done=true; |
| 850 |
members.clear(); |
| 851 |
return; |
| 852 |
} |
| 853 |
} |
| 854 |
isItARealRing(); |
| 855 |
} |
| 856 |
|
| 857 |
void isItARealRing(){ |
| 858 |
|
| 859 |
if (complete==false) return; |
| 860 |
bool killme=false; |
| 861 |
killme = (t.size()!=members.size()); |
| 862 |
for (int i=0; i<t.size(); i++){ |
| 863 |
int u,v,w; |
| 864 |
u=members.indexOf(t.at(i).n[0]); |
| 865 |
v=members.indexOf(t.at(i).n[1]); |
| 866 |
w=members.indexOf(t.at(i).n[2]); |
| 867 |
killme|=!((((u+1)%t.size()==v)&&((u-1+t.size())%t.size()==w))||(((u+1)%t.size()==w)&&((u-1+t.size())%t.size()==v))); |
| 868 |
killme|=(u*v*w<0); |
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
} |
| 875 |
if (killme) { |
| 876 |
|
| 877 |
complete=false; |
| 878 |
members.clear(); |
| 879 |
done=true; |
| 880 |
} |
| 881 |
} |
| 882 |
|
| 883 |
void printRing(Molecule *mol){ |
| 884 |
QString str="+"; |
| 885 |
for (int i = 0; i < members.size(); i++){ |
| 886 |
str.append(mol->asymm.at(members.at(i)).Label); |
| 887 |
str.append((i==members.size()-1)?"+\n+":"="); |
| 888 |
} |
| 889 |
int l=str.size()-4; |
| 890 |
for (int i=0; i<l; i++) str.append("="); |
| 891 |
str.append("+\n"); |
| 892 |
printf("%s",str.toStdString().c_str()); |
| 893 |
str.clear(); |
| 894 |
} |
| 895 |
|
| 896 |
void debugRing(Molecule *mol){ |
| 897 |
printRing(mol); |
| 898 |
QString str="+"; |
| 899 |
for (int i = 0; i < t.size(); i++){ |
| 900 |
str.append("|"); |
| 901 |
str.append(mol->asymm.at(t.at(i).n[1]).Label); |
| 902 |
str.append("~"); |
| 903 |
str.append(mol->asymm.at(t.at(i).n[0]).Label); |
| 904 |
str.append("~"); |
| 905 |
str.append(mol->asymm.at(t.at(i).n[2]).Label); |
| 906 |
str.append((i==t.size()-1)?"+\n+":"="); |
| 907 |
} |
| 908 |
int l=str.size()-4; |
| 909 |
for (int i=0; i<l; i++) str.append("="); |
| 910 |
str.append("+\n"); |
| 911 |
printf("%s",str.toStdString().c_str()); |
| 912 |
str.clear(); |
| 913 |
|
| 914 |
} |
| 915 |
|
| 916 |
void addTripel(Tripel nt){ |
| 917 |
if (t.contains(nt)) return; |
| 918 |
t.append(nt); |
| 919 |
center += nt.midcenter; |
| 920 |
if (!members.contains(nt.n[1])) members.append(nt.n[1]); |
| 921 |
if (!members.contains(nt.n[0])) members.append(nt.n[0]); |
| 922 |
if (!members.contains(nt.n[2])) members.append(nt.n[2]); |
| 923 |
isComplete(); |
| 924 |
} |
| 925 |
|
| 926 |
}; |
| 927 |
#endif |