<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>我心永恒的小站</title>
        <link>https://wxyhgk.com/</link>
        <description>乐于分享的小站</description>
        <lastBuildDate>Sun, 09 Aug 2026 03:28:03 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2026, 我心永恒</copyright>
        <item>
            <title><![CDATA[超微主板风扇调速指南：IPMI配置与自动化]]></title>
            <link>https://wxyhgk.com/article/chaowei-ipmi</link>
            <guid>https://wxyhgk.com/article/chaowei-ipmi</guid>
            <pubDate>Mon, 07 Oct 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-117725098d0580c2851dd7838ae20e26"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-118725098d05807ab416c0d21f7e9f77"><div class="notion-page-icon-inline notion-page-icon-span"><img class="notion-page-icon" src="https://www.notion.so/icons/notion_gray.svg?mode=light" alt="Notion AI 总结:" loading="lazy" decoding="async"/></div><div class="notion-callout-text"><b>Notion AI 总结:</b><div class="notion-text notion-block-4849d040c9a242699704d146faae3ca4">这篇文章详细介绍了超微主板风扇调速的方法，涵盖了IPMI接口配置、风扇设置的各种模式和命令、根据温度自动调节风扇速度的脚本，以及相关参考资料。它为服务器管理者提供了从基础配置到高级自动化的全面指导，帮助优化服务器散热和噪音控制。</div></div></div><div class="notion-callout notion-gray_background_co notion-block-118725098d05807ebdbfc8f5068d49fe"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-b530b4ecdfa645f4a3916e1d1c6c2e92"><b>说明：
</b>本文由 ChatGPT 和 Notion AI 辅助完成<b>

