24小时热门版块排行榜    

Znn3bq.jpeg
北京石油化工学院2026年研究生招生接收调剂公告
查看: 2931  |  回复: 24

秋雨子

金虫 (小有名气)

引用回帖:
18楼: Originally posted by asaka at 2011-12-10 16:33:17:
以上作者只考虑闭壳层计算的情况,你有开壳层的计算吗?那时候你需要总的HOMO,LUMO还是分别alpha以及beta的HOMO和LUMO?
他们的程序都只有一点小问题,相信LZ可以搞定。
mchen10 的程序少了一个 |,多了一个奇怪 ...

非常感谢高手的赐教,我的分子群全是闭壳层的,当然也有许多别的分子信息需要提取,那些都相对简单一些,自己可以学着搞定!非常感谢!
To the time to life, rather than to life in time
21楼2011-12-11 20:10:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

秋雨子

金虫 (小有名气)

送鲜花一朵
引用回帖:
19楼: Originally posted by mchen10 at 2011-12-11 04:06:32:
[code]#!/bin/bash
# print homo lumo energy of gaussian output
# usage: print_homo_lumo filename(s)
for file in "$@"
do
echo $file
tac $file | tr "\n" "@" | egre ...

谢谢不吝赐教!我会努力的学习的,才接触脚本,总是觉得深奥难懂,心理的排斥应该克服!总是想绕过难题去走捷径是不行的!非常感谢!
To the time to life, rather than to life in time
22楼2011-12-11 20:13:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ZDBWHZ

金虫 (正式写手)

`ls -l *.log | awk '{print $9}' | sed 's/.log//g' > file_list`
这一行中的9可能是8,需要自己数一下ls -l *.log出现多少列。
23楼2011-12-12 13:28:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ZDBWHZ

金虫 (正式写手)

再来个Fortran
PROGRAM HOLU2
!
! Program to extract HOMO and LUMO data from multiple Gaussian output files
! SRK 2011/06/30
! SRK 2011/10/18 Modified to produce 3 output files, bug fix
!
! Input : A file containing a list of filenames, one per line
! Output:  One line per input filename, 3 columns, holding the filename, the HOMO and the LUMO
!          Input filename, HOMO and LUMO are written to file 'HOMOandLUMO.txt'
!          HOMO is written to file 'HOMO.txt'
!          LUMO is written to file 'LUMO.txt'
!
IMPLICIT NONE
! Variable declarations
INTEGER, PARAMETER :: inunit=22, listunit=23 ! Unit numbers for input files and list file
INTEGER, PARAMETER :: hlunit=24, hunit=25, lunit=26 ! Unit numbers for output files
INTEGER :: i          ! Loop variable
INTEGER :: n          ! Number of characters in current line
INTEGER :: stat       ! Holds the current state of the input file, 0=OK
INTEGER :: numfiles   ! Number of filenames detected in the input
INTEGER :: blockflag  ! Flag variable to find the correct HOMO-LUMO data
CHARACTER (LEN=100) :: listname ! File containing the list of filenames to be processed
CHARACTER (LEN=100) :: inpfile  ! Current input filename
CHARACTER (LEN=100) :: line     ! Current line in the input file
CHARACTER (LEN=100) :: prevline ! Previous line in the input file
CHARACTER (LEN=9) :: homostring, lumostring ! Strings containing the HOMO/LUMO eigenvalues

!
! Executable code

WRITE (*,*) 'HOLU - a program to extract HOMO and LUMO data'
WRITE (*,*) 'Enter the name of an input file containing a list of filenames (no blank lines!)'
READ (*,'(A)') listname
OPEN(listunit,FILE=listname)
!
! Find out how many files are in the list
numfiles = 0
stat = 0
DO
   READ(listunit,'(A)',iostat=stat) line
   IF (stat /= 0) EXIT
   numfiles = numfiles + 1
END DO
CLOSE(listunit)
WRITE (*,*) 'Detected ',numfiles,' lines in list file'

!
! Open output files
OPEN(hlunit,FILE='HOMOandLUMO.txt')
OPEN(hunit,FILE='HOMO.txt')
OPEN(lunit,FILE='LUMO.txt')

! Now loop over these files
OPEN(listunit,FILE=listname)
DO i = 1, numfiles
   READ(listunit,'(A)') inpfile
   OPEN(inunit,file=TRIM(inpfile))
   blockflag = 0
