版块导航
正在加载中...
客户端APP下载
论文辅导
申博辅导
登录
注册
帖子
帖子
用户
本版
应《网络安全法》要求,自2017年10月1日起,未进行实名认证将不得使用互联网跟帖服务。为保障您的帐号能够正常使用,请尽快对帐号进行手机号验证,感谢您的理解与支持!
24小时热门版块排行榜
>
论坛更新日志
(3817)
>
文献求助
(395)
>
导师招生
(310)
>
虫友互识
(290)
>
硕博家园
(154)
>
博后之家
(153)
>
休闲灌水
(138)
>
考博
(124)
>
论文投稿
(109)
>
基金申请
(86)
>
招聘信息布告栏
(51)
>
考研
(50)
>
教师之家
(48)
>
公派出国
(40)
>
绿色求助(高悬赏)
(37)
>
找工作
(36)
小木虫论坛-学术科研互动平台
»
计算模拟区
»
分子模拟
»
LAMMPS/DL_POLY
»
【原创】MAPS中构筑lammps的无定形结构的python程序
5
1/1
返回列表
查看: 1015 | 回复: 3
只看楼主
@他人
存档
新回复提醒
(忽略)
收藏
在APP中查看
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖
zyj8119
木虫
(著名写手)
模拟EPI: 10
应助: 65
(初中生)
贵宾: 0.003
金币: 915.1
散金: 1440
红花: 35
帖子: 2936
在线: 1329.4小时
虫号: 664177
注册: 2008-11-29
性别: GG
专业: 理论和计算化学
[交流]
【原创】MAPS中构筑lammps的无定形结构的python程序
已有3人参与
CODE:
#!/usr/bin/python
###########################################################################
# amorphousLAMMPS.py - description
# ----------------------------------
# begin : Tue Oct 7 18:23:23 EEST 2008
# copyright : (C) 2008 by Scienomics
# email : loukas.peristeras@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) 2008 Scienomics S. A. #
# #
###########################################################################
#
# $Id: amorphousLAMMPS.py,v 1.4 2010/01/30 08:32:20 lperi Exp $
# $Log: amorphousLAMMPS.py,v $
# Revision 1.4 2010/01/30 08:32:20 lperi
# Fix version handling.
#
# Revision 1.3 2010/01/26 22:12:53 lperi
# Fix bug 3182.
#
# Revision 1.2 2010/01/04 19:29:03 lperi
# Update with recoil growth.
#
# Revision 1.1 2008/10/27 08:37:28 jrh
# Created
#
# $Revision: 1.4 $
# $Release$
# Script to demonstrate the Amorphous Builder functionality in
# combination with LAMMPS optimizer.
# - builds a 100mer chain (Ethylene monomer is used with Dreiding force
# field assigned)
# - builds a amorphous system (2 chains, 0.79 g/cm3) is build
# - perform LAMMPS optimization on the resulting system
import os
import time
import Maps
import MapsChemistryDataModel
import MapsViewer
import MapsLAMMPS
import MapsAmorphousBuilder
from PyQt4 import *
class AmorphousBuilderProtocol():
""" The protocol used to prepare an amorphous cell of a given
set of molecules.
"""
plugin=MapsAmorphousBuilder.AmorphousBuilderPlugin.get()
builder=None
def create(self, molecule, nchain, density, temperature):
self.builder=MapsAmorphousBuilder.AmorphousBuilder(app)
self.builder.setFlexible(True)
self.builder.setSimultaneously(True)
self.builder.setNewProject(False)
self.builder.setTemperature(temperature)
self.builder.setDensity(density)
self.builder.setInsertLateral(False)
self.builder.setNumberOfInsertionTrials(50)
self.builder.setNumberOfBuildTrials(5)
self.builder.setNumberOfMoleculeBuildTrials(5)
self.builder.setNumberOfBackSteps(5)
self.builder.setNumberOfTrials(12)
self.builder.setRecoiGrowth(True)
self.builder.setScaleGroup(1.0)
self.builder.setScaleLateralBonds(1.0)
self.builder.setScaleBonds(1.0)
self.builder.useNonBondedInteractions(True)
self.builder.initializeRandomNumber(1234);
molecules = [molecule]
nmolecules = [nchain]
self.builder.setMolecules(molecules,nmolecules)
self.plugin.setBuilder(self.builder)
self.builder.runningInThread=False
app.statusBar().showMessage("Building amorphous system...")
QtGui.qApp.processEvents()
self.builder.startBuilder(False)
QtGui.qApp.processEvents()
app.statusBar().showMessage("Ready")
QtGui.qApp.processEvents()
if ( self.builder.getMolecule() ):
self.builder.getMolecule().setName("amorphous")
return(1)
else:
return(0)
def getMolecule(self):
if self.builder:
return(self.builder.getMolecule())
else:
return(None)
class OptimizationProtocol:
""" The protocol used to optimize the system.
"""
plugin=MapsLAMMPS.LAMMPSPlugin.get()
results=None
molecule=None
jobName=""
projectName=""
def setup(self):
writer=MapsLAMMPS.LAMMPSWriter(app, self.plugin)
writer.setOption("coordinateFile", self.jobName + ".data")
writer.setOption("cutoff", "11.0")
writer.setOption("dielectric", "1.0")
writer.setOption("energyConvergence", "0.0001")
writer.setOption("ensemble", "NVE")
writer.setOption("forceCalculations", "5000")
writer.setOption("forceConvergence", "0.000001")
writer.setOption("forceFile", self.jobName + ".frcdump")
writer.setOption("initialTemperature", "298.15")
writer.setOption("method", "conjugatedGradient")
writer.setOption("restartAtEnd", self.jobName)
writer.setOption("scale12", "0.0")
writer.setOption("scale12Coulomb", "0.0")
writer.setOption("scale13", "0.0")
writer.setOption("scale13Coulomb", "0.0")
writer.setOption("scale14", "1.0")
writer.setOption("scale14Coulomb", "1.0")
writer.setOption("seed", str(int(time.time())))
writer.setOption("steps", "500")
writer.setOption("switchDistance", "8.0")
writer.setOption("switching", "on")
writer.setOption("timestep", "1")
writer.setOption("title", self.jobName)
writer.setOption("trajectoryFile", self.jobName + ".dump")
writer.setOption("trajectoryFrequency", "100")
writer.setOption("type", "forcefield")
writer.setOption("typeOfCalculation", "optimization")
writer.setOption("velocityFile", self.jobName + ".veldump")
success=writer.createInput(self.results,self.molecule, self.jobName)
if not success:
QMessageBox.critical(app, "Note", writer.getErrorDescription())
return(success)
def checkStatus(self):
file=open("status", "r")
line=file.readline()
file.close()
if line == "Completed":
return(1)
else:
return(0)
def optimize(self,molecule):
self.molecule=molecule
self.jobName=molecule.getName()+"_opt"
self.projectName=cdm.findProjectNameForMolecule(self.molecule)
# Add an experiment
project=cdm.findProjectByName(self.projectName)
experiment=Maps.Experiment(cdm,None,project,DataObject.END_TYPE)
experiment.setName("LAMMPS " + str(self.molecule.getName()) + " optimization")
project.addExperiment(experiment)
self.results=Maps.ExperimentalResult(cdm,experiment)
self.results.setName("LAMMPS results for " + str(self.molecule.getName()))
experiment.addExperimentalResult(self.results)
app.statusBar().showMessage("Optimizing structure using LAMMPS ...")
# Setup LAMMPS optimization
dirName=str(workingDirectory + "/" + self.jobName)
if not os.path.exists(dirName):
os.mkdir(dirName)
os.chdir(dirName)
success=0
if self.setup():
if os.name == "posix":
prefix="./"
else:
prefix=""
os.system(prefix + "run.py")
if self.checkStatus():
m=self.plugin.loadFile(self.results, \
self.jobName.toLatin1() + ".log")
success=1
else:
QtGui.QMessageBox.critical(app, "Note", "The optimization using LAMMPS failed.")
os.chdir("..")
app.statusBar().showMessage("Ready")
QtGui.qApp.processEvents()
return(success)
def main():
# Create output project
project=MapsChemistryDataModel.Project(cdm)
project.setName("Python polymer builder")
cdm.addProject(project)
# Find path to MAPS installation
for d in app.getInstallPath():
dir=d.toLatin1()
if os.path.exists(dir): break
file = "Ethylene.cml"
fileName=dir + "/groups/Monomers/" + file
# Build 100 mer chain
print "Building polymer ..."
molecule=MapsChemistryDataModel.Molecule(cdm)
project.addMolecule(molecule)
viewerPlugin.start(molecule)
viewer=viewerPlugin.getActiveViewer()
QtGui.qApp.processEvents()
chainLength=100
molecule.setName(str(chainLength) + "mer of " + file[0:len(file)-4])
monomer=MapsViewer.Monomer(fileName, "Monomer", chainLength)
monomers=[]
monomers.append(monomer)
viewer.buildPolymer(monomers, 1, 1, 0, MapsViewer.Viewer.ISOTACTIC)
del monomers
QtGui.qApp.processEvents()
# Assign Dreiding force field
print "Assigning force field ..."
ff=MapsChemistryDataModel.ForceField(cdm, dir + "/forcefields/Dreiding.params")
handler=MapsChemistryDataModel.ForceFieldHandler(app,ff.getForceFieldPath(),"")
nullarg=None
handler.setMolecule(molecule,nullarg)
atomType=True
atomCharge=True
if handler.assignForceField(atomType,atomCharge):
QtGui.QMessageBox.information(app, "Note", "The Dreiding force field was assigned.")
else:
QtGui.QMessageBox.warning(app, "Note", "There was a problem with the assignment\nof the force field.")
QtGui.qApp.processEvents()
# Create a amorphous system of 5 chains (0.79 g/cm3)
nchain=2
density=0.79
temperature=450.0
builder=AmorphousBuilderProtocol()
print "Building amorphous system ..."
if not builder.create(molecule,nchain,density,temperature):
QtGui.QMessageBox.information(app, "Note", "Amorphous builder failed.")
else:
print "Optimizing amorphous system ..."
optimizer=OptimizationProtocol()
if not optimizer.optimize(builder.getMolecule()):
QtGui.QMessageBox.information(app, "Note", "Optimization failed.")
QtGui.qApp.processEvents()
#-------------------------
if __name__ == '__main__':
# Check if MAPS is at least at version 3.2
try:
version=Maps.MapsApp.getVersion()
except (TypeError, AttributeError):
version=0
if version < 302:
QtGui.QMessageBox.information(None, "Note", "This script requires at least MAPS version 3.2.")
else:
# Get plugins needed
app=Maps.MapsApp.getContainer()
cdm=MapsChemistryDataModel.ChemistryDataModel.get()
viewerPlugin=MapsViewer.ViewerPlugin.get()
workingDirectory=app.getPreference("Working directory")
main()
回复此楼
» 猜你喜欢
到新单位后,换了新的研究方向,没有团队,持续积累2区以上论文,能申请到面上吗
已经有7人回复
申请2026年博士
已经有5人回复
天津工业大学郑柳春团队欢迎化学化工、高分子化学或有机合成方向的博士生和硕士生加入
已经有5人回复
寻求一种能扛住强氧化性腐蚀性的容器密封件
已经有6人回复
2025冷门绝学什么时候出结果
已经有7人回复
请问有评职称,把科研教学业绩算分排序的高校吗
已经有6人回复
Bioresource Technology期刊,第一次返修的时候被退回好几次了
已经有7人回复
请问哪里可以有青B申请的本子可以借鉴一下。
已经有4人回复
请问下大家为什么这个铃木偶联几乎不反应呢
已经有5人回复
康复大学泰山学者周祺惠团队招收博士研究生
已经有6人回复
高级回复
» 本主题相关价值贴推荐,对您同样有帮助:
CTD申报资料中 已知杂质结构确证 部分该怎么写呢?
已经有11人回复
与安卓的wifi相关!
已经有9人回复
在科研过程中如何验证自己编译程序的正确性
已经有3人回复
控制算法源程序问题
已经有5人回复
用Dmol优化收敛的结构,用vasp不收敛?
已经有9人回复
如何改变能带结构图的精度
已经有16人回复
结构化学的学习用哪本教材好呢????????望大家交流交流
已经有12人回复
请问哪个化合物的结构和这四个化合物的结构最接近
已经有11人回复
各位高手,怎么在windows下编译LAMMPS?
已经有4人回复
IBM+PC+汇编语言程序设计(第五版)中文版
已经有33人回复
科学家通过化学反应改变碳纳米管内部结构-《自然— 化学》杂志
已经有41人回复
形状可控纳米复合结构在催化的发展
已经有10人回复
求SnO2(金红石四方晶体结构)处理k点的syml程序
已经有4人回复
百度文库里的,转给大家看看,Python的学习
已经有12人回复
【求助】Lammps 多机并行的问题
已经有11人回复
好好学习,天天向上。
1楼
2010-12-26 17:41:04
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
hbcsucy
木虫
(小有名气)
AAA
应助: 0
(幼儿园)
金币: 5593.2
散金: 10
红花: 1
帖子: 293
在线: 192.4小时
虫号: 1067102
注册: 2010-07-31
性别: GG
专业: 凝聚态物性 II :电子结构
★
小木虫(金币
+0.5
):给个红包,谢谢回帖交流
maps软件那里有啊?要多少钱啊?。。。。
赞
一下
(1人)
回复此楼
高级回复
day day
4楼
2011-01-15 21:30:48
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
查看全部 4 个回答
amynihao
金虫
(正式写手)
寂寞大虫
应助: 1
(幼儿园)
金币: 361.1
散金: 385
红花: 2
帖子: 443
在线: 230.7小时
虫号: 941269
注册: 2010-01-12
性别:
MM
专业: 金属材料的凝固与结晶学
★
小木虫(金币
+0.5
):给个红包,谢谢回帖交流
引用回帖:
Originally posted by
zyj8119
at 2010-12-26 17:41:04:
[code]#!/usr/bin/python
###########################################################################
# amorphousLAMMPS.py - description
# --------- ...
专家您好,这个程序是用来产生无定形结构的吗?那硅酸盐的玻璃态的结构可以用这个程序吗?这个程序是lammps里的,可以拟合到MS里吗?
赞
一下
(1人)
回复此楼
不是要做一个单纯优秀的人,而是要做一个不可替代的人。
2楼
2010-12-28 09:11:21
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
zyj8119
木虫
(著名写手)
模拟EPI: 10
应助: 65
(初中生)
贵宾: 0.003
金币: 915.1
散金: 1440
红花: 35
帖子: 2936
在线: 1329.4小时
虫号: 664177
注册: 2008-11-29
性别: GG
专业: 理论和计算化学
★ ★
zh1987hs(金币+2):谢谢 2011-01-14 14:46:30
引用回帖:
Originally posted by
amynihao
at 2010-12-28 09:11:21:
专家您好,这个程序是用来产生无定形结构的吗?那硅酸盐的玻璃态的结构可以用这个程序吗?这个程序是lammps里的,可以拟合到MS里吗?
无定形的结构,只能自己编程,用随机数产生程序。
赞
一下
(1人)
回复此楼
好好学习,天天向上。
3楼
2011-01-13 15:49:40
已阅
回复此楼
关注TA
给TA发消息
送TA红花
TA的回帖
查看全部 4 个回答
如果回帖内容含有宣传信息,请如实选中。否则帐号将被全论坛禁言
普通表情
龙
兔
虎
猫
高级回复
(可上传附件)
百度网盘
|
360云盘
|
千易网盘
|
华为网盘
在新窗口页面中打开自己喜欢的网盘网站,将文件上传后,然后将下载链接复制到帖子内容中就可以了。
信息提示
关闭
请填处理意见
关闭
确定