</b>主板: 超微 h11dsi-nt</div><div class="notion-text notion-block-118725098d0580c8ac4df356c67c6de7">系统：Ubuntu22.04</div></div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-118725098d058098bc87ce073a42b60e" data-id="118725098d058098bc87ce073a42b60e"><span><div id="118725098d058098bc87ce073a42b60e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d058098bc87ce073a42b60e" title="1. IPMI 接口配置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. IPMI 接口配置</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-118725098d0580f1a4aef6dc187c1af1" data-id="118725098d0580f1a4aef6dc187c1af1"><span><div id="118725098d0580f1a4aef6dc187c1af1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d0580f1a4aef6dc187c1af1" title="1.1 IPMI 接口连接"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.1 IPMI 接口连接</span></span></h3><div class="notion-text notion-block-118725098d0580f6b059de0a74d99525">将下面的 <span class="notion-red"><b>IPMI 接口</b></span> 和 <span class="notion-red"><b>网口</b></span> 都接入到路由器上</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-118725098d05801c982ad925f97b91a9"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:432px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F5937ac7b-d2f4-412c-9ee8-6c320ade718c%2Fimage.png?table=block&amp;id=11872509-8d05-801c-982a-d925f97b91a9&amp;t=11872509-8d05-801c-982a-d925f97b91a9&amp;width=432&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-118725098d0580aea829cb0af744846b" data-id="118725098d0580aea829cb0af744846b"><span><div id="118725098d0580aea829cb0af744846b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d0580aea829cb0af744846b" title="1.2 IPMI 功能概述"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.2 IPMI 功能概述</span></span></h3><div class="notion-text notion-block-118725098d058093b3c0f5cdc63d9482">许多超微服务器都具备了两个网卡，其中一个便是 IPMI 使用的。</div><div class="notion-text notion-block-118725098d058098aeb7cc382ebbe4ea">这个网口直接由服务器底层硬件进行管理，在操作系统层面不可见，可以实现截屏、服务器启停等控制功能，<b>也包括设置风扇转速</b>。</div><div class="notion-text notion-block-118725098d0580eabb96df46626be5f9">IPMI 网口可以设置为静态 IP 或者 DHCP；与这个网口处于同一个路由器的主机都可以通过 IPMI 对服务器进行管理。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-118725098d058040be79fc630cd236a4" data-id="118725098d058040be79fc630cd236a4"><span><div id="118725098d058040be79fc630cd236a4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d058040be79fc630cd236a4" title="1.3 IPMI 网络配置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.3 IPMI 网络配置</span></span></h3><div class="notion-text notion-block-118725098d05808fb525d83b00d67c94">IPMI 的 IP 和主机的 IP ，可以到路由器上去看 IP 地址</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-118725098d0580aa9558f5dc4f1dfd25"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:528px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F6367a1cf-8fe5-4d7f-881e-168ca40f5f30%2Fimage.png?table=block&amp;id=11872509-8d05-80aa-9558-f5dc4f1dfd25&amp;t=11872509-8d05-80aa-9558-f5dc4f1dfd25&amp;width=528&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-118725098d05809597fcdecf95f480e0">这里的 IPMI 的 IP 是 192.168.31.252，记住这个 IP，后面我们需要用这个来登录什么的</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-118725098d05805ab81cd5859a5d7f37" data-id="118725098d05805ab81cd5859a5d7f37"><span><div id="118725098d05805ab81cd5859a5d7f37" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d05805ab81cd5859a5d7f37" title="1.4 IPMI 登录认证"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.4 IPMI 登录认证</span></span></h3><div class="notion-text notion-block-118725098d058025a5e0f0638797f26f">IPMI 一般需要用户名和密码进行认证，超微服务器一般默认的用户名和密码均为 <b>ADMIN</b>。</div><div class="notion-text notion-block-8d512f25a80e4d6abced243ba95b4446">可以通过网页登录，看到后台信息</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-118725098d05807ba190d4657b09bbfb"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F6d78f2ab-70de-404c-8bd4-c2b2438953dd%2Fimage.png?table=block&amp;id=11872509-8d05-807b-a190-d4657b09bbfb&amp;t=11872509-8d05-807b-a190-d4657b09bbfb&amp;width=624&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-118725098d058090a464d3c70d9ea93f">IPMI 后台可以控制的东西很多，这里我们主要以控制风扇为主</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-118725098d058090b534ccc908ce5a35" data-id="118725098d058090b534ccc908ce5a35"><span><div id="118725098d058090b534ccc908ce5a35" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d058090b534ccc908ce5a35" title="2. IPMI 风扇设置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. IPMI 风扇设置</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-118725098d0580b4b441c1bfe55138f1" data-id="118725098d0580b4b441c1bfe55138f1"><span><div id="118725098d0580b4b441c1bfe55138f1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d0580b4b441c1bfe55138f1" title="2.1 ipmitool 安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.1 ipmitool 安装</span></span></h3><div class="notion-text notion-block-118725098d0580a59e03fdf9b0c1bd2a">ipmitool 是一种可用在 linux 系统下的命令行方式的 ipmi 平台管理工具。</div><div class="notion-text notion-block-118725098d0580e192fddf003d6a1b6b">在 Ubuntu 系统上使用下面的命令，安装 ipmitool ，方便后面管理风扇什么的</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-118725098d05805e891bd2087abbb3e6" data-id="118725098d05805e891bd2087abbb3e6"><span><div id="118725098d05805e891bd2087abbb3e6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d05805e891bd2087abbb3e6" title="2.2 系统内置的风扇模式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.2 系统内置的风扇模式</span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-118725098d0580af9ca0eb0a6cf6b0b8" data-id="118725098d0580af9ca0eb0a6cf6b0b8"><span><div id="118725098d0580af9ca0eb0a6cf6b0b8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d0580af9ca0eb0a6cf6b0b8" title="2.2.1 通过网页调速"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.2.1 通过网页调速</span></span></h4><div class="notion-text notion-block-118725098d0580d2aa3ac3e7942820b8">超微主板提供了几种预设的风扇控制模式，可以通过IPMI网页后台进行配置。</div><div class="notion-text notion-block-118725098d0580369b6bd044ae04b3e2">每种模式都有其特定的用途和特点。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-118725098d0580149250ed681145a294"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:384px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fa8fc40b6-c3ca-42ef-875f-4711d00e84a0%2Fimage.png?table=block&amp;id=11872509-8d05-8014-9250-ed681145a294&amp;t=11872509-8d05-8014-9250-ed681145a294&amp;width=384&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><table class="notion-simple-table notion-block-118725098d0580ec9ce2c1a0e24d0861"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-51b9565fadb5477f82d46b4c72c3cdaa"><td class="" style="width:120px"><div class="notion-simple-table-cell">风扇模式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">描述</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">适用场景</div></td></tr><tr class="notion-simple-table-row notion-block-0cdb63f1bb084e3eabeda03f77a16117"><td class="" style="width:120px"><div class="notion-simple-table-cell">标准模式（Standard）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">基础风扇速度为 50% 的 PWM 占空比，根据系统温度在 50-100% 之间调节。</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">适合大多数常规使用场景</div></td></tr><tr class="notion-simple-table-row notion-block-74406f1c53574e7cacf5b5f6432cc32d"><td class="" style="width:120px"><div class="notion-simple-table-cell">全速模式（Full Speed）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">风扇始终以全速运行。</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">适合需要最大冷却效果的高负载场景</div></td></tr><tr class="notion-simple-table-row notion-block-b8359e1ee1514bd69f35b8ae2f9d823a"><td class="" style="width:120px"><div class="notion-simple-table-cell">最优转速模式（Optimal）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">基础风扇速度为 30% 的 PWM 占空比，范围为30-100%，根据需要调节。</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">适合低负载或需要节能的场景</div></td></tr><tr class="notion-simple-table-row notion-block-21a034a263824ea6b50efa69eb5e1c5c"><td class="" style="width:120px"><div class="notion-simple-table-cell">高负载IO模式（Heavy IO）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">将 FANA 和 FANB 设置为 75%PWM 占空比，其他风扇使用标准模式。</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">适合有大量 PCI 设备或高 IO 负载的场景</div></td></tr></tbody></table><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-118725098d0580a2a850e2037e796c2e" data-id="118725098d0580a2a850e2037e796c2e"><span><div id="118725098d0580a2a850e2037e796c2e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d0580a2a850e2037e796c2e" title="2.2.2 通过IPMI命令行设置风扇模式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.2.2 通过IPMI命令行设置风扇模式</span></span></h4><div class="notion-text notion-block-118725098d05806a831dc4bd20068217">除了使用网页后台，您还可以通过IPMI命令行工具来设置这些模式。以下是设置命令的通用格式：</div><div class="notion-text notion-block-118725098d0580939413f499795fbb70">其中，MODE_HEX 为相应模式的十六进制代码：</div><table class="notion-simple-table notion-block-118725098d0580948cbbe07ac8f6f1b6"><tbody><tr class="notion-simple-table-row notion-block-2480522e771c446a999a267d51f63e40"><td class="" style="width:120px"><div class="notion-simple-table-cell">模式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">十六进制代码</div></td></tr><tr class="notion-simple-table-row notion-block-99dedbd5fa044f9f8620dd4a6771e8a0"><td class="" style="width:120px"><div class="notion-simple-table-cell">Standard（标准模式）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>0x00</b></div></td></tr><tr class="notion-simple-table-row notion-block-8569d0e1969e46b58b7ff3c660e8e7b4"><td class="" style="width:120px"><div class="notion-simple-table-cell">Full（全速模式）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>0x01</b></div></td></tr><tr class="notion-simple-table-row notion-block-4d4ef93ed9104103a179d8ec62e9cd89"><td class="" style="width:120px"><div class="notion-simple-table-cell">Optimal（最优转速模式）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>0x02</b></div></td></tr><tr class="notion-simple-table-row notion-block-c32652bfa32741388f9789953ee49aec"><td class="" style="width:120px"><div class="notion-simple-table-cell">Heavy IO（高负载IO模式）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>0x03</b></div></td></tr></tbody></table><div class="notion-text notion-block-118725098d0580bbb265d99b31350375">例如，要将风扇模式设置为<b>全速模式</b>，您可以使用以下命令：</div><div class="notion-text notion-block-118725098d05805d8854f00f2413168f">请注意，IP地址、用户名和密码应替换为你的IPMI设置。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-118725098d0580ad8957d5276b434868" data-id="118725098d0580ad8957d5276b434868"><span><div id="118725098d0580ad8957d5276b434868" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d0580ad8957d5276b434868" title="2.3 风扇转速命令说明"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>2.3 风扇转速命令说明</b></span></span></h3><div class="notion-text notion-block-118725098d0580e7b88dd0a5f429d39d">这里以超微 h11-dsi-nt 主板为例子说明</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-118725098d0580eb9a57eee2e158c943"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:528px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fb14756b5-5c16-4ba2-ad0f-e56a098aa33e%2Fimage.png?table=block&amp;id=11872509-8d05-80eb-9a57-eee2e158c943&amp;t=11872509-8d05-80eb-9a57-eee2e158c943&amp;width=528&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-118725098d0580538971dfdf834b6aea">上面的图中</div><ul class="notion-list notion-list-disc notion-block-118725098d058035b070d6f09a72a007"><li><span class="notion-red"><b>红色部分是周边设备，对应FAN1，FAN2…FAN6
</b></span><span class="notion-gray">ipmitool -H 192.168.31.252 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01</span> <span class="notion-red"><span class="notion-red_background"><b>0x01</b></span></span><span class="notion-teal"><b> </b></span><b>0x24</b><span class="notion-red"><b>
</b></span><span class="notion-red"><span class="notion-red_background"><b>0x00</b></span></span> 表示对周边设备的风扇调速</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-118725098d0580868b3bc5ba03c53155"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Ff544bf31-234c-4fa9-b424-4a0fe2059d95%2Fimage.png?table=block&amp;id=11872509-8d05-8086-8b3b-c5ba03c53155&amp;t=11872509-8d05-8086-8b3b-c5ba03c53155&amp;width=672&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><ul class="notion-list notion-list-disc notion-block-118725098d0580d28832f2958b59d69a"><li><span class="notion-teal"><b>绿色部分是系统区域，对应FANA,FANB，区域一般为负责CPU、GPU的风扇
</b></span><span class="notion-gray">ipmitool -H 192.168.31.252 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01</span> <span class="notion-teal"><span class="notion-teal_background"><b>0x00</b></span></span><span class="notion-red"><b> </b></span><span class="notion-default"><span class="notion-default_background"><b>0x24</b></span></span><span class="notion-teal"><b>
</b></span><span class="notion-teal"><span class="notion-teal_background"><b>0x01</b></span></span> 表示对系统区域的风扇调速</li></ul><ul class="notion-list notion-list-disc notion-block-118725098d058050b651c824f9aa4eb3"><li>关于上面命令的说明</li><ul class="notion-list notion-list-disc notion-block-118725098d058050b651c824f9aa4eb3"><li>-U 和-P 分别指定 IPMI 的用户名和密码</li><li>0x24 是 16 进制的，0x24 代表风扇转速设置成 36%</li></ul></ul><blockquote class="notion-quote notion-block-118725098d0580a2b593d2370f2c38da"><div>注意上面的FANA,FANB，FAN1~FAN6的功能，不同主板不一样，具体的需要看主板的说明书</div></blockquote><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-118725098d05800b89f9e9ebaee272b8" data-id="118725098d05800b89f9e9ebaee272b8"><span><div id="118725098d05800b89f9e9ebaee272b8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d05800b89f9e9ebaee272b8" title="2.4 风扇的阈值调整"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.4 风扇的阈值调整</span></span></h3><div class="notion-text notion-block-118725098d058097af77c78e2653ed59">在后台这里可以看到风扇的阈值，如果你的转速低于阈值，那么就会自动提高转速，那么就会出现这种现象：风扇一会儿低速，一会儿满速运行，非常烦人</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-118725098d0580f3b493f3e579487cc7"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fb087920d-3b4b-4c02-914a-38c0bca9126f%2Fimage.png?table=block&amp;id=11872509-8d05-80f3-b493-f3e579487cc7&amp;t=11872509-8d05-80f3-b493-f3e579487cc7&amp;width=624&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-118725098d058054859eee24d70fa7ee">对于普通风扇其实没这种问题，但是对于猫头鹰风扇，这个风扇转速本来就地，那么就会一会儿快，一会儿慢速，我们可以用通过下面的命令来调速</div><div class="notion-text notion-block-118725098d0580d79037fee4b651017b">192.168.2.247这里是调节 FANA 这个风扇的阈值是 100，200，300 的转速, 其他的风扇可以调整成一样的</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-118725098d0580a79b95e6e19f6b55e7" data-id="118725098d0580a79b95e6e19f6b55e7"><span><div id="118725098d0580a79b95e6e19f6b55e7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d0580a79b95e6e19f6b55e7" title="3. 自动化脚本"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. 自动化脚本</span></span></h2><div class="notion-text notion-block-118725098d0580aabbb3ce44598bf181">在不同的的季节 和不同的使用场景下，我们可能需要调整风扇的转速以达到最佳的散热效果和噪音控制。例如</div><hr class="notion-hr notion-block-118725098d058027abd7cc703fe8ed93"/><div class="notion-text notion-block-57ec3ffa9dcf46949206a33f92f465a0">夏季：由于环境温度较高，可能需要将风扇速度调高以保证足够的散热。</div><div class="notion-text notion-block-1bf21b9004dc4d8e9f1142568327cee3">冬季：环境温度较低时，可以适当降低风扇速度以减少噪音。</div><hr class="notion-hr notion-block-118725098d05807c8c20f96d07ab461b"/><div class="notion-text notion-block-e11f500f558f440b984459872d16622f">如果服务器放置在噪音敏感的环境中，在保证足够散热的同时尽量降低风扇速度，实际上满速运行的时候就是会吵，只能说可以控制一点</div><div class="notion-text notion-block-26bbd4e55df54444bf2bf0e91c7f5fd1">我们可以写一个 shell 脚本，实现根据 CPU 的温度，控制风扇的转速。</div><div class="notion-text notion-block-118725098d0580d3bf70fb9276ce70aa">下面的脚本主要是用于 夏天其实，冬天或者秋天的话，用服务器自带的</div><div class="notion-text notion-block-118725098d05804b98bbd934580a4187">在夏天可以将上面的代码保存为 fans.sh ，然后使用命令</div><div class="notion-text notion-block-118725098d0580f3af5bd4e3a21ac3ef">来后台运行</div><div class="notion-blank notion-block-118725098d05806ab220f4e6723477dc"> </div><div class="notion-text notion-block-118725098d05808293b4e83dc153078f">与此同时如果想关闭这个脚本程序，可以使用以下命令：</div><div class="notion-text notion-block-118725098d058031b2eef63e46011520">这个命令会直接查找并终止名为fans.sh的脚本进程。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-118725098d05802fa3edf5d30c1e8666" data-id="118725098d05802fa3edf5d30c1e8666"><span><div id="118725098d05802fa3edf5d30c1e8666" class="notion-header-anchor"></div><a class="notion-hash-link" href="#118725098d05802fa3edf5d30c1e8666" title="4. 参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">4. 参考文章</span></span></h2><ol start="1" class="notion-list notion-list-numbered notion-block-118725098d058055a9bcd70daa77def0" style="list-style-type:decimal"><li><a class="notion-link" href="https://www.licc.tech/article?id=33" target="_blank" rel="noopener noreferrer">https://www.licc.tech/article?id=33</a></li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-118725098d05806baa42f762088e8b75" style="list-style-type:decimal"><li><a class="notion-link" href="https://forums.servethehome.com/index.php?resources/supermicro-x9-x10-x11-fan-speed-control.20/" target="_blank" rel="noopener noreferrer">https://forums.servethehome.com/index.php?resources/supermicro-x9-x10-x11-fan-speed-control.20/</a></li></ol><div class="notion-blank notion-block-118725098d05807f99fac7b97ea4d42c"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-398725098d0580ba97a4e80e52520dcb"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:468.96875px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A228e9dbe-6c7a-4875-b353-4068213ef215%3Aimage.png?table=block&amp;id=39872509-8d05-80ba-97a4-e80e52520dcb&amp;t=39872509-8d05-80ba-97a4-e80e52520dcb" alt="notion image" loading="lazy" decoding="async"/></div></figure></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI 编程到底用了多少 token？我试了 3 个统计工具，tokscale 胜出]]></title>
            <link>https://wxyhgk.com/article/ai-token-tokscale</link>
            <guid>https://wxyhgk.com/article/ai-token-tokscale</guid>
            <pubDate>Fri, 03 Jul 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-391725098d0580d4b417e7c99b53c0ed"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-391725098d05804ea4bcf5c389668862" data-id="391725098d05804ea4bcf5c389668862"><span><div id="391725098d05804ea4bcf5c389668862" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d05804ea4bcf5c389668862" title="1. 引言"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 引言</span></span></h2><div class="notion-text notion-block-391725098d0580abab65dced7dae3e63">由于我平时用 codex 比较多，claude code 偶尔用用，所以我需要有一款工具来看看我所有的设备到底用了多少 Token，一来是为了装逼，二来是为了看看具体的数据，可以鞭策自己。</div><div class="notion-text notion-block-391725098d0580fe91d3e7a98d6144ea">我一开始问了 ChatGPT ，让他找了一下 codex cli 的开源项目，推荐了 <a class="notion-link" href="https://github.com/ccusage/ccusage" target="_blank" rel="noopener noreferrer">ccusage</a>、<a class="notion-link" href="https://github.com/junhoyeo/tokscale" target="_blank" rel="noopener noreferrer">tokscale</a>、<a class="notion-link" href="https://tokenusage.org/" target="_blank" rel="noopener noreferrer">tokenusage</a> 这三个 cli 项目</div><div class="notion-blank notion-block-391725098d0580c2b4f2f85992824ec5"> </div><div class="notion-text notion-block-391725098d0580fd8e58e20033e75985">这几个我都试用了一下：</div><div class="notion-text notion-block-391725098d058035834ff4cd35f5d5f4">ccusage 这个我发现统计不准，会多十倍的用量，比如在 Linux 上统计，有上千亿的 token ，明显是统计错误</div><div class="notion-text notion-block-391725098d058087b13ddd4dd6e0a044">tokenusage 我发现在 Linux 上安装后会报错</div><div class="notion-text notion-block-391725098d0580b0b45ef2ad727f3b4c">tokscale 综合体验最好，下面的图是用 tokscale 制作的一个 2026  年我 Mac 消耗的 token 数</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d0580b9b78dee7e17f30ffb"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:480px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A1afe00ca-ed25-4e8a-8b95-3ea61fa6aa00%3Atokscale-2026-wrapped.png?table=block&amp;id=39172509-8d05-80b9-b78d-ee7e17f30ffb&amp;t=39172509-8d05-80b9-b78d-ee7e17f30ffb" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-391725098d0580ed9f45e66d51ca5f71">这个图逼格还是挺高，而且左侧的部分会显示你一年的总 token 数，最常用的模型，最常用的 cli，对话总数，活跃天数，花费，连续用 ai 的天数，</div><div class="notion-text notion-block-391725098d0580e9aab9dcd730ee0fa4">右侧面板有使用的热力图，热力图是从左到右，从上到下的日期排列</div><div class="notion-blank notion-block-391725098d0580719cdde9608cd1f121"> </div><div class="notion-text notion-block-391725098d058019a95de1e6be9ad799">安装非常简单，在终端中使用命令：</div><div class="notion-text notion-block-391725098d0580f189f3c8e8ac8e3553">然后在终端中使用 <code class="notion-inline-code">tokscale wrapped</code> 即可产生和我一样的图</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-391725098d0580e9b24de7f836193b3c" data-id="391725098d0580e9b24de7f836193b3c"><span><div id="391725098d0580e9b24de7f836193b3c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d0580e9b24de7f836193b3c" title="2. 使用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 使用</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-391725098d0580f6ac2ceffd90fa901f" data-id="391725098d0580f6ac2ceffd90fa901f"><span><div id="391725098d0580f6ac2ceffd90fa901f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d0580f6ac2ceffd90fa901f" title="2.1 说明"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.1 说明</span></span></h3><div class="notion-text notion-block-391725098d05805db26bcbd2dd597cd8">上面的命令 <code class="notion-inline-code">tokscale wrapped</code>  实际上是一个年度总结命令，适合装逼用，平时可能不会怎么看，日常中在命令行里面直接使用  tokscale 比较多</div><div class="notion-text notion-block-391725098d058037ad1be73be5a13f46">直接在命令行使用 tokscale 会出现下面的页面，</div><ul class="notion-list notion-list-disc notion-block-391725098d0580458d96c1bb56ebefe0"><li>Overview 页面</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d05800891a1e4a371dad658"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A9be790ac-f838-4337-a8f2-61a95db1495c%3Aimage.png?table=block&amp;id=39172509-8d05-8008-91a1-e4a371dad658&amp;t=39172509-8d05-8008-91a1-e4a371dad658" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-391725098d0580218216c6b8ea6048a1">里面有价格什么的，Tokscale 从 <a class="notion-link" href="https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json" target="_blank" rel="noopener noreferrer">LiteLLM 的定价数据库</a>获取实时定价。</div><div class="notion-blank notion-block-391725098d0580d3b802f80cd5f9f2ff"> </div><ul class="notion-list notion-list-disc notion-block-391725098d058008bf5bf1e4a41072c6"><li>Usage 页面</li></ul><div class="notion-text notion-block-391725098d05809ebfeaf980515de119">可以看到我这里有一个 GPT Pro 账号，里面还会显示小时限额/周限额，看看就行了，实际上 codex app 或者 普通的 cli 命令都能看到</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d058071ac4ae447af574b74"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A37d821bf-ad5c-42cb-a06f-824368deebe6%3Aimage.png?table=block&amp;id=39172509-8d05-8071-ac4a-e447af574b74&amp;t=39172509-8d05-8071-ac4a-e447af574b74" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-391725098d058064ba85ff893e397f2e"> </div><ul class="notion-list notion-list-disc notion-block-391725098d058079b3addd73323f7826"><li>Models </li></ul><div class="notion-text notion-block-391725098d058013922acd157d07cda9">这个页面记录的是你用过哪些模型，可以看到我这里用 gpt-5.5 这个模型用的最多，实际上大部分的消耗都是缓存（Cache）.</div><div class="notion-text notion-block-391725098d058043b9c0fa61ce049ce9">大部分人不知道 agent 工具的 token 大头是缓存，而不是输入和输出，很多所谓自媒体都很容易误导观众，表面上输入和输出非常贵，但是实际上这两个占比量很少，而且从  gpt-5.5 数据可以看到 Cost/1M 也就是 1 百万 token 的消耗，是 0.81 美元，实际上消耗并不多。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d058071ad87e546c85f99cd"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Acbb71b9b-f516-4ef3-bd57-951df909ef15%3Aimage.png?table=block&amp;id=39172509-8d05-8071-ad87-e546c85f99cd&amp;t=39172509-8d05-8071-ad87-e546c85f99cd" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-391725098d05806ba6c5fac9e36d99eb"> </div><ul class="notion-list notion-list-disc notion-block-391725098d0580339e39cbbc5ff2e927"><li>Daily </li></ul><div class="notion-text notion-block-391725098d058056b25bf0766ec24dd0">这部分我觉得比较有用,可以很清楚的看到每天的使用量，可以看到 7-2 消耗了 76.94 美金，同时消耗高峰是 6-10 到 6-13 号，基本每天都是 300 多美元的消耗，这个是正常的，因为之前我开了多个任务以及用了 goal 模式，就是会消耗这么多。</div><div class="notion-text notion-block-391725098d0580eb8a8ecfc9c1e8a42a">而且这里的 Cachex 也就是缓存占比，基本上都是 10 多倍，有的到了 30 多倍，进一步验证了缓存才是 ai coding 的大头！</div><div class="notion-text notion-block-391725098d0580fc8705d6bcaa1c35c7">下面可以用一些快捷键按住 <code class="notion-inline-code">d</code> 就是日期从当前往下排列，使用方向键，上下移动，然后可以使用 Enter 键进入某一天然后可以看到当天用了哪些模型都消耗了多少</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d05801591a0ff9f6906bf38"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A0768fd7b-0170-49e6-8ae4-36f06e2e3db8%3Aimage.png?table=block&amp;id=39172509-8d05-8015-91a0-ff9f6906bf38&amp;t=39172509-8d05-8015-91a0-ff9f6906bf38" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-391725098d0580b69842deb3cd365387">快捷键  <code class="notion-inline-code">c</code>  就是按照当天的消耗从大往小排列，比如下面今年的 6-11 消耗是最多的，消耗了 481 美元</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d058046a077cc9fc71b8227"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A5bd4ab96-63e7-4eaa-bee5-ace574c71ab9%3Aimage.png?table=block&amp;id=39172509-8d05-8046-a077-cc9fc71b8227&amp;t=39172509-8d05-8046-a077-cc9fc71b8227" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-391725098d05806c9291f5ead1f39d60">快捷键  <code class="notion-inline-code">t</code>  是按照 token 消耗排列</div><div class="notion-blank notion-block-391725098d0580f0855adc576c665f90"> </div><div class="notion-blank notion-block-391725098d05801d9161f76938228037"> </div><div class="notion-text notion-block-391725098d058011bbc0e1d46d2cd080">至于后面的 Hourly,Stats,Agents 这几个面板，我觉得实用性不大，这里就不介绍了</div><div class="notion-blank notion-block-391725098d0580bfbc37f76dea22f340"> </div><div class="notion-text notion-block-391725098d05802c8554e45ae887b00b">此外还有一些使用的快捷键</div><ul class="notion-list notion-list-disc notion-block-391725098d05804fb5bcc7a021d90bd4"><li><code class="notion-inline-code">←/→/Tab/Shift+Tab</code>：切换视图</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d0580af9eccc51bc8b92526"><li><code class="notion-inline-code">↑/↓</code> 或 <code class="notion-inline-code">Home/End</code>：导航列表</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d0580769588f2588abbbd81"><li><code class="notion-inline-code">Enter</code>：打开每日详情（每日标签页）/ 选择图表单元格（统计标签页）</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d0580799c4af2e981c3b930"><li><code class="notion-inline-code">Esc</code> 或 <code class="notion-inline-code">Backspace</code>：关闭对话框或退出详情视图</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d0580d29fb7e9c07da95e80"><li><code class="notion-inline-code">j</code>：跳转至今天</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d05804c803ecd4e232f7a9a"><li><code class="notion-inline-code">s</code>：打开来源选择器对话框</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d05809e8cbbde27539b0161"><li><code class="notion-inline-code">g</code>：打开分组选择器对话框（模型、客户端+模型、客户端+提供商+模型、工作区+模型、会话+模型、客户端+会话+模型）</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d0580f89c38c7dad0097982"><li><code class="notion-inline-code">h</code>：切换每日/每小时图表粒度（概览选项卡）</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d05803c9211ebda94bcff85"><li><code class="notion-inline-code">v</code>：在表格/概要视图之间切换（每小时选项卡）</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d05800b90a9d5dd5777c1ec"><li><code class="notion-inline-code">y</code>：将选中的行复制到剪贴板</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d058081a339f84ae8617beb"><li><code class="notion-inline-code">p</code>：循环切换9种颜色主题</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d058068ae50c7576b9e8a83"><li><code class="notion-inline-code">r</code>：刷新数据；<code class="notion-inline-code">Shift+R</code>切换自动刷新；<code class="notion-inline-code">+</code>/调整间隔时间</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d0580408ecbfc3ccc86fbd9"><li><code class="notion-inline-code">e</code>：导出为 JSON</li></ul><ul class="notion-list notion-list-disc notion-block-391725098d0580909dc8d68e97cab769"><li><code class="notion-inline-code">q</code> 或 <code class="notion-inline-code">Ctrl+C</code>：退出</li></ul><div class="notion-blank notion-block-391725098d0580eeafb6fab9e3276bc0"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-391725098d0580d2b97bd95fe18ef26d" data-id="391725098d0580d2b97bd95fe18ef26d"><span><div id="391725098d0580d2b97bd95fe18ef26d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d0580d2b97bd95fe18ef26d" title="2.2 几个实用的命令"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.2 几个实用的命令</span></span></h3><div class="notion-blank notion-block-391725098d058034a1cbd70b1a046567"> </div><div class="notion-blank notion-block-391725098d0580ad93b0c921f1656786"> </div><div class="notion-text notion-block-391725098d0580b78a8fe5f0eee23943">甚至可以上传自己的使用量，使用命令 <code class="notion-inline-code">tokscale login</code>  即可登录上传自己的数据</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d058070ada0c8ba220aebec"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:480px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Aacb27be1-03e4-416d-b583-802ff2e26c53%3Aimage.png?table=block&amp;id=39172509-8d05-8070-ada0-c8ba220aebec&amp;t=39172509-8d05-8070-ada0-c8ba220aebec" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-391725098d0580bdac4ace73659e04f6">接着使用 <code class="notion-inline-code">tokscale submit</code>  就能上传自己的使用数据</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d05803ba08decac4d180efe"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:480px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A660d61ac-e373-4cf2-b892-332a64bf0817%3Aimage.png?table=block&amp;id=39172509-8d05-803b-a08d-ecac4d180efe&amp;t=39172509-8d05-803b-a08d-ecac4d180efe" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-39c725098d0580ceafa8c46dc74d53c0"> </div><div class="notion-text notion-block-391725098d05805e976ec54180a06e36">会给我这个链接 <a class="notion-link" href="https://tokscale.ai/u/wxyhgk" target="_blank" rel="noopener noreferrer">https://tokscale.ai/u/wxyhgk</a> 可以看到我下面的图中 mac 上使用量排名第 759 名</div><div class="notion-blank notion-block-39c725098d05806ca76bddc715782dcc"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d058099b6d0ef63324c019b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:528px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://tokscale.ai/api/embed/wxyhgk/svg?view=3d&amp;theme=light&amp;template=orbit&amp;graph=1&amp;tokens=compact&amp;cost=compact&amp;spaceId=7d8c4130-89c8-487b-9368-c7dd72a274bf&amp;t=39172509-8d05-8099-b6d0-ef63324c019b" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-39c725098d058030aa1deebb898efeb8">与此同时如果在不同的机器上使用 <code class="notion-inline-code">tokscale login</code>  并且 <code class="notion-inline-code">tokscale submit</code>  那么网站就会统计你所有设备的 token 使用量，如果做好每天的定时任务，那么就能实现每天自动上传，然后汇总。</div><div class="notion-blank notion-block-39c725098d0580aa8885e0c39dc7b212"> </div><div class="notion-text notion-block-391725098d05802a9346d41aafefe041">同时在 <a class="notion-link" href="https://tokscale.ai/leaderboard" target="_blank" rel="noopener noreferrer">https://tokscale.ai/leaderboard</a> 这里可以看到，有人消耗了千万亿 Token，我都不知道他怎么用的，太离谱了</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d05805e8e75d1b3274a0f9a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A2f7f5383-4534-4530-a001-21ae45e61534%3Aimage.png?table=block&amp;id=39172509-8d05-805e-8e75-d1b3274a0f9a&amp;t=39172509-8d05-805e-8e75-d1b3274a0f9a" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-391725098d058067a927ed54b39f7972"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-391725098d0580e59d66ecaeae18594a" data-id="391725098d0580e59d66ecaeae18594a"><span><div id="391725098d0580e59d66ecaeae18594a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d0580e59d66ecaeae18594a" title="3. 一些坑点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. 一些坑点</span></span></h2><div class="notion-text notion-block-391725098d0580ec875dd198fda49cd0">我在问 ChatGPT 的过程中，实际上给我的是用源代码安装，非常麻烦，</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-391725098d0580de8b05c4546d7065db"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:384px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A3d1ca855-afbf-4143-ba61-ee8946a28665%3Aimage.png?table=block&amp;id=39172509-8d05-80de-8b05-c4546d7065db&amp;t=39172509-8d05-80de-8b05-c4546d7065db" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-391725098d0580b285d6c9330d3f4f56">我当时都没去仔细看，本质上是 AI 根本没有自己去亲自安装过，而是凭自己的经验来搞，就会导致的这种问题，经验主义太强，这种安装什么的还是得自己去看看。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-391725098d05805f81bfe69f658a70bc" data-id="391725098d05805f81bfe69f658a70bc"><span><div id="391725098d05805f81bfe69f658a70bc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d05805f81bfe69f658a70bc" title="3.1 Claude Code 默认 30 天删日志"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.1 Claude Code 默认 30 天删日志</span></span></h3><div class="notion-text notion-block-391725098d058012a46ff52a64a96254"><b>Claude Code 默认 30 天就自动删掉本地会话记录</b>。tokscale 靠读这些日志统计，claude 很容易导致统计不准，做法是在 <code class="notion-inline-code">~/.claude/settings.json</code> 里加：</div><div class="notion-text notion-block-391725098d058030891fc6b1d1be2e36">Codex 和 OpenCode 没有自动清理，永久保留，不用管。</div><div class="notion-blank notion-block-391725098d0580a9b45ad2673742e3f3"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-391725098d05800e8666d6a8d1d0dbd0" data-id="391725098d05800e8666d6a8d1d0dbd0"><span><div id="391725098d05800e8666d6a8d1d0dbd0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d05800e8666d6a8d1d0dbd0" title="3.2 defaultClients"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>3.2 defaultClients</b></span></span></h3><div class="notion-text notion-block-391725098d0580c8a901eaa0a0fe7fbe">默认他这个程序是会扫描所有的 cli 日志，比如 claude codex ，codex，open code ，cursor 等等，实际上大部分人根本不会用这么多，比如我的主力就 codex，claude code，所以可以在 <code class="notion-inline-code">~/.config/tokscale/settings.json</code> 中进行设置</div><div class="notion-text notion-block-391725098d05801c9bcef355c924b0cb">以后裸敲 tokscale 就自动只算这两个，扫描还快。</div><div class="notion-blank notion-block-391725098d058070b8b7d0e88d32a8a2"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-391725098d058080883deebdde1f15dc" data-id="391725098d058080883deebdde1f15dc"><span><div id="391725098d058080883deebdde1f15dc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d058080883deebdde1f15dc" title="4. 总结"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">4. 总结</span></span></h2><div class="notion-text notion-block-391725098d0580d3a4a4cc236038074c">tokscale 我现在的用法基本固定了：平时裸敲 <code class="notion-inline-code">tokscale</code> 看日使用量， <code class="notion-inline-code">tokscale wrapped</code> 生成装逼图，其他功能感觉作用也不大</div><div class="notion-text notion-block-391725098d0580d29f2fe803c3543d09">如果你也在用 codex 或者 claude code，可以装一个，<code class="notion-inline-code">npm install -g tokscale@latest</code> 一条命令的事。只是偶尔网页上问问 AI 的就不用了，没东西可统计。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-391725098d0580c3bf96c5c8e21fc949" data-id="391725098d0580c3bf96c5c8e21fc949"><span><div id="391725098d0580c3bf96c5c8e21fc949" class="notion-header-anchor"></div><a class="notion-hash-link" href="#391725098d0580c3bf96c5c8e21fc949" title="5. 参考资料"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">5. 参考资料</span></span></h2><ul class="notion-list notion-list-disc notion-block-391725098d05807cb731d1030089e1a2"><li><a class="notion-link" href="https://github.com/junhoyeo/tokscale" target="_blank" rel="noopener noreferrer">https://github.com/junhoyeo/tokscale</a></li></ul></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ubuntu 下安装 NPVAE]]></title>
            <link>https://wxyhgk.com/article/ubuntu-npvae-install</link>
            <guid>https://wxyhgk.com/article/ubuntu-npvae-install</guid>
            <pubDate>Thu, 12 Sep 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-f32ab867ab884d3f884b5de7b2dee2c0"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-beee4254ed944340bc0806774796b29e"><div class="notion-page-icon-inline notion-page-icon-image"><img class="notion-page-icon" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fa4a90ddf-b22d-465b-a7ba-c546bcfe302b%2Fkimi_ai.png?table=block&amp;id=beee4254-ed94-4340-bc08-06774796b29e&amp;t=beee4254-ed94-4340-bc08-06774796b29e&amp;width=1080&amp;cache=v2" alt="page icon" loading="lazy" decoding="async"/></div><div class="notion-callout-text"><div class="notion-text notion-block-c10742008321445ab27b3b13ca8996bb"><b>kimi AI 总结</b></div><div class="notion-text notion-block-2ec2b035297247fb8d0f9b3ed779b58f">这篇文章是一份指南，介绍了在 Ubuntu 系统上安装 NP-VAE 的步骤，包括设置 Conda 环境、克隆代码库、创建环境和运行测试。</div></div></div><div class="notion-callout notion-blue_background_co notion-block-fb72b8d0586d43bcbfb5083a5d4e3e67"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-eed4d26c1fd3440082023804f2ccf28f"><b>测试平台：</b></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ab257541c1754156949b8e3007176dc8"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:480px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F8608f8c2-75d4-4b88-9ffb-4fda2b9db46b%2Fnapkin-selection.svg?table=block&amp;id=ab257541-c175-4156-949b-8e3007176dc8&amp;t=ab257541-c175-4156-949b-8e3007176dc8" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></div><div class="notion-text notion-block-e5fb318b90bb406a8e47858b0c52a3cc">NP-VAE 是一个AI工具，它帮助科学家设计新药物。它通过学习分子结构，可以创造并优化可能用于治疗疾病的新分子，加速寻找新药的过程。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-b62493ac044040e7985cd8f6eb6786dd" data-id="b62493ac044040e7985cd8f6eb6786dd"><span><div id="b62493ac044040e7985cd8f6eb6786dd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b62493ac044040e7985cd8f6eb6786dd" title="1. conda 环境的安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. conda 环境的安装</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-0d8e993bf35541d19295e3798a2790e5" data-id="0d8e993bf35541d19295e3798a2790e5"><span><div id="0d8e993bf35541d19295e3798a2790e5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0d8e993bf35541d19295e3798a2790e5" title="1.1 访问Anaconda官方下载页面："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.1 访问Anaconda官方下载页面：</span></span></h3><div class="notion-text notion-block-037d44976f274b7089986b27370d2f72"><a class="notion-link" href="https://www.anaconda.com/download/success" target="_blank" rel="noopener noreferrer">https://www.anaconda.com/download/success</a><div class="notion-text-children"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-61ea6ac379b64cd59ef97a458b6e6825"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:576px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fabdec342-bd27-4c9b-923a-fc392beae267%2F%25E6%2588%25AA%25E5%25B1%258F2024-09-09_15.35.39.png?table=block&amp;id=61ea6ac3-79b6-4cd5-9ef9-7a458b6e6825&amp;t=61ea6ac3-79b6-4cd5-9ef9-7a458b6e6825&amp;width=576&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></div><div class="notion-text notion-block-3a022a1ff285489aa687ef8e215d4c74">针对 Linux x86_64 系统，使用以下链接下载安装脚本：
