public static void fillAlignedAtomArrays ( AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 , Atom [ ] ca1aligned , Atom [ ] ca2aligned ) { int pos = 0 ; int [ ] blockLens = afpChain . getOptLen ( ) ; int [ ] [ ] [ ] optAln = afpChain . getOptAln ( ) ; assert ( afpChain . getBlockNum ( ) <= optAln . length ) ; for ( int block = 0 ; block < afpChain . getBlockNum ( ) ; block ++ ) { for ( int i = 0 ; i < blockLens [ block ] ; i ++ ) { int pos1 = optAln [ block ] [ 0 ] [ i ] ; int pos2 = optAln [ block ] [ 1 ] [ i ] ; Atom a1 = ca1 [ pos1 ] ; Atom a2 = ( Atom ) ca2 [ pos2 ] . clone ( ) ; ca1aligned [ pos ] = a1 ; ca2aligned [ pos ] = a2 ; pos ++ ; } } // this can happen when we load an old XML serialization which did not support modern ChemComp representation of modified residues. if ( pos != afpChain . getOptLength ( ) ) { logger . warn ( "AFPChainScorer getTMScore: Problems reconstructing alignment! nr of loaded atoms is " + pos + " but should be " + afpChain . getOptLength ( ) ) ; // we need to resize the array, because we allocated too many atoms earlier on. ca1aligned = ( Atom [ ] ) resizeArray ( ca1aligned , pos ) ; ca2aligned = ( Atom [ ] ) resizeArray ( ca2aligned , pos ) ; } }
Fill the aligned Atom arrays with the equivalent residues in the afpChain .