Exhibit
      10.2
     
    AMENDMENT
      NO. 1
    TO
    CONSTRUCTION
      AND TERM LOAN AGREEMENT
    AND
    AGREEMENT
      AS TO FUTURE FINANCING TRANSACTIONS
     
    This
      AMENDMENT NO. 1 TO CONSTRUCTION AND TERM LOAN AGREEMENT AND AGREEMENT AS TO
      FUTURE FINANCING TRANSACTIONS, dated September 29, 2006 (this “Amendment”),
      is by
      and among
      PACIFIC ETHANOL MADERA LLC, a Delaware limited liability company (“Borrower”),
      the
      lenders named on the signature pages to this Amendment, TD BANKNORTH, N.A.,
      a
      national banking association, as administrative agent for the Lenders (as
      defined below) (the “Administrative
      Agent”),
      and
      PACIFIC ETHANOL, INC., a Delaware corporation (“PEI”),
      and
      amends to the extent stated herein the Construction and Term Loan Agreement,
      dated April 10, 2006 (the “Original
      Loan Agreement”),
      among
      Borrower, the Lenders and the Administrative Agent.
      Capitalized terms used and not defined herein have the meanings ascribed to
      them
      in Schedule X of the Original Loan Agreement.
     
    RECITALS:
     
    WHEREAS,
      Borrower, the Lenders and the Administrative Agent are all of the parties to
      the
      Original Loan Agreement;
     
    WHEREAS,
      the business requirements of Borrower have changed in a manner that has caused
      Borrower to determine that it is not in its best interest to utilize certain
      of
      the Loans made available by the Lenders to Borrower pursuant to the Original
      Loan Agreement;
     
    WHEREAS,
      the Administrative Agent and the Lenders are willing to amend the Original
      Loan
      Agreement (including Schedule X thereto) so as to enable Borrower to pursue
      its
      preferred financing arrangements; and 
     
    WHEREAS,
      in consideration of the willingness of the Administrative Agent and the Lenders
      to amend the Original Loan Agreement, PEI and Borrower are willing to grant
      to
      the Lenders the right to participate in certain future financing transactions
      involving the Project;
     
    NOW,
      THEREFORE, in consideration of the premises and the mutual covenants contained
      herein, and other good and valuable consideration, the receipt and adequacy
      of
      which are hereby acknowledged, the parties hereto agree as follows:
     
    
    
     
    ARTICLE
      I
    AMENDMENTS
      AND CONSENTS TO THE
    ORIGINAL
      LOAN AGREEMENT AND OTHER LOAN DOCUMENTS
     
    Section
      1.1. Amendment
      to Reflect No Obligation to Borrow Construction Loans.
      Section
      2.1 of the Original Loan Agreement is hereby amended to include the following
      new subsection (c):
     
    “(c) No
      Obligation to Borrow Construction Loans.
      Notwithstanding the foregoing or any other contrary provision of the Loan
      Documents, Borrower will have no obligation to borrow any Construction Loan
      at
      any time.”
     
    Section
      1.2. Amendments
      to Reflect Mandatory Term Loan Borrowing.
     
    (a) Amendment
      to Section 2.2(b) of the Original Loan Agreement.
      Section
      2.2(b)(i) of the Original Loan Agreement is hereby amended by adding the words
      “(if any)” after the words “and the repayment in full of all Construction Loans”
