create_caches.py
def writemol(root, mol, out):
    '''mol is gninatypes file, write it in the appropriate binary format to out'''
    fname = root+'/'+mol
    try:
        with open(fname,'rb') as gninatype:
            if len(fname) > 255:
                print("Skipping",mol,"since filename is too long")
                return
            s = bytes(mol)
            out.write(struct.pack('b',len(s)))
            out.write(s)
            data = gninatype.read()
            assert(len(data) % 16 == 0)
            natoms = len(data)/16
            out.write(struct.pack('i',natoms))
            out.write(data)            
    except Exception as e:
        print(mol)
        print(e)
mol is gninatypes file, write it in the appropriate binary format to out
mol is gninatypes file, write it in the appropriate binary format to out
mol is gninatypes file write it in the appropriate binary format to out
def writemol(root, mol, out):
    fname = root+'/'+mol
    try:
        with open(fname,'rb') as gninatype:
            if len(fname) > 255:
                print("Skipping",mol,"since filename is too long")
                return
            s = bytes(mol)
            out.write(struct.pack('b',len(s)))
            out.write(s)
            data = gninatype.read()
            assert(len(data) % 16 == 0)
            natoms = len(data)/16
            out.write(struct.pack('i',natoms))
            out.write(data)            
    except Exception as e:
        print(mol)
        print(e)
def writemol ( root , mol , out ) : fname = root + '/' + mol try : with open ( fname , 'rb' ) as gninatype : if len ( fname ) > 255 : print ( "Skipping" , mol , "since filename is too long" ) return s = bytes ( mol ) out . write ( struct . pack ( 'b' , len ( s ) ) ) out . write ( s ) data = gninatype . read ( ) assert ( len ( data ) % 16 == 0 ) natoms = len ( data ) / 16 out . write ( struct . pack ( 'i' , natoms ) ) out . write ( data ) except Exception as e : print ( mol ) print ( e )
mol is gninatypes file, write it in the appropriate binary format to out
mol is gninatypes file write it in the appropriate binary format to out
'''mol is gninatypes file, write it in the appropriate binary format to out'''
root
mol
out