| #include "SASurface.h"
|
|
|
| SASurface::SASurface(ChemMolecule& molecule, float probeRadius, float d) :
|
| molecule_(molecule), probeRadius_(probeRadius), density_(d), molIntersection_(&molecule_, probeRadius_)
|
| {}
|
|
|
| unsigned int SASurface::buildCapsSurface(Surface& surface) {
|
| surface.reserve(int(molecule_.size() * density_));
|
| for(unsigned int i=0; i<molecule_.size(); i++) {
|
|
|
| const float atomRadius = molecule_[i].getRadius();
|
| DotSphere dotSphere(atomRadius, density_);
|
| float pointArea = (4 * pi * atomRadius * atomRadius)/dotSphere.size();
|
| for(DotSphere::iterator it=dotSphere.begin(); it!=dotSphere.end(); it++) {
|
|
|
| Vector3 dotCoord = *it + molecule_(i);
|
| Vector3 normal = *it/(*it).norm();
|
| Vector3 probeCenter = dotCoord + normal*probeRadius_;
|
| if(!molIntersection_.isIntersecting(probeCenter, i)) {
|
| surface.push_back(SurfacePoint(dotCoord, normal, pointArea, i , -1 , -1));
|
| }
|
| }
|
| }
|
| return surface.size();
|
| }
|
|
|
| float SASurface::computeASAForAtoms() {
|
| float ASA = 0;
|
| for(unsigned int i=0; i<molecule_.size(); i++) {
|
| const float atomRadius = molecule_[i].getRadius();
|
|
|
| DotSphere dotSphere(atomRadius, density_);
|
| float pointArea = (4 * pi * atomRadius * atomRadius)/dotSphere.size();
|
| float atomASA = 0;
|
| for(DotSphere::iterator it=dotSphere.begin(); it!=dotSphere.end(); it++) {
|
|
|
| Vector3 dotCoord = *it + molecule_(i);
|
| Vector3 normal = *it/(*it).norm();
|
| Vector3 probeCenter = dotCoord + normal*probeRadius_;
|
| if(!molIntersection_.isIntersecting(probeCenter, i)) {
|
| atomASA += pointArea;
|
| }
|
| }
|
| molecule_[i].setASA(atomASA);
|
| ASA += atomASA;
|
| }
|
| return ASA;
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|