atoms_pole_numbers, from_fragment = index_fragments(fragment_list, ipoles) elapsed = time.time() - start print(F'Bookkeeping:\t {elapsed}') ########################################################################### # # Send Probe Information to Tinker # ########################################################################### start = time.time() # Inform Tinker of the probe atoms for comm in engine_comm: mdi.MDI_Send_Command(">NPROBES", comm) mdi.MDI_Send(len(probes), 1, mdi.MDI_INT, comm) mdi.MDI_Send_Command(">PROBES", comm) mdi.MDI_Send(probe_pole_indices, len(probes), mdi.MDI_INT, comm) angstrom_to_bohr = mdi.MDI_Conversion_Factor("angstrom", "atomic_unit_of_length") elapsed - time.time() - start print(F'Sending info to tinker:\t {elapsed}') ########################################################################### # # Engine and Trajectory File Compatibility Check. # ########################################################################### # Check that engine and trajectory are compatible.
ds_dr = colvar.GetGradient() # Apply restraints if colvar_val > upper_restraint: dVg_ds = k_restraint * (colvar_val - upper_restraint) # Compute the updated forces mdi.MDI_Send_Command("<FORCES", comm) forces = mdi.MDI_Recv(3 * natoms, mdi.MDI_DOUBLE, comm) for idx_atom in range(2): for idx_dir in range(3): iatom = colvar.GetAtoms()[idx_atom] forces[3 * iatom + idx_dir] -= dVg_ds * ds_dr[idx_atom][idx_dir] # Send the new forces to the engine mdi.MDI_Send_Command(">FORCES", comm) mdi.MDI_Send(forces, 3 * natoms, mdi.MDI_DOUBLE, comm) print(" Colvar_val: " + str(colvar_val / angstrom_to_atomic)) # Send the "EXIT" command to each of the engines mdi.MDI_Send_Command("EXIT", comm) # Print the data to an output file output = open("s_of_t.out", "w") for i in range(len(s_of_t)): output.write(str(i) + " " + str(s_of_t[i]) + "\n") my_plot.finalize()