File size: 2,039 Bytes
8efb4bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "ChemAtom.h"

const float ChemAtom::maxRadius = 3.5;
ChemAtom::ChemAtom(){}

ChemAtom::ChemAtom(const Vector3& p, const char ch, const unsigned int aid,
		   const unsigned int resid, const char* const t, const char resTp,
		   const int chemType, const float radius, const float charge):
  Atom(p, ch, aid, resid, t, resTp),
  chemType_(chemType), radius_(radius), charge_(charge), epsilon_(-0.01),
  hbType_(NONE), hbDirection_(Vector3(0,0,0)), ASA_(0) {
  setPolarity();
}

ChemAtom::ChemAtom(const std::string& PDBrec, bool cif) :
  Atom(PDBrec, cif),
  chemType_(0), radius_(1.5), charge_(0), epsilon_(-0.01), hbType_(NONE), hbDirection_(Vector3(0,0,0)), ASA_(0) {
  setPolarity();
}

void ChemAtom::setHBData(const HB_TYPE hbType, const Vector3& hbDirection) {
  // set type
  if(hbType_ == NONE) hbType_ = hbType;
  if((hbType_ == DONOR && hbType == ACCEPTOR) || (hbType_ == ACCEPTOR && hbType == DONOR)) hbType_ = HB_BOTH;

  // set direction
  if(hbDirection_.isZero()) {
    hbDirection_ = hbDirection;
  }
}

void ChemAtom::setPolarity() {
  const char res = residueType();
  const char* atomT = type();

  bool nonPolar = true;

  if (atomT[1] == 'S') nonPolar = true;

  if (atomT[1] != 'C') nonPolar = false;
  if ((atomT[2] == 'A' || atomT[2] == 'B' ) && atomT[3] == ' ') nonPolar = true;
  if ( atomT[2] == 'H') nonPolar = true;
  if ( atomT[2] == 'G') {
    if (res == 'N') nonPolar = false;
    nonPolar = true;
  }
  if ( atomT[2] == 'D') {
    if (res == 'Q') nonPolar = false;
    nonPolar = true;
  }
  if ( atomT[2] == 'E') {
    if (res == 'H') nonPolar = false;
    nonPolar = true;
  }
  if ( atomT[2] == 'Z') {
    if (res == 'R') nonPolar = false;
    nonPolar = true;
  }
  if ( atomT[2] == 'Z') {
    if (res == 'R') nonPolar = false;
    nonPolar = true;
  }


  if(fabs(charge_) > 0.4 && nonPolar) {
    //Logger::warningMessage() << "Non Polar atom " << *this << " charge = " << charge_ << endl;
  }
  isNonPolar_ = nonPolar;
}