URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [pr32604.f90] - Rev 695
Compare with Previous | Blame | View Log
MODULE TESTIMPLICIT NONEINTEGER, PARAMETER :: dp=KIND(0.0D0)TYPE mulliken_restraint_typeINTEGER :: ref_countREAL(KIND = dp) :: strengthREAL(KIND = dp) :: TARGETINTEGER :: natomsINTEGER, POINTER, DIMENSION(:) :: atomsEND TYPE mulliken_restraint_typeCONTAINSSUBROUTINE INIT(mulliken)TYPE(mulliken_restraint_type), INTENT(INOUT) :: mullikenALLOCATE(mulliken%atoms(1))mulliken%atoms(1)=1mulliken%natoms=1mulliken%target=0mulliken%strength=0END SUBROUTINE INITSUBROUTINE restraint_functional(mulliken_restraint_control,charges, &charges_deriv,energy,order_p)TYPE(mulliken_restraint_type), &INTENT(IN) :: mulliken_restraint_controlREAL(KIND=dp), DIMENSION(:, :), POINTER :: charges, charges_derivREAL(KIND=dp), INTENT(OUT) :: energy, order_pINTEGER :: IREAL(KIND=dp) :: dumcharges_deriv=0.0_dporder_p=0.0_dpDO I=1,mulliken_restraint_control%natomsorder_p=order_p+charges(mulliken_restraint_control%atoms(I),1) &-charges(mulliken_restraint_control%atoms(I),2)ENDDOenergy=mulliken_restraint_control%strength*(order_p-mulliken_restraint_control%target)**2dum=2*mulliken_restraint_control%strength*(order_p-mulliken_restraint_control%target)DO I=1,mulliken_restraint_control%natomscharges_deriv(mulliken_restraint_control%atoms(I),1)= dumcharges_deriv(mulliken_restraint_control%atoms(I),2)= -dumENDDOEND SUBROUTINE restraint_functionalEND MODULEUSE TESTIMPLICIT NONETYPE(mulliken_restraint_type) :: mullikenREAL(KIND=dp), DIMENSION(:, :), POINTER :: charges, charges_derivREAL(KIND=dp) :: energy,order_pALLOCATE(charges(1,2),charges_deriv(1,2))charges(1,1)=2.0_dpcharges(1,2)=1.0_dpCALL INIT(mulliken)CALL restraint_functional(mulliken,charges,charges_deriv,energy,order_p)write(6,*) order_pEND