in the third sentence thereof.
     
    (b) Amendment
      to Section 2.7(b) of the Original Loan Agreement.
      Section
      2.7(b) of the Original Loan Agreement is hereby amended to be and read in its
      entirety as follows:
     
    “(b) Term
      Loans.
      Proceeds of the Term Loans may be used only to (i) refinance the principal
      of and accrued and unpaid interest on all Construction Loans outstanding on
      the
      Term Loan Conversion Date, if any, (ii) pay interest, fees and other
      expenses payable pursuant to Section 2.3, Section 2.5, Section 2.10
      and Section 8.11, if any, and (iii) after the payment in full of all amounts
      described in the preceding clauses (i) and (ii), finance a distribution or
      dividend (directly or indirectly) to PEI (it being acknowledged and agreed
      that
      the amount of such distribution or dividend shall not exceed the amount of
      capital contributions made (directly or indirectly) by PEI to Borrower after
      the
      Closing Date in connection with or related to the development, construction,
      installation, start-up or testing of the Project). To the extent that proceeds
      of the Term Loans are not sufficient to pay in full all of the amounts described
      in clauses (i), (ii) and (iii) of the preceding sentence, such proceeds will
      be
      applied first
      to the
      amounts described in clause (i) of the preceding sentence, second
      to the
      amounts described in clause (ii) of the preceding sentence and third
      to the
      amounts described in clause (iii) of the preceding sentence until all of such
      proceeds have been disbursed. Any amount described in clauses (i) and (ii)
      of
      the first sentence of this paragraph not paid with the proceeds of the Term
      Loans will be payable in full by or on behalf of Borrower on the date on which
      the Term Loans are disbursed.”
     
    
    (c) Amendment
      to the Definition of Term Loan Conversion Date.
      The
      definition of “Term Loan Conversion Date” is hereby amended to be and read in
      its entirety as follows:
     
    “Term
      Loan Conversion Date”
means
      the date on which Borrower borrows Term Loans in the aggregate initial principal
      amount equal to the maximum amount permitted pursuant to the definition of
      “Aggregate Term Loan Commitment” following the delivery of a Notice of Borrowing
      pursuant to Section 2.2(c) and the satisfaction of the conditions precedent
      contained in Section 3.3, which date must occur on or prior to December 15,
      2006.”
     
    Section
      1.3. Amendments
      to Reflect Early Termination and Prepayment Provisions.
     
    (a) Amendment
      to Section 2.8(b) of the Original Loan Agreement.
      Section
      2.8(b) of the Original Loan Agreement is hereby amended to be and read in its
      entirety as follows:
     
    “(b) Optional
      Prepayment.
      Borrower may, on any Business Day following the Term Loan Conversion Date,
      after
      having given the Administrative Agent at least ten (10) Business Days’ prior
      revocable notice and five (5) Business Days’ prior irrevocable notice, prepay in
      full the Term Loans and all other amounts then-outstanding under the Loan
      Documents (including amounts under Section 2.3, Section 2.5, Section 2.10
      and Section 8.11). In connection with such prepayment, Borrower will pay to
      the
      Lenders the prepayment fee calculated in accordance with Section 2.8(c), if
      any.”
     
    (b) Addition
      of New Section 2.11 to the Original Loan Agreement.
      A new
      Section 2.11 is hereby added to the Original Loan Agreement to be and read
      in
      its entirety as follows:
     
    “Section
      2.11 Early
      Termination and Failure to Borrow Term Loans.
      
     
    (a) If
      the
      Term Loan Conversion Date has not occurred on or prior to December 15, 2006,
      Borrower may at its option terminate this Agreement and the other Loan Documents
      by delivering a written notice of such termination to the Administrative Agent
      and paying to the Administrative Agent, in immediately available funds for
      distribution to the Lenders in proportion to their Pro Rata Shares of the
      Aggregate Term Loan Commitment, a nonrefundable fee in the amount of
      $1,020,000.00 (the “Early
      Termination Fee”)
      (which
      shall be the sole fee required in connection with any such termination) and
      all
      other amounts then due and payable under Section 2.10, Section 8.11 and Section
      8.12 of this Agreement and the other Loan Documents. 
     
    
    (b) Without
      duplication of Borrower’s obligations under clause (a) above, if Borrower
      has not borrowed Term Loans in the aggregate initial principal amount equal
      to
      at least $34,000,000 on or prior to December 15, 2006, and Borrower has not
      exercised its rights under clause (a) above, then Borrower will pay to the
      Administrative Agent, in immediately available funds for distribution to the
      Lenders in proportion to their Pro Rata Shares of the Aggregate Term Loan
      Commitment, a nonrefundable fee in the amount of the product of (i)
      $1,020,000.00 and (ii) a fraction, the numerator of which is the aggregate
      initial principal amount of Term Loans borrowed by Borrower on or prior to
      December 15, 2006, and the denominator of which is 34,000,000, such fee being
      payable to the Administrative Agent on December 15, 2006, and upon receipt
      by the Administrative Agent of such fee and all other amounts then due and
      payable under Section 2.10, Section 8.11 and Section 8.12 of this Agreement
      and
      the other Loan Documents, this Agreement and the other Loan Documents will
      terminate.
     
    (c) In
      connection with any final prepayment of Term Loans (as notified by Borrower
      to
      the Administrative Agent) or in connection with any termination event described
      in clauses (a) and (b) above, upon the prepayment of such Loans or the payment
      of the Early Termination Fee (as applicable) and the other amounts provided
      for
      in Section 2.8 or this Section 2.11 (as applicable), this Agreement and the
      other Loan Documents shall automatically terminate and all Liens granted by
      the
      PEIX Parties under the Loan Documents shall automatically be released and
      terminate, in each case without further action of the parties. Without limiting
      the foregoing, the Administrative Agent shall execute and deliver all customary
      pay-off letters, UCC-3 Termination Statements and other documents and
      instruments reasonably necessary to effectuate such release and termination,
      as
      well as return to Borrower or its designee any pledged Collateral in the
      Administrative Agent’s possession or control.”
     
    Section
      1.4. Amendments
      to Reflect Term Loan Borrowing.
      
     
    (a) Section 3.2
      of the Original Loan Agreement is hereby amended as follows:
     
    (i) Each
      of
      Sections 3.2(a)(ix)-(xi) of the Original Loan Agreement is hereby deleted in
      its
      entirety and replaced with the words “[RESERVED]”.
     
    (ii) Section
      3.2 of the Original Loan Agreement is hereby amended by adding the following
      at
      the end of Section 3.2 of the Original Loan Agreement:
     
    “Notwithstanding
      anything to the contrary herein (including this Section 3.2, Section 2.2(a)
      and
      Section 3.3), the parties acknowledge and agree that Borrower’s election to pay
      for Qualified Project Construction Expenses with the proceeds of capital or
      equity contributions (rather than Construction Loans) shall not be a valid
      basis
      for any Lender to decline to make a Construction Loan or Term
      Loan.”
     
    
    (b) Section 3.3
      of the Original Loan Agreement is hereby amended by adding the following at
      the
      end of Section 3.3 of the Original Loan Agreement:
     
    “Notwithstanding
      anything to the contrary herein (including this Section 3.3. and Section
      2.2(b)), if Borrower requests that the Lenders make a Term Loan the proceeds
      of
      which will be applied in whole or in part in the manner contemplated by Section
      2.7(b)(iii) (and not in the manner contemplated by Section 2.7(b)(i)), then
      the
      conditions precedent specified in Sections 3.3(a)(iv)-(v), Sections
      3.3(a)(viii)(A)-(B) and Sections 3.3(i)-(k) shall not be required to be
      satisfied until sixty (60) days after the date of disbursement of the Term
      Loan
      (and Borrower covenants with the Lenders that it will so satisfy such conditions
      on or before the date that is sixty (60) days after the date of disbursement
      of
      the Term Loan); provided,
      that it
      shall be a condition precedent to disbursement of the Term Loan that the
      Administrative Agent receive a certificate of the Engineer satisfactory to
      the
      Administrative Agent, certifying that as of the date of disbursement of the
      Term
      Loan the Project is capable of operating in a manner that will permit Borrower
      to comply with its obligations contained in Section 5.1(p).”
     
    Section
      1.5. Amendment
      to Distribution Covenant.
      Section
      5.2(i) of the Original Loan Agreement is hereby amended by adding “or as
      contemplated by Section 2.7(b)” at the end of such Section.
     
    Section
      1.6. Consents
      to Certain Change Orders and Agreements.
     
    (a) The
      Administrative Agent and each Lender hereby consent to and approve for all
      purposes under the Loan Documents (including, without limitation, Sections
      3.2,
      4.1(k), 5.1(e) and 5.2(c) of the Original Loan Agreement) each of the change
      orders listed on Schedule
      I
      hereto
      (and amendments, modifications or supplements thereto made after the date
      hereof) and any other change order executed by Borrower after the date hereof
      or
      any other expenditure which was not approved by the Lenders on the Closing
      Date;
