public static Perturbation generate(String type, Molecule m,int resList[],BufferedReader br){//Generates a perturbation of the indicated type, affecting units in unitList
        //(Basically a constructor wrapper)
        Arrays.sort(resList);//We need the list of affected residues to be in ascending order

        if(type.equalsIgnoreCase("SHEAR"))
            return new Shear(m,resList);

        else if(type.equalsIgnoreCase("BACKRUB"))
            return new Backrub(m,resList);

        else if(type.equalsIgnoreCase("LOOP CLOSURE ADJUSTMENT"))
            return new LoopClosureAdjustment("LOOP CLOSURE ADJUSTMENT",m,resList);

        else if(type.equalsIgnoreCase("SSNE"))
            return new LoopClosureAdjustment("SSNE",m,resList);

        else if(type.equalsIgnoreCase("SSCE"))
            return new LoopClosureAdjustment("SSCE",m,resList);

        else if(type.equalsIgnoreCase("PARTIAL STRUCTURE SWITCH"))
            return new PartialStructureSwitch(m, resList, br);

        else if(type.equalsIgnoreCase("FULL STRUCTURE SWITCH"))
            return new FullStructureSwitch(m, resList, br);

        else if(type.equalsIgnoreCase("PROLINE FLIP"))
            return new ProlineFlip(m, resList);

        else{//not clear
            System.err.println("Perturbation type not identified: " + type);
            System.exit(1);
            return null;
        }
    }