from org.gavrog.joss.geometry import SpaceGroupFinder, CrystalSystem from org.gavrog.joss.pgraphs.io import Net from org.gavrog.joss.pgraphs.io import Archive # ============================================================ # Prepare for RCSR lookup # ============================================================ # --- get RCSR archive file (possibly from a .jar or the web) rcsr_path = "org/gavrog/apps/systre/rcsr.arc" rcsr_stream = ClassLoader.getSystemResourceAsStream(rcsr_path) reader = BufferedReader(InputStreamReader(rcsr_stream)) # --- create an archive object from it archive = Archive("1.0") archive.addAll(reader) # ============================================================ # Main data processing # ============================================================ # --- dictionary of seen nets seen = {} # --- count the nets that we read count = 0 # --- main loop for G0 in Net.iterator(sys.argv[1]):
# Prepare for RCSR and Zeolite Atlas lookup # ============================================================ def archive_read(archive, path): from java.lang import ClassLoader from java.io import InputStreamReader, BufferedReader # --- make sure this works from within .jar files and such stream = ClassLoader.getSystemResourceAsStream(path) reader = BufferedReader(InputStreamReader(stream)) archive.addAll(reader) # --- create an empty archive archive = Archive("1.0") # --- add entries from RCSR and zeolite archive files archive_read(archive, "org/gavrog/apps/systre/rcsr.arc") archive_read(archive, "org/gavrog/apps/systre/zeolites.arc") # ============================================================ # Main loop: read nets and print their symbols if found # ============================================================ for G in Net.iterator(sys.argv[1]): if not G.isLocallyStable(): print ">>>unstable<<<" else: found = archive.get(G.minimalImage().systreKey) if found:
from org.gavrog.joss.geometry import SpaceGroupFinder, CrystalSystem from org.gavrog.joss.pgraphs.io import Net from org.gavrog.joss.pgraphs.io import Archive # ============================================================ # Prepare for RCSR lookup # ============================================================ # --- get RCSR archive file (possibly from a .jar or the web) rcsr_path = "org/gavrog/apps/systre/rcsr.arc" rcsr_stream = ClassLoader.getSystemResourceAsStream(rcsr_path) reader = BufferedReader(InputStreamReader(rcsr_stream)) # --- create an archive object from it archive = Archive("1.0") archive.addAll(reader) # ============================================================ # Helper function # ============================================================ def minimalImageWithNodeNames(net): if net.isMinimal(): return net, dict((v, [str(net.getNodeName(v))]) for v in net.nodes()) else: phi = net.minimalImageMap() imageGraph = phi.getImageGraph() names = {}
# ============================================================ # Prepare for RCSR and Zeolite Atlas lookup # ============================================================ def archive_read(archive, path): from java.lang import ClassLoader from java.io import InputStreamReader, BufferedReader # --- make sure this works from within .jar files and such stream = ClassLoader.getSystemResourceAsStream(path) reader = BufferedReader(InputStreamReader(stream)) archive.addAll(reader) # --- create an empty archive archive = Archive("1.0") # --- add entries from RCSR and zeolite archive files archive_read(archive, "org/gavrog/apps/systre/rcsr.arc") archive_read(archive, "org/gavrog/apps/systre/zeolites.arc") # ============================================================ # Main loop: read nets and print their symbols if found # ============================================================ for G in Net.iterator(sys.argv[1]): if not G.isLocallyStable(): print ">>>unstable<<<" else: found = archive.get(G.minimalImage().systreKey)