Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Bugfix: ASA calculation was by default using all models. Now it will …
…use model 1 by default. Added new constructor to choose model.
  • Loading branch information
josemduarte committed Feb 21, 2025
commit c45c3dd05beaed3f214b991526f713d9090b5e1f
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,37 @@ static class IndexAndDistance {
* Constructs a new AsaCalculator. Subsequently call {@link #calculateAsas()}
* or {@link #getGroupAsas()} to calculate the ASAs
* Only non-Hydrogen atoms are considered in the calculation.
* @param structure the structure, all non-H atoms will be used
* @param structure the structure, all non-H atoms of given model number will be used
* @param probe the probe size
* @param nSpherePoints the number of points to be used in generating the spherical
* dot-density, the more points the more accurate (and slower) calculation
* @param nThreads the number of parallel threads to use for the calculation
* @param hetAtoms if true HET residues are considered, if false they aren't, equivalent to
* @param modelNr the model number from which we want atoms extracted
* NACCESS' -h option
*/
public AsaCalculator(Structure structure, double probe, int nSpherePoints, int nThreads, boolean hetAtoms, int modelNr) {
this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms, modelNr);
this.atomCoords = Calc.atomsToPoints(atoms);
this.probe = probe;
this.nThreads = nThreads;

this.useSpatialHashingForNeighbors = DEFAULT_USE_SPATIAL_HASHING;

// initialising the radii by looking them up through AtomRadii
radii = new double[atomCoords.length];
for (int i=0;i<atomCoords.length;i++) {
radii[i] = getRadius(atoms[i]);
}

initSpherePoints(nSpherePoints);
}

/**
* Constructs a new AsaCalculator. Subsequently call {@link #calculateAsas()}
* or {@link #getGroupAsas()} to calculate the ASAs
* Only non-Hydrogen atoms are considered in the calculation.
* @param structure the structure, all non-H atoms of model 1 will be used
* @param probe the probe size
* @param nSpherePoints the number of points to be used in generating the spherical
* dot-density, the more points the more accurate (and slower) calculation
Expand All @@ -135,7 +165,7 @@ static class IndexAndDistance {
* NACCESS' -h option
*/
public AsaCalculator(Structure structure, double probe, int nSpherePoints, int nThreads, boolean hetAtoms) {
this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms);
this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms, 1);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delegating to the new constructor makes this easier to maintain.

Suggested change
this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms, 1);
this(structure, probe, nSpherePoints, nThreads, hetAtoms, 1);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks. Now pushed

this.atomCoords = Calc.atomsToPoints(atoms);
this.probe = probe;
this.nThreads = nThreads;
Expand Down