Initial work in the Molecule and Atom class

Signed-off-by: Vitor Hideyoshi <vitor.h.n.batista@gmail.com>
This commit is contained in:
2021-06-29 17:16:00 -03:00
committed by Vitor Hideyoshi
parent 7d74c3fb3e
commit 292995d0ea
4 changed files with 54 additions and 1 deletions

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"python.pythonPath": "/home/hideyoshi/Python/3.8/bin/python3.8"
}

View File

@@ -21,7 +21,7 @@ internal = {}
## Diceplayer: ## Diceplayer:
player['maxcyc'] = 1 player['maxcyc'] = 1
player['initcyc'] = 1 # May restart an optimization (append to geoms.xyz from start) 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['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['altsteps'] = 20000 # Steps for thermalization when starting from previous step
player['maxstep'] = 0.3 # Maxstep for geometry relaxation in Bohr player['maxstep'] = 0.3 # Maxstep for geometry relaxation in Bohr

49
DPpack/SetGlobalsClass.py Normal file
View File

@@ -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

View File

@@ -23,6 +23,7 @@ if __name__ == '__main__':
help='input file of diceplayer [default = control.in]') help='input file of diceplayer [default = control.in]')
parser.add_argument('-o', dest='outfile', default='run.log', metavar='OUTFILE', parser.add_argument('-o', dest='outfile', default='run.log', metavar='OUTFILE',
help='output file of diceplayer [default = run.log]') 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() args = parser.parse_args()