!
! Search for the needed information in the input file
   prevline = ''
   DO
      READ(inunit,FMT='(A)',IOSTAT=stat) line ! Read in the next line of the file using '(A)' format
      IF (stat /= 0 ) EXIT
      IF (index(line,'Alpha virt.') > 0 ) THEN   ! found a line listing virtual states
        IF (blockflag == 0) blockflag = 1
        IF (blockflag == 2) THEN                    ! we have found the second block
           lumostring = line(30:40)                 ! first number on this line
           n = len_trim(prevline)
           homostring = prevline(n-8:n)             ! last number on previous line
           WRITE(*,*) TRIM(inpfile),' ', 'HOMO', ' ', homostring,' ', 'LUMO', ' ', lumostring
           WRITE(hlunit,'(A),(A),(A),(A)') TRIM(inpfile),' ', 'HOMO', ' ', homostring,' ', 'LUMO', ' ', lumostring
           WRITE(hunit,'(A)') TRIM(inpfile),' ', 'HOMO', ' ', homostring
           WRITE(lunit,'(A)') TRIM(inpfile),' ', 'LUMO', ' ', lumostring
           EXIT
        END IF
      ELSE
        IF (blockflag == 1) blockflag = 2      
      END IF
      prevline = line
   END DO
   CLOSE(inunit)
END DO


! Close all files that are still open
CLOSE(listunit)
CLOSE(hlunit)
CLOSE(hunit)
CLOSE(lunit)

!
END PROGRAM HOLU2
这是source code,需要编译。
编译后,`ls -l *.log | awk '{print $9}' > file_list
再运行编译后的程序,输入文件就是file_list。所有的输出结果都显示在屏幕上,可以拷入txt文档,进行后续的计算。
24楼2011-12-12 13:37:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

秋雨子

金虫 (小有名气)

高手如云啊!学习了学习了!可以成为经典贴了!
To the time to life, rather than to life in time
25楼2011-12-13 23:43:07
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 秋雨子 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 297求调剂 +15 GENJIOW 2026-04-07 16/800 2026-04-08 06:23 by lijunpoly
[考研] 一志愿吉大化学327求调剂 +10 王王白石 2026-04-06 11/550 2026-04-07 23:54 by JourneyLucky
[考研] 318求调剂 +5 李青山山山 2026-04-07 5/250 2026-04-07 18:24 by 蓝云思雨
[考研] 08600生物与医药-327 +9 18755400796 2026-04-05 9/450 2026-04-06 22:35 by 52305043001
[考研] 生物学学硕求调剂:351分一志愿南京师范大学生物学专业 +6 …~、王…~ 2026-04-06 7/350 2026-04-06 18:54 by macy2011
[考研] 308求调剂 +13 倘若起风了呢 2026-04-05 13/650 2026-04-06 14:20 by 蒋皓禹
[考研] 一志愿南航,数一英一学硕317求调剂!! +6 Acaciad 2026-04-04 6/300 2026-04-06 12:13 by 考研学校招点人
[考研] 332求调剂 +17 小小孟... 2026-04-05 18/900 2026-04-06 09:51 by 蓝云思雨
[考研] 294求调剂 +4 Grey_Ey 2026-04-01 5/250 2026-04-05 23:05 by Grey_Ey
[考研] 一志愿北京交通大学材料工程总分358求调剂 +4 cs0106 2026-04-04 4/200 2026-04-05 18:46 by imissbao
[考研] 一志愿上海海洋大学083200食品学硕,求调剂,接受其他专业083200 +4 what张 2026-04-04 5/250 2026-04-05 14:07 by chw1980_0
[考研] 材料与化工306分找调剂 +23 沧海轻舟e 2026-04-02 27/1350 2026-04-04 21:52 by laoshidan
[考研] 333求调剂 +12 wfh030413@ 2026-04-03 13/650 2026-04-04 21:02 by jj987
[考研] 283求调剂 +4 mcbbc 2026-04-03 5/250 2026-04-04 20:51 by imissbao
[考研] 324求调剂 +14 想上学求调 2026-04-02 15/750 2026-04-04 20:31 by 无际的草原
[考研] 一志愿中国石油大学化学工程323分求调剂 +4 化工专硕323分 2026-04-03 6/300 2026-04-03 22:12 by dongzh2009
[考研] 295求调剂 +3 尚偌呀 2026-04-03 4/200 2026-04-03 21:23 by zhq0425
[考研] 考研调剂 +3 Draa 2026-04-03 3/150 2026-04-03 17:37 by hgwz7468
[考研] 081200-11408-276学硕求调剂 +5 崔wj 2026-04-03 5/250 2026-04-03 15:06 by arrow8852
[考研] 环境工程调剂 +9 hyzzzzzzz. 2026-04-01 9/450 2026-04-01 14:20 by salamander`
信息提示
请填处理意见