24小时热门版块排行榜    

查看: 788  |  回复: 2
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

zyj8119

木虫 (著名写手)

[交流] 【原创】MAPS中计算自由体积的python程序 已有2人参与

CODE:
#!/usr/bin/python
###########################################################################
#              calculateVolumeQt.py  -  description
#              ------------------------------------
#   begin                : Fri Dec 15 16:11:04 CET 2006
#   copyright            : (C) 2006 by Scienomics
#   email                : Joerg-Ruediger.Hill@scienomics.com
###########################################################################
#
###########################################################################
#                                                                         #
#   This program and all subroutines,  data, and  files used by it are    #
#   protected by copyright and hence may not be used, copied, modified    #
#   transmitted, inspected, or executed by any means including the use    #
#   of electronic data processing equipment,  xerography, or any other    #
#   methods  without the express  written permission  of the copyright    #
#   holder.                                                               #
#                                                                         #
#   Copyright (C) 2006 Scienomics S. A.                                   #
#                                                                         #
###########################################################################
#
# $Id: calculateVolumeQt.py,v 1.4 2010/03/29 15:15:56 jrh Exp $
# $Log: calculateVolumeQt.py,v $
# Revision 1.4  2010/03/29 15:15:56  jrh
# Moved to new way of retrieving plugin objects
#
# Revision 1.3  2008/01/16 12:42:53  jrh
# Moved to Qt4
#
# Revision 1.2  2006/12/20 13:08:54  jrh
# Added error checking
#
# Revision 1.1  2006/12/15 16:05:32  jrh
# Created
#
#

# A simple demo script showing how to calculate a property for a
# molecule from information already available in MAPS and using
# Qt for output.

from math import pi
import Maps
import MapsChemistryDataModel
from PyQt4.QtGui import QMessageBox

app=Maps.MapsApp.getContainer()
cdm=MapsChemistryDataModel.ChemistryDataModel.get()
projects=cdm.getProjects()
if len(projects) == 0:
  QMessageBox.information(app, "Note", "Please load or sketch a molecule before running this script.")
else:  
  molecules=projects[0].getMolecules()
  if len(molecules) == 0:
    QMessageBox.information(app, "Note", "Please load or sketch a molecule before running this script.")
  else:
    volume=0.0
    for atom in molecules[0].atoms:
      r=atom.element.vanDerWaalsRadius
      volume=volume+r*r*r
    QMessageBox.information(app, "Note", "The volume is " + str(4.0*pi*volume/3.0) + " Ang^3.")

回复此楼

» 本帖已获得的红花(最新10朵)

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

好好学习,天天向上。
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

qphll

金虫 (正式写手)

送鲜花一朵
好东西不少, 继续...
Life, Love, Laugh.
3楼2012-03-23 10:14:21
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 3 个回答
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见