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


Python Calculator.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
 def __init__(self, morses=None, bonds=None, angles=None, dihedrals=None,
              vdws=None, coulombs=None, **kwargs):
     Calculator.__init__(self, **kwargs)
     if (morses is None and
         bonds is None and
         angles is None and
         dihedrals is None and
         vdws is None and
             coulombs is None):
         raise ImportError("At least one of morses, bonds, angles, dihedrals,"
                           "vdws or coulombs lists must be defined!")
     if morses is None:
         self.morses = []
     else:
         self.morses = morses
     if bonds is None:
         self.bonds = []
     else:
         self.bonds = bonds
     if angles is None:
         self.angles = []
     else:
         self.angles = angles
     if dihedrals is None:
         self.dihedrals = []
     else:
         self.dihedrals = dihedrals
     if vdws is None:
         self.vdws = []
     else:
         self.vdws = vdws
     if coulombs is None:
         self.coulombs = []
     else:
         self.coulombs = coulombs
开发者ID:rchiechi,项目名称:QuantumParse,代码行数:37,代码来源:ff.py

示例2: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self, restart=None, ignore_bad_restart_file=False, label=None,
                 atoms=None, calc=None, block=False, **kwargs):
        '''Basic calculator implementation.
        restart: str
            Prefix for restart file.  May contain a directory.  Default
            is None: don't restart.
        ignore_bad_restart_file: bool
            Ignore broken or missing restart file.  By default, it is an
            error if the restart file is missing or broken.
        label: str
            Name used for all files.  May contain a directory.
        atoms: Atoms object
            Optional Atoms object to which the calculator will be
            attached.  When restarting, atoms will get its positions and
            unit-cell updated from file.

        Create a remote execution calculator based on actual ASE calculator 
        calc.
        '''
        logging.debug("Calc: %s Label: %s" % (calc, label))
        Calculator.__init__(self, restart, ignore_bad_restart_file, label, atoms, **kwargs)
        logging.debug("Dir: %s Ext: %s" % (self.directory, self.ext))
        self.calc=calc
        self.jobid=None
        self.block=block
开发者ID:jochym,项目名称:Elastic,代码行数:27,代码来源:parcalc.py

示例3: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self,                  
                 hirshfeld=None, vdwradii=None, calculator=None,
                 Rmax = 10, # maximal radius for periodic calculations
                 vdWDB_alphaC6 = vdWDB_alphaC6,
                 txt=None,
                 ):
        """Constructor

        Parameters
        ==========
        hirshfeld: the Hirshfeld partitioning object
        calculator: the calculator to get the PBE energy
        """
        self.hirshfeld = hirshfeld
        if calculator is None:
            self.calculator = self.hirshfeld.get_calculator()
        else:
            self.calculator = calculator
        if txt is None:
            self.txt = self.calculator.txt
        else:
            self.txt = get_txt(txt, rank)
        self.vdwradii = vdwradii
        self.vdWDB_alphaC6 = vdWDB_alphaC6
        self.Rmax = Rmax
        self.atoms = None

        self.sR = 0.94
        self.d = 20

        Calculator.__init__(self)
开发者ID:jboes,项目名称:ase,代码行数:33,代码来源:vdwcorrection.py

示例4: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self, restart=None, ignore_bad_restart_file=False, label=None,
                 atoms=None, k=10, rt=1.5, sp_type='rep', **kwargs):

        Calculator.__init__(self, restart, ignore_bad_restart_file,
                            label, atoms, **kwargs)
        # Common parameters to all springs
        self.sp_type = sp_type
        self.k = k
        self.rt = rt

        # Depending on the spring type use different kernels
        self.nrg_func = spring_nrg
        self.f_func = spring_force
        self.v_nrg = voxel_spring_nrg
        self.atomwise_nrg = atomwise_spring_nrg
        if sp_type == 'com':
            self.nrg_func = com_spring_nrg
            self.f_func = com_spring_force
            self.v_nrg = voxel_com_spring_nrg
            self.atomwise_nrg = atomwise_com_spring_nrg
        if sp_type == 'att':
            self.nrg_func = att_spring_nrg
            self.f_func = att_spring_force
            self.v_nrg = voxel_att_spring_nrg
            self.atomwise_nrg = atomwise_att_spring_nrg
开发者ID:ZhouHUB,项目名称:pyIID,代码行数:27,代码来源:spring_calc.py

示例5: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self, f, cutoff=None):
        Calculator.__init__(self)
        self.f = f

        self.dict = {x: obj.get_cutoff() for x, obj in f.items()}
        self.df = {x: obj.derivative(1) for x, obj in f.items()}
        self.df2 = {x: obj.derivative(2) for x, obj in f.items()}
开发者ID:libAtoms,项目名称:matscipy,代码行数:9,代码来源:calculator.py

