Exemplo n.º 1
0
from NN_prepare_batch import OneBatch
from NN_misc import CalcRMSD, MakePDB, MoveToCenter, CalcAvgDistUnMatched, CalcAvgDist, NUM_1D, PIXEL_LEN
import numpy as np
from numpy import float32

AtomRadius = 1.0 * PIXEL_LEN
AtomRadiusSqr = AtomRadius * AtomRadius

CSV_Path = "C:/Users/david/Documents/newff/results/NN/simulations/mol_05/csv_files/"
FileList = "sim_files_005_to_009.txt"

print("reading the files listed in: " + CSV_Path + FileList)

# read in all the CSV files that hold the MD simulation data
allLines = AllLines()
ReadFilesInList(allLines, CSV_Path, FileList)

print("num lines = " + str(allLines.getNumLines()))
print("num molecules = " + str(allLines.GetNumMolecules()))
print("num simulations per molecule = " +
      str(allLines.GetNumSimulations(allLines.GetMolNumStart())))
print("num time steps per simulation = " +
      str(allLines.GetNumTimeSteps(allLines.GetMolNumStart(), 5)) +
      " (many are skipped)")

# for the record
print("NUM_1D = %d" % (NUM_1D))

# make a batch of NN input and output data
batchData = OneBatch(10)  # 10 or 100 or ...
batchData.makeABatch(allLines,
Exemplo n.º 2
0
                   axis=-1))  # ModelNum = 1  ('mean_squared_error')


CSV_Path = "C:/Users/david/Documents/newff/results/NN/simulations/mol_05/csv_files/"
#-----------------------------------------------------------
# read the CSV files that have the MD simulation data
# allLinesTrain has the raw training data
# allLinesValidate has the raw validation data
#-----------------------------------------------------------
# FileListTrain = "sim_files_000_to_029.txt"       # 000_to_004 or 000_to_029
# FileListValidate = "sim_files_030_to_034.txt"    # 005_to_009 or 030_to_034
FileListTrain = "sim_files_000_to_000.txt"  # 000_to_004 or 000_to_029
FileListValidate = "sim_files_000_to_000.txt"  # 005_to_009 or 030_to_034
print("reading the training files listed in: " + CSV_Path + FileListTrain)
allLinesTrain = AllLines()
ReadFilesInList(allLinesTrain, CSV_Path, FileListTrain)
print("reading the validation files list in: " + CSV_Path + FileListValidate)
allLinesValidate = AllLines()
ReadFilesInList(allLinesValidate, CSV_Path, FileListValidate)

#-------------------------------------------------------------------------------
# make a OneNNData to get array sizes for the NN
#-------------------------------------------------------------------------------
data = OneNNData()
inShape = data.InData.shape
outShape = data.OutData.shape

#-------------------------------------------------------------------------------
# make the Keras Functional API model.
#-------------------------------------------------------------------------------
input = Input(shape=data.InData.shape)
    print("yTrue.shape = ", yTrue.shape)
    print("yPred.shape = ", yPred.shape)
    return (K.mean(K.square(yPred - yTrue),
                   axis=-1))  # ModelNum = 1  ('mean_squared_error')


#-----------------------------------------------------------
# read CSV files that have the MD simulation data.
# for testing, use the validation data.
# allLinesValidate has the raw validation data.
#-----------------------------------------------------------
CSV_Path = "C:/Users/david/Documents/newff/results/NN/simulations/mol_05/csv_files/"
FileListValidate = "sim_files_030_to_039.txt"  # 005_to_009 or 030_to_039
print("reading the validation files list in: " + CSV_Path + FileListValidate)
allLinesValidate = AllLines()
ReadFilesInList(allLinesValidate, CSV_Path, FileListValidate)

#-----------------------------------------------------------
# read the connection file for this molecule
#-----------------------------------------------------------
ConnectionFile = "C:/Users/david/Documents/newff/results/NN/simulations/mol006_sim000.connections.csv"
print("reading connections file: " + ConnectionFile)
Connections = ProteinConnections(ConnectionFile)
TotalNumConnections = Connections.getTotalNumConnections()
print("check: total num connections = " + str(TotalNumConnections))

#-------------------------------------------------------------------------------
# make a OneNNData for general use.
#-------------------------------------------------------------------------------
data = OneNNData(SizedForNN=True)