1 | &GLOBAL |
WFN_RESTART_FILE_NAME #读取波函数文件,需要同时在DFT/&SCF中开启SCF_GUESS RESTART
CHARGE #体系整体电荷
MULTIPLICITY #体系的整体自旋多重度,2n+1
1 | &MGRID |
OT #OT算法
PRECONDITIONER #
MINIMIZER #
OUTER_SCF #
EPS_SCF #
MAX_SCF #
1 | &XC |
1 | &GLOBAL |
WFN_RESTART_FILE_NAME #读取波函数文件,需要同时在DFT/&SCF中开启SCF_GUESS RESTART
CHARGE #体系整体电荷
MULTIPLICITY #体系的整体自旋多重度,2n+1
1 | &MGRID |
OT #OT算法
PRECONDITIONER #
MINIMIZER #
OUTER_SCF #
EPS_SCF #
MAX_SCF #
1 | &XC |
Table
Gaussian
MD+AIMD
cp2k
Other
高被引
顶刊
Machine-Learning
以往读过的重要MD文献
以下主要为势参数
4.Behavior and State of Boron in CaO–SiO2 Slags during Refining of Solar Grade Silicon 论文 链接
5.Effects of B2O3 on the structure and properties of blast furnace slag by molecular dynamics simulation
6.First principle study of electronic structural and physical properties of CaO-SiO2-Al2O3 ternary slag system by using Ab Initio molecular and lattice dynamics
8.The effect ofCaO(MgO) on the structure and properties ofaluminosilicate system by molecular dynamics simulation
9.The Importance of Slag Structure to Boron Removal from Silicon during the Refining Process: Insights from Raman and Nuclear Magnetic Resonance Spectroscopy Study
10.Design of Refining Slag Based on Raman and NMR Spectroscopy Study for Removing Phosphorus for SoG-Si
11.Calculated role of aluminum in the incorporation of ferric iron into magnesium silicate perovskite
12.A Molecular Dynamics Study of the Atomic Structure of (CaO)x(SiO2)1-x Glasses
14.谷歌学术Molecular dynamics study of the structures and bulk moduli of crystals in the system CaO-MgO-Al2O3-SiO2
15.Development of empirical potentials for sodium borosilicate glass systems
16.Structural Role of Sodium in Borosilicate, Phosphosilicate, and Borophosphosilicate Glasses Unveiled by Solid-State NMR and MD Simulations
势函数, 2007, Bertrand Guillot, A computer simulation study of natural silicate melts. Part I: Low pressure properties K2O–Na2O–CaO–MgO–FeO–Fe2O3–Al2O3–TiO2–SiO2 (KNCMFATS)
势函数, 1998, Akira MIYAKE, Interatomic potential parameters for molecular dynamics simulation of crystals in the system K2O–Na2O–CaO–MgO–Al2O3–SiO2
Computer modeling of natural silicate melts: What can we learn from ab initio simulations
势函数, 1994, Matsui, A Transferable Interatomic Potential Model for Crystals and Melts in the System CaO-MgO-Al2O3-SiO2
势函数, 1996, Matsui, Molecular dynamics study of the structures and bulk moduli of crystals in the system CaO-MgO-Al2O3-SiO2
Transferability of interatomic potentials with insights into the structure–property relationship of SiO2–CaO–MgO–Al2O3 melts—-pdf论文
势函数, 2011, Le-HaiKieu, Development of empirical potentials for sodium borosilicate glass systems, SiO2–B2O3–Na2O
势函数, 2018, MengyiWang, A new transferable interatomic potential for molecular dynamics simulations of borosilicate glasses, B2O3-K2O–Na2O–CaO–MgO–FeO–Fe2O3–Al2O3–TiO2–SiO2
势函数, 2018, Jincheng Du, Development of boron oxide potentials for computer simulations of multicomponent oxide glasses, B-O, O‐O, Si‐O, Al‐O, Li‐O, Na‐O, K‐O, Ca‐O, P‐O, Sr‐O, and Zr‐O
First-principles study of a sodium borosilicate glass-former. I. The liquid state 论文
以下主要为分子模拟
Ab Initio Molecular Dynamics of CdSe Quantum-Dot-Doped Glasses Chimie ParisTech, PSL University, CNRS, Institut de Recherche de Chimie Paris, 75005 Paris, France
Graphical user interface for an easy and reliable construction of input files to CP2K
Trace element partitioning between silicate melts – A molecular dynamics approach
Coordination of Zr4+/Hf4+/Nb5+/Ta5+ in silicate melts: insight from first principles molecular dynamics simulations State Key Laboratory for Mineral Deposits Research, School of Earth Sciences and Engineering, Nanjing University, Nanjing, Jiangsu 210023, China
Effect of strontium inclusion on the bioactivity of phosphate-based glasses
Carbon dioxide in silicate melts at upper mantle conditions: Insights from atomistic simulations
Structure and luminescence of intrinsic localized states in sodium silicate glasses
Modelling the interactions and diffusion of NO in amorphous SiO2
2020-2021
Ab initio molecular dynamics simulations and Raman spectra of the YbCl3-KCl and Yb2O3-YbCl3-KCl ionic melts Institute of High-Temperature Electrochemistry, Yekaterinburg, Russia
Ab initio molecular dynamics simulations of molten lead oxyhalides Pb3O2X2 (X = Cl, Br, I)
The structure of molten FLiNaK Department of Physics and Astronomy, Brigham Young University, Provo, UT, 84602, USA
Carbon species solvated in molten carbonate electrolyser cell from first-principles simulations
Structure and dynamics of the molten alkali-chloride salts from an X-ray, simulation, and rate theory perspective Chemical Sciences Division, Oak Ridge National Laboratory, 1 Bethel Valley Rd., Oak Ridge, TN 37830, USA
Complexation of Mo in FLiNaK Molten Salt: Insight from Ab Initio Molecular Dynamics
Ab initio molecular dynamics assessment of thermodynamic and transport properties in (K,Li)Cl and (K, Na)Cl molten salt mixtures Pacific Northwest National Laboratory, Richland, WA 99352, United States
First-Principles Modeling of Transport Mechanisms in Carbonate–Hydroxide Electrolytes Department of Chemical and Biological Engineering, Princeton University, Princeton, New Jersey 08544, United States
The role of sulfur in molybdenum transport in hydrothermal fluids: Insight from in situ synchrotron XAS experiments and molecular dynamics simulations CSIRO Mineral Resources, Clayton, Vic 3168, Australia
cp2k经典文献
Ab initio calculation of vibrational absorption and circular dichroism spectra using density functional force fields—-谷歌学术
2007_DZVP Gaussian basis sets for accurate calculations on molecular systems in gas and condensed phases
1997_GPW A hybrid Gaussian and plane wave density functional scheme
1984a_Nose A molecular dynamics method for simulations in the canonical ensemble
1984b_Nose A unified formulation of the constant temperature molecular dynamics methods
1985_Hoover Canonical dynamics: Equilibrium phase-space distributions
2010_DL_POLY DL_POLY: Application to molecular simulation
Introduction
Input Files
Running the Calculation
Obtaining the Results
Adding Smearing
We first look at the input files required for this calculation. The necessary input files are:
A list of basis set and pseudopotential files may be found in cp2k/data/ that comes with a cp2k source release.
These should cover most of the commonly used elements.
The user will, however, need to produce their own main input file for a given calculation.
Let us look at the main input: Si_bulk8.inp in detail.
The name of this file can be arbitrary, so is the file extension.
The input file is structured into ordered blocks and keywords, the order of which are unimportant.
Each input block is referred to as a “section” in this tutorial, and some sections are “subsections” of other sections.
Full definitions of the input file format and keywords is available via the ‘’CP2K’’ input reference manual.
The input file is shown below:
1 | &GLOBAL |
The main sections in the input file are:
‘’GLOBAL’’: contains general options for the CP2K run, such as the name of the job, the type of run etc.
‘’FORCE_EVAL’’: contains all parameters associated with the evaluation of forces on atoms, this includes the initial atomic coordinates.
We look at each section in detail. The GLOBAL section in Si_bulk8.inp is presented below
We will be doing a static energy and force calculation, in this case, we must set ‘’RUN_TYPE’’ to ENERGY_FORCE.
Keyword ‘’PROJECT’’ is an alias for PROJECT_NAME, which sets the root-name of the calculation, in this case Si_bulk8.
Any output files automatically generated by CP2K will have the name prefixed by Si_bulk8.
‘’PRINT_LEVEL’’ controls the default verbosity of the main output of CP2K, in this example, it is set to “low”.
The verbosity of the output can be fine-tuned by overriding this setting in each individual subsection of the input.
We now explain the section FORCE_EVAL line-by-line.
The keyword ‘’METHOD’’ chooses the method for evaluating the forces on atoms to QUICKSTEP, i.e.
Density Functional Theory using the Gaussian and Planewaves (GPW) method.
The subsection ‘’SUBSYS’’ defines the simulation unit cell and the initial coordinates of atoms in the calculation.
The subsection ‘’KIND’’ gives definitions of elements in the calculation.
There must be one KIND subsection per element.
In this example, for Si, we have defined the basis set to be used: DZVP-GTH-PADE (double-ζ with polarisation basis optimised for Geodecker-Teter-Hutter PADE LDA pseudopotential); and the pseudopotential: GTH-PADE-q4 (Geodecker-Teter-Hutter PADE LDA pseudopotential with 4 valence electrons).
The basis set and pseudopotential names must correspond to an existing entry in the corresponding basis set and pseudopotential files defined by ‘’BASIS_SET_FILE_NAME’’ and ‘’POTENTIAL_FILE_NAME’’ keywords in ‘’DFT’’ subsection, in FORCE_EVAL section.
The chosen basis for Si corresponds to parameters:
1 | Si DZVP-GTH-PADE |
in file BASIS_SET; and the chosen pseudopotential corresponds to parameters:
1 | Si GTH-PADE-q4 GTH-LDA-q4 |
in file GTH_POTENTIALS.
The subsection ‘’CELL’’ defines the simulation unit cell used in a calculation.
In this example, we define the unit cell as cubic, with lattice constant equal to 5.4306975 Angstroms.
“Angstrom” is the default unit for cell vectors.
‘’A’’, ‘’B’’ and ‘’C’’ are the first, second and third lattice (cell) vectors.
There are many ways to define the cell, see ‘’CP2K’’ input reference manual for more details.
The initial atomic coordinates are specified in the ‘’COORD’’ subsection.
The default input format for atomic coordinates in CP2K is:
1 | <ATOM_KIND> X Y Z |
where X, Y and Z are Cartesian coordinates in Angstroms.
This can be changed by configuring keyword ‘’SCALED’’ to .TRUE., in the COORD subsection, which makes the coordinate input X Y Z to be fractional with respect to the lattice vectors.
One can also change the unit for the Cartesian coordinates by setting the keyword ‘’UNIT’’ with in the subsection.
After the SUBSYS section in the input file Si_bulk8.inp follows the ‘’DFT’’ subsection, which controls all aspects of the self-consistent Kohn-Sham Density Functional Theory calculation.
This subsection is only relevant if and only if the METHOD keyword in FORCE_EVAL is set to QUICKSTEP.
1 | BASIS_SET_FILE_NAME BASIS_SET |
As already mentioned above, the keywords ‘’BASIS_SET_FILE_NAME’’ and ‘’POTENTIAL_FILE_NAME’’ set the files that contains basis set and pseudopotential parameters.
1 | &QS |
The ‘’QS’’ subsection contains general control parameters used by QUICKSTEP.
‘’EPS_DEFAULT’’ sets the default value for all tolerances used within QUICKSTEP.
The individual tolerances (EPS_*) can be set, and they will override the EPS_DEFAULT value.
1 | &MGRID |
The ‘’MGRID’’ subsection defines how the integration grid used in QUICKSTEP calculations should be setup.
QUICKSTEP uses a multi-grid method for representing Gaussian functions numerically on the grid.
Narrow and sharp Gaussians are mapped onto a finer grid than wider and smoother Gaussians.
In this case, we are telling the code to set up 4 levels of multi-grids,
with the planewave cutoff of the finest grid set to be 300 Ry,
and with the grid spacing underneath any Gaussian functions to be finer than the equivalent planewave cutoff of 60 Ry.
The users should read the tutorial “Converging the CUTOFF and REL_CUTOFF” for details on how these parameters affect the grid constructed, and how to define a sufficient grid for their calculation.
In this example, the grid defined has already been found to be sufficient for the energy and force calculation.
The ‘’XC’’ subsection follows:
1 | &XC |
This defines which exchange-correlation density functional we want to use.
In this we choose PADE LDA functional, which is consistent with the basis set and pseudopotential we have chosen.
1 | &SCF |
The ‘’SCF’’ subsection defines all the settings related to methods used to find a self-consistent solution of the Kohn-Sham DFT formalism.
‘’SCF_GUESS’’ sets how the initial trial electron density function ρ(→r) is to be generated.
In this example (ATOMIC), the initial density is to be generated using overlapping of atomic charge densities.
A good starting point for the electron density in the self-consistency loop is important in obtaining a convergent result quickly.
‘’EPS_SCF’’ sets the tolerance of the charge density residual.
This overrides the EPS_DEFAULT value set in QS subsection.
‘’MAX_SCF’’ sets the maximum number of self-consistency loops QUICKSTEP is allowed to perform for each ground-state energy calculation.
1 | &DIAGONALIZATION ON |
The ‘’DIAGONALIZATION ‘’ subsection tells the code to use the traditional diagonalisation method for finding the ground state Kohn-Sham energy and electron density.
The subsection heading also takes an argument, and in this case is set to “ON”, which equivalent to “.TRUE.” or “T”, and indicates that the diagonalisation method is turned on.
One can also omit the value of the subsection heading, which defaults to “.TRUE.”.
The alternative to diagonalisation is to use the Orbital Transform (OT) method, in which case, the user should either delete the DIAGONALIZATION block or change “ON” to “OFF” (or “.FALSE.”), and add the ‘’OT’’ subsection instead.
The ‘’ALGORITHM’’ keyword sets the algorithm to use for diagonalisation of the Kohn-Sham Hamiltonian.
“STANDARD” means the standard LAPACK/SCALAPACK subroutines are to be used for diagonalisation.
1 | &MIXING T |
The ‘’MIXING’’ subsection contains all the parameters associated with charge mixing in a self-consistency calculation.
The subsection also admits a value, which can be either .TRUE. (T) or .FALSE. (F), which switches charge mixing on or off.
The default is .TRUE.. Note that this subsection only applies to the traditional diagonalisation method.
The OT method uses a different approach for charge mixing, and is explained in other tutorials.
The keyword ‘’ALPHA’’ sets the mixing parameter; in this example 0.4 of the output density will be mixed with 0.6 of the input density to form the new input density in the next SCF iteration.
The keyword ‘’METHOD’’ sets the mixing method; in this case, we will use Broyden mixing.
The keyword ‘’NBROYDEN’’ is an alias to the parameter NBUFFER, and it sets the number of histories to be used in the Broyden mixing algorithm.
The final ‘’PRINT’’ subsection in FORCE_EVAL section:
1 |
|
tells CP2K, in this case, to print out atomic forces in the main output of the calculation.
1 | mpirun -n 2 cp2k.popt -o Si_bulk8.out Si_bulk8.inp & |
1 | SCF_GUESS RESTART |
1 | Number of electrons: 32 |
1 | Electronic density on regular grids: -31.9999999889 0.0000000111 |
1 | &SMEAR ON |
1 | ADDED_MOS 10 |
1 | Number of electrons: 32 |
1 | Electronic density on regular grids: -31.9999999889 0.0000000111 |
1 | Electronic entropic energy: -0.00001687947145 |
1 | Total energy: -31.29788686349247 |
1 | ENERGY| Total FORCE_EVAL ( QS ) energy (a.u.): -31.297887031736590 |
1 | &GLOBAL |
GLOBAL
PROJECT Si_bulk8
RUN_TYPE ENERGY_FORCE
PRINT_LEVEL LOW
1 | &FORCE_EVAL |
FORCE_EVAL #计算能量和受力的部分
METHOD #计算受力的方法,包括FIST,QMMM,QS,NNP,EIP等
STRESS_TENSOR #是否计算晶胞的应力
SUBSYS #控制原子坐标、晶胞参数、元素/原子的基组赝势等信息
CELL #定义晶胞边长,也可以从其他文件里读取晶胞的信息,比如CIF、XSC文件,通过CELL_FILE_FORMAT和CELL_FILE_NAME
COORD
KIND
ELEMENT
BASIS_SET
POTENTIAL
1 | &DFT |
DFT
BASIS_SET_FILE_NAME
POTENTIAL_FILE_NAME
QS #控制DFT等计算的一些参数精度
EPS_DEFAULT
EXTRAPOLATION #控制波函数外推的一些方法,建议用ASPC
EXTRAPOLATION_ORDER #一般用默认值3
MGRID
NGRIDS #NGRIDS控制的就是几套网格,每套网格的截断能不一样,一般用默认值NGRIDS 4
CUTOFF #CUTOFF是整体网格精度的最高值,单位是Ry(Rydberg),设置取决于体系中元素的种类,默认280 Ry
REL_CUTOFF #REL_CUTOFF 参数控制有多少网格点落到最精细的级别,默认为40 Ry,一般设置到50 或60 Ry
XC
XC_FUNCTIONAL
PADE
PBE
VDW_POTENTIAL
1 | &SCF |
SCF
SCF_GUESS
EPS_SCF
MAX_SCF
DIAGONALIZATION
ALGORITHM
MIXING
METHOD
ALPHA
PRINT
FORCES
DOS
PDOS
MULLIKEN
ELF_CUBE
MO_CUBES
经典分子动力学模拟NaCl在水中的溶解
Si单胞的单点能计算
单个水分子的几何优化
NaC团簇的几何优化
乙酸与锐钛矿 TiO2 的两种可能结合模式
大量液态水的AIMD
Calculating Energy and Forces using QuickStep
Accuracy parameters: Converging CUTOFF and REL_CUTOFF
Converging CUTOFF for a more realistic problem
Sensible SCF setups
Geometry optimisation in CP2K
Geometry and cell optimization of NaCl clusters
‘Surface Science’ using local GGA functionals
Ab initio MD of bulk liquid water
Hybrid functionals and ADMM
Wavefunction correlation: MP2 & RPA
Linear scaling DFT
QMMM using GEEP
Excited States
Metadynamics
QM/MM
Nudged Elastic Band
Classical forcefields (CHARMM)
Introduction and Overview of CP2K
Running CP2K Calculations
Introduction to Exercises
Moving atoms - AIMD, geometry optimisation
Short ‘HowTo’ exercises on various basic functions of CP2K:
Single-point energy & force calculation using DFT
How to converge the total energy w.r.t. the CUTOFF and REL_CUTOFF
Experiment with SCF settings:
How to run geometry optimisation
Geometry and cell optimisation of NaCl clusters
‘Surface Science’ using local DFT
Running ab initio MD of liquid water
Hybrid functional calculations and dispersion corrections
Linear Scaling DFT
Electron correlation: MP2 and RPA
QM/MM using GEEP
Excited state calculations
Metadynamics calculations
QM/MM of Urea in water
Adsorption on metallic surfaces (Nudged Elastic Band)
Force-field calculations on a protein
• Also VIBRATIONAL_ANALYSIS, NMR, X-Ray, DFT+U
• In /home/y14/shared/cp2k
Determination of melting temperature of copper from molecular dynamics
参考资料 量子化学教程 黄明宝 p65
假设1 体系的状态用坐标和时间的函数$\Psi$来描述。这个函数称为状态函数或波函数,它包含关于体系的可确定的全部知识。
波函数应是单值的、连续的和平方可积的品优函数。这些数学要求是关于坐标变量的。关于波函数随时间的变化见“假设6”及有关论述。假设中的最后一句话的含义是:可以由波函数来计算体系的各种性质(见假设5)。由于波函数描述的是体系的状态(如基态和激发态),严格来说应是:可以计算波函数所描述的体系的那个状态的各种性质。如果涉及微观粒子的自旋,波函数还要包含自旋坐标。
假设2 每个物理量对应一个线性厄米算子。这个算子是这样构造的:用笛卡尔坐标和对应的(线)动量的分量写出物理量的经典力学表达式,然后把每个坐标$x$代以算子$x$,而每个动量分量$p_{x}$代以算子“$-i\hbar \dfrac{\partial }{\partial x}$”。
对算子厄米的要求来源于“物理量的测量平均值应是实数”的要求;对算子的线性要求与“态的叠加”相关联。量子力学的算子之间存在着“可对易”或“不可对易的关系”。
假设3 从物理量$A$的测量可得到的仅有可能值是下列本征方程中的本征值$a_{i}$:
$ A \varphi {i}=a{i}\varphi _{i}$
式中算子$A$对应于物理量$A$。如果体系的状态函数$ \Psi= varphi_{i}$,则测量有确定值——本征值$a_{i}$;如果$\Psi$不是算子$A$的本征函数,则测量没有确定值(不能确定得到哪个本征值)。
$$
01 算子
1.1 括号标记法
一个波函数取复共轭再与另一个波函数相乘后的积分,可使用一种括号标记
$ \left \langle \psi _{1} | \psi _{2} \right \rangle = \int \psi _{1} ^{\ast } \psi _{2} \mathrm{d} \tau $
括号运算规则
$\left \langle \psi | \psi \right \rangle \ge 0$
$ \left \langle \psi {\tiny 2} | \psi {\tiny 1} \right \rangle = \left \langle \psi {\tiny 1} | \psi {\tiny 2} \right \rangle ^{*} $
$ \left \langle a | b+c \right \rangle = \left \langle a | b \right \rangle+\left \langle a | c \right \rangle $
$ \left \langle a +b | c \right \rangle = \left \langle a | c \right \rangle+\left \langle b | c \right \rangle $
$ \left \langle a | \lambda b \right \rangle = \lambda \left \langle a | b \right \rangle $
$ \left \langle \lambda a | b \right \rangle = \lambda ^{*} \left \langle a | b \right \rangle $
算子是一种规则,它把给出的某个函数变成另外的对应函数
$ Au(x)=v(x) $
平方根算子SQRT, $ SQRTu(x)=[u(x)]^{1/2} $
微分算子, $ D=\mathrm{\frac{d}{dx} }u(x) $
Laplace算子$ \bigtriangledown ^{2} $, $ \bigtriangledown ^{2} u(x,y,z) = \partial ^{2} u/\partial x ^{2} + \partial ^{2} u/\partial y ^{2} + \partial ^{2} u/\partial z ^{2} $
$ $
$\mathit{\hat{H}\Psi } \left ( r,R \right ) =\mathit{E\Psi } \left ( r,R \right ) $
波函数归一化
$\int_{-\infty }^{\infty } \left | \Psi (x,t) \right |^{2} \mathrm{ dx} =1$
一维空间单粒子的含时薛定谔方程
$ -\dfrac{\hbar }{i}\dfrac{\Psi \left( x,t\right) }{\partial t}=\dfrac{\hbar ^{2}}{2m}\dfrac{\partial ^{2}\Psi \left( x,t\right) }{\partial x^{2}}+V\left( x,t\right) \cdot \psi \left( x,t\right)$
方程归一化条件
$ \int ^{\infty }_{-\infty }\left| \Psi \left( x,t\right) \right| ^{2}dx=1 $
引进哈密顿算子
$ H=-\dfrac{\hbar ^{2}}{2m}\dfrac{\partial ^{2}}{\partial x^{2}}+V\left( x,t\right) $
含时薛定谔方程可以写成
$ -\dfrac{\hbar }{i}\dfrac{\partial \Psi \left( x,t\right) }{\partial t}=H\Psi \left( x,t\right) $
假设势能函数不含时间,上述方程进行以下分离变量处理
设 $ \Psi {}\left( x,t\right) =f\left( t\right) \psi \left( x\right) $
$ -\dfrac{\hbar }{i}\dfrac{df\left( t\right) }{dt}\cdot \psi \left( x\right) =-\dfrac{\hbar ^{2}}{2m}\dfrac{d^{2}\psi \left( x\right) }{dx^{2}}\cdot f\left( t\right) +V\left( x\right) f\left( t\right) \psi \left( x\right) $
$ $
$ $
$ $
$ $
$ $
$ $
谷歌—-必应—-BingChat—-知乎—-小红书—-搜狗—-搜狗微信—-百度—-Wikipedia—-DuckDuckGo—-今日头条—-Yandex—-Yahoo—-Duckduckgo—-DeepL翻译—-谷歌翻译—-百度翻译—-有道翻译—-阿里翻译—-必应翻译—-彩云小译—-一帆文档翻译—-福昕翻译—-全国图书馆参考咨询联盟—-长春数字图书馆—-谷歌图书—-拍照翻译精灵—-cnki学术翻译助手—-letpub期刊查询—-ACS Publishing Center—-Materials Project—-journal of molecular liquids—-aweill_homepage—-Docs.google—-telegra.ph博客—-Gmail—-protonMail—-WordPress登录—-pubpeer—-github中文社区—-TOEFL托福报名
chatGPT—-poe—-Notion AI—-you.com—-forefront—-Phind—-Bard—-claude—-bingImage—-Perplexity.AI—-Andi—-steamship—-cursor—-文心一言—-通义千问—-星火—-chatpdf—-discord_openai—-opeai-API—-cloudflare—-vercel—-namesilo—-namecheap—-domains.google—-squarespace—-DNS查询—-腾讯域名注册控制台—-腾讯DNSPod 管理控制台—-telegram—-labs.openai.—-ip138—-网站标识符iconfinder—-ipapi.co—-ipdata.co—-whoer.net—-哪煮米—-ipaddress—-ip-skk—-hyperbeam.com—-在线云浏览器—-similarsites.com—-tcp.ping.pe—-VirusTotal
vercel-index—-github-index—-chrome-extension—-firefox-extension—-edge-extension
Khan Academy—-TED-Ed—-duolingo—-Vox
ISBN生成—-paypal—-Google Pay—-京东—-amazon—-Google play
quillbot—-句子改写wordtune—-freethesaurus—-turnitin—-期刊缩写—-迅捷—-CAS期刊缩写
Latex公式编辑器—-GoJS图表组件—-MyscriptLatex—-HTML在线工具—-知犀思维导图—-coggle—-xmind—-常用LaTex字符与公式速查—-MathpixSnip—-白描网页版—-sms-activate—-拾色器—-RGB-HEX—-SVG在线查看器
多功能元素周期表—-单质密度—-双原子键长—-原子范德华半径—-相对原子质量—-离子半径查询—-空间群查询—-CRC_Handbook_Chem.&Phys.103rd—-量化常用单位换算—-ValenceElectrons
谷歌学术—-crossref—-doi.org—-PubMed—-科研通—-科研通Ablesci—-药研导航—-iData谷歌学术—-必应学术—-Semantic学术—-X-mol—-百度学术—-ResearchGate—-proquest—-ORCiD—-AA—-学术搜索—-谷禾信息—-MaiPDF—-微信公众平台—-寇享直播—-微信网页版—-pdf合并_smallpdf—-图片转Excel—-localhost:2000
TheHiddenWiki—-OnionLinks—-DuckDuckGo—-Z-Library—-Facebook—-NewYorkTimes—-SecureDrop—-onion666—-
腾讯ECS导航—-digitalocean—-aws.amazon—-微软Azure—-cloudcone—-racknerd—-racknerd控制面板—-my.vultr—-阿里云开发者社区—-阿里云控制台—-nextCloud—-腾讯云控制台—-腾讯云服务器—-华为云服务器—-Ucloud优刻得—-甲骨文云服务器—-外网面板地址—-百度云服务器—-腾讯云根目录—-云音乐—-doVPS
科学网博客—-education.github—-Github网站—-Gitee—-GiteeCodes—-MathFormula—-DownGit—-aweill_github—-Fx Coudert
gitbook网站—-gitbook_home—-gitbook_github—-github—-腾讯微云—-腾讯文档—-北京超算—-中科曙光
TIOBE—-鱼C论坛—-吾爱破解论坛—-CSDN社区—-github—-GitLab—-hostloc—-mjj-bbs—-博客园—-Leetcode—-力扣—-kaggle—-Coggle数据科学—-Stackoverflow—-OSCHINA社区—-Segmentfault社区—-Docker端口IP—-Dockerhub—-Python包索引—-python3文档—-php手册—-正则表达式在线测试—-yescaptcha—-ipip查询—-bejson—-豌豆代理—-蜜蜂代理—-崔庆才博客—-Pexels—-开放代理—-崔庆才代理池
Runoob_Java—-Java博客学习_Github—-Java后端知识图谱_Github—-CyC2018_Github_Java—-JavaGuide_Github—-AdvancedJava_Github—-JavaFamily_Github—-LeetCode_Github—-AwesomeJava_Github—-ToBeJaver_Github—-IntelliJ教程—-Java_Github—-FullstackTutorial_Github—-CS-Book—-Java程序员眼中的Linux—-Java-Tutorial_Github—-FreeBooks_Github—-科技周刊_github
Sentences—-Papers—-MD-Note—-AIMD-Note—-Machine Learning-Note—-Gaussian-Note—-思想家—-学者方向—-Archives
SCIHUB_1 2 3 4—-iData—-读秀—-知网—-知网海外版—专利下载—-大木虫—-sci-hub—-Library Genesis—-libgen.fun——–z-library—-ITeBooks—-Z-Lib+30—-读秀—-pdfDrive—-科学文库—-浙江图书馆—-广西图书馆—-首都图书馆—-广图电子资源—-E-book—-资源帝—-罗马盘—-图书创世纪—-Annas-Archive—-cse.google—-myanonamouse—-zlib_freedit—-pirateBay
如风搜—-鸠摩搜书
ScienceDirect—-ACS—-Springer—-RSC—-Wliey—-Web of Science
Nature—-Science—-JACS—-Angewandte—-PRL—-Separation and Purification Technology—-
Dr. Michele Parrinello—-Jürg Hutter Group—-法国-Fx Coudert—-德国-Prof. Dr. Stefan Grimme—-瑞典-Mattias Edén—-美国-Mathieu Bauchy—-美国-Jincheng Du—-澳大利亚-Yuan-Mei—-波兰-Paweł Stoch—-美国伍斯特理工Deskins—-MindSpore昇思
中科大杨金龙组—-北师方维海组—-北大吴云冬组—-北大数院鄂维南主页—-港中文帅志刚组—-吉大马琰铭组—-中科大李震宇组—-化物所韩克利组—-过程所李静海组—-厦大程俊组—-杜克杨伟涛
Resources Policy—-The Extractive Industries and Society—-Asian Studies Review—-MMTB检索—-Read
材料基因组计划—-清华大学—-北京大学—-北京市通州区委—-诺贝尔奖官网—-中国科学院—-国家自然科学基金委—-中国载人航天工程—-中国化学会—-IUPAC国际纯粹与应用化学联合会—-中国材料研究学会—-中国金属学会—-环球科学—-领研网—-国科大信息网—-中科大教务处培养方案—-过程所—-国科大教育云系统—-中科院教育云—-中科院地质与地球物理研究所—-中科院邮件系统—-网易邮箱—-139邮箱—-Microsoft账户—-icloud—-outlook邮件—-gmail—-yahoo邮箱—-世界时间—-谷歌地图—-onedrive—-中国商标网
—-tesla官网
计算化学公社—-思想家公社的门口—-Multiwfn—-量子化学软件中文网—-Gaussian—-expchem3—-墨灵格
VASP官网—-VASP国内代理源资科技—-VASP manual—-vaspkit中文手册—-Vaspkit论坛—-vaspkit官网—-vaspkit手册ECS
庚子计算—-cp2k官网—-Matsci论坛—-cp2k谷歌论坛—-cp2k Exercises—-cp2k关键词—-单点能计算—-cp2k/Fist—-cp2k/QS—-cp2k/QMMM—-cp2k官网论文—-知乎cp2k入门
lammps—-模拟小窝—-Interatomic Potentials Repository—-ReaxFF_Dr.Adri—-哲●科●文Jerkwin_李继存
Quantum-Espresso官网—-2019-Summer-School—-TUTORIALS—-ICTP官网—-ORCA官网
Factsage官网—-科学计算软件网—-HSC-Chemistry—-Thermo-Calc—-科研工具—-科研工具ECS
世事如棋—-归档—-Learn Vasp the Hard Way—-开发者文档
全球高清摄像头—-抖音—-Tiktok—-抖音视频在线解析—-B站—-Spotify—-Google-Podcast—-BBC sounds—-music.youtube—-Youtube—-Youtube字幕下载—-Netflix奈飞—-IMDb—-RottenTomatoes—-油管视频下载—-TED—-TED下载—-qq音乐—-网易云音乐—-喜马拉雅—-蜻蜓FM—-MP3音乐下载—-可可英语—-ANG动漫—-微博—-腾讯视频—-88影视—-豆瓣—-高德地图—-腾讯地图—-在线调色—-Hexo主题
维基百科—-twitter—-V2EX—-facebook—-Instagram—-Quora—-Pinterest—-telegram—-tumblr—-Reddit—-OpenAI—-互联网档案馆—-emergentmind—-1link.fun—-Hacker News—-ScientificAmerican
鸟哥的Linux私房菜—-git教程—-Shell教程—-MarkDown语法—-W3school-Python语法—-RUNOOB-Python3教程—-matlab语法—-Mathworks中国官网—-《Python Cookbook》3rd Edition—-简单教程—-scikit-learn—-计算机书单:小资源栈—-Linux命令大全—-图灵社区—-人民邮电出版社—-异步社区—-NoStarch—-O’Reilly—-oreilly—-manning
—-Packt—-Apress-springer—-千锋教育—-科学出版社—-华章教育
ASE—-moltemplate—-Gnuplot—-ISAACS—-R.I.N.G.S.—-Jmol—-VESTA—-OVITO—-VMD—-Chrimerax—-ChemDraw官网—-Packmol—-ABCluster—-Mercury—-知云翻译—-WebPlotDigitizer—-Anaconda官网—-USPEX结构预测—-MDtraj—-Atomsk官网—-MD Analysis—-Pymol—-Jmol-manual—-
esaygui模块—-Processing—-Fiddler4—-PyCharm—-Eclipse-Java—-Oracle-JDK—-MinGW-W64 GCC—-strawberryperl—-WinSCP官网—-Open_MPI—-Intel—MKL官网—-Dev-C++—-Rstudio—-R语言—-MySQL—-jetbrains—-MSYS2—-Java-JDK
Sublime Text—-Notepad++—-TRAVIS—-ISAACS—-git—-Node.js—-Typora—-VS Code—-KMCounter键盘统计—-WinDjView—-SumatraPDF—-FastStone Capture
Yandex—-Opera浏览器—-火狐浏览器—-chrome—-Edge—-沙盘软件sandboxie—-TorBrowser—-TorBridges—-adspower
Bing Chat for All Browsers—-Proxy SwitchyOmega
MaterialsSpringer材料数据库—-AMSD-美国矿物学家晶体结构数据库—-晶体学开放数据库COD—-费米维基—-ICSD无机晶体结构数据库—-Materials Project
NIST美国国家标准与技术研究院
NIST 标准参考数据库物理和化学参考数据期刊重印本—-JARVIS—-Atomly—-OQMD—-AFLOW
W—-lantern—-kingfast—-panda—-leiting—-蚂蚁—-一支红杏—-dukou—-clash for windows—-夏时国际加速器—-quickq—-v2fly用户手册—-v2ray高级篇
中科院科创计划—-实验室安全问答库—-南开大学结构化学课—-基金查询
BSE基组数据库—-Turbomole程序的基组库—-Gaussian基组
—-天然产物研究与开发课题组,中国药科大学天然药物化学系,王小兵
—-计算分子与材料科学课题组,合肥微尺度物质科学国家研究中心,李震宇,化学反应和物理过程(特别是成核和生长)的机理,功能材料的理论设计和计算表征,以及电子结构计算和分子模拟的方法
—-地质与地球物理研究所行星内部物质成分与性质组,张毅刚,地球早期核幔分异过程元素配分的第一原理分子动力学研究
—-
—-
—-
—-
—-
—-
—-
—-
沧海桑田
路虽远行则将至,事虽难做则必成
真正的英雄主义只有一种,那就是在认清生活真相之后依然热爱生活。–罗曼 罗兰
不思,故有惑;不求,故无得;不问,故不知。 ——曾国藩
盛年不重来,一日难再晨,及时当勉励,岁月不待人。 ——陶渊明
古人不见今时月 今月曾经照古人。
惊喜,热爱,努力,快乐
人有逆天之时,天无绝人之路。 ——冯梦龙《醒世恒言》
不是一番寒彻骨,怎得梅花扑鼻香。——冯梦龙《醒世恒言》
无论什么事,如果不断收集材料,积之十年,总可成一学者。——鲁迅
生活会有望穿秋水的等待,也会有意想不到的惊喜。
学以致用才是学知识的真正目的
无论何人无论何时,人们总要在乌云周围寻索着浪漫的微光活下去。–村上春树
如果要用的知识量是一定的话,会的越多,不会的就越少,人生应该是越来越容易的。
失败越多,离成功就越近,你所要做的就是从失败中学习,然后加快脚步。
创建一个元组很简单,只要在( )中添加元素,并使用( )隔开即可。(括号,逗号)
可以直接使用一对( )创建一个空元祖。(小括号)
元组与字符串类似,下标索引从( )开始,可以进行截取,组合等。( 0 )
元组中的元素是不可变的,当修改元组的元素时会抛出( )异常。( TypeError )
在这一章节中,我们主要学习函数(Function),我们知道,”function” 一词本身就有“功能”的意思,便于理解,可以直接将“函数”视为“功能”。出于严谨,下文中我们仍然统一称之为“函数”。
我们之前已经使用过一些函数,如 print
、input
,它们属于内置函数,BIF(built-in functions),顾名思义,是 Python 自带的一些函数,我们可以直接使用它们。以 print
函数为例,包括但不限于以下的调用形式都是合法的。
1 | print("hello, world!") |
既然存在内置函数,那意味着也存在自定义函数,确实是这样,本章节也围绕自定义函数展开。
一般的,通过 def
关键字定义函数,括号 () 内为其参数 (Param),return
关键字用于返回值。
先来看一个最简单的自定义函数:
1 | def add(a, b): # 不要忽略冒号 |
def
定义了一个函数名为 add
的自定义函数,它有名为 a 和 b 的两个参数,并返回 result
的值。
对于这种逻辑简单的函数,还可以直接写成这样:
1 | def add(a, b): |
函数光是定义是永远不会运行的,还需要我们调用:
1 | def add(a, b): |
函数体内还可以做更多的逻辑判断,比如我们实现一个求绝对值的函数:
1 | def abs(a): |
这个函数还可以写成这样:
1 | def abs(a): |
如果函数不需要返回值,则 return
关键字不是必须的:
1 | def greet(): |
在这个问好函数 greet
中,由于不需要传参,所以括号内没有参数。
对于函数的“参数”,还有“形参”和“实参”的概念,即形式参数和实际参数。我们仍然以上文的 abs
函数为例:
1 | def abs(a): |
在这个例子中,abs(number)
向 abs
函数传入了 number
的值,即 -10
现在是 abs 函数的实参;定义时,abs(a)
中的 a
也是参数,但为形参,仅用来代表实际传入的 -10
。
简单来说,形参的值是不固定的,由传入的实参确定。
明白了这一点后,我们也能理解下面的代码了:
1 | def fun(a): |
若让改变变量 a 起效,应这样写:
1 | def fun(a): |
自定义函数最常被用作封装功能,便于代码复用。
在上一章节的最后,我们提出前台登录的程序还有很大的改进空间,其中关键的一点就是代码可维护性差。现在,我们用新学的知识继续改进它:
1 | def get_age_from_id(): |
我们将从身份证获取年龄的代码抽象出来,封装成一个自定义函数,这样,这样,我们只需要关注业务逻辑部分,而无需在意具体的实现细节:
1 | name = input("请输入你的姓名:") |
这样做的好处是很多的。如果我们后面的代码中需要重复使用这个功能,不用每次都拷贝一遍代码,若是需要修改其中的某些细节,也不需要挨个修改。
在上一章节中,我留了一个课后练习题:实现一个猜数字的小游戏。你不知道有练习题?练习题会在编程小窝群中发布,我会挨个批改,帮助大家在实战中精进。
有一个同学交了这样的一份答卷:
1 | import random |
本来是很简单的一个功能,写了这么一大坨,这也难怪,因为他当时还不会使用自定义函数,现在我们着手改进它:
1 | import random |
是不是一下子就简洁了许多呢? 👏
函数非常灵活,我们可以通过传入多个参数扩充功能:
1 | def get_id(): |
利用自定义函数,对代码进行封装,代码更加简洁,并且业务逻辑部分与技术实现部分相解耦,降低我们组织代码时的心智负担,编写更具有可读性,并且高度可维护的代码。
函数非常灵活,功能也无比强大。在今后的代码编写中,要多加思考,是否可以利用函数优化代码。
在上一章节中,我们编写的程序还有很大的改进空间,在这一章节中,我们将逐一解决这些问题。
首先,之前的程序永远只会执行一次判断,如果用户输错了格式,也没有机会修正。我们应该要让程序不断的尝试获取输入,直到输入格式确实符合要求为止。我们在编写时并不知道何时输入值是合法的,这时就需要循环语句了。
先来看一个最简单的 while 循环示例:
1 | i = 1 # 初始化申明一个变量 |
程序的运行结果为:
1 | 这是第 1 次打印 |
为了便于理解 while
循环,我做了个图解:
利用循环语句,我们将之前的程序改写为:
1 | name = input("请输入你的姓名:") |
while not age.isdigit():
语句表示当 age
不为纯数字时循环。
在编程语言中,通常用 !
表示”否“,如用 !=
表示“不等于”,相应的,上面的语句则要用 while (!age.isdigit())
表示;而 Python 则支持用 not
关键字表示“否”,这非常直观并且人性化,同时体现了 Python 的优雅之处。
除了 not
外,Python 中还有“并”: and
、“或”: or
,分别对应 &&
和 ||
,这些被称为逻辑运算符。
经过循环语句后,我们可以确保 age
的值已为纯数字,可以放心的使用 int()
函数将其转换为整数类型;原本用于处理格式不正确的 else
语句也要去掉。
解决了上面的问题,我们再来看如何更严谨的确定年龄。
直接让用户输入年龄的形式并不合适,一种更好的方法是从身份证号中确定年龄。我们知道,身份证号由确定的格式组成,从身份证号中我们可以获取很多信息。具体来说,身份证号前六位表示地址,接下来的八位表示出生日期,再接下来三位为顺序码,最后一位为校验码。
身份证的最后一位是根据前 17 位通过校验算法计算出来的,改变原本的任何一位都会导致校验码不符。通过身份证号,我们就可以较严谨的确定年龄了。
程序处理时间和日期,可能会比大多数人想象的要复杂,为了降低学习的心智负担,这里我们会尽可能简化从身份证号中获取年龄的算法。
假定现在获取的身份证号为 510101200106180395
,我们只提取 2001
这个年份,直接与当前的年份 2020
相减计算出年龄。
该如何获取 "510101200106180395"
中的字符呢,其实“字符串”顾名思义就是由“字符”连成的串,我们直接通过位次就可以获取到其中的字符
1 | word = "hello" |
没错,程序员就是从 0 开始数数的 😅
可以看到,上面的代码非常繁琐,而且假如需要提取 1000 位,难道还写 1000 行吗?这显然是不可能的,我们可以借助刚学的循环来完成:
1 | word = "hello" |
len()
函数用于获取数据长度,len("hello")
的结果自然是 5
。i += 1
是 i = i + 1
的简写,二者等价。那么,结合之前所学的条件语句,提取出生年份的代码就可以这样写:
1 | id = "510101200106180395" |
if i in (6, 7, 8, 9):
语句用到了 Python 的一些高级特性,我们还没有学,没关系,光这么看就已经非常直观。它和下面的代码等价:
1 | if i == 6 or i == 7 or i == 8 or i == 9: |
高下立判, 再一次赞叹 Python 的简洁优雅 👏
能不能再简洁一点,更优雅一点?
Python 告诉你:还真能!
1 | id = "510101200106180395" |
id[6:10]
用到了 Python 的“切片”操作符,它可以用于截取字符串。为了便于理解,我又做了个图解:
现在,改写之前的程序:
1 | name = input("请输入你的姓名:") |
1 | > 请输入你的姓名:王花花 |
很好的实现了我们的需求 🥳
不要忘了,我们将判断年龄的算法尽可能简化了,如果以后我们想让算法更完善,或是给程序添加更多的功能,就需要不断的在中间新插入代码,其中有实现我们业务逻辑的部分,也有具体算法实现的部分,相互耦合在一起,非常琐碎复杂。
管理和维护这样的代码,是我们不愿接受的,该如何解决这种问题呢?
将在下一章节中详细展开 😘
现在我们来看一个具体场景下的 Python 代码编写。
在上一章节中,我们编写了一段这样的代码:
1 | name = input("请输入你的姓名:") |
执行这段代码时,程序将获取我们输入的名字和岁数,并且按照某种形式打印出来。
假设,现在有这么一种场景:某娱乐场所的前台登记系统,需要用户输入自己的姓名和年龄,系统将判断用户是否成年,如果成年则欢迎并放行,否则让用户回家。我们该如何用 Python 来实现这个需求呢?
很显然,我们需要对用户输入的年龄进行判断,这就要有请判断语句:if
和 else
出场了
1 | age = 10 |
#
表示注释,Python 中只有单行注释,即与 #
在同一行并在它后面的都是注释,程序在执行时将忽略掉注释,注释的存在是便于程序的编写者和阅读者理解代码的含义与用途。
上面的代码将判断 age
变量的值是否大于等于 18,如果是则打印“成年”,否则打印“未成年”,不要漏掉那个冒号 :
。
Python 的一大特点是用缩进表示语句块,建议使用四个空格缩进而不是按 tab
键,出于方便,我们可以把 tab
替换成四个空格:
通常情况下这就是默认配置
现在我们再利用判断语句将之前的代码改进一下:
1 | name = input("请输入你的姓名:") |
之所以 input("请输入你的年龄:")
被 int()
包裹,是因为 input()
在这里实际上是获取到一个字符串,所以用 int()
强制转换为数字,方便我们下面的判断。我们测试一下:
1 | > 输入你的姓名:谭小蝶 |
可以看到成功了,非常棒。如果这个时候,又有新需求,考虑到身体健康问题,大于 60 岁的用户就不再放行。我们可以改写成这样:
1 | name = input("请输入你的姓名:") |
elif
是 else if
的简写,顾名思义,表示“否则,如果……”,程序会自上而下的依次判断是否符合条件,如果遇到条件符合时,将执行相应的语句,并不再判断接下来的条件,所以先判断的条件要放到更上面。
1 | > 输入你的姓名:谭小蝶 |
测试了一下,符合我们的预期,非常棒哈。
但是,在程序就有非常有名的一句话: 永远不要相信用户的输入 ,万一上面的这个登记系统,用户傻傻的把名字和年龄填反了怎么办?如果遇见捣蛋鬼存心乱填怎么办?
1 | > 请输入你的年龄: 莉莉 |
事实上,仅凭之前的代码,根本无法应对这些情况,所以,我们需要对用户的输入合法性(合理性)也进行判断,改进后的代码如下:
1 | name = input("请输入你的姓名:") |
我们对新代码逐一分析,首先在第二行中,我们去掉了 int()
,因为在这里我们还无法判断用户输入的是否为纯数字,如果不是纯数字却执行 int()
可能会报错。
虽然用户也有可能输入诸如 -10
或者 2333
这种显然不可能存在的岁数,不过程序不会报错,而且反正也通不过我们原有的判断,所以暂时不做处理。
age.isdigit()
用于获取是否 age
是否为纯数字,如果是返回 True
,否者返回 False
,True
和 False
都属于“布尔值(Boolean)“数据类型,用于表示真假;理解了布尔值的概念后,我们回过头再去看看 if
:
1 | age = "18" |
实际上,if
和 :
之间的语句被程序判断,返回一个布尔值,最终等价于 if True:
或 if False
,前者会执行之后的语句。
另外,在计算机中我们常常用 1 表示”真“,0 表示 ”假“,所以 True
也等于 1
,相应的 False
也等于 0
。
1 | True == 1 |
正如你所注意的,在代码中通常用两个等号 ==
表示通常意义上的”相等“,这是避免和一个等号 =
表示的赋值相冲突。
回到之前的前台登记需求,现在我们已经能安全的判断用户输入的年龄,符合我们准入规则的才放行。现在,又有新情况:老板 40 岁生日,他大手一挥,宣布今天跟他同岁的顾客统统免单,并且他年仅 8 岁的小女儿莉莉也允许进入。
还能咋办?有需求咱就改呗:
1 | name = input("请输入你的姓名:") |
由于 if
……elif
……else
…… 自上而下判断,所以我们需要根据情况合理的调整判断顺序,然后测试一下:
1 | > 请输入你的姓名:莉莉 |
非常好,实现了需求。
老板满意的看着你,表示你可以下班回家休息了。你心满意足的回到家,洗澡的时候脑子里突然冒出了今天写的代码,你突然觉得大段的 if
……elif
……else
…… 看起来啰嗦累赘,还一不小心没理清逻辑就写错条件。
继而你接着想到,给用户输入的机会只有一次,要是用户一不小心输错了,就直接被拒之门外了,这样的用户体验也不好。并且如果有人输小姐的名字假冒她,也被直接放进来了,这显然不行;再者,直接让用户输年龄,不排除有人谎报的,应该用更严谨的方式确定年龄。
该怎么改进上面的问题呢,将在下一章娓娓道来。