void getTerms(EnergyFunction ef,HashMap<Integer,double[]> termMap, double coeff){
        //get the appropriate VDW terms from ef, which has coefficient coeff in the energy,
        //and put them in termMap
        
        if(ef instanceof ForceFieldEnergy){//The terms are only in ForceFieldEnergies
            
            double nbTerms[] = ((ForceFieldEnergy)ef).a96ff.nonBondedTerms;
            RotMatrix r = new RotMatrix();
            
            for(int t=0; t<nbTerms.length/4; t++){
                
                int atom1 = (int)nbTerms[4*t];
                int atom2 = (int)nbTerms[4*t+1];
                
                double dist = r.norm( r.subtract( m.getActualCoord(atom1), m.getActualCoord(atom2) ) );
                
                if( dist<distCutoff){
                    
                    int index = Math.min(atom1,atom2)*m.numberOfAtoms + Math.max(atom1,atom2);
                    double coeff12 = coeff*V12*nbTerms[4*t+2];//coefficient for this term for r^-12
                    double coeff6 = coeff*V6*nbTerms[4*t+3];
                                        
                    
                    double coeffElec = coeff*m.atom[atom1].charge*m.atom[atom2].charge*coulombFactor;
                    
                    if(termMap.containsKey(index)){
                        double[] termCoeffs = termMap.get(index);
                        termCoeffs[0] += coeff12;
                        termCoeffs[1] += coeff6;
                        termCoeffs[2] += coeffElec;
                        if(termCoeffs[0]==0 && termCoeffs[1]==0 && termCoeffs[2]==0)//terms cancelled out
                            termMap.remove(index);
                    }
                    else{
                        double termCoeffs[] = new double[] {coeff12,coeff6,coeffElec};
                        termMap.put(index, termCoeffs);
                    }
                } 
            }
        }
        else if(ef instanceof MultiTermEnergyFunction){//recursively look for ForceFieldEnergies
            MultiTermEnergyFunction mtef = (MultiTermEnergyFunction)ef;
            for(int t=0; t<mtef.numTerms; t++)
                getTerms(mtef.terms[t],termMap,mtef.coeffs[t]*coeff);
        }
        //else we have an EnergyFunction not containing VDW, so do nothing
    }