public int getLength ( ResidueNumber start , ResidueNumber end ) { if ( ! start . getChainName ( ) . equals ( end . getChainName ( ) ) ) { throw new IllegalArgumentException ( String . format ( "Chains differ between %s and %s. Unable to calculate length." , start , end ) ) ; } Integer startPos = getPosition ( start ) ; Integer endPos = getPosition ( end ) ; if ( startPos == null ) { throw new IllegalArgumentException ( "Residue " + start + " was not found." ) ; } if ( endPos == null ) { throw new IllegalArgumentException ( "Residue " + start + " was not found." ) ; } return getLength ( startPos , endPos , start . getChainName ( ) ) ; }
Calculates the number of atoms between two ResidueNumbers inclusive . Both residues must belong to the same chain .