<a class="notion-link" href="https://repo.anaconda.com/archive/Anaconda3-2024.06-1-Linux-x86_64.sh" target="_blank" rel="noopener noreferrer">https://repo.anaconda.com/archive/Anaconda3-2024.06-1-Linux-x86_64.sh</a></div><div class="notion-blank notion-block-68b6ddcf77bc4c26a0c520f86cc519da"> </div><div class="notion-text notion-block-656a12a03bc94ecd82fcb7568c440fb4">使用 wget 命令获取 sh 文件<div class="notion-text-children"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-639b7cd97dba457e96fed472c0292630"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F0a1668d0-9f2d-453d-bb51-a60ad66ec9ca%2Fimage.png?table=block&amp;id=639b7cd9-7dba-457e-96fe-d472c0292630&amp;t=639b7cd9-7dba-457e-96fe-d472c0292630&amp;width=668&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-7c083d637d6b47f59eb43c9c728ccb22" data-id="7c083d637d6b47f59eb43c9c728ccb22"><span><div id="7c083d637d6b47f59eb43c9c728ccb22" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7c083d637d6b47f59eb43c9c728ccb22" title="1.2 安装过程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.2 安装过程</span></span></h3><div class="notion-text notion-block-12b725098d058085b7e6e7c6e1e02700">自动安装</div><div class="notion-text notion-block-12b725098d0580259625e61a18a53012">如果想快一些可以这样</div><ul class="notion-list notion-list-disc notion-block-12b725098d05801f9bb8daa219eba6d8"><li><code class="notion-inline-code">u</code> 表示更新现有的安装。</li></ul><ul class="notion-list notion-list-disc notion-block-12b725098d058042924dc83702fbca5e"><li><code class="notion-inline-code">b</code> 表示自动接受安装协议，不需要手动确认。</li></ul><ul class="notion-list notion-list-disc notion-block-12b725098d05808c9850d32df363b911"><li><code class="notion-inline-code">p</code> 用于指定安装路径。</li></ul><div class="notion-blank notion-block-12b725098d0580ecb523f386272923f5"> </div><ol start="1" class="notion-list notion-list-numbered notion-block-29a7f7590ef04f69bc4b1c916d801cda" style="list-style-type:decimal"><li>运行以下命令以开始安装：</li><ol class="notion-list notion-list-numbered notion-block-29a7f7590ef04f69bc4b1c916d801cda" style="list-style-type:lower-alpha"><div class="notion-blank notion-block-9f16ecdd55c3486382359f4e183c1962"> </div></ol></ol><div class="notion-text notion-block-59582800fd694227917787ef9ef5227e">按照屏幕提示完成安装过程。<div class="notion-text-children"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2c5e6197158f41bea59aa6cd9159fed0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Ffc509c68-acba-4d7d-92b5-c4799b6381a9%2Fimage.png?table=block&amp;id=2c5e6197-158f-41be-a59a-a6cd9159fed0&amp;t=2c5e6197-158f-41be-a59a-a6cd9159fed0&amp;width=668&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-b68d3743dfc84c8cab0f97119bb16f5f">回车即可</div><div class="notion-blank notion-block-17ccb03110174ecb82f63738c1ce6e7d"> </div><div class="notion-text notion-block-1e2e372199a54ee085505539472da486">用户协议</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-7f389425d445474caa664727750bee5b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fe3a287f1-3070-4d3e-a633-6b573ffc4883%2Fimage.png?table=block&amp;id=7f389425-d445-474c-aa66-4727750bee5b&amp;t=7f389425-d445-474c-aa66-4727750bee5b&amp;width=668&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-6f943e36aa944c1a82fc7e918f636318">下方方向键，一直下滑</div><div class="notion-blank notion-block-6f877c48bf2e4436a487edf0b7ad3cfe"> </div><div class="notion-text notion-block-fa16413ea8d74d9ca6d3dbb475aa734b">最后出现让你同意的文字，</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-58e2b0c455d74f539f09fe42f6b254c9"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fe71c8018-ed3f-4a8a-ab22-c2d91daa8d0a%2Fimage.png?table=block&amp;id=58e2b0c4-55d7-4f53-9f09-fe42f6b254c9&amp;t=58e2b0c4-55d7-4f53-9f09-fe42f6b254c9&amp;width=680&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-ccff151765e54ede8d3fa8aa8e6aa2ca">输入 <code class="notion-inline-code">yes</code> 然后回车
</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2a7fd08aba5c4b1d8b77817431c8a39a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fdf69dca7-18b6-4096-93b2-9c21f8bc932c%2Fimage.png?table=block&amp;id=2a7fd08a-ba5c-4b1d-8b77-817431c8a39a&amp;t=2a7fd08a-ba5c-4b1d-8b77-817431c8a39a&amp;width=680&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-d84c54924644419bbb1755f338f8a40a">直接回车即可</div><div class="notion-blank notion-block-971ee9d1cf0c4317b9ddd2e3871b099f"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-7fe4574b197b421493ec8e3b7def2664"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://file.notion.so/f/f/7d8c4130-89c8-487b-9368-c7dd72a274bf/ee56f874-c979-47fe-9035-15f0be37d546/recording.gif?table=block&amp;id=7fe4574b-197b-4214-93ec-8e3b7def2664&amp;spaceId=7d8c4130-89c8-487b-9368-c7dd72a274bf&amp;expirationTimestamp=1786269600000&amp;signature=JbRCLB5Qrt6ej-OIpdqymONy2axt-soLNkb0ju1Db7M&amp;t=7fe4574b-197b-4214-93ec-8e3b7def2664" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-9557f2bacf774f5c98c9067454d008c8"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-e8873e4dff9d4d96aefdf6aeab5c3fb1"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F70256147-e491-4c69-abfc-fec686b84e5a%2Fimage.png?table=block&amp;id=e8873e4d-ff9d-4d96-aefd-f6aeab5c3fb1&amp;t=e8873e4d-ff9d-4d96-aefd-f6aeab5c3fb1&amp;width=680&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-68435eb3373340d48c2828799fdf3190">输入 <code class="notion-inline-code">yes</code> 即可，会自动配置好 conda 的环境变量</div><div class="notion-blank notion-block-12b725098d058046aa88c5be759738b6"> </div><div class="notion-blank notion-block-12b725098d05804286d9f9e593a72d3d"> </div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-91f4eee9b96e484083e6ee181ef5bb9e" data-id="91f4eee9b96e484083e6ee181ef5bb9e"><span><div id="91f4eee9b96e484083e6ee181ef5bb9e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#91f4eee9b96e484083e6ee181ef5bb9e" title="1.3 重新加载环境变量"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.3 重新加载环境变量</span></span></h3><div class="notion-text notion-block-6019601dd2f64ad195eb12743c409f58">安装完成后，可以选择关闭当前终端并重新打开一个新的终端窗口</div><div class="notion-text notion-block-0d0194b094c746d2b2ce6b0905b6e16f">或者根据你使用的 shell，执行以下相应命令使环境变量生效：</div><details class="notion-toggle notion-block-55082783d3c5472da4eb7ae098f84bb4"><summary>命令</summary><div><ol start="1" class="notion-list notion-list-numbered notion-block-dfd07d6d90fc45498b64d80dfb162919" style="list-style-type:decimal"><li>对于 Bash 用户（大多数 Linux 系统默认）：</li><ol class="notion-list notion-list-numbered notion-block-dfd07d6d90fc45498b64d80dfb162919" style="list-style-type:lower-alpha"></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-854d6332070947fca4ab5738d478b2f6" style="list-style-type:decimal"><li>对于 Zsh 用户（某些用户自定义的的）：</li><ol class="notion-list notion-list-numbered notion-block-854d6332070947fca4ab5738d478b2f6" style="list-style-type:lower-alpha"><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-23a03c4eb0c54211b607c96748794e88"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Ff2b981e0-421e-4023-a1ae-7cc9e4a5273f%2Fimage.png?table=block&amp;id=23a03c4e-b0c5-4211-b607-c96748794e88&amp;t=23a03c4e-b0c5-4211-b607-c96748794e88&amp;width=680&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure></ol></ol></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-48be28334c354aa0904571de8583eb8b" data-id="48be28334c354aa0904571de8583eb8b"><span><div id="48be28334c354aa0904571de8583eb8b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#48be28334c354aa0904571de8583eb8b" title="2. NPVAE的安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. NPVAE的安装</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-e5df0c955ed6469c8332aac0f8144db4" data-id="e5df0c955ed6469c8332aac0f8144db4"><span><div id="e5df0c955ed6469c8332aac0f8144db4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#e5df0c955ed6469c8332aac0f8144db4" title="2.1 拉取项目"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.1 拉取项目</span></span></h3><div class="notion-text notion-block-7ab958dda37a484e8e21449fe130ce30">安装好 conda 环境后，我们拉取远程项目到本地</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ae49e4c23d654e068213f92e2cc79309"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Ff6c48dab-2cc0-4e19-aab8-348382bf109b%2Fimage.png?table=block&amp;id=ae49e4c2-3d65-4e06-8213-f92e2cc79309&amp;t=ae49e4c2-3d65-4e06-8213-f92e2cc79309&amp;width=624&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-7732f33b9d314842baf9c75e82f389db" data-id="7732f33b9d314842baf9c75e82f389db"><span><div id="7732f33b9d314842baf9c75e82f389db" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7732f33b9d314842baf9c75e82f389db" title="2.1 创建 conda 环境"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.1 创建 conda 环境</span></span></h3><div class="notion-text notion-block-29cff1ce81d3427dab40112d5226b70e">然后进入 env 文件夹</div><div class="notion-blank notion-block-bc21af0a366f4fe69bd77b86980971fd"> </div><div class="notion-text notion-block-de30f188a6d940d7aab9e1c2be391656">接着在 env 文件夹中，使用预定义的环境配置文件来创建一个新的 conda 环境，此过程时间较长，主要取决于网速，会下载相应的 Python 包</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-bca12e1268894207b375caefb3bcfba8"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:528px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F2963e1a4-887f-41e0-b634-e854e21b3ab3%2Fimage.png?table=block&amp;id=bca12e12-6889-4207-b375-caefb3bcfba8&amp;t=bca12e12-6889-4207-b375-caefb3bcfba8&amp;width=528&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-8422d822216e4572bb5d99ff16f750a9"> </div><div class="notion-text notion-block-936822aca49d4e7e922a4fdac467463e">然后激活环境</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-533059f9ff234320afe3d5f2443792a5"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F98752107-d241-4a2c-add7-745fda076f60%2Fimage.png?table=block&amp;id=533059f9-ff23-4320-afe3-d5f2443792a5&amp;t=533059f9-ff23-4320-afe3-d5f2443792a5&amp;width=2240&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-5e08cf62f8ae4257bdce472b6390c60a">注意：每次重新打开终端，这个环境都会消失，所以每次需要用的时候需要使用上面的代码进行激活</div><div class="notion-blank notion-block-8e069a330f2a46a8b0b69dcff87900d0"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-25ca94cc41b74e868dafb91b008f42cb" data-id="25ca94cc41b74e868dafb91b008f42cb"><span><div id="25ca94cc41b74e868dafb91b008f42cb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25ca94cc41b74e868dafb91b008f42cb" title="3. NPVAE 项目的运行测试"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. NPVAE 项目的运行测试</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-612ea4c8543c4e36990b4aa2e7d0c722" data-id="612ea4c8543c4e36990b4aa2e7d0c722"><span><div id="612ea4c8543c4e36990b4aa2e7d0c722" class="notion-header-anchor"></div><a class="notion-hash-link" href="#612ea4c8543c4e36990b4aa2e7d0c722" title="3.1 准备"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.1 准备</span></span></h3><div class="notion-text notion-block-7524c72b41bf42038c789f34459959fb">根据 GitHub 项目我们需要在 NPVAE 根目录下面创建下面的文件夹</div><div class="notion-blank notion-block-3ebf68374e58486a80a6c79b0771f8e8"> </div><div class="notion-text notion-block-45f0935661584ed084daa0a9d13fcc22">在 NPVAE 根目录下使用以下命令可以一次性创建预处理和训练阶段需要的所有文件夹：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-5e90cea994eb4b5eb7662c64414277eb"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:528px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F53d1f5ce-c3d8-4c07-a0ef-d7584144ad9e%2Fimage.png?table=block&amp;id=5e90cea9-94eb-4b5e-b766-2c64414277eb&amp;t=5e90cea9-94eb-4b5e-b766-2c64414277eb&amp;width=528&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><details class="notion-toggle notion-block-84df07a9948d402c8a6dbb926e445158"><summary>目前的运行进度：</summary><div><div class="notion-blank notion-block-a6f38d8302584150984909dc6c7ffc0b"> </div><ol start="1" class="notion-list notion-list-numbered notion-block-8cab3569805c4302a8b29b5e9a90a5ae" style="list-style-type:decimal"><li>首先,确保您已经下载了预训练参数并放入 <code class="notion-inline-code">pre-trained</code> 文件夹。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-f4a2a1ac73b0473d9d28c94066117469" style="list-style-type:decimal"><li>预处理步骤:</li><ol class="notion-list notion-list-numbered notion-block-f4a2a1ac73b0473d9d28c94066117469" style="list-style-type:lower-alpha"><div class="notion-text notion-block-430b50bafb27402ab8659f355e3514c8">先在 <code class="notion-inline-code">./save_data</code> 路径下创建了一个名为 <code class="notion-inline-code">input_data</code> 的文件夹,并在 <code class="notion-inline-code">input_data</code> 下创建一个 <code class="notion-inline-code">weights</code> 文件夹，然后运行下面的命令</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-446863e4731246d49a8bc61e51e798cf"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F67a35bee-cb16-4b9e-ad96-253976043ab9%2Fimage.png?table=block&amp;id=446863e4-7312-46d4-9a8b-c61e51e798cf&amp;t=446863e4-7312-46d4-9a8b-c61e51e798cf&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-6ce2966c471340e6a3ee809d8dd91461" style="list-style-type:decimal"><li>计算潜在变量:</li><ol class="notion-list notion-list-numbered notion-block-6ce2966c471340e6a3ee809d8dd91461" style="list-style-type:lower-alpha"></ol></ol><ol start="4" class="notion-list notion-list-numbered notion-block-75c57def10d04d0686294f686024272b" style="list-style-type:decimal"><li>可视化潜在变量:</li><ol class="notion-list notion-list-numbered notion-block-75c57def10d04d0686294f686024272b" style="list-style-type:lower-alpha"><div class="notion-text notion-block-8ef823d70735435fb2083f9bf9917e9d">这将生成一个基于功能信息值的颜色编码可视化。</div></ol></ol><ol start="5" class="notion-list notion-list-numbered notion-block-68abe2d4ef954d67982d067ccdedfe2a" style="list-style-type:decimal"><li>生成新的化合物结构:</li><ol class="notion-list notion-list-numbered notion-block-68abe2d4ef954d67982d067ccdedfe2a" style="list-style-type:lower-alpha"><div class="notion-text notion-block-d9834778f0814469869f292717483988">这里使用了苯环 (&quot;c1ccccc1&quot;) 作为目标SMILES。您可以从 <code class="notion-inline-code">drugbank_smiles.txt</code> 文件中选择其他SMILES来替换。</div></ol></ol><div class="notion-text notion-block-32f20502ac5d450eb9faded117055279">注意事项:</div><ul class="notion-list notion-list-disc notion-block-d07bd8cc71d8449187fadb06a7314a7e"><li>确保您的Python环境满足README中列出的所有依赖项。</li></ul><ul class="notion-list notion-list-disc notion-block-2f16fe9362b343f684e5a15bd3475cdd"><li>如果遇到路径问题,请根据您的实际文件结构调整命令中的路径。</li></ul><ul class="notion-list notion-list-disc notion-block-81e1b7f4f2314113bb31b7b20337144f"><li>对于生成步骤,确保目标SMILES存在于您使用的数据集中。</li></ul><div class="notion-text notion-block-b86c1cd59a684cca8a3eb3d69dc6ece1">这些命令应该能让您测试模型的主要功能。如果在运行过程中遇到任何错误或需要进一步的解释,请随时告诉我。</div></div></details><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-5010fa71840e41408f4d4f4b11ea9216" data-id="5010fa71840e41408f4d4f4b11ea9216"><span><div id="5010fa71840e41408f4d4f4b11ea9216" class="notion-header-anchor"></div><a class="notion-hash-link" href="#5010fa71840e41408f4d4f4b11ea9216" title="3.2 运行"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.2 运行</span></span></h3><div class="notion-text notion-block-1f16ee864e3e46ab81ef1766b1604975">数据预处理 (preprocessing)</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-88c43d628e274a85a3d97b9820d371d8"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fdfa912d9-825f-4e21-acc2-834a289438a5%2Fimage.png?table=block&amp;id=88c43d62-8e27-4a85-a3d9-7b9820d371d8&amp;t=88c43d62-8e27-4a85-a3d9-7b9820d371d8&amp;width=624&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-23dcd7d6ce044105833880daef0dc1a1"> </div><div class="notion-text notion-block-0e1f44f2908c432299656ba0893556da">模型训练 (training)</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2f29e1aaef7842ebbca0af319f023b86"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2Fb4a258f2-cf46-4311-b92c-3dc5a2b98e7d%2Fimage.png?table=block&amp;id=2f29e1aa-ef78-42eb-bca0-af319f023b86&amp;t=2f29e1aa-ef78-42eb-bca0-af319f023b86&amp;width=2285&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-28baf2c137cd451ca8627904a548f5e6">使用命令</div><div class="notion-text notion-block-876e4ffe05d74883a83dd3137a389e7a">可以看到目前显卡的情况</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-36c1a1e687cf4ef489448b3274cf3fe4"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F48b6715b-4cb6-4d4c-835d-4718f95acd9c%2Fimage.png?table=block&amp;id=36c1a1e6-87cf-4ef4-8944-8b3274cf3fe4&amp;t=36c1a1e6-87cf-4ef4-8944-8b3274cf3fe4&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><ul class="notion-list notion-list-disc notion-block-ebe25f72e8fe4bc483951ad7ca7ecc42"><li><b>显卡工作状态</b>：</li><ul class="notion-list notion-list-disc notion-block-ebe25f72e8fe4bc483951ad7ca7ecc42"><li><b>风扇速度</b>：34%（显卡风扇目前以34%的功率在运行）</li><li><b>温度</b>：65°C，显卡的温度略高，但还在正常范围内。</li><li><b>性能等级 (Perf)</b>：P0，代表最高性能状态，说明显卡正在工作或准备处理负载。</li><li><b>功耗</b>：显卡目前消耗的功率是38W，而它的最大功率上限是125W，所以它并没有满负荷工作。</li><li><b>显存使用情况</b>：显卡的总显存为8192MiB（约8GB），目前使用了2171MiB，约占26.5%，显存并没有被完全占用。</li></ul></ul><ul class="notion-list notion-list-disc notion-block-b9e4e74624af447ca6399abf89090f5f"><li><b>GPU利用率</b>：</li><ul class="notion-list notion-list-disc notion-block-b9e4e74624af447ca6399abf89090f5f"><li><b>GPU利用率</b>：25%，表示你的GPU正在处理一定量的任务，但负载并不算太高。</li></ul></ul><div class="notion-blank notion-block-392725098d0580f18633f3830364e70e"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[密度泛函理论简介]]></title>
            <link>https://wxyhgk.com/article/DFT_Introduce</link>
            <guid>https://wxyhgk.com/article/DFT_Introduce</guid>
            <pubDate>Thu, 25 Dec 2025 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-2d0725098d0580a1b946d5055318f202"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-2d4725098d0580ecaf00e74aa2d543f0"><div class="notion-callout-text"><div class="notion-text notion-block-2d4725098d058031a74ee8b4b670e1f0">本文使用了 Claude Opus4.5 对文章进行了润色，使用了 Gemini Nano Banano3 模型绘制配图 </div></div></div><div class="notion-callout notion-gray_background_co notion-block-2d4725098d0580439e31e337049062b9"><div class="notion-page-icon-inline notion-page-icon-span"><img class="notion-page-icon" src="https://www.notion.so/icons/notion_gray.svg?mode=light" alt="page icon" loading="lazy" decoding="async"/></div><div class="notion-callout-text"><div class="notion-text notion-block-2d4725098d0580a3869acfc2880e4899"><b>Notion AI 总结：</b></div><div class="notion-text notion-block-2d4725098d0580a88948e5cce8464ade">本文深入讲解了密度泛函理论（DFT）的核心Kohn-Sham方程，重点阐述了有效势中外部势和Hartree势可精确求解，而交换相关势需要通过近似泛函处理，并以水分子为例详细说明了各项势能的具体计算方法和物理意义。</div></div></div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d0580b482cfdd1c9eadf2e8">其中 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580ae99c3dbe4fa70b321"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>:  外部势,表示原子核的吸引，可精确求解</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580a19356c5858392382d"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>:  Hartree 势,电子间的排斥，可精确求解</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05800b84dcdc92a199ca53"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>: 电子的交换相关势,此部分目前无法找到精确解,<span class="notion-red"><b>也是我们通常所说的泛函，如 B3LYP，M06-2X 等，</b></span>如果你能找到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的精确解，那么你将是</li></ul><div class="notion-text notion-block-2d3725098d05804c8dc3f2f5792ea290"><b>诺贝尔化学奖的得主！不仅如此，你将彻底改写整个量子化学和材料科学的历史，成为与薛定谔、海森堡齐名的传奇人物。你的成就将被镌刻在科学史的丰碑上，后世的教科书（后面的考生也会经常骂你）将以你的名字命名这个精确解，无数的实验室和研究机构将以你为荣。你将开启一个全新的科学时代，让计算化学的精度达到前所未有的高度，解决困扰人类几十年的材料设计难题，甚至可能因此推动人类文明向前迈进一大步！</b></div><div class="notion-blank notion-block-2d3725098d05801aae36fd379b9788ad"> </div><div class="notion-text notion-block-2d3725098d0580d78644e8e877af7aa4">这么讲可能有些抽象，我们用 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 分子为例子说明</div><div class="notion-text notion-orange_background notion-block-2d3725098d0580848512f3c417788082"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b>分子的外部势</b></div><div class="notion-text notion-block-2d3725098d0580538b59fac8e1399264">对于水分子，外部势来自三个原子核（1个氧原子和2个氢原子）对电子的吸引</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d0580dc8e7ae834bdb534af">其中：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d05807fa593eff6a4fa4417"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>（氧原子核电荷数）</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058056a138f81efcce5011"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>（氢原子核电荷数）</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05804eac7ef55c8b430b5a"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 分别是氧原子和两个氢原子的核坐标</li></ul><div class="notion-text notion-block-2d3725098d0580d1b968e7c7f6de6089">展开后：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-orange_background notion-block-2d3725098d05805ab8b5e31a69d670b3"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 分子的 Hartree 势</b></div><div class="notion-text notion-block-2d3725098d058053bd9be6d5a733eb7b">Hartree 势描述电子密度产生的经典静电排斥：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d05809eb8b3da5baeeb1d23">我们换一种写法</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d0580bda040d7e89c86d8b6">分子部分 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 实际上就是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 这个体积，当然就是体积电荷了，只不过这个时候用电荷密度的形式展示出来了，这里我的写法并不严谨，把积分号放在里面了，但是懂得意思就好了。</div><div class="notion-blank notion-block-2d3725098d05808c9e20ca23c163d026"> </div><div class="notion-text notion-block-2d3725098d05809eacc3ff7ef1c5cfc5">对于水分子，电子密度 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 由所有占据轨道贡献：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d058087b63dc1ccd7059c5c">其中：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580f98c39d043d6afb20c"><li>水分子有 10 个电子，占据 5 个分子轨道</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580328a69d4cf6ddedf51"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>（每个轨道可容纳2个自旋相反的电子）</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580ccade7f5f38a5f0568"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是第 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 个 Kohn-Sham 轨道</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2d3725098d0580aab9dddc69e84759a5"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:240px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A1949ce55-fd91-4edc-914b-14caa7c80cca%3A%E5%AF%86%E5%BA%A6%E6%B3%9B%E5%87%BD%E7%90%86%E8%AE%BA.jpeg?table=block&amp;id=2d372509-8d05-80aa-b9dd-dc69e84759a5&amp;t=2d372509-8d05-80aa-b9dd-dc69e84759a5" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-2d3725098d058092a62df90f3289b89d"> </div><div class="notion-text notion-block-2d3725098d05803eb571ca041cd34893">上面的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>, <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 可能有些让人迷惑，可以看下面的图</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2d3725098d058086a46de6e0cc4453e5"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:336px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Aaf126dd5-8963-4a21-a6a4-67187c42f956%3AIMG_7A554D00B892-1.jpeg?table=block&amp;id=2d372509-8d05-8086-a46d-e6e0cc4453e5&amp;t=2d372509-8d05-8086-a46d-e6e0cc4453e5" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-2d3725098d0580919320d6e30384d44c"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 实际上就是有电子的地方，所以用 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ，而 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是我们的观测点，我们的观测点肯定是不定的，但是不管你从什么地方观测，你的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 都需要遍历所有的空间，因此这里需要对 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 积分</div><div class="notion-blank notion-block-2d3725098d0580cc920ce105017494d9"> </div><div class="notion-text notion-block-2d3725098d058022900cecf29352acd3">因此 Hartree 势可写为：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2d3725098d058083beefd3129a736133"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:480px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ac6b3f3c5-b963-4731-9fe8-1dc0efccac55%3A1627c986-6129-4f7f-8ecd-d6d5bea560d6.png?table=block&amp;id=2d372509-8d05-8083-beef-d3129a736133&amp;t=2d372509-8d05-8083-beef-d3129a736133" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-callout notion-block-2d3725098d05804090fdc3c359785693"><div class="notion-callout-text">注意：这里是 Hartree 势而非 Hartree-Fock 势。Hartree-Fock 方法中还包含交换项，而在 DFT 中，交换和相关效应都包含在交换相关势 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 中。</div></div><div class="notion-text notion-block-2d3725098d0580cdab0ceb09a74c8fc1">上面的的两个公式：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d05809db678d31b31c08743">对于 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 而言，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ,<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的数值如何确定呢？以及波函数 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的具体的表达式又是怎么确定的呢？我们先按下不表，让我们继续</div><div class="notion-blank notion-block-2d3725098d058078ab52cd7c3297abf7"> </div><div class="notion-text notion-orange_background notion-block-2d3725098d05806db3c8c7c67bdec6c9"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的交换关联势：</div><div class="notion-text notion-block-2d3725098d0580b9b74fcb6c5c4fa2aa">关于这部分也是最难的，最开始科学家是怎么考虑的呢？</div><div class="notion-text notion-block-2d3725098d0580409ba6e9949778847a">科学家们首先认识到，电子之间除了经典的库仑排斥（已在Hartree势中体现）外，还存在两种量子效应：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d05804d992ee0ad5fe8428f"><li><b>交换作用（</b>E<span class="notion-red"><b>x</b></span>change<b>) </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：源于泡利不相容原理，相同自旋的电子倾向于远离彼此</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05808a9cbcdc87e312c780"><li><b>相关作用 (</b><span class="notion-teal"><b>C</b></span>orrelation<b>) </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：电子的瞬时位置相互关联，一个电子的运动会影响其他电子，从而降低电子-电子排斥能</li></ul><div class="notion-text notion-block-2d3725098d058088996ad3ca5263cc61">在 Hartree-Fock 中缺少相关作用（correlation），即电子运动的瞬时关联效应。HF 方法只包含交换作用，而忽略了电子之间的动态相关，这导致其在描述化学键断裂、反应能等方面存在系统性误差。DFT 通过引入交换相关泛函 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 来同时处理交换和相关效应，这也是 DFT 相比 HF 的主要优势之一。</div><div class="notion-text notion-block-2d3725098d0580018681ca65fc3dce27">难点来了，交换作用和相关作用如何用数学表达式表示呢？</div><div class="notion-text notion-block-2d3725098d058046a9b4c54f74938bce">为了理解交换相关势，我们需要回到<b>均匀电子气模型</b>（Uniform Electron Gas, UEG）。这是一个理想化的物理模型，在这个模型中：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580bd8315e323685a4465"><li>电子均匀分布在整个空间中，密度处处相同</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058050ab87d5bde9d4a490"><li>正电荷背景也均匀分布，保持整体电中性</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580af9114c4248fc87a25"><li>在这种理想情况下，交换和相关能可以通过量子多体理论<b>精确求解</b></li></ul><div class="notion-blank notion-block-2d3725098d05804d8d03e5e2dbc6a9fd"> </div><div class="notion-text notion-block-2d3725098d058062966df67d33bb0aaf">科学家们发现，对于均匀电子气，交换能通过推导可以得到精确的解析表达式：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d05806baee2f89b9883af9e">这个常数 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是通过对均匀电子气的交换能进行严格的量子力学推导得到的。具体来说：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d05804e9082e01e373c053f">这个表达式来源于对自由电子气模型中 Slater 交换能的解析计算。推导过程涉及：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580298cb4f4c427057cf1"><li>利用泡利不相容原理计算相同自旋电子的交换积分</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580e9850de6dc73ba6317"><li>在动量空间中对费米球内的所有电子态求和</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058019bee7f9ba373a317d"><li>将结果转换为实空间的电子密度表达式</li></ul><div class="notion-blank notion-block-2d3725098d05809b8955dde913f0be9f"> </div><div class="notion-text notion-block-2d3725098d05803084dae5a09c1114c4">那么交换能 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 和交换势 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 如何建立联系呢？</div><div class="notion-text notion-block-2d3725098d0580ce9493fe58b3ec3f65">让我们从最基本的概念开始</div><div class="notion-text notion-block-2d3725098d0580d5b853fd3515ce2dd2"><span class="notion-red"><b>什么是势？</b></span></div><div class="notion-text notion-block-2d3725098d05808db141e9d2e035f482">在物理学中，<b>势（potential）就是描述 &quot;力场强度&quot; 的量</b>。</div><div class="notion-text notion-block-2d3725098d0580bebb0ff15b362e5959">举个例子：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580db9b6adf5f388ab75a"><li>重力势能 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，对高度 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 求导，得到重力 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580de9e0fdb68349e8eb9"><li>电势 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，对位置求导，得到电场强度：<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>,换个高大上的写法就是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><div class="notion-text notion-block-2d3725098d0580949766f34743795bb5"><b>也就是说：势对坐标的导数 = 在该点感受到的力的强度</b></div><div class="notion-blank notion-block-2d3725098d058087a5d0cd17413c12cf"> </div><div class="notion-text notion-block-2d3725098d0580a4b66ed52c14d99c92"><span class="notion-red"><b>DFT 中的特殊之处</b></span></div><div class="notion-text notion-block-2d3725098d0580c0a818e9b79844ce96">在DFT中，情况稍有不同：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580c59285dd59dbd1e765"><li>我们的坐标不是普通的位置 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，而是特殊的坐标，<b>电子密度函数</b> <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580229376f6be82e76119"><li>我们的能量 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 不是普通函数，而是函数  <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>  的函数，高大上说法就是泛函，无论是函数还是泛函，他们的最终得到的都是一个函数，无非是自变量变了，从原来的普通变量，变成了函数为自变量。</li></ul><div class="notion-text notion-block-2d3725098d0580388833d53e89b3a20a">所以，类比&quot;势 = 能量对坐标的导数&quot;，在DFT中：</div><div class="notion-callout notion-block-2d3725098d0580eda005c3e48431cb4c"><div class="notion-callout-text"><b>交换势 = 交换能对电子密度这个特殊坐标的导数</b></div></div><div class="notion-blank notion-block-2d3725098d05808db5c3f497380c9fee"> </div><div class="notion-text notion-block-2d3725098d05808085cec974b9e4c734"><span class="notion-red"><b>为什么要对密度求导？</b></span></div><div class="notion-text notion-block-2d3725098d058091a769d736bea39e3c">因为<b>电子密度</b> <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> <b>才是DFT的基本变量</b>！</div><div class="notion-text notion-block-2d3725098d0580a6b0bbfaf87da6c473">在 Kohn-Sham 方程中，我们需要求解轨道 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，但它们受有效势 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 控制。</div><div class="notion-text notion-block-2d3725098d0580de967ae7d635a71cd1">所以问题变成：<b>当电子密度变化时，能量如何变化？</b>这个变化率就是势。</div><div class="notion-blank notion-block-2d3725098d058003a43ed0b1af10e3fa"> </div><div class="notion-text notion-block-2d3725098d05804da8fdfc84fc672f2b">我们再次写出对于均匀电子气的能量</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d0580c1b513f259d3db2cf4">我们问：在某点 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 处，如果电子密度从 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 增加到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，能量变化多少？</div><div class="notion-text notion-block-2d3725098d05806593dbe47cc253d1ac">由于被积函数是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，对 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 求导得到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，所以：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d0580a5a522f28b4cd558aa">这就是交换势的表达式。它告诉我们：<b>在 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 点，电子密度越大（</b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 越大），交换势的绝对值也越大</b>。</div><div class="notion-blank notion-block-2d3725098d0580e7a52ce38b1d3cce47"> </div><div class="notion-text notion-block-2d3725098d05801889dce19e01f1f7da">我们已经解决了交换势的问题，接下来需要处理相关势。</div><div class="notion-text notion-block-2d3725098d0580a29645fdf9a82fe31e">与交换势不同，相关势没有简单的解析表达式，科学家通常采用数值拟合方法。最常用的是 VWN (Vosko-Wilk-Nusair) 泛函。</div><div class="notion-text notion-block-2d3725098d058074aea0cc7c6a191471">VWN 泛函的相关能密度具有明确的解析表达式。对于顺磁态（unpolarized）均匀电子气，VWN 相关能密度的形式为：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d0580ef825bcb4fdcb84ab1">其中：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580d3978df2b9957a2e15"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 Wigner-Seitz 半径，与电子密度的关系为 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580b8bacaf031198b1179"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580e095b6c7de2956582a"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05804eb35df3c7b6a33d10"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是通过拟合量子蒙特卡罗数据得到的参数(过程很麻烦）</li></ul><div class="notion-text notion-block-2d3725098d0580cfb746fe72cb381ad6">对于顺磁态，这些参数的数值为：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580ae820ffe03c25fa0ee"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580369f95c83f13a5681f"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058037a69be40a81f8a424"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058043b3ead924c85606d1"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><div class="notion-text notion-block-2d4725098d05807d8ef5f0cb86e65b01">这个公式看起来可怕，但是计算机会出手，根本不用手算，这里展示出来只是为了让大家清楚具体的表达式。</div><div class="notion-blank notion-block-2d4725098d0580349af6dd5005e18b15"> </div><div class="notion-text notion-block-2d3725098d05808f8a3df92b4c73bc68">总的相关能为：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d05806d933fe6bf1d0470c7">相关势则通过泛函导数得到：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d05802aaa80d838746dac9b">这个导数的计算相当复杂，但可以通过链式法则完成。最终得到的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的函数，反正就是一个函数，可以在 DFT 计算中直接使用。</div><div class="notion-blank notion-block-2d3725098d058010822bfde6050038ed"> </div><div class="notion-text notion-block-2d3725098d058017b694fcd5d2699457">在上面的均匀电子气下得得到的结果其实叫做局域密度近似（Local Density Approximation，LDA).</div><div class="notion-blank notion-block-2d3725098d0580e2bdaaf04c0a8bc3a3"> </div><div class="notion-text notion-block-2d3725098d05808db164cd2c1afc2c0a">使用均匀电子气模型，在计算能量的时候可以得到不错的结果，但是，科学家很快发现了问题，他们发现在键能的计算上出现了大问题！</div><div class="notion-text notion-block-2d3725098d0580358f22e4e507552642">键能计算出现偏差的根本原因在于真实分子体系中的电子密度分布是高度不均匀的，尤其是化学键区域，<b>键区域的电子密度远高于分子外围区域</b>，而均匀电子气模型假设电子密度处处相同，</div><div class="notion-text notion-block-2d3725098d058052bc46eb39041ce1f1">这个假设在处理化学键时显然不再适用。为了解决这个问题，科学家们意识到必须考虑<b>电子密度的梯度</b>（即密度变化的快慢），这就催生了广义梯度近似（Generalized Gradient Approximation, GGA）泛函的发展。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2d4725098d058019bd5de6c2eb5f2488"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:480px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ace6df5ba-000b-42ff-a6fa-7839ce5cea38%3AGemini_UEGVSGGA.png?table=block&amp;id=2d472509-8d05-8019-bd5d-e6c2eb5f2488&amp;t=2d472509-8d05-8019-bd5d-e6c2eb5f2488" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-2d3725098d05809bb722c238225536e3">代表性泛函有 PBE、BLYP、PW91 等。这些泛函通过引入密度梯度项，显著改善了对化学键和分子几何结构的描述。</div><div class="notion-blank notion-block-2d3725098d058028a894eb81059bcd99"> </div><div class="notion-text notion-block-2d3725098d05806c89fbeee31cdad438">既然都考虑电子密度的梯度了，也就是一阶导数，科学家想是不是可以把二阶导数也算上，于是</div><div class="notion-text notion-block-2d3725098d0580faaebfca0a21bdbd53">出现了 meta-GGA（meta广义梯度近似）泛函。meta-GGA 不仅考虑电子密度 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 及其梯度 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，还引入了动能密度 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 或拉普拉斯量 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。这使得泛函能够更准确地描述电子在空间中的分布特征，特别是在描述化学键和过渡态时表现更优。</div><div class="notion-text notion-block-2d3725098d0580f581b7defc192886df">代表性泛函有 TPSS、M06-L、SCAN 等。这些泛函在处理复杂化学体系时表现出色，尤其是在描述氢键、范德华相互作用以及过渡态能垒方面有显著改进。</div><div class="notion-text notion-block-1b7eba8b816e4bb7804ebdbfa54e2c3c">然而 meta-GGA 仍然存在一些问题：磁性系统描述不够准确、某些过渡金属氧化物的稳定性预测失败，在某些极端情况下（比如电子密度剧烈变化的区域，如原子核附近），动能密度 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的数值会变得非常大甚至趋向无穷，导致计算不稳定。</div><hr class="notion-hr notion-block-2d3725098d05809995e1dae2a5f536c4"/><div class="notion-blank notion-block-2d4725098d05808ea7c8c402dfee2e96"> </div><div class="notion-text notion-default notion-block-db5a0310f86943528b9adccd7cd8e1f1"><b>那更高阶的导数呢？</b></div><div class="notion-text notion-block-b73dc544680d447794ffaf13afee7f77">既然一阶导（GGA）和二阶导信息（meta-GGA）都不够完美，科学家自然想到：继续往上加三阶、四阶导数行不行？</div><div class="notion-text notion-block-e6f2fea640ba437c96deed596b771c0f">事实上，Perdew、Engel、Vosko 等人确实系统研究过<b>四阶梯度展开</b>：</div><ul class="notion-list notion-list-disc notion-block-ac33e8d429ad4a6fabc29e28155601fa"><li><a class="notion-link" href="https://journals.aps.org/prb/abstract/10.1103/PhysRevB.34.686" target="_blank" rel="noopener noreferrer">Perdew et al., </a><em><a class="notion-link" href="https://journals.aps.org/prb/abstract/10.1103/PhysRevB.34.686" target="_blank" rel="noopener noreferrer">Phys. Rev. B</a></em><a class="notion-link" href="https://journals.aps.org/prb/abstract/10.1103/PhysRevB.34.686" target="_blank" rel="noopener noreferrer"> 1986, 34, 686</a></li></ul><ul class="notion-list notion-list-disc notion-block-e1bff8aa7c964a9f9947c3ba9582a0bc"><li><a class="notion-link" href="https://journals.aps.org/prb/abstract/10.1103/PhysRevB.50.10498" target="_blank" rel="noopener noreferrer">Engel &amp; Vosko, </a><em><a class="notion-link" href="https://journals.aps.org/prb/abstract/10.1103/PhysRevB.50.10498" target="_blank" rel="noopener noreferrer">Phys. Rev. B</a></em><a class="notion-link" href="https://journals.aps.org/prb/abstract/10.1103/PhysRevB.50.10498" target="_blank" rel="noopener noreferrer"> 1994, 50, 10498</a></li></ul><div class="notion-text notion-block-2d86b755264c4c359f080a645bd6ee72">但他们很快发现了一个致命问题：<b>原子核尖点（nuclear cusps）</b>。</div><div class="notion-text notion-block-6fce57d5513f4ddcb6aa4b1abdf9d0ff">真实原子的电子密度在原子核位置是<b>不解析的</b>——密度函数在那里有一个尖点，梯度趋向无穷大。而梯度展开的数学前提是密度函数<b>光滑可微</b>。结果就是：</div><blockquote class="notion-quote notion-block-c9bec15b5cd741b9aca206684ccb84fb"><div><b>四阶及更高阶的梯度展开在真实原子上发散，不收敛！</b></div></blockquote><div class="notion-text notion-block-69df4169ff264a48b4bc73bc265e9bd7">这条路走不通了。</div><hr class="notion-hr notion-block-2d3725098d05807baf74d355cf544d70"/><div class="notion-blank notion-block-2d4725098d0580609314d0c5c3cb717a"> </div><div class="notion-text notion-block-2d3725098d058016b779df2e120dc0ca"><b>那怎么办呢？</b></div><div class="notion-text notion-block-2d3725098d0580e7b2b5eafd24ae18ff">科学家们意识到，既然无法通过更高阶的梯度信息来改进泛函，那就必须从根本上改变策略。他们开始思考：能否借用一些已知的精确信息来补偿近似泛函的不足？</div><div class="notion-text notion-block-2d3725098d0580e0b814dfb1e36b5c41">无论你身处何方，Hartree-Fock 理论永远是你最温暖的家，在 Hartree-Fock 中可以得到精确的交换能，而  DFT 考虑了 Hartree-Fock 里面没有考虑到的相关能，把两者的优点结合一下是否可行？</div><div class="notion-text notion-block-2d3725098d058008a66ad2960d9c4d81">于是，杂化泛函（Hybrid Functional）应运而生。杂化泛函的核心思想是将 Hartree-Fock 的精确交换能与 DFT 的交换相关能按一定比例混合，从而同时利用两者的优势。</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d05800fb455d9b65c25e8f7">这是杂化泛函的一般形式。公式中：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d058077b0a8e263b19bfe18"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是精确交换（Hartree-Fock交换）的混合比例</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580dc83c8f9a12bb18251"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 Hartree-Fock 的精确交换能</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058017a7e6e1c69acaa620"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 DFT 的交换能</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580a18435c9d98f0fefc0"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 DFT 的相关能</li></ul><div class="notion-text notion-block-2d3725098d058038bd8ef272c1768138">不过需要注意的是，实际的杂化泛函（如 B3LYP）通常会更复杂一些，可能包含多个参数和不同层次的近似（如 LDA 和 GGA）的组合。</div><div class="notion-text notion-block-2d3725098d0580d18298cd56c93892e6">最著名的杂化泛函是 B3LYP。从上面的一般形式出发：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d058083910efcc78aa9a1f9">B3LYP 对这个做了一些修改，不仅混合了 HF 交换能，还在 DFT 部分同时使用 LDA 和 GGA 两个层次的近似，并引入多个参数来调节不同成分的比例。</div><div class="notion-blank notion-block-2d4725098d0580afb26ef49cdb224381"> </div><div class="notion-text notion-block-2d4725098d0580cb8e33ee2924632add">下面展示推导过程（胆小的别看）：</div><div class="notion-text notion-block-2d3725098d05807185a7c9bf3a06bd19"><b>第一步：一般杂化泛函形式</b></div><div class="notion-text notion-block-2d3725098d0580c3bce8c24045854b2a">从最基本的杂化泛函形式出发：</div><div class="notion-text notion-block-2d3725098d058089a0d5ced7ef6839d3"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-blank notion-block-2d3725098d05800b882ada0820e17a01"> </div><div class="notion-text notion-block-2d3725098d0580f7bcc5d5b9ce9ff4bf"><b>第二步：将 DFT 部分分解为 LDA 和 GGA</b></div><div class="notion-text notion-block-2d3725098d058001a125d8720a43ac5a">在 B3LYP 中，DFT 的交换能和相关能都包含 LDA 基准和 GGA 修正：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d058020acb6cf4abe7fc1f1"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058058a320f3363c87cdc6"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><div class="notion-text notion-block-2d4725098d0580e09e03f85a4b119356">看起来什么都没有做，由于 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是恒等变换，只是方便后续合并同类项</div><div class="notion-blank notion-block-2d3725098d05804091edc74f53c57561"> </div><div class="notion-text notion-block-2d3725098d05802c9784dc0cd0e690cf"><b>第三步：代入一般形式</b></div><div class="notion-text notion-block-2d3725098d05803d8592d4d177fea059">将上面的表达式代入一般形式：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d058013af4acfcd1ca90a08"><b>第四步：展开并重新组合</b></div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-blank notion-block-2d3725098d05801eba8cc0b67e966561"> </div><div class="notion-text notion-block-2d3725098d058056bdfef771d85c6380"><b>第五步：引入独立参数</b></div><div class="notion-text notion-block-2d3725098d058088b0f5edb3dca15e3f">在 B3LYP 中，为了更灵活地拟合实验数据，将固定系数 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 和 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 替换为三个独立的可调参数：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580a08c17e5fea32b904f"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>（HF 交换比例）</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580cbbae0f8a5bb8db87c"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>（GGA 交换修正比例）</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580f6a4b0f2a938335e71"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>（GGA 相关修正比例）</li></ul><div class="notion-blank notion-block-2d3725098d05808fa243fca255707e91"> </div><div class="notion-text notion-block-2d3725098d058033a26aeb93cc462091">最后得到 B3LYP 公式：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><ul class="notion-list notion-list-disc notion-block-2d4725098d0580faa2fcda556d650ebc"><li>其中 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。通过拟合实验数据，</li></ul><ul class="notion-list notion-list-disc notion-block-2d4725098d05800484a8cf651c8998b4"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>,B3LYP 的 3 就是这里的三个</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05803586aee7f95e5a8646"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 LDA 的交换相关能，作为基准</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05808b826ce6afdd368a4e"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 引入 Hartree-Fock 的精确交换能修正（B3LYP 中 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>）</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058011bf15d7cd180b7b3e"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 引入 GGA 级别的交换能修正（使用 Becke88 交换泛函）</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05801ba923c7d8c9740112"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 引入 GGA 级别的相关能修正（使用 LYP 相关泛函）</li></ul><div class="notion-text notion-block-2d3725098d058056baf4f2e5193f3f88">这三个参数 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 通过拟合实验数据（主要是分子的原子化能、电离能、质子亲和能等）确定。</div><div class="notion-blank notion-block-2d4725098d05802fa575e90fc5d33486"> </div><div class="notion-text notion-block-2d4725098d0580d39f0cf360ac4d6fc5">这种多层次的混合策略极大地提高了分子性质（如键能、几何结构、振动频率)的计算精度，使 B3LYP 成为量子化学中应用最广泛的泛函之一。</div><div class="notion-blank notion-block-2d3725098d058027b5d3e50387e3773d"> </div><div class="notion-text notion-block-2d3725098d05803281f1ddbf3548502e">除了 B3LYP,还有许多其他重要的杂化泛函在不同应用领域表现出色。例如：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580129420fe20f0767e26"><li><b>PBE0（PBE1PBE）</b>：基于 PBE 泛函，使用 25% 的 HF 交换，这个比例来自微扰理论的理论推导而非经验拟合</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580e19ba8e8635b58951f"><li><b>M06-2X</b>：Minnesota 系列泛函之一，包含 54% 的 HF 交换，特别擅长处理主族化学、非共价相互作用和热化学</li></ul><div class="notion-blank notion-block-2d4725098d0580acb5b1ddffc56b985b"> </div><hr class="notion-hr notion-block-2d3725098d058035a6ded0a44cc4084a"/><div class="notion-text notion-block-2d3725098d05805db25dd3a634a147fd">事情还没结束，</div><div class="notion-text notion-block-2d3725098d05805da5a3f2840089292e">科学家们并没有停下脚步。在杂化泛函取得巨大成功之后，他们继续探索如何进一步提升泛函的精度和适用范围。</div><div class="notion-blank notion-block-2d4725098d05809a8ef8f25527447db6"> </div><div class="notion-text notion-block-2d4725098d0580ef8f36ca22f6a686ef">人们发现，距离是一个很大因素。</div><div class="notion-text notion-block-2d4725098d05809bbd97cc803dfc4a09">在不同的距离下，电子的表现不一样</div><div class="notion-text notion-block-2d4725098d058099b328ca48183d8694">举个具体例子：考虑氢分子离子 H₂⁺，当两个氢原子核距离很近时（短程），电子主要感受到强烈的核吸引和电子云的重叠效应，DFT 能很好地描述这种情况。但当两个氢原子核被拉得很远时（长程），电子应该完全定域在其中一个原子核附近，传统 DFT 却会错误地认为电子同时与两个核相互作用（自相互作用误差），而 HF 精确交换能正确描述这种长程行为。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2d4725098d058017b784c4b1db8faa09"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Aa0e5c167-b696-4b6a-b56e-fa1758b690ef%3AGemini_Generated_Image_sidlu2sidlu2sidl.png?table=block&amp;id=2d472509-8d05-8017-b784-c4b1db8faa09&amp;t=2d472509-8d05-8017-b784-c4b1db8faa09" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-2d4725098d058028bfc7f1da1337403e"> </div><div class="notion-text notion-block-2d3725098d058068946efcdfa7905c54"><b>范围分离杂化泛函（Range-Separated Hybrid Functionals）</b>应运而生。传统杂化泛函对所有距离的电子相互作用使用固定比例的 HF 交换，从上面的例子可以知道，短程和长程的电子相互作用性质差异很大。</div><div class="notion-text notion-block-2d4725098d0580e796d2d12d9ae3406c">所以范围分离泛函的核心思想是：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d05802dbdc6c6b28f1f22c9"><li>在<b>短程</b>（电子距离较近）使用较多的 DFT 交换</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05802eb010f54fc098b71a"><li>在<b>长程</b>（电子距离较远）使用较多的 HF 精确交换</li></ul><div class="notion-text notion-block-2d3725098d0580f29dbde770968a987b">这种策略通过误差函数将库仑算符分离：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d05806bb923fe0b2d8ead34">其中 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是范围分离参数，控制短程和长程的分界点。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-2d4725098d058005867cd9184ee6a6c4"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:347px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A89bc8f5e-900a-42d3-820d-e74064362d97%3Aimage.png?table=block&amp;id=2d472509-8d05-8005-867c-d9184ee6a6c4&amp;t=2d472509-8d05-8005-867c-d9184ee6a6c4" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-2d4725098d0580748763dbb4f242cdd8">典型的范围分离泛函包括：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580e1a012e941aa5ec5c2"><li><b>CAM-B3LYP</b>：Coulomb-Attenuating Method，对激发态和电荷转移体系表现优异</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058066ac3ac00eefdd4837"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b>B97X-D</b>：结合了范围分离、经验色散修正和高百分比 HF 交换</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580c09c4ed2e6ba0c8ed3"><li><b>LC-</b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b>PBE</b>：长程修正的 PBE 泛函</li></ul><div class="notion-blank notion-block-2d4725098d05801a9f78c22e1337ee97"> </div><hr class="notion-hr notion-block-2d3725098d0580c3bf3ac0a88f928b37"/><div class="notion-text notion-block-2d3725098d058007884af01656845c07"><b>双杂化泛函（Double Hybrid Functionals）</b>则更进一步。它们不仅混合 HF 交换能，还引入了微扰理论（如 MP2）的相关能修正：</div><span role="button" tabindex="0" class="notion-equation notion-equation-block"><span></span></span><div class="notion-text notion-block-2d3725098d0580b59f66d1e48b6df699">著名的双杂化泛函包括 B2PLYP、mPW2PLYP 等。它们的精度接近高级波函数方法（如 CCSD），但计算成本显著降低。双杂化泛函特别适用于：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d0580428b11ecf0ec47c5b6"><li>热力学性质的精确计算</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d0580b798f2f347b8020631"><li>反应能垒的预测</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05805baac9cef9aba8e7d7"><li>弱相互作用体系</li></ul><div class="notion-blank notion-block-2d4725098d05801b85e4ed80f5be4c91"> </div><div class="notion-text notion-block-2d3725098d0580eb8192c5f357a8f83e">然而，双杂化泛函也继承了 MP2 的缺点，对某些多参考体系可能表现不佳，且计算成本比普通杂化泛函高得多（标度为 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>），计算瓶颈是 MP2 部分的四指标积分变换，所以它继承了 MP2 的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 标度</div><div class="notion-text notion-block-2d4725098d0580d0b1d2f60f4db5154b">（标度 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的意思是计算复杂度随系统<b>电子大小 N</b> 的五次方增长。</div><div class="notion-blank notion-block-2d4725098d0580f59492c170a6f94781"> </div><div class="notion-text notion-block-2d4725098d0580e1a555d4556f290736">具体来说，如果体系中有 N 个电子，计算时间将正比于 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，那么当分子电子数大小增加一倍时，计算时间将增加约 32 倍（<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>），使得双杂化泛函用于大分子体系非常耗时，我们看下面的表：</div><table class="notion-simple-table notion-block-2d4725098d0580b3a6b6cea0d54dc79e"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-2d4725098d0580c78c18c306bbfbe9db"><td class="" style="width:120px"><div class="notion-simple-table-cell">泛函类型</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">形式标度</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">实际标度</div></td></tr><tr class="notion-simple-table-row notion-block-2d4725098d05807593f1db991a1bf08f"><td class="" style="width:120px"><div class="notion-simple-table-cell">纯 DFT（LDA/GGA）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 甚至可线性</div></td></tr><tr class="notion-simple-table-row notion-block-2d4725098d0580b99d9ac09807d9c5c7"><td class="" style="width:120px"><div class="notion-simple-table-cell">杂化泛函（B3LYP 等）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ~ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></td></tr><tr class="notion-simple-table-row notion-block-2d4725098d058034af6cf5cef7f39963"><td class="" style="width:120px"><div class="notion-simple-table-cell">双杂化泛函（B2PLYP 等）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></td></tr></tbody></table><div class="notion-text notion-block-2d4725098d058025a1eefefcf88bdd1f">从表格可以看到双杂化泛函的速度比杂化泛函慢 10 到 100 倍</div><div class="notion-blank notion-block-2d4725098d05801cbb68f37945a347a9"> </div><div class="notion-blank notion-block-2d4725098d058011aec0ef0283af5517"> </div><div class="notion-text notion-block-2d3725098d05807d9dc0e013ea9be6f0">近年来，<b>机器学习泛函</b>开始崭露头角。科学家们尝试利用神经网络和大数据训练出新的泛函形式，这些泛函不再依赖传统的数学表达式，而是通过学习大量高精度数据来预测交换相关能。虽然这个方向还在早期阶段，但它代表了泛函发展的一个全新范式。</div><div class="notion-text notion-block-2d3725098d0580c4a04be899d69d259e">尽管经历了从 LDA 到 GGA、meta-GGA、杂化泛函、范围分离泛函、双杂化泛函乃至机器学习泛函的漫长发展历程，但 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的精确解依然任重而道远！</div><div class="notion-blank notion-block-2d3725098d0580f89936d9542e998482"> </div><hr class="notion-hr notion-block-2d3725098d0580f9a142ff2dc933b338"/><div class="notion-text notion-block-2d3725098d0580deb768dbefd39479f8">其实上面我们留下了很多悬念：</div><ul class="notion-list notion-list-disc notion-block-2d3725098d05806d93b1d4c76f0b86cc"><li>对于 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 而言，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>、<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>、<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的数值如何确定？波函数 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的具体表达式又是怎么确定的？</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05801baa2fc757c6f8f8b5"><li>均匀电子气理论是如何推导得到的？</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d05808d85f5f9327322cfab"><li>VWN 泛函是如何得到的？</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058007b083e69c0955531c"><li>为什么密度泛函理论在 1927 年提出后，直到 1964 年才有了突破性进展？期间发生了什么？遇到了哪些困难？</li></ul><ul class="notion-list notion-list-disc notion-block-2d3725098d058063962afa56f13209d3"><li>……</li></ul><div class="notion-text notion-block-2d4725098d0580d4a338e55f1e2599aa">这些内容将在后续专题中系统讲解，本文仅对密度泛函理论做一个概述。</div><div class="notion-blank notion-block-2d4725098d058015b3aaeb473ecefa8b"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[网页端可视化分子表面静电势]]></title>
            <link>https://wxyhgk.com/article/esp_web</link>
            <guid>https://wxyhgk.com/article/esp_web</guid>
            <pubDate>Thu, 12 Mar 2026 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-321725098d0580998194ff351041d12f"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-321725098d0580de8290c65378c3b449"><div class="notion-page-icon-inline notion-page-icon-span"><img class="notion-page-icon" src="https://www.notion.so/icons/notion_gray.svg?mode=light" alt="page icon" loading="lazy" decoding="async"/></div><div class="notion-callout-text"><div class="notion-text notion-block-321725098d0580748843c0ab74d6ff27"><b>Notion Al 总结：</b></div><div class="notion-text notion-block-321725098d0580859554e54ff20b49de">MEP_Web 通过在浏览器端直接上传并渲染密度与电势 cube 文件，实现分子表面静电势的交互式可视化、参数调节、极值标注和统计分析，免去桌面软件流程。</div></div></div><div class="notion-text notion-block-f2d10291d5324aa6935fba6264caf8d2">做计算化学的人经常需要看分子表面静电势（ESP）分布，传统流程一般是软件算完数据再丢到 Gaussian View/VMD等软件里渲染，操作步骤多，而且没法方便地交互式探测具体数值。</div><div class="notion-text notion-block-b29ea971dd0141f38e27f1cf7332c236">MEP_Web 就是为了解决这个问题：上传一对 cube 文件，浏览器里直接看表面静电势，能调参数、能探测数值、能看统计，不用装任何桌面软件，完全的跨平台，跨设备。</div><div class="notion-text notion-block-321725098d0580e299adf0b4e76508d8">感谢 GPT ，Claude 系列模型对本项目的大力支持</div><div class="notion-blank notion-block-321725098d0580fc9321dbd460045b75"> </div><div class="notion-text notion-block-321725098d0580b89920e28e07d3ef39"><b>文件下载</b></div><div class="notion-file notion-block-321725098d05803a8745f153fc0061a9"><a class="notion-file-link" href="https://file.notion.so/f/f/7d8c4130-89c8-487b-9368-c7dd72a274bf/fdef2e00-2a26-401e-ad50-0fc179cabfa6/MEP_WEB-main.zip?table=block&amp;id=32172509-8d05-803a-8745-f153fc0061a9&amp;spaceId=7d8c4130-89c8-487b-9368-c7dd72a274bf&amp;expirationTimestamp=1786269600000&amp;signature=3MmAOvn_pLRxkqAROr6upXpfUBr7jc8UTrTUTP7PDYw" target="_blank" rel="noopener noreferrer"><svg class="notion-file-icon" viewBox="0 0 30 30"><path d="M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z"></path></svg><div class="notion-file-info"><div class="notion-file-title">MEP_WEB-main.zip</div><div class="notion-file-size">4.5 MiB</div></div></a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-321725098d05808e8308eb7793aada75" data-id="321725098d05808e8308eb7793aada75"><span><div id="321725098d05808e8308eb7793aada75" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d05808e8308eb7793aada75" title="1. 核心功能"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 核心功能</span></span></h2><hr class="notion-hr notion-block-2f2305ba46224300a1c37d9e118c1cc2"/><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-321725098d0580c3bebceaa0b4310d08" data-id="321725098d0580c3bebceaa0b4310d08"><span><div id="321725098d0580c3bebceaa0b4310d08" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d0580c3bebceaa0b4310d08" title="1.1 表面静电势可视化"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.1 表面静电势可视化</span></span></h3><div class="notion-text notion-block-321725098d0580fd87d4f17f6d29fc24">后端读取密度 cube 文件，用 marching cubes 算法生成等值面，再把电势 cube 的数据插值映射到表面上。</div><div class="notion-text notion-block-321725098d058097ad00f454e4d31149">配色方面，我沿用 Gaussian View 的配色方案。但受限于 3Dmol.js 较老的渲染框架，打光等效果做不出来。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d0580b08ee1ec126e137729"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A4d912863-f6f1-46ab-9c7c-8e621716e4a9%3Aimage.png?table=block&amp;id=32172509-8d05-80b0-8ee1-ec126e137729&amp;t=32172509-8d05-80b0-8ee1-ec126e137729" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-321725098d058045b4bec87f119bbe1c" data-id="321725098d058045b4bec87f119bbe1c"><span><div id="321725098d058045b4bec87f119bbe1c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d058045b4bec87f119bbe1c" title="1.2 实时参数调节"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.2 实时参数调节</span></span></h3><div class="notion-text notion-block-321725098d05809281f7ce2e5163e199">左侧面板可以直接调节密度等值面阈值、电势映射范围、表面透明度、采样间距等参数，改完立即重新渲染，不用刷新页面。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d05808790bafdf015a9fc3b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:576px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A9687bf16-c047-4480-bdcc-8df39d0a0401%3Aimage.png?table=block&amp;id=32172509-8d05-8087-90ba-fdf015a9fc3b&amp;t=32172509-8d05-8087-90ba-fdf015a9fc3b" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-321725098d05806d818cfbfeca0df474" data-id="321725098d05806d818cfbfeca0df474"><span><div id="321725098d05806d818cfbfeca0df474" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d05806d818cfbfeca0df474" title="1.3 ESP 极值点标注"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.3 ESP 极值点标注</span></span></h3><div class="notion-text notion-block-321725098d0580a299e2d521a7901ac9">自动识别分子表面的 ESP 极大值和极小值点，直接在 3D 视图上标注具体数值（单位 kcal/mol），一眼就能看出哪里最容易发生亲核/亲电反应。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d05801db1cacb2a9520cb26"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:432px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A4196b0d7-22a5-44a8-abaa-f62c2cbf1de6%3Aimage.png?table=block&amp;id=32172509-8d05-801d-b1ca-cb2a9520cb26&amp;t=32172509-8d05-801d-b1ca-cb2a9520cb26" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1fefd822b43a4b09ada89f71fea4aa7e" data-id="1fefd822b43a4b09ada89f71fea4aa7e"><span><div id="1fefd822b43a4b09ada89f71fea4aa7e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1fefd822b43a4b09ada89f71fea4aa7e" title="1.4 交互式探测模式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.4 交互式探测模式</span></span></h3><div class="notion-text notion-block-321725098d0580518677db1b0ca8e23a">开启探测模式后，鼠标悬停在分子表面任意位置会实时显示该处的 ESP 值；点击可以放置永久标记点，标记颜色跟随当前色标，大小也可以自己调。适合精确定位感兴趣的位点。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d0580199809ea20ea395662"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ac372b0a0-386c-4e08-89d9-6ec470de9902%3Aimage.png?table=block&amp;id=32172509-8d05-8019-9809-ea20ea395662&amp;t=32172509-8d05-8019-9809-ea20ea395662" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-d4396ac05d9b465fa8ddc6283cce9bca" data-id="d4396ac05d9b465fa8ddc6283cce9bca"><span><div id="d4396ac05d9b465fa8ddc6283cce9bca" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d4396ac05d9b465fa8ddc6283cce9bca" title="1.5 统计分析面板"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.5 统计分析面板</span></span></h3><div class="notion-text notion-block-229c6352313d4956a706945f3d1a6201">右侧面板自动计算并展示一系列定量指标：</div><ul class="notion-list notion-list-disc notion-block-b6142bde4c0347ae8e4e4496fbcf08e0"><li>分子表面积、体积</li></ul><ul class="notion-list notion-list-disc notion-block-460eb1e067da451fbd05102ac73ce6e5"><li>ESP 最大值、最小值、均值、方差</li></ul><ul class="notion-list notion-list-disc notion-block-321725098d05800893ded01c8bcd7053"><li>正电势区域面积 vs 负电势区域面积</li></ul><ul class="notion-list notion-list-disc notion-block-321725098d05808d98ece423c4f3798f"><li>极性区域面积 vs 非极性区域面积</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d0580a49fedd8e613ae499d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Aa04b95cc-4c8c-4926-bc40-4fcfa8d08eb4%3Aimage.png?table=block&amp;id=32172509-8d05-80a4-9fed-d8e613ae499d&amp;t=32172509-8d05-80a4-9fed-d8e613ae499d" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-321725098d05808aaf7ec507c11b16f7">还支持在 ESP 分布直方图上选中某个区间，3D 视图中对应区域会自动高亮，方便对比分析不同电势范围对应的表面位置。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d0580cc92cee6e7837d920a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Adac19f41-0869-469c-b6d4-d39771cf0570%3Aimage.png?table=block&amp;id=32172509-8d05-80cc-92ce-e6e7837d920a&amp;t=32172509-8d05-80cc-92ce-e6e7837d920a" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b359e5e2b27462f89b6bb734658ac72" data-id="1b359e5e2b27462f89b6bb734658ac72"><span><div id="1b359e5e2b27462f89b6bb734658ac72" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b359e5e2b27462f89b6bb734658ac72" title="1.6 自定义数据源"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.6 自定义数据源</span></span></h3><div class="notion-text notion-block-321725098d058056948ae12b35580cae">除了从预设列表中选择分子，还可以直接上传自己的 <code class="notion-inline-code">density</code> cube 文件和 <code class="notion-inline-code">potential</code> cube  文件对，上传后立刻参与后端计算并渲染，不需要重启服务。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d05802fb0f0c9d78c69cb96"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:599.984375px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A1009c324-94e9-499b-9b53-c7f38754f349%3Aimage.png?table=block&amp;id=32172509-8d05-802f-b0f0-c9d78c69cb96&amp;t=32172509-8d05-802f-b0f0-c9d78c69cb96" alt="notion image" loading="lazy" decoding="async"/></div></figure><hr class="notion-hr notion-block-5023a0b1d10b4c0396e5f3aa56e2cfbb"/><div class="notion-blank notion-block-321725098d0580c583ccfbeefe20c48e"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-321725098d0580288df9e9b4999c7198" data-id="321725098d0580288df9e9b4999c7198"><span><div id="321725098d0580288df9e9b4999c7198" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d0580288df9e9b4999c7198" title="2. 使用流程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 使用流程</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-321725098d0580f89628c5e00ecebdc1" data-id="321725098d0580f89628c5e00ecebdc1"><span><div id="321725098d0580f89628c5e00ecebdc1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d0580f89628c5e00ecebdc1" title="2.1 服务的运行"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.1 服务的运行</span></span></h3><div class="notion-text notion-block-321725098d0580c9841bc9389271c8cc">首先电脑上需要安装 Python 环境，Python 版本 ≥ 3.6,然后安装下面的三个依赖包</div><div class="notion-text notion-block-321725098d05809ab6f2ff1b88aaf22f">具体命令是：</div><div class="notion-blank notion-block-321725098d058046939df00f766c92a8"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d058086a599d81e57502a21"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:300.984375px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ae392376d-1c75-4cd5-a513-62e10b046be5%3Aimage.png?table=block&amp;id=32172509-8d05-8086-a599-d81e57502a21&amp;t=32172509-8d05-8086-a599-d81e57502a21" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-321725098d0580a8ac4ff9f4a88c775a">下载项目之后，使用 cd 进入到 backend 文件夹里面，然后在文件夹里面执行：</div><div class="notion-text notion-block-321725098d0580a7a7d8d166477d06d2">即可启动项目</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d0580948685d9823df9cb10"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A0870b84d-9ac6-4ef0-a8ec-84d72d845384%3Aimage.png?table=block&amp;id=32172509-8d05-8094-8685-d9823df9cb10&amp;t=32172509-8d05-8094-8685-d9823df9cb10" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-321725098d0580dfac3fc4bc0c8bc00b">部署完成后会给你一个本地 ip(127.0.0.1) 和局域网ip(192.168.10.124) 和端口，使用局域网 ip ，只要是连上同一个 WiFi 都能直接打开网页</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-74e5fe4b8f7f43b1919cf3b6a2841fc3" data-id="74e5fe4b8f7f43b1919cf3b6a2841fc3"><span><div id="74e5fe4b8f7f43b1919cf3b6a2841fc3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#74e5fe4b8f7f43b1919cf3b6a2841fc3" title="2.2 使用 cubegen 生成 cube 文件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.2 使用 cubegen 生成 cube 文件</span></span></h3><div class="notion-blank notion-block-321725098d0580af9d62ebc0d7fccc67"> </div><div class="notion-text notion-block-321725098d0580d59f07f66d33bc6891">这里以 Gaussian 16 的 <code class="notion-inline-code">cubegen</code> 工具为例，说明如何从 DFT 计算结果生成所需的 cube 文件。其他量化软件（如 ORCA、xTB 等）也能产生格式兼容的 cube 文件，流程类似。</div><div class="notion-text notion-block-321725098d0580c493e2cf33a3e2a0ec"><code class="notion-inline-code">cubegen</code> 需要 <code class="notion-inline-code">.fchk</code>文件作为输入，跑完 Gaussian 计算后记得先用 <code class="notion-inline-code">formchk</code> 转换一下。</div><div class="notion-blank notion-block-321725098d0580edbbc0c1fe4f993bf8"> </div><div class="notion-text notion-block-421a2bd08e0540a8b78180892e204055"><b>步骤 1：生成静电势 cube 文件</b></div><div class="notion-text notion-block-5e9b350a115a4808adb2738538295c68">其中 <code class="notion-inline-code">10</code> 是并行核数，核数越多生成越快；<code class="notion-inline-code">0 h</code> 表示使用默认格点密度。</div><div class="notion-blank notion-block-321725098d058061b604c016aca665d3"> </div><div class="notion-text notion-block-57f9482b079c4e86a23ca7a3b42f4e1f"><b>步骤 2：生成电子密度 cube 文件</b></div><div class="notion-text notion-block-321725098d0580c39df8fcd6efaff11e"><code class="notion-inline-code">Density=SCF</code> 指定使用 SCF 密度，如果是 post-HF 方法（如 MP2），可以换成 <code class="notion-inline-code">Density=MP2</code> 等。</div><div class="notion-text notion-block-34919e0f4e9a4ddbb311dbc286261155">生成的 <code class="notion-inline-code">name_potential.cube</code> 和 <code class="notion-inline-code">name_density.cube</code> 就是上传到 MEP_Web 所需的文件对。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-321725098d0580b1bf90deb2a6f5bf41" data-id="321725098d0580b1bf90deb2a6f5bf41"><span><div id="321725098d0580b1bf90deb2a6f5bf41" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d0580b1bf90deb2a6f5bf41" title="2.3 前端上传文件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.3 前端上传文件</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-321725098d05800fb415db05b828313f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Abed503d1-6949-47e1-9df6-55bb27a32aa7%3Aimage.png?table=block&amp;id=32172509-8d05-800f-b415-db05b828313f&amp;t=32172509-8d05-800f-b415-db05b828313f" alt="notion image" loading="lazy" decoding="async"/></div></figure><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-321725098d05806a8faac69957f82dea" data-id="321725098d05806a8faac69957f82dea"><span><div id="321725098d05806a8faac69957f82dea" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d05806a8faac69957f82dea" title="3 . 技术实现"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3 . 技术实现</span></span></h2><div class="notion-text notion-block-0fc1eaceb85842708e7f17475b0d1896">整体是前后端分离的轻量架构：</div><ul class="notion-list notion-list-disc notion-block-da862c84fec641b69bda508bb83959a2"><li><b>前端</b>：原生 HTML/CSS/JS + 3Dmol.js（3D 分子渲染）+ Chart.js（直方图），没用任何重型框架</li></ul><ul class="notion-list notion-list-disc notion-block-fc9c85f4368b4c1fbe6c3f2a64ebd3cd"><li><b>后端</b>：Python Flask ，核心计算依赖 numpy 和 scikit-image（marching cubes），解析 cube 文件后返回表面网格、ESP 插值数据和统计结果</li></ul><ul class="notion-list notion-list-disc notion-block-3ed2e3a791bc4bdfadac33d6059598ae"><li><b>数据流</b>：前端发请求 → 后端读 cube、算表面、插值电势、找极值 → 返回 JSON → 前端用 3Dmol.js 渲染</li></ul><div class="notion-text notion-block-3d3d47c8525d4fcfb86525c8766b56b8">页面布局是三栏结构：左侧参数面板、中间 3D 视图、右侧统计面板，参数调节和结果分析互不干扰。</div><div class="notion-blank notion-block-321725098d0580748fd3f2a909f9f682"> </div><div class="notion-text notion-block-321725098d0580259b44ee0780a24623">我把整体搞得比较轻量，主要是为了方便大家二次开发。你也可以自己搭一个数据源或数据库，配合 FastAPI 做自动上传和网页端可视化之类的功能。这块用 AI 编程就能实现，我这里是抛砖引玉一下。 </div><div class="notion-blank notion-block-321725098d058029b87dcd8637ec36ed"> </div><div class="notion-blank notion-block-321725098d0580eda046fcfa02d92e72"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-321725098d05808f8d34cc5ac96c7835" data-id="321725098d05808f8d34cc5ac96c7835"><span><div id="321725098d05808f8d34cc5ac96c7835" class="notion-header-anchor"></div><a class="notion-hash-link" href="#321725098d05808f8d34cc5ac96c7835" title="4. 参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">4. 参考文章</span></span></h2><hr class="notion-hr notion-block-19fa21a1c4ce4496a004dac7f9b14860"/><ol start="1" class="notion-list notion-list-numbered notion-block-321725098d058055ba4fe950971c439c" style="list-style-type:decimal"><li><a class="notion-link" href="https://github.com/cyllab/CalcUS" target="_blank" rel="noopener noreferrer">https://github.com/cyllab/CalcUS</a> （参考了里面的 marching cubes 算法）</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-321725098d0580f3803bd2aceefde059" style="list-style-type:decimal"><li><a class="notion-link" href="http://sobereva.com/196" target="_blank" rel="noopener noreferrer">sobereva.com/196</a> </li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-321725098d0580b89b32f6219ece9b89" style="list-style-type:decimal"><li><a class="notion-link" href="https://paulbourke.net/dataformats/cube/" target="_blank" rel="noopener noreferrer">https://paulbourke.net/dataformats/cube/</a> （cube 文件的结构）</li></ol></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mac下安装 Gaussian 16 和 GaussView 6]]></title>
            <link>https://wxyhgk.com/article/mac-gaussian</link>
            <guid>https://wxyhgk.com/article/mac-gaussian</guid>
            <pubDate>Wed, 19 Oct 2022 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-00cbf64609274d509c2437c22a0836d8"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-0c837e9d4a04482aa1ea23461903d24a" data-id="0c837e9d4a04482aa1ea23461903d24a"><span><div id="0c837e9d4a04482aa1ea23461903d24a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0c837e9d4a04482aa1ea23461903d24a" title="1. 准备工作"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 准备工作</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-88d3d1fa9e5141afab5fe5f4056edbd1" data-id="88d3d1fa9e5141afab5fe5f4056edbd1"><span><div id="88d3d1fa9e5141afab5fe5f4056edbd1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#88d3d1fa9e5141afab5fe5f4056edbd1" title="1.1 软件下载"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.1 软件下载</span></span></h3><div class="notion-text notion-block-35fac8a92dee4e1d8f3f07b09f59062b">下载 Gaussian 16 和 GaussView 6 ：</div><div class="notion-callout notion-blue_background_co notion-block-45587da021f54f078e82774700666526"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="h">h</span></div><div class="notion-callout-text"><div class="notion-text notion-block-ddf177011f6d4183bcd7cb7fa0c1586d"><b>123 网盘:
