当前位置: 首页>>代码示例>>Python>>正文


Python Molecule.edit_qcrems方法代码示例

本文整理汇总了Python中molecule.Molecule.edit_qcrems方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.edit_qcrems方法的具体用法?Python Molecule.edit_qcrems怎么用?Python Molecule.edit_qcrems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在molecule.Molecule的用法示例。


在下文中一共展示了Molecule.edit_qcrems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: QChem

# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import edit_qcrems [as 别名]

#.........这里部分代码省略.........
        # Molecule object from loading the input file.
        self.M = Molecule(fin, ftype)
        if 'elem' not in self.M.Data.keys():
            raise RuntimeError('Input file contains no atoms')
        # Q-Chem input file that will be written for each Q-Chem execution.
        # If the original input file happens to also be a Q-Chem input file,
        # then use the suffix 'qcin' add an underscore so we
        # don't accidentally overwrite our original file.
        if qcin == None:
            qcin = os.path.splitext(fin)[0]+'.in'
        if qcin == fin and fin.endswith('.in'):
            self.qcin = os.path.splitext(fin)[0]+'.qcin'
        elif qcin == fin:
            raise RuntimeError('Please do not provide a file with extension .qcin')
        else:
            self.qcin = qcin
        # Keep track of the number of calculations done.
        self.ncalc = 0
        # Whether a Hessian calculation has been done.
        self.haveH = 0
        # Set Q-Chem calculation options ($rem variables).
        if 'qcrems' not in self.M.Data.keys():
            if method == None or basis == None or charge == None or mult == None:
                raise RuntimeError('Must provide charge/mult/method/basis!')
            # Print a Q-Chem template file.
            prepare_template(qcrem_default, '.qtemp.in', charge, mult, method, basis, molecule=self.M)
            self.M.add_quantum('.qtemp.in')
        else:
            if charge != None:
                self.M.charge = charge
            if mult != None:
                self.M.mult = mult
            if method != None:
                self.M.edit_qcrems({'method' : method})
            # Treat custom basis and ECP.
            ecpname = None
            ecpsect = None
            if basis != None:
                basisname, basissect, ecpname, ecpsect = get_basis(basis, self.M)
                self.M.edit_qcrems({'basis' : basisname})
                if basisname == 'gen':
                    self.M.qctemplate['basis'] = basissect
            if ecpname != None:
                self.M.edit_qcrems({'ecp' : ecpname})
                if ecpname == 'gen':
                    self.M.qctemplate['ecp'] = ecpsect
        # The current job type, which we can set using
        # different methods for job types.
        self.jobtype = 'sp'
        # Rem dictionary for SCF convergence.
        self.remscf = OrderedDict()
        # Extra rem variables for a given job type.
        self.remextra = OrderedDict()
        # Default name of Q-Chem output file
        self.qcout = os.path.splitext(self.qcin)[0]+".out" if qcout == None else qcout
        self.qcerr = os.path.splitext(self.qcin)[0]+".err"
        # Saved Q-Chem calculations if there is more than one.
        self.qcins = []
        self.qcouts = []
        self.qcerrs = []
        # Specify whether to tack "-save" onto the end of each Q-Chem call.
        self.qcsave = qcsave
        # Q-Chem scratch directory
        self.qcdir = os.path.splitext(self.qcin)[0]+".d" if qcdir == None else qcdir
        # Flag to read SCF guess at the first calculation
        self.readguess = readguess
开发者ID:leeping,项目名称:qchem-utils,代码行数:70,代码来源:qchem.py


注:本文中的molecule.Molecule.edit_qcrems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。