Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Example] Add TADF材料分子的光电性质预测 #974

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

YfB1125
Copy link

@YfB1125 YfB1125 commented Aug 17, 2024

TADF材料分子的光电性质预测

PR types

PR changes

Describe

有机发光二极管(OLED)具有高效率、结构灵活和低成本的优势,在先进显示和照明技术中受到广泛关注。在有机发光二极管器件中,电注入载流子以1:3的比例形成单线态和三线态激子。以纯荧光材料为发光材料构建的OLED发光效率IQE理论极限为25%。另一方面,有机金属复合物发光材料通过引入稀有金属(Ir,Pt等)带来强自旋轨道耦合(SOC),可以将单线态激子通过系间窜越过程转化成三线态激子,从而利用三线态激子发出磷光,其IQE可达100%,但是稀有金属价格昂贵,为推广使用带来了阻碍。热活化延迟荧光材料(TADF)为解决这些问题提供了新思路,并引起了广泛关注。在TADF中,三线态通过逆系间窜越过程(RISC)转化成单重态并发出荧光,从而实现100%的IQE,而RISC过程很大程度上取决于最低单线态(S1)和最低三线态(T1) 之间的能隙(ΔEST)。根据量子力学理论,ΔEST相当于HOMO和LUMO之间的交换积分的两倍。因此TADF分子的常见设计策略是将电子供体(D)和电子受体(A)以明显扭曲的二面角结合以实现HOMO和LUMO在空间上明显的分离。然而,与ΔEST相反,振子强度(f)需要较大的HOMO和LUMO之间的重叠积分,这二者之间的矛盾需要进一步平衡。

Copy link

paddle-bot bot commented Aug 17, 2024

Thanks for your contribution!

@CLAassistant
Copy link

CLAassistant commented Aug 17, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ YfB1125
❌ Zhaoyiou123
You have signed the CLA already but the status is still pending? Let us recheck it.

@luotao1 luotao1 self-assigned this Aug 19, 2024
@HydrogenSulfate
Copy link
Collaborator

HydrogenSulfate commented Aug 21, 2024

请起一个合适的标题 @YfB1125 ,并补充一下PR的简单描述
image

@HydrogenSulfate
Copy link
Collaborator

HydrogenSulfate commented Aug 21, 2024

commit代码之前请安装pre-commit,并且使用pre-commit格式化代码,否则code-style-check CI无法通过

  1. https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/development/#1
  2. https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/development/#4

@HydrogenSulfate HydrogenSulfate changed the title Dev model [Example] Add TADF材料分子的光电性质预测 Aug 26, 2024
@leeleolay
Copy link

leeleolay commented Aug 26, 2024

辛苦按照paddlescience代码规范提交代码@YfB1125 可参考其他PR:#964 , #962
建议写一个文档说明该项目

@YfB1125 YfB1125 closed this Aug 26, 2024
@YfB1125 YfB1125 deleted the dev_model branch August 26, 2024 09:21
@YfB1125 YfB1125 reopened this Aug 26, 2024
@leeleolay
Copy link

https://paddlescience-docs.readthedocs.io/zh-cn/latest/zh/development/ 辛苦按照开发指南再整理一下代码规范和文档

from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split

paddle.device.set_device("cpu")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要指定运行设备为cpu呢

Comment on lines 18 to 21
EPOCHS = 200
LR = 0.0001
BATCH = 8

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BATCH = 8

data = []
for line in open("D://resources//machine learning//paddle//2024-08//Est.dat"):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用相对路径,./data/xxx即可

TADF/Est/est_paddle_train.py Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件和train.py的区别是?

Comment on lines +10 to +86
## 4.模型构建
深度神经网络为含有两层隐藏层的神经网络,第一层隐藏层含有587个神经元,第二层隐藏层含有256个神经元,隐藏层之间加入Dropout。

```
class Net(nn.Layer):

def __init__(self):
super(Net, self).__init__()
self.fc1 = paddle.nn.Linear(in_features=587, out_features=587)
self.fc2 = paddle.nn.Linear(in_features=587, out_features=256)
self.fc3 = paddle.nn.Linear(in_features=256, out_features=1)
self.dropout = paddle.nn.Dropout(p=0.5)
self.relu = paddle.nn.ReLU()

def forward(self, _input):
x = self.fc1(_input)
x = self.relu(x)
x = self.dropout(x)
x = self.fc2(x)
x = self.relu(x)
x = self.dropout(x)
x = self.fc3(x)
output = self.relu(x)
return output.squeeze(axis=-1)
def initialize(self):
"""初始化权重"""
for m in self.sublayers():
if isinstance(m, nn.Linear):
paddle.nn.initializer.XavierNormal()(m.weight)
```
## 5.模型训练

```
def train(model,X_train,Y_train,X_val,Y_val,batchsize,lr,epochs):
train_loader = paddle.io.DataLoader(Mydataset(X_train,Y_train), batch_size=batchsize, shuffle=True, num_workers=0)
loss_func = paddle.nn.MSELoss()
optimizer = paddle.optimizer.Adam(parameters=model.parameters(),learning_rate=lr,beta1=(0.9, 0.99)[0],
beta2=(0.9, 0.99)[1],weight_decay=1e-5)
train_Loss =[]
val_Loss = []
for epoch in range(epochs):
model.train()
train_loss = 0.
print(epoch)
for i,data in enumerate(train_loader):
input_,tar = data
output = model(input_)
loss = loss_func(output,tar)
rmse = paddle.sqrt(loss)
optimizer.clear_grad()
rmse.backward()
optimizer.step()
train_loss += loss.item()
train_loss *= batchsize
train_loss /= len(X_train)
train_Loss.append(train_loss)

with paddle.no_grad():
val_pre = model(paddle.to_tensor(X_val))
#val_pre = val_pre*std+mean
val_loss = loss_func(val_pre, paddle.to_tensor(Y_val))
val_loss = paddle.sqrt(val_loss)
val_loss = val_loss.detach().numpy()
val_Loss.append(val_loss)

return train_Loss,val_Loss
```
## 6. 优化器构建
训练器采用Adam优化器
```
optimizer = paddle.optimizer.Adam(parameters=model.parameters(),learning_rate=lr,beta1=(0.9, 0.99)[0],
beta2=(0.9, 0.99)[1],weight_decay=1e-5)
```
## 7. 模型保存
```
paddle.save(model.state_dict(), "D://FILE_YFBU//paddle//model//f.pdparams")
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文档内的所有代码块请使用引用格式,引用代码文件的内容,否则要维护两份代码,参考:

``` py linenums="63"
--8<--
examples/allen_cahn/allen_cahn_piratenet.py:63:64
--8<--
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改建议同Est案例

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改建议同Est案例

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 修改建议同Est案例
  2. angle_paddle_train和angle_ppsci的区别是什么,是否可以只保留一个文件?
  3. 文件名请重新命名为具有实际意义的名字,angle_ppsci不太能看出来这个文件是做什么的,可以是train.py或者main.py

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修改建议同Est和Angle案例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants