FindUnionICSD


Find the union of pymatgen and aflowlib


In [46]:
import sys

In [47]:
with open('ICSD_numbers.txt','r') as rf:
    aflowList=(rf.read().split('\n')[:-1])

In [48]:
with open('ICSD-IDs-matproj.txt','r') as rf:
    pymatList=set(rf.read().split('\n')[:-1])

In [42]:
print len(aflowList)
print type(aflowList)
print len(pymatList)
print type(pymatList)


24190
<type 'list'>
27490
<type 'set'>

In [43]:
inter=0
for af in aflowList:
    if af in pymatList:
        inter+=1
print inter


18564

In [50]:
aflowNum=map(int,aflowList)
aflowNum.sort()

In [51]:
with open('ICSD_aflowlib_sort.txt','w') as wf:
    for af in aflowNum:
        print >>wf, af

In [ ]: