||
https://downloads.ccdc.cam.ac.uk/documentation/API/installation_notes.html#windows
安装简单流程。
1. 安装python
2. 安装csds
3. 使用pip命令安装csd-python-api.zip
注意事项就是需要先安装微软的vcforpython,以及来自uci的轮子库lxml。
4. 解压csd-python-api.zip,在test文件夹中运行run_tests.bat
----
CCDC 剑桥晶体数据中心 http://www.ccdc.cam.ac.uk/
GOLD 分子对接软件以及 CSDS数据库就出自该中心。
----
CSDS 最近又引入python API, 灵活性得到进一步加强。
```python
#!/python2
#coding: utf-8
import ccdc
from ccdc.search import SubstructureSearch, SMARTSSubstructure
from ccdc.descriptors import MolecularDescriptors as MD, GeometricDescriptors as GD
#create fragment
# ccdc.search.SMARTSSubstructure
XBD_sub=ccdc.search.SMARTSSubstructure('FC') #index is 0
XBA_sub=ccdc.search.SMARTSSubstructure('N') #index is 0
#load fragment
XB_search_engine=ccdc.search.SubstructureSearch()
XBDid=XB_search_engine.add_substructure(XBD_sub)
XBAid=XB_search_engine.add_substructure(XBA_sub)
#set bond length and angle
#1.36 1.45
#XB_search_engine.add_distance_constraint('DIST2',XBDid,0,XBDid,1,(0,1.36),type='Intramolecular')
#3.02 3.22
XB_search_engine.add_distance_constraint('DIST1',XBDid,0,XBAid,0,(0,3.02),type='Intermolecular')
XB_search_engine.add_angle_constraint('ANG1',XBDid,1,XBDid,0,XBAid,0,(140.0,180.0))
#test search mode
#no errors// not disordered //R factor less than 0.1
XB_search_engine.settings.no_disorder='all'
XB_search_engine.settings.no_errors=True
XB_search_engine.settings.max_r_factor = 0.1
print "start searching"
#searching set small database
XBhits=XB_search_engine.search(max_hits_per_structure=1)
print "len XB",len(XBhits)
#output
outf=open('outf.txt','w')
for obj in XBhits:
'''
'''
#refcode DIST0 DIST1 ANG1 N_atomtype Rfactor Atom1id Atom2id Atom3id
bond_len=MD.atom_distance(obj.match_atoms()[0],obj.match_atoms()[1])
elements=[ obj.identifier ,bond_len,obj.constraints['DIST1'], obj.constraints['ANG1'],obj.match_atoms()[2].sybyl_type, obj.entry.r_factor]
line=' '.join(map(str,elements))+"n"
print line,
outf.write(line)
```
搜索相互作用详细信息
----------------
linux 下安装python
$ tar zxvf Python-2.7.9.tgz $ cd Python-2.7.9 $ ./configure --prefix=/home/my/python2.7 --enable-unicode=ucs4 $ make $ make install安装好了以后添加到path中,同时修改别名python27,避免冲突。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-27 10:46
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社