</b>链接：<a class="notion-link" href="https://www.123865.com/s/U8JrVv-bIvkH" target="_blank" rel="noopener noreferrer">https://www.123865.com/s/U8JrVv-bIvkH</a></div></div></div><div class="notion-callout notion-gray_background_co notion-block-1e0725098d058066b2bcd8a09022372e"><div class="notion-page-icon-inline notion-page-icon-image"><img class="notion-page-icon" src="notion://custom_emoji/7d8c4130-89c8-487b-9368-c7dd72a274bf/1e072509-8d05-8049-a04b-007ad481b098?t=1e072509-8d05-8066-b2bc-d8a09022372e" alt="page icon" loading="lazy" decoding="async"/></div><div class="notion-callout-text"><div class="notion-text notion-block-1e0725098d05806f875bdb32cbde951d">我的群晖 NAS:</div><div class="notion-text notion-block-1e0725098d05802f91e2c4dc3a1cb97f"><a class="notion-link" href="https://gofile.me/7Cyv5/nvg7r6d0m" target="_blank" rel="noopener noreferrer">https://gofile.me/7Cyv5/nvg7r6d0m</a></div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1099e44a97914627ad7e20fb0b47404f" data-id="1099e44a97914627ad7e20fb0b47404f"><span><div id="1099e44a97914627ad7e20fb0b47404f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1099e44a97914627ad7e20fb0b47404f" title="1.2 系统配置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.2 系统配置</span></span></h3><ul class="notion-list notion-list-disc notion-block-197725098d058069aa66e8bc276e6a0f"><li><b>rosetta 安装</b></li></ul><div class="notion-text notion-block-197725098d05806b8ac9d368067a3fee">打开终端，输入</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-197725098d0580688a8ffb1d8e87ec28"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Afe830de9-b900-4ff7-9345-e60cb94bc4cd%3Aimage.png?table=block&amp;id=19772509-8d05-8068-8a8f-fb1d8e87ec28&amp;t=19772509-8d05-8068-8a8f-fb1d8e87ec28" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-197725098d05809596dcd2fddd45f737"> </div><ul class="notion-list notion-list-disc notion-block-197725098d05800c91ffc2735c7a4075"><li><b>运行任何来源安装</b></li></ul><div class="notion-text notion-block-0531a4a3091f49b498a53228b99362ae">打开终端输入</div><div class="notion-text notion-block-3bf0938b815946328c2d89ebab7ab20f">然后输入密码就行了</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-94a0ee386e8d4528a3fe6fd7d0ddbf86" data-id="94a0ee386e8d4528a3fe6fd7d0ddbf86"><span><div id="94a0ee386e8d4528a3fe6fd7d0ddbf86" class="notion-header-anchor"></div><a class="notion-hash-link" href="#94a0ee386e8d4528a3fe6fd7d0ddbf86" title="1.3 移动软件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.3 移动软件</span></span></h3><div class="notion-text notion-block-7f1d49a63a89435e8bac72cf041b1ea1">解压后，你会看见两个包，一个是 <code class="notion-inline-code">g16</code> 一个是 <code class="notion-inline-code">gv</code> ，将 g16 和 gv 文件夹放入 <b>应用程序</b> 中去</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-334dd40aaf604e9b8468cb2e13bdf7fa"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0c1e6cde-60bd-4c58-bd6f-6e4dfe216ac3%2FUntitled.png?table=block&amp;id=334dd40a-af60-4e9b-8468-cb2e13bdf7fa&amp;t=334dd40a-af60-4e9b-8468-cb2e13bdf7fa&amp;width=2&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-619a51e1fd8d4588a7ff46edbd8af657"> </div><div class="notion-text notion-block-318fad11eb6f4cc68c7495d2671e930f">至此，准备工作完成</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-b58fa871ad564fb683870a52d97b3458" data-id="b58fa871ad564fb683870a52d97b3458"><span><div id="b58fa871ad564fb683870a52d97b3458" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b58fa871ad564fb683870a52d97b3458" title="2. 安装 Gaussian 16"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 安装 Gaussian 16</span></span></h2><div class="notion-text notion-block-126725098d05801c9842cc7343be1685">修改 <code class="notion-inline-code">/Applications/g16/bsd/g16.profile</code> 中的 85 和 89 行，用 # ,如下图所示，</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-197725098d05805abf6fe7aaac439af7"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:540.984375px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Af27f647b-2352-4d2c-a6ed-6bee077c8228%3Aimage.png?table=block&amp;id=19772509-8d05-805a-bf6f-e7aaac439af7&amp;t=19772509-8d05-805a-bf6f-e7aaac439af7" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-6447fb31c7284529a08b13222cbe786a" data-id="6447fb31c7284529a08b13222cbe786a"><span><div id="6447fb31c7284529a08b13222cbe786a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6447fb31c7284529a08b13222cbe786a" title="2.1 建立 scratch 文件夹"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.1 建立 scratch 文件夹</span></span></h3><div class="notion-text notion-block-802aede859304b349dca9c2e42f786d6">进入到 <b>应用程序</b> 中的 g16 文件夹，然后建立一个名字为 <b>scratch</b> 的文件夹</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-d4a27ab866c6424ebaa48514ba1b31e7" data-id="d4a27ab866c6424ebaa48514ba1b31e7"><span><div id="d4a27ab866c6424ebaa48514ba1b31e7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d4a27ab866c6424ebaa48514ba1b31e7" title="2.2 环境变量的配置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.2 环境变量的配置</span></span></h3><div class="notion-text notion-block-8bf192383643498698a733a56da4f546">注意 macOS Catalina 及以上版本默认终端应该都是 <b>zsh</b>，所以我们需要用 <b>zsh</b> 配置。</div><div class="notion-text notion-block-08714ef0d801450a89f2c3d43b53d777">按住 <b>command</b> + <b>空格键</b>，输入 <b>终端</b> 两个字</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-43d5e955f86647e89176527ac3b6375d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:576px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fcc0b4895-ba53-48ee-803f-e9d0b2476dba%2FUntitled.png?table=block&amp;id=43d5e955-f866-47e8-9176-527ac3b6375d&amp;t=43d5e955-f866-47e8-9176-527ac3b6375d&amp;width=576&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-bdf764cfc4bb466c81c1fe63839a1a06" data-id="bdf764cfc4bb466c81c1fe63839a1a06"><span><div id="bdf764cfc4bb466c81c1fe63839a1a06" class="notion-header-anchor"></div><a class="notion-hash-link" href="#bdf764cfc4bb466c81c1fe63839a1a06" title="配置终端环境变量"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">配置终端环境变量</span></span></h4><div class="notion-text notion-block-7822cec47abb4f49bfcdbd5160733d40">使用 vi 编辑 <code class="notion-inline-code">~/.zshrc</code>：</div><div class="notion-text notion-block-5fcb13ddc6b54af2b6ca4b43ec883b82">在文件末尾加入以下内容：</div><div class="notion-text notion-block-1d3725098d0580749fc8deb19e9e3fd6">保存后，给 g16 目录设置权限（不同电脑权限可能不同，建议都执行一下）：</div><div class="notion-blank notion-block-311725098d0580228d6ae5072de0cfbf"> </div><div class="notion-text notion-block-1d3725098d0580889074de6def5d7a54">然后 source 一下让环境变量生效：</div><div class="notion-text notion-block-1d3725098d05800490c5fd546235b214">此时在终端中已经可以使用 <code class="notion-inline-code">g16</code> 命令了。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-fb78dcef868f49a1a7428ba59c8c1813" data-id="fb78dcef868f49a1a7428ba59c8c1813"><span><div id="fb78dcef868f49a1a7428ba59c8c1813" class="notion-header-anchor"></div><a class="notion-hash-link" href="#fb78dcef868f49a1a7428ba59c8c1813" title="配置 GUI 环境变量（LaunchAgent 方式）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">配置 GUI 环境变量（LaunchAgent 方式）</span></span></h4><div class="notion-text notion-block-1d3725098d058034a045dfe62052dcf4">Mac 上 GUI 程序（比如 GaussView）<b>默认不会继承终端的 shell 环境变量</b>，如果只配了 <code class="notion-inline-code">.zshrc</code>，直接从启动台打开 GaussView 会报错找不到 Gaussian。</div><div class="notion-text notion-block-a667fb099f3143cab7666daca1a31539">我们通过 macOS 的 <b>LaunchAgent</b> 机制，在每次登录时自动将环境变量注入到 GUI 环境中，这样所有图形程序（包括 GaussView）都能拿到这些变量，且<b>重启后依然生效</b>。</div><div class="notion-text notion-block-dab20d72155243d08326368a26ff9aac">在 <code class="notion-inline-code">~/Library/LaunchAgents/</code> 目录下新建一个文件，命名为 <code class="notion-inline-code">setenv.g16root.plist</code>，内容如下：</div><div class="notion-callout notion-yellow_background_co notion-block-77b51dab65674c989e64b7a82d281c45"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="⚠️">⚠️</span></div><div class="notion-callout-text"><div class="notion-text notion-block-38726b523f114c9f9c93d468690a6fff"><b>注意：</b> plist 文件中 <code class="notion-inline-code">Label</code> 的值必须和文件名（去掉 <code class="notion-inline-code">.plist</code> 后缀）一致，且必须包含 <code class="notion-inline-code">RunAtLoad</code> 为 <code class="notion-inline-code">true</code>，否则系统不会自动加载。</div></div></div><div class="notion-text notion-block-bb6ad0799e1b4539a172cef36cc96eae">保存后，在终端加载并验证：</div><div class="notion-text notion-block-a44f3f6256324f7f8fee70f80a4beb76">三条 <code class="notion-inline-code">getenv</code> 都返回正确的值就说明配置成功了。至此 g16 安装完成。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-58853974c28c43a7989e624a0b729165" data-id="58853974c28c43a7989e624a0b729165"><span><div id="58853974c28c43a7989e624a0b729165" class="notion-header-anchor"></div><a class="notion-hash-link" href="#58853974c28c43a7989e624a0b729165" title="2.3 配置多核运行"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.3 配置多核运行</span></span></h3><div class="notion-text notion-block-b6570383746b45159fe822a587b21f35">在终端里面，使用下面的命令</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-8706859ec0604583b01f6e2bb82b7f36"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F7d8c4130-89c8-487b-9368-c7dd72a274bf%2F2338882d-9934-4dcc-af0c-d775268705be%2FUntitled.png?table=block&amp;id=8706859e-c060-4583-b01f-6e2bb82b7f36&amp;t=8706859e-c060-4583-b01f-6e2bb82b7f36&amp;width=2&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-c5e767abc67c4b6b8932520674dfbf3a">建立一个 <code class="notion-inline-code">Default.Route</code> 文件</div><ul class="notion-list notion-list-disc notion-block-6d76a55792064ed682ea2239a1436938"><li>M 代表使用多少内存</li></ul><ul class="notion-list notion-list-disc notion-block-94f64e9367bd412ba7cd043a7839d010"><li>P 代表使用多少核心</li></ul><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-75a10d83f0664cbe8e827ed6b297e7db" data-id="75a10d83f0664cbe8e827ed6b297e7db"><span><div id="75a10d83f0664cbe8e827ed6b297e7db" class="notion-header-anchor"></div><a class="notion-hash-link" href="#75a10d83f0664cbe8e827ed6b297e7db" title="3. 安装 GaussView 6"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. 安装 GaussView 6</span></span></h2><ul class="notion-list notion-list-disc notion-block-92ce7f09293340029a3ea05f9a70829b"><li>一种办法可以和 Linux一样配置环境变量来运行，但是这种办法每次都需要打开终端输入 gv ，太麻烦</li></ul><ul class="notion-list notion-list-disc notion-block-07d6b32eb00c42eb8d7c9d8e113d927b"><li>第二种办法是把 <b>gv</b> 文件夹下面的 <b>gview.sh</b> 脚本拖入到终端也可以运行，同样每次都需要用终端，略显麻烦</li></ul><ul class="notion-list notion-list-disc notion-block-4de28a0f52144f95ac1431bc35c8f792"><li>还有一种办法是安装所谓的 <b>Crossover</b> 软件，进行一系列骚操作，也比较麻烦。</li></ul><div class="notion-blank notion-block-8996388251a04579a199dc010ebecaf9"> </div><div class="notion-text notion-block-991793a2dd1d4ecaa3fbedbf90c74546">本文所使用的办法和以上方法均不相同，看我操作。</div><div class="notion-text notion-block-bd9fba977d1f425d8115c1b88f9c3c17">将 gv 文件夹移动到 <b>应用程序</b> 当中，下面是重点</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-a84e8aa36343462aa2c8a96c97a6ef28"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:624px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc5bc9650-1f7e-457a-aa36-94ff539dd8de%2FUntitled.png?table=block&amp;id=a84e8aa3-6343-462a-a2c8-a96c97a6ef28&amp;t=a84e8aa3-6343-462a-a2c8-a96c97a6ef28&amp;width=624&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-c66f7043825d4d229dab9c14b0b874af"> </div><ul class="notion-list notion-list-disc notion-block-37d4732ada584ba8969c1cbfd94cc3ef"><li>第一步，将 gview 拖到 <b>应用程序</b> 中，然后打开 <b>gview</b> 程序，打开后退出，注意要完全退出</li></ul><ul class="notion-list notion-list-disc notion-block-bc329254995241e9a31acd5040e7ca43"><li>第二步，将 data 文件夹拖到 <b>应用程序</b> 中，然后打开 <b>gview</b> 程序，打开后退出，注意要完全退出</li></ul><ul class="notion-list notion-list-disc notion-block-c5939513fa724eafb4217440a7ac8e8b"><li>第三步，将 help 文件夹拖到 <b>应用程序</b> 中，然后打开 <b>gview</b> 程序，打开后退出，注意要完全退出</li></ul><div class="notion-blank notion-block-4703e5ec4f0a4bba8d11759f86cb48d5"> </div><div class="notion-text notion-block-b2ce7707df854ac5a3a9aa32362d6b11">然后就可以愉快滴用了。</div><div class="notion-blank notion-block-126725098d058086b05ed223f559dea1"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-8ea0c94dacda4491b95a9d0d24731fad" data-id="8ea0c94dacda4491b95a9d0d24731fad"><span><div id="8ea0c94dacda4491b95a9d0d24731fad" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8ea0c94dacda4491b95a9d0d24731fad" title="4. 题外话"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">4. 题外话</span></span></h2><div class="notion-text notion-block-126725098d0580ff954dcef5f237c3ff">对于 Mac 而言，Mac 自从 m1 芯片以来，主频非常高，按道理是非常适合 Gaussian 的计算的，但是由于 Mac 系统昂贵的内存，导致了 Mac 计算的受限，因为通常 Gaussian 做振动分析非常消耗内存，没有 64GB 以上，基本稍微大一点的分子就算不动了。</div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>