示例6: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
 def __init__(self, *args, **results):
     """Save energy, forces, stress, ... for the current configuration."""
     if args and isinstance(args[0], float):
         # Old interface:
         assert not results
         for key, value in zip(['energy', 'forces', 'stress', 'magmoms'],
                               args):
             if value is not None:
                 results[key] = value
         atoms = args[-1]
     else:
         if args:
             atoms = args[0]
         else:
             atoms = results.pop('atoms')
         
     Calculator.__init__(self)
     self.results = {}
     for property, value in results.items():
         assert property in all_properties
         if value is None:
             continue
         if property in ['energy', 'magmom']:
             self.results[property] = value
         else:
             self.results[property] = np.array(value, float)
     self.atoms = atoms.copy()
开发者ID:PHOTOX,项目名称:fuase,代码行数:29,代码来源:singlepoint.py

示例7: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
 def __init__(self, calculator, db='checkpoints.db', logfile=None):
     Calculator.__init__(self)
     self.calculator = calculator
     if logfile is None:
         logfile = DevNull()
     self.checkpoint = Checkpoint(db, logfile)
     self.logfile = logfile
开发者ID:rchiechi,项目名称:QuantumParse,代码行数:9,代码来源:checkpoint.py

示例8: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self, restart=None, ignore_bad_restart_file=False,
                 label='cp2k', atoms=None, command=None,
                 debug=False, **kwargs):
        """Construct CP2K-calculator object."""

        self._debug = debug
        self._force_env_id = None
        self._child = None
        self._shell_version = None
        self.label = None
        self.parameters = None
        self.results = None
        self.atoms = None

        # Several places are check to determine self.command
        if command is not None:
            self.command = command
        elif CP2K.command is not None:
            self.command = CP2K.command
        elif 'ASE_CP2K_COMMAND' in os.environ:
            self.command = os.environ['ASE_CP2K_COMMAND']
        else:
            self.command = 'cp2k_shell'  # default

        assert 'cp2k_shell' in self.command

        Calculator.__init__(self, restart, ignore_bad_restart_file,
                            label, atoms, **kwargs)

        # launch cp2k_shell child process
        if self._debug:
            print(self.command)
        self._child = Popen(self.command, shell=True, universal_newlines=True,
                            stdin=PIPE, stdout=PIPE, bufsize=1)
        assert self._recv() == '* READY'

        # check version of shell
        self._send('VERSION')
        shell_version = self._recv().rsplit(":", 1)
        assert self._recv() == '* READY'
        assert shell_version[0] == "CP2K Shell Version"
        self._shell_version = float(shell_version[1])
        assert self._shell_version >= 1.0

        # enable harsh mode, stops on any error
        self._send('HARSH')
        assert self._recv() == '* READY'

        if restart is not None:
            try:
                self.read(restart)
            except:
                if ignore_bad_restart_file:
                    self.reset()
                else:
                    raise
开发者ID:jboes,项目名称:ase,代码行数:58,代码来源:cp2k.py

示例9: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self, restart=None, ignore_bad_restart_file=False, label=None,
                 atoms=None, **kwargs):
        """Accepted Keypairs
        calculation:
            str - only scf[default] supported at the moment
        ecutwfc: 
            plane wave cuttoff [eV] notice not in Ry!
        nbands:
            number of bands for calculation (see pw.x -> nbnd)
        usesymm:
            whether or not to use symmetry in calculation (True/False)
        maxiter:
            maximum number of iterations in an scf step
        convergence:
            {'energy', <value>} - only one implemented
        kpts:
            (1, 1, 1) - gamma point
            (n1, n2, n3) - Morstead Packing
            [[k1, k2, k3] ... ] - List of kpoints
        prefix: (self.label is meaningless at moment)
            str - string to append to output files
        pseudo:
            {'atom symbol': 'name of pseudo potential', ...} - dictionary of pseudo per atom
        outdir:
            str - relative or absolute path to output directory.
                  Will create it if it does not exist.
        pseudo_dir:
            str - relative or absolute path to pseudo directory.
        occupations:
            str - 'smearing', 'tetrahedra', 'fixed', 'from_input'
        input_dft:
            str - functional to use
        fft_mesh:
            [nr1, nr2, nr3] - fft mesh to use for calculation
        keypairs:
            way to initialize via the base class PWBase. 
            (DO NOT SET CELL OR ATOM POSITIONS via PWBase this is done 
            automagically via ASE Atoms)
        debug:
            if True will print input and output QE files

        AUTOMATICALLY SET KEYPAIRS:
        Set so we can always extract stress and forces:
            control.tstress=True
            control.tprnfor=True
        From atoms object:
            CARD 'CELL PARAMETERS (angstroms)' from atoms.cell
            CARD 'ATOMIC POSITIONS (angstroms)' from atoms[i]
            system.nat from number of unique atoms in atoms[i]
            system.ntyp from len(atoms)
        Thus DO NOT SET:
            A, B, C, cosAB, cosBC, cosAC, celldm(1-6)
            or any of these previously mentioned. Be smart
        """
        Calculator.__init__(self, restart, ignore_bad_restart_file, label, atoms, **kwargs)
        self._pw = None
