From 292995d0eac228ecc4b0a2e6d8283b35edf33c0b Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Nakazone Batista Date: Tue, 29 Jun 2021 17:16:00 -0300 Subject: [PATCH] Initial work in the Molecule and Atom class Signed-off-by: Vitor Hideyoshi --- .vscode/settings.json | 3 +++ DPpack/SetGlobals.py | 2 +- DPpack/SetGlobalsClass.py | 49 +++++++++++++++++++++++++++++++++++++++ diceplayer.py | 1 + 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 DPpack/SetGlobalsClass.py diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..52e1068 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/home/hideyoshi/Python/3.8/bin/python3.8" +} \ No newline at end of file diff --git a/DPpack/SetGlobals.py b/DPpack/SetGlobals.py index 61fd7dd..6fb4c8a 100644 --- a/DPpack/SetGlobals.py +++ b/DPpack/SetGlobals.py @@ -21,7 +21,7 @@ internal = {} ## Diceplayer: player['maxcyc'] = 1 player['initcyc'] = 1 # May restart an optimization (append to geoms.xyz from start) -player['nprocs'] = 1f +player['nprocs'] = 1 player['switchcyc'] = 3 # At which step start doing only one QM calculation (geom & chg) player['altsteps'] = 20000 # Steps for thermalization when starting from previous step player['maxstep'] = 0.3 # Maxstep for geometry relaxation in Bohr diff --git a/DPpack/SetGlobalsClass.py b/DPpack/SetGlobalsClass.py new file mode 100644 index 0000000..63b6022 --- /dev/null +++ b/DPpack/SetGlobalsClass.py @@ -0,0 +1,49 @@ +import os, sys +import math +import shutil +import textwrap +import numpy as np + +from DPpack.PTable import * +from DPpack.Misc import * + +class Molecule: + + def __init__(self): + + self.atoms = [] # Lista de instancias de Atom + self.positions = None # Array Numpy + self.energy = None # Array Numpy + self.gradient = None # Array Numpy + self.hessian = None # Array Numpy + + def add_atom(self, a): + + self.atoms.append(a) # Inserção de um novo atomo + + def center_of_mass(self): + + com = np.zeros(3) + total_mass = 0.0 + for atom in self.atoms: + total_mass += atom.mass + com += atom.mass * np.array([atom.rx, atom.ry, atom.rz]) + + com = com / total_mass + + return com + + +class Atom: + + def __init__(self, lbl,na,rx,ry,rz,chg,eps,sig): + + self.lbl = lbl # Integer + self.na = na # Integer + self.rx = rx # Double + self.ry = ry # Double + self.rz = rz # Double + self.chg = chg # Double + self.eps = eps # Double + self.sig = sig # Double + self.mass = atommass[self.na] # Double diff --git a/diceplayer.py b/diceplayer.py index e9cb51e..fb79f77 100644 --- a/diceplayer.py +++ b/diceplayer.py @@ -23,6 +23,7 @@ if __name__ == '__main__': help='input file of diceplayer [default = control.in]') parser.add_argument('-o', dest='outfile', default='run.log', metavar='OUTFILE', help='output file of diceplayer [default = run.log]') + ## Study the option of a parameter for continuing the last process via data from control.in and run.log files args = parser.parse_args()