我有一个包含 1804 个粒子的配置,但有些粒子重叠。我尝试制作 Fortran 代码来删除粒子的坐标。我有一些错误。请帮我。
PROGRAM CHECK_OVERLAP
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
PARAMETER (MAXATOM = 20000000)
DIMENSION RX(MAXATOM), RY(MAXATOM), RZ(MAXATOM)
REAL DRMAX
CHARACTER RESNAME*(5),ATOMNAME*(5)
CHARACTER BOX_PAR
DRMAX = 0.15
OPEN (10, FILE = 'conf.gro')
READ (10,*) BOX_PAR
READ (10,*) NN
DO 100 IPART = 1, NN
READ(10,99) NUMRES,RESNAME,ATOMNAME,NUMATOM,
& RX(IPART), RY(IPART), RZ(IPART)
99 FORMAT (I5,2A5,I5,3F8.3)
100 CONTINUE
CLOSE(10)
DO 200 I = 1, NN-1
RXI = RX(I)
RYI = RY(I)
RZI = RZ(I)
DO 300 J = I+1 , NN
RXIJ = RXI - RX (J)
RYIJ = RYI - RY (J)
RZIJ = RZI - RZ (J)
RIJSQ = RXIJ*RXIJ + RYIJ*RYIJ + RZIJ*RZIJ
IF ( RIJSQ.LT.25) THEN
RXIOLD = RXI
RYIOLD = RYI
RZIOLD = RZI
RXINEW = RXIOLD + (2.0 * RANF (DUMY) - 1.0) * DRMAX
RYINEW = RYIOLD + (2.0 * RANF (DUMY) - 1.0) * DRMAX
RZINEW = RZIOLD + (2.0 * RANF (DUMY) - 1.0) * DRMAX
RXINEW = RXINEW - ANINT (RXINEW)
RYINEW = RYINEW - ANINT (RYINEW)
RZINEW = RZINEW - ANINT (RZINEW)
RXIJ_NEW = RXI - RXINEW
RYIJ_NEW = RYI - RYINEW
RZIJ_NEW = RZI - RZINEW
RIJSQ_NEW = RXIJ_NEW*RXIJ_NEW + RYIJ_NEW*RYIJ_NEW+
& RZIJ_NEW*RZIJ_NEW
IF (RIJSQ_NEW.GT.25) THEN
RX(I) = RXINEW
RY(I) = RYINEW
RZ(I) = RZINEW
END IF
END IF
300 CONTINUE
200 CONTINUE
CALL WRITEOUT (CN)