开发者ID:costrouc,项目名称:pyqe,代码行数:58,代码来源:qe.py

示例10: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
 def __init__(self, atoms=None, label=None, top=None, crd=None,
              mm_options=None, qm_options=None, permutation=None, **kwargs):
     if not have_sander:
         raise RuntimeError("sander Python module could not be imported!")
     Calculator.__init__(self, label, atoms)
     self.permutation = permutation
     if qm_options is not None:
         sander.setup(top, crd.coordinates, crd.box, mm_options, qm_options)
     else:
         sander.setup(top, crd.coordinates, crd.box, mm_options)
开发者ID:rchiechi,项目名称:QuantumParse,代码行数:12,代码来源:amber.py

示例11: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self, rc=5.0, width=1.0):
        """TIP3P potential.

        rc: float
            Cutoff radius for Coulomb part.
        width: float
            Width for cutoff function for Coulomb part.
        """
        self.rc = rc
        self.width = width
        Calculator.__init__(self)
开发者ID:rosswhitfield,项目名称:ase,代码行数:13,代码来源:tip3p.py

示例12: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
 def __init__(self, calculator, jsonfile=None, dumpjson=False):
     Calculator.__init__(self)
     self.calculator = calculator
     self.fmax = {}
     self.walltime = {}
     self.energy_evals = {}
     self.energy_count = {}
     self.set_label('(none)')
     if jsonfile is not None:
         self.read_json(jsonfile)
     self.dumpjson = dumpjson
开发者ID:rchiechi,项目名称:QuantumParse,代码行数:13,代码来源:loggingcalc.py

示例13: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self, client, ip=None, atoms=None, port=0, logger=screen, bgq=False):
        Calculator.__init__(self)

        self.client = client
        if ip is None:
            ip = '127.0.0.1' # default to localhost
        self.logger = logger
        self.bgq=bgq
        self.server = AtomsServerSync((ip, port), AtomsRequestHandler,
                                      [self.client], logger=self.logger,
                                      bgq=self.bgq)
        self.label = 1
        self.atoms = atoms
开发者ID:libAtoms,项目名称:matscipy,代码行数:15,代码来源:socketcalc.py

示例14: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
 def __init__(self, atoms, **results):
     """Save energy, forces, stress, ... for the current configuration."""
     Calculator.__init__(self)
     self.results = {}
     for property, value in results.items():
         assert property in all_properties
         if value is None:
             continue
         if property in ['energy', 'magmom', 'free_energy']:
             self.results[property] = value
         else:
             self.results[property] = np.array(value, float)
     self.atoms = atoms.copy()
开发者ID:rosswhitfield,项目名称:ase,代码行数:15,代码来源:singlepoint.py

示例15: __init__

# 需要导入模块: from ase.calculators.calculator import Calculator [as 别名]
# 或者: from ase.calculators.calculator.Calculator import __init__ [as 别名]
    def __init__(self, selection, qmcalc, mmcalc, interaction,
                 vacuum=None, embedding=None, output=None):
        """EIQMMM object.

        The energy is calculated as::
            
                    _          _         _    _
            E = E  (R  ) + E  (R  ) + E (R  , R  )
                 QM  QM     MM  MM     I  QM   MM
                 
        parameters:
            
        selection: list of int, slice object or list of bool
            Selection out of all the atoms that belong to the QM part.
        qmcalc: Calculator object
            QM-calculator.
        mmcalc: Calculator object
            MM-calculator.
        interaction: Interaction object
            Interaction between QM and MM regions.
        vacuum: float or None
            Amount of vacuum to add around QM atoms.  Use None if QM
            calculator doesn't need a box.
        embedding: Embedding object or None
            Specialized embedding object.  Use None in order to use the
            default one.
        output: None, '-', str or file-descriptor.
            File for logging information - default is no logging (None).
            
        """
        
        self.selection = selection

        self.qmcalc = qmcalc
        self.mmcalc = mmcalc
        self.interaction = interaction
        self.vacuum = vacuum
        self.embedding = embedding
        
        self.qmatoms = None
        self.mmatoms = None
        self.mask = None
        self.center = None  # center of QM atoms in QM-box
        
        self.name = '{0}+{1}+{2}'.format(qmcalc.name,
                                         interaction.name,
                                         mmcalc.name)
        
        self.output = convert_string_to_fd(output)
        
        Calculator.__init__(self)
开发者ID:rosswhitfield,项目名称:ase,代码行数:53,代码来源:qmmm.py


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