Beispiel #1
0
    l_init = mydevice.load(l_init)
    q_label = mydevice.load(q_label)
    p_label = mydevice.load(p_label)

    return q_init,p_init,q_label,p_label,l_init


def print_dict(name,thisdict):
    print(name,'dict ============== ')
    for key,value in thisdict.items(): print(key,':',value)

if __name__=='__main__':

    _ = mydevice()
    _ = system_logs(mydevice)
    system_logs.print_start_logs()

    torch.set_default_dtype(torch.float64)

    #print('checking pbc method ... wait a minute ')
    #check_pbc()
    torch.manual_seed(23841)

    traindict = {"loadfile"  : None, # to load previously trained model
                 "nn_mode"   : 'hf', # 'hf' or 'ff' predict hamiltonian or predict force
                 "force_clip": 5,    # clamp the force within a range
                 "grad_clip" : 10,   # clamp the gradient for neural net parameters
                 "tau_long"  : 0.1,  # the large time step
                 "n_chain"   : 1,    # number of times to do integration before cal the loss
                 "ngrids"    : 6,    # for multibody interactions
                 "b"         : 0.2,  # grid lattice constant for multibody interactions
    # python ML_trainer.py ../data/gen_by_ML/basename/MD_config.dict  ../data/gen_by_ML/basename/ML_config.dict

    argv = sys.argv
    MDjson_file = argv[1]
    MLjson_file = argv[2]

    MD_parameters.load_dict(MDjson_file)
    ML_parameters.load_dict(MLjson_file)

    seed = ML_parameters.seed
    torch.manual_seed(seed)  

    torch.set_default_dtype(torch.float64)

    _ = system_logs(mydevice)  # HK
    system_logs.print_start_logs() # HK

    # io varaiables
    train_filename = ML_parameters.train_filename
    val_filename   = ML_parameters.valid_filename  # read the same data
    test_filename  = val_filename
    train_pts      = ML_parameters.train_pts
    val_pts        = ML_parameters.valid_pts
    test_pts       = val_pts
    qp_weight      = ML_parameters.qp_weight
    Lambda         = ML_parameters.Lambda
    clip_value     = ML_parameters.clip_value

    # crash checker variables
    rthrsh0                       = MD_parameters.rthrsh0
    pthrsh0                       = MD_parameters.pthrsh0