def create_system(input_contents): S = data.mdsys_t() for count, line in enumerate(input_contents): (R, value) = get_a_line(line) if (R == 0): if (count == 0): S.natoms = c_int(int(value)) elif (count == 1): S.mass = c_double(float(value)) elif (count == 2): S.epsilon = c_double(float(value)) elif (count == 3): S.sigma = c_double(float(value)) elif (count == 4): S.rcut = c_double(float(value)) elif (count == 5): S.box = c_double(float(value)) elif (count == 6): restfile = value elif (count == 7): trajfile = value elif (count == 8): ergfile = value elif (count == 9): S.nsteps = c_int(int(value)) elif (count == 10): S.dt = c_double(float(value)) elif (count == 11): nprint = int(value) return S, restfile, trajfile, ergfile, nprint
# UTILITIES TESTS # run as: # python3 testutilities.py < argon_3.inp import data from ctypes import * from utilities import get_a_line import sys system = data.mdsys_t() system.natoms = 3 # natoms system.mass = 39.948 # mass in AMU system.epsilon = 0.2379 # epsilon in kcal/mol ; system.sigma = 3.405 # sigma in angstrom system.rcut = 8.5 # rcut in angstrom system.box = 17.1580 # box length (in angstrom) system.nsteps = 100 # nr MD steps system.dt = 5.0 # MD time step (in fs) str_rest = "argon_3.rest" str_traj = "argon_3.xyz" str_ener = "argon_3.dat" nprint = 100 tests = [ "natoms", "mass", "epsilon", "sigma", "rcut", "box", "restart file", "trajectory file", "energy file", "nsteps", "dt", "nprint" ] values = [