You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.py 2.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Copyright 2021 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """main"""
  16. import time
  17. import argparse
  18. from mindspore import context
  19. from src.simulation_initial import Simulation
  20. parser = argparse.ArgumentParser(description='Sponge Controller')
  21. parser.add_argument('--i', type=str, default=None, help='input file')
  22. parser.add_argument('--amber_parm', type=str, default=None,
  23. help='paramter file in AMBER type')
  24. parser.add_argument('--c', type=str, default=None,
  25. help='initial coordinates file')
  26. parser.add_argument('--r', type=str, default="restrt", help='')
  27. parser.add_argument('--x', type=str, default="mdcrd", help='')
  28. parser.add_argument('--o', type=str, default="mdout", help="")
  29. parser.add_argument('--box', type=str, default="mdbox", help='')
  30. args_opt = parser.parse_args()
  31. context.set_context(mode=context.PYNATIVE_MODE,
  32. device_target="GPU", device_id=0, save_graphs=True)
  33. if __name__ == "__main__":
  34. start = time.time()
  35. simulation = Simulation(args_opt)
  36. simulation.Main_Initial()
  37. res = simulation.Initial_Neighbor_List_Update(not_first_time=0)
  38. md_info = simulation.md_info
  39. md_info.step_limit = 1
  40. for i in range(1, md_info.step_limit + 1):
  41. print("steps: ", i)
  42. md_info.steps = i
  43. simulation.Main_Before_Calculate_Force()
  44. simulation.Main_Calculate_Force()
  45. simulation.Main_Calculate_Energy()
  46. simulation.Main_After_Calculate_Energy()
  47. temperature = simulation.Main_Print()
  48. simulation.Main_Iteration_2()
  49. end = time.time()
  50. print("Main time(s):", end - start)
  51. simulation.Main_Destroy()