210 Star 874 Fork 650

GVPMindSpore/mindscience

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
dynamics.py 3.52 KB
一键复制 编辑 原始数据 按行查看 历史
luojianing 提交于 2024-05-07 11:51 . fix docs issue
# Copyright 2021-2023 @ Shenzhen Bay Laboratory &
# Peking University &
# Huawei Technologies Co., Ltd
#
# This code is a part of MindSPONGE:
# MindSpore Simulation Package tOwards Next Generation molecular modelling.
#
# MindSPONGE is open-source software based on the AI-framework:
# MindSpore (https://www.mindspore.cn/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Space updater"""
from mindspore import Tensor
from .md import UpdaterMD
from ..system import Molecule
from ..control.controller import Controller
from ..control.integrator import Integrator
class DynamicUpdater(UpdaterMD):
r"""
Updater for molecular dynamics (MD) simulation.
This updater will be removed a future release. Please use :class:`sponge.optimizer.UpdaterMD` instead.
Args:
system (:class:`sponge.system.Molecule`): Simulation system.
integrator (`sponge.control.Integrator`): MD integrator.
thermostat (:class:`sponge.control.Controller`, optional): Thermostat
for temperature coupling.
Default: ``None``.
barostat (:class:`sponge.control.Controller`, optional): Barostat for pressure coupling.
Default: ``None``.
constraint (:class:`sponge.control.Controller`, optional): Constraint for bond.
controller (:class:`sponge.control.Controller`, optional): Other controllers.
time_step (float, optional): Time step. Default: ``1e-3``.
velocity (Tensor, optional): Atomic velocity. The shape of tensor is :math:`(B, A, D)`.
Here :math:`B` is the number of walkers in simulation,
:math:`A` is the number of atoms,
and :math:`D` is the spatial dimension of the simulation system, which is usually 3.
Data type is float. Default: ``None``.
weight_decay (float, optional): An value for the weight decay. Default: ``0.0``.
loss_scale (float, optional): A value for the loss scale. Default: ``1.0``.
Supported Platforms:
``Ascend`` ``GPU``
"""
def __init__(self,
system: Molecule,
integrator: Integrator,
thermostat: Controller = None,
barostat: Controller = None,
constraint: Controller = None,
controller: Controller = None,
time_step: float = 1e-3,
velocity: Tensor = None,
weight_decay: float = 0.0,
loss_scale: float = 1.0,
):
super().__init__(
system=system,
integrator=integrator,
thermostat=thermostat,
barostat=barostat,
constraint=constraint,
controller=controller,
time_step=time_step,
velocity=velocity,
weight_decay=weight_decay,
loss_scale=loss_scale,
)
print('[WARNING] `DynamicUpdater` will be removed a future release. '
'Please use `UpdaterMD` instead.')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mindspore/mindscience.git
git@gitee.com:mindspore/mindscience.git
mindspore
mindscience
mindscience
master

搜索帮助