provided, that
      the
      payment obligations under such change orders and such expenditures are funded
      with the proceeds of capital or equity contributions received by Borrower (and
      not with the proceeds of Loans) and provided,
      further,
      that no
      such change order not listed on Schedule
      I
      hereto
      and no amendment, modification or supplement to any change order, and no other
      expenditure, materially alters the character of the Project. Without limiting
      the foregoing, the Administrative Agent and each Lender hereby acknowledge
      that
      Borrower may dispute any such change orders pursuant to the dispute procedures
      set forth in the EPC Contract or otherwise.
     
    (b) Notwithstanding
      anything to the contrary in the Loan Documents, the Administrative Agent and
      each Lender hereby agree that, for so long as no Loans are outstanding, (i)
      Borrower will not be required to comply with Sections 4.1(k), 5.1(e)(i) (solely
      with respect to compliance with the Construction Budget and Construction and
      Draw Schedule), 5.1(e)(ii), 5.2(c)(ii)(solely with respect to the change orders
      listed in Schedule I hereto), and 5.2(c)(iv) of the Original Loan Agreement
      and
      (ii) any breach of any representation, warranty or covenant contained in any
      Loan Document resulting from any PEIX Party’s failure to perform under the EPC
      Contract or develop, construct, install, test or start-up the Project in the
      manner required by the Loan Documents shall not be deemed to be a Default or
      Event of Default if such breach could not reasonably be expected to have a
      Material Adverse Effect (taking into account the absence of any Loans made
      to
      Borrower).
     
    
    (c) Notwithstanding
      anything to the contrary in the Loan Documents, the Administrative Agent and
      each Lender hereby agree that any PEIX Party may without restriction directly
      or
      indirectly pay for any Qualified Project Construction Expenses with funds other
      than Loan proceeds, and such payments may be considered capital or equity
      contributions to Borrower.
     
    ARTICLE
      II
    RIGHT
      TO PARTICIPATE IN FUTURE FINANCING TRANSACTIONS
     
    Section
      2.1. Right
      of Participation.
      In
      consideration of the agreement of the Administrative Agent and the Lenders
      to
      amend the Original Loan Agreement in the manner described in Article I of this
      Amendment, PEI hereby grants to each of the Lenders who are a party to the
      Original Loan Agreement as of August 1, 2006, the right to participate as a
      lender in any refinancing or multi-plant financing involving the Project that
      closes on or before December 31, 2006. Each Lender’s right to participate in any
      such refinancing or multi-plant financing will be in a proportion relative
      to
      such Lender’s Pro Rata Share of the Aggregate Term Loan Commitment (provided,
      that
      without PEI’s prior written consent, the Lenders will only have the right to
      provide up to $34,000,000 (in the aggregate) in commitments in respect of such
      refinancing or financing). If a Lender agrees to participate in such refinancing
      or multi-plant financing, then (a) the prepayment fee pursuant to the Original
      Loan Agreement (as amended by this Amendment) or Early Termination Fee due
      to
      that Lender in connection with such repayment shall be reduced by a fraction
      the
      numerator of which is the aggregate amount of such Lender’s commitment to
      participate in such refinancing or multi-plant financing and the denominator
      of
      which is the product of (i) such Lender’s Pro Rata Share of the Aggregate
      Term Loan Commitment and (ii) 34,000,000 or (b) if such Lender has
      previously received a prepayment fee or Early Termination Fee pursuant to the
      Original Loan Agreement, as amended by this Amendment, then such Lender will
      refund to Borrower, on the date of such refinancing or financing, the difference
      between the fee received by it and the amount that would otherwise be payable
      to
      such Lender pursuant to the preceding clause (a).
     
    ARTICLE
      III
    REPRESENTATIONS
      AND WARRANTIES
     
    Section
      3.1. Representations
      and Warranties.
      Each of
      PEI, Borrower, the Administrative Agent and the Lenders represents and warrants
      to each other party to this Amendment on and as of the date hereof that (a)
      it
      is duly organized or formed, validly existing and in good standing under the
      Laws of the United States of America or the state of its incorporation or
      formation and is duly qualified to do business as a foreign corporation and
      is
      in good standing in each jurisdiction in which such qualification is necessary
      or desirable in view of its current or proposed business and operations or
      the
      ownership of its properties, (b) it has all necessary rights, franchises and
      privileges and full power and authority to execute, deliver and perform this
      Amendment and to conduct its business as currently conducted and as proposed
      to
      be conducted, (c) it has taken all necessary action to execute, deliver and
      perform this Amendment and (d) this Amendment has been duly executed and
      delivered by it and constitutes the legally valid and binding obligation of
      it,
      enforceable in accordance with its terms, except as enforcement may be limited
      by bankruptcy, insolvency, reorganization, moratorium or similar Laws relating
      to or limiting creditors’ rights generally or by general principles of
      equity.
     
    
    Section
      3.2. No
      Default or Event of Default.
      Each of
      the Administrative Agent and the Lenders acknowledges that, as of the date
      of
      this Amendment, no Default or Event of Default has occurred and is continuing
      under the Original Loan Agreement. Each of PEI and Borrower acknowledges and
      agrees that, as of the date of this Amendment, none of the Administrative Agent
      and the Lenders is in default of its obligations under the Loan
      Documents.
     
    ARTICLE
      IV
    GENERAL
      PROVISIONS
     
    Section
      4.1. Counterparts.
      This
      Amendment may
      be
      executed in any number of counterparts and by the different parties hereto
      in
      separate counterparts, each of which when so executed will be deemed to be
      an
      original and all of which taken together will constitute one and the same
      instrument.
     
    Section
      4.2. Costs
      and Expenses.
      PEI and
      Borrower agree to pay to the Administrative Agent and the Lenders on demand
      all
      reasonable, documented costs and expenses incurred or arising in connection
      with
      the preparation, documentation, negotiation, execution and delivery of this
      Amendment.
     
    Section
      4.3. Continuing
      Effect of Other Loan Documents.
      Except
      as set forth in Article I hereof, the terms and provisions of the Loan Documents
      remain in full force and effect without change, amendment, waiver or
      modification. This Amendment constitutes a Loan Document and, from and after
      the
      date hereof, the Original Loan Agreement shall be deemed to be amended as
      provided in Article I hereof.
     
    Section
      4.4. Governing
      Law.
      THIS
      AMENDMENT WILL BE GOVERNED BY AND CONSTRUED IN ACCORDANCE WITH THE LAWS OF
      THE
      STATE OF NEW YORK, WITHOUT REGARD TO THE CONFLICT OF LAW PROVISIONS THEREOF
      (OTHER THAN SECTION 5.1401 OF THE GENERAL OBLIGATIONS LAW AND ANY SUCCESSOR
      STATUTE THERETO).
     
    
    IN
      WITNESS WHEREOF, the parties hereto, intending to be legally bound, have caused
      this Amendment No. 1 to Construction and Term Loan Agreement and Agreement
      as to
      Future Financing Transactions to be executed on the date first above
      written.
    
     
    PACIFIC
      ETHANOL MADERA LLC
     
    By
      /s/
      John T. Miller 
    Name:
      John T. Miller
    Title:
      President
    
     
    TD
      BANKNORTH, N.A.,
    as
      the
      Administrative Agent, a Construction 
    Lender
      and a Term Lender
     
    By
      /s/
      Jerome P. Peters, Jr. 
    Name:
      Jerome P. Peters, Jr.
    Title:
      Senior Vice President
    
     
    COMERICA
      BANK, 
    as
      a
      Construction Lender and a Term Lender
     
    By
      /s/
      Robert J. Harlan 
    Name:
      Robert J. Harlan
    Title:
      Vice President
     
     
    PACIFIC
      ETHANOL, INC.
     
    By
      /s/
      John T. Miller 
    Name:
      John T. Miller
    Title:
      COO
     
    
    Schedule
      I
     
    Change
      Orders
     
    
      
      
        
            
              | 
                 GMP
                  At Financial Close 
               | 
                | 
                | 
              
                 50,635,346.62 
               | 
                | 
                | 
              
                 Includes
                  Change Order 4's 1-6 
               | 
                | 
            
            
              |   | 
                | 
                | 
                | 
                | 
                | 
                | 
                | 
            
            
              | 
                 Approved
                  &
                  Agreed
                  Change Orders 
                Change
                  Order #7 
               | 
                | 
                | 
              
                 158,469.92 
               | 
                | 
                | 
              
                 Permits,
                  etc 
               | 
                | 
            
            
              | 
                 Change
                  Order #8 
               | 
                | 
                | 
              
                 1,576,326,64 
               | 
                | 
                | 
              
                 CLS
                  system 
               | 
                | 
            
            
              | 
                 Change
                  Order #9 
               | 
                | 
                | 
              
                 (384,237.03 
               | 
              
                 ) 
               | 
                | 
              
                 Emergency
                  Generator 
               | 
                | 
            
            
              | 
                 Change
                  Order #10 
               | 
                | 
                | 
              
                 270,236.72 
               | 
                | 
                | 
              
                 Electrical 
               | 
                | 
            
            
              | 
                 Change
                  Order #11 
               | 
                | 
                | 
              
                 307,904.87 
               | 
                | 
                | 
              
                 12kV
                  switchgear 
               | 
                | 
            
            
              | 
                 Change
                  Order #12 
               | 
                | 
                | 
              
                 352,358.22 
               | 
                | 
                | 
              
                 Electrical,
                  water 
               | 
                | 
            
            
              | 
                 Change
                  Order #13 
               | 
                | 
                | 
              
                 412,646.02 
               | 
                | 
                | 
              
                 Electrical 
               | 
                | 
            
            
              |   | 
                | 
                | 
              
                 2,693.705.36 
               | 
                | 
                | 
              
                 Subtotal
                  CO's 7-13 
               | 
                | 
            
            
              |   | 
                | 
                | 
                | 
                | 
                | 
                | 
                | 
            
            
              | 
                 Total
                  Approved &
                  Agreed
                  GMP 
               | 
                | 
                | 
              
                 53,329,051.98 
               | 
                | 
                | 
                | 
                | 
            
        
       
       
      
        
            
              | 
                 Potential
                  Change Orders Signed (CO's
                  unsigned)  
               | 
                | 
                | 
                | 
                | 
                | 
                | 
                | 
            
            
              | 
                 Change
                  Order #14 
               | 
                | 
                | 
              
                 307,713.80 
               | 
                | 
                | 
              
                 Design,
                  Acceleration 
               | 
                | 
            
            
              | 
                 Change
                  Order #15 
               | 
                | 
                | 
              
                 130,919.30 
               | 
                | 
                | 
              
                 Permits 
               | 
                | 
            
            
              | 
                 Change
                  Order #16 
               | 
                | 
                | 
              
                 245,221.01 
               | 
                | 
                | 
              
                 Acceleration 
               | 
                | 
            
            
              | 
                 Change
                  Order #17 
               | 
                | 
                | 
              
                 299,373,67 
               | 
                | 
                | 
              
                 Acceleration 
               | 
                | 
            
            
              |   | 
                | 
                | 
              
                 983,227.78 
               | 
                | 
                | 
              
                 Subtotal
                  CO's 14-17 
               | 
                | 
            
            
              |   | 
                | 
                | 
                | 
                | 
                | 
                | 
                | 
            
            
              | 
                 Total
                  GMP Post CO #'s 14-17 
               | 
                | 
                | 
              
                 54,312,279.76 
               | 
                | 
                | 
                | 
                |