Skip to content

Commit

Permalink
Merge branch 'development_efrem'
Browse files Browse the repository at this point in the history
  • Loading branch information
efrembernuz committed Jan 29, 2020
2 parents 8d0fa63 + 51304b3 commit ce066ac
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 57 deletions.
2 changes: 1 addition & 1 deletion cosymlib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.7.1'
__version__ = '0.7.2'

from cosymlib.cosym_api import Cosymlib
from cosymlib.utils import get_shape_map
4 changes: 3 additions & 1 deletion cosymlib/file_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def get_molecule_from_file_xyz(file_name):
molecules = []
with open(file_name, mode='r') as lines:
lines.readline()
name = lines.readline().split()[0]
name = lines.readline()
if name.strip():
name = name.split()[0]
for line in lines:
if '$' in line or '#' in line:
pass
Expand Down
2 changes: 1 addition & 1 deletion cosymlib/molecule/geometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self,
self._positions = []
self._atom_groups = list(symbols)

if name is not None:
if name.strip():
self._name = name
else:
self._name = ' ' * 5
Expand Down
63 changes: 34 additions & 29 deletions scripts/cosym
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ parser.add_argument(type=str, dest="yaml_input", nargs='?', default=None,
parser.add_argument('-o', '--output_name', dest='output_name', default=None, help='save in file name')
parser.add_argument('-info', action='store_true', default=False, help='return information about the input geometries')

parser.add_argument('-central_atom', action='store', dest='central_atom',
parser.add_argument('-c', '--central_atom', action='store', dest='central_atom',
type=int, default=0, help='position of the central atom if exist')
parser.add_argument('-custom_ref', action='store', dest='custom_ref', default=None,
help='take a given structure from the file and use it as reference')
parser.add_argument('-fix_permutation', dest='fix_permutation', action='store_true', default=False,
parser.add_argument('-fix_perm', '--fix_permutation', dest='fix_permutation', action='store_true', default=False,
help='use the given permutation to perform a calculation')
parser.add_argument('-ignore_atom_labels', dest='ignore_atom_labels', action='store_true', default=False,
parser.add_argument('-no_labels', '--ignore_atom_labels', dest='ignore_atom_labels', action='store_true', default=False,
help='ignore atom labels from given structures')
# parser.add_argument('-connectivity', dest='connectivity', action='store', default=None,
# help='Connect a set of atoms by...')
Expand All @@ -36,21 +36,21 @@ parser.add_argument('-center', dest='center', action='store', default=None, narg

# Shape input flags
group_shape = parser.add_argument_group('Shape')
group_shape.add_argument('-shp_measure',
group_shape.add_argument('-shp_m', '--shp_measure',
dest='shp_measure',
action='store',
default=None,
help='Shape measure of input structure with reference polyhedra')
group_shape.add_argument('-shp_labels', action='store_true',
group_shape.add_argument('-shp_l', '--shp_labels', action='store_true',
dest='shp_labels',
default=False,
help='show the reference labels for a given structure')
group_shape.add_argument('-shp_structure',
group_shape.add_argument('-shp_s', '--shp_structure',
dest='shp_structure',
action='store_true',
default=False,
help='return the closes input structure to the reference shape')
group_shape.add_argument('-shp_references',
group_shape.add_argument('-shp_r', '--shp_references',
dest='shp_references',
action='store_true',
default=False,
Expand All @@ -67,39 +67,44 @@ group_pointgroup.add_argument('-pointgroup',

# Symgroup input flags
group_symgroup = parser.add_argument_group('Symgroup')
group_symgroup.add_argument('-sym_measure',
group_symgroup.add_argument('-sym_m','--sym_measure',
dest='sym_measure',
action='store',
default=None,
help='Symgroup measure of input structure with reference group')
group_symgroup.add_argument('-sym_structure',
group_symgroup.add_argument('-sym_s','--sym_structure',
dest='sym_structure',
action='store_true',
default=False,
help='return the closes input structure to the reference symmetry')
group_symgroup.add_argument('-sym_labels',
group_symgroup.add_argument('-sym_l', '--sym_labels',
dest='sym_labels',
action='store_true',
default=False,
help='return the possible symmetry labels that can be used in symgroup')
group_symgroup.add_argument('-sym_quirality',
dest='sym_quirality',
group_symgroup.add_argument('-sym_chirality',
dest='sym_chirality',
action='store_true',
default=False,
help='search for a possible quirality in molecule')

# Wfnsym input flags
group_wfnsym = parser.add_argument_group('Wfnsym')
group_wfnsym.add_argument('-sym_wf',
dest='sym_wf',
action='store',
default=False,
help='Wfnsym measure of input structure with reference group')
# group_wfnsym.add_argument('-psym_wf',
# dest='psym_wf',
# action='store',
# default=False,
# help='Pseudo-symmetry measure of input structure with reference group')
help='search for a possible chirality in molecule')

# Qsym input flags
group_qsym = parser.add_argument_group('Qsym')
group_qsym.add_argument('-qsym_wfn',
dest='qsym_wfn',
action='store',
default=False,
help='Wfnsym measure of input structure with reference group')
group_qsym.add_argument('-qsym_dens',
dest='qsym_dens',
action='store',
default=False,
help='Density measure of input structure with reference group')
group_qsym.add_argument('-qsym_mos',
dest='qsym_wfn',
action='store',
default=False,
help='Range of orbitals to analyze density or wavefunction symmetry')

# Utils
parser.add_argument('-mo_diagram', dest="mo_diagram", action='store_true', default=False,
Expand Down Expand Up @@ -199,22 +204,22 @@ elif args.sym_measure:
output_name=args.output_name)

# Wfnsym commands
if args.sym_wf:
if args.qsym_wfn:
if args.axis1 is not None:
args.axis1 = np.array(args.axis1).astype(float)
if args.axis2 is not None:
args.axis2 = np.array(args.axis2).astype(float)
if args.center is not None:
args.center = np.array(args.center).astype(float)
symobj.write_wnfsym_measure_2file(args.sym_wf,
symobj.write_wnfsym_measure_2file(args.qsym_wfn,
vector_axis1=args.axis1,
vector_axis2=args.axis2,
center=args.center,
output_name=args.output_name)

#Utils
if args.mo_diagram:
symobj.write_mo_diagram(args.wf_group,
symobj.write_mo_diagram(args.qsym_wfn,
vector_axis1=args.axis1,
vector_axis2=args.axis2,
center=args.center)
Expand Down
4 changes: 2 additions & 2 deletions scripts/cosym.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pointgroup: True
sym_measure: "C3v"
sym_structure: False
sym_labels: False
sym_quirality: False
sym_chirality: False
# Wfnsym command line
sym_wf: "Td"
qsym_wfn: "Td"
# Optional command line
central_atom: 1
custom_ref: "external_file.ref"
Expand Down
7 changes: 4 additions & 3 deletions scripts/example_shape_file
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
shape_measure: T-4
shape_structure: False
central_atom: 1
shp_measure: T-4
shp_structure: False
central_atom: 1
output_name: test
17 changes: 9 additions & 8 deletions scripts/shape
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,36 @@ parser.add_argument(type=str, dest='input_file', help='input file name(+extensio
parser.add_argument(type=str, dest="yaml_input", nargs='?', default=None,
help='Perform the calculations with the command file')
parser.add_argument('-o', '--output_name', dest='output_name', default=None, help='save in file name')
parser.add_argument('-info', action='store_true', default=False, help='return information about the input geometries')
parser.add_argument('-info', action='store_true', default=False,
help='return information about the input geometries')

parser.add_argument('-central_atom', action='store', dest='central_atom',
parser.add_argument('-c', '--central_atom', action='store', dest='central_atom',
type=int, default=0, help='position of the central atom if exist')
parser.add_argument('-custom_ref', action='store', dest='custom_ref', default=None,
help='take a given structure from the file and use it as reference')
parser.add_argument('-fix_permutation', dest='fix_permutation', action='store_true', default=False,
parser.add_argument('-fix_perm', '--fix_permutation', dest='fix_permutation', action='store_true', default=False,
help='use the given permutation to perform a calculation')
# parser.add_argument('-connectivity', dest='connectivity', action='store', default=None,
# help='Connect a set of atoms by...')


# Shape input flags
group_shape = parser.add_argument_group('Shape')
group_shape.add_argument('-measure',
group_shape.add_argument('-m', '--measure',
dest='measure',
action='store',
default=None,
help='Shape measure of input structure with reference polyhedra')
group_shape.add_argument('-labels', action='store_true',
group_shape.add_argument('-l', '--labels', action='store_true',
dest='labels',
default=False,
help='show the reference labels for a given structure')
group_shape.add_argument('-structure',
group_shape.add_argument('-s', '--structure',
dest='structure',
action='store_true',
default=False,
help='return the closes input structure to the reference shape')
group_shape.add_argument('-references',
group_shape.add_argument('-r', '--references',
dest='references',
action='store_true',
default=False,
Expand Down Expand Up @@ -113,7 +114,7 @@ elif not reference_polyhedron:
c = int(bool(args.central_atom))
reference_polyhedron = shape_tools.get_structure_references(n_atoms - c)
else:
reference_polyhedron = [args.shape_measure]
reference_polyhedron = [args.measure]

if args.structure:
symobj.write_shape_structure_2file(reference_polyhedron,
Expand Down
4 changes: 2 additions & 2 deletions scripts/shape_map
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ parser.add_argument(type=str, dest='input_file', help='input file name(+extensio
parser.add_argument('-o', '--output_name', dest='output_name', default=None, help='save in file name')
parser.add_argument(type=str, dest="yaml_input", nargs='?', default=None,
help='Perform the calculations with the command file')
parser.add_argument('-central_atom', action='store', dest='central_atom',
parser.add_argument('-c', '--central_atom', action='store', dest='central_atom',
type=int, default=0, help='position of the central atom if exist')
parser.add_argument('-custom_ref', action='store', dest='custom_ref', default=None,
help='take a given structure from the file and use it as reference')
parser.add_argument('-fix_permutation', dest='fix_permutation', action='store_true', default=False,
parser.add_argument('-fix_perm', '--fix_permutation', dest='fix_permutation', action='store_true', default=False,
help='use the given permutation to perform a calculation')

# Shape input flags
Expand Down
18 changes: 9 additions & 9 deletions scripts/symgroup
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ parser.add_argument(type=str, dest="yaml_input", nargs='?', default=None,
parser.add_argument('-o', '--output_name', dest='output_name', default=None, help='save in file name')
parser.add_argument('-info', action='store_true', default=False, help='return information about the input geometries')

parser.add_argument('-central_atom', action='store', dest='central_atom',
parser.add_argument('-c', '--central_atom', action='store', dest='central_atom',
type=int, default=0, help='position of the central atom if exist')
parser.add_argument('-fix_permutation', dest='fix_permutation', action='store_true', default=False,
parser.add_argument('-fix_perm', '--fix_permutation', dest='fix_permutation', action='store_true', default=False,
help='use the given permutation to perform a calculation')
parser.add_argument('-ignore_atom_labels', dest='ignore_atom_labels', action='store_true', default=False,
parser.add_argument('-no_labels', '--ignore_atom_labels', dest='ignore_atom_labels', action='store_true', default=False,
help='ignore atom labels from given structures')
# parser.add_argument('-connectivity', dest='connectivity', action='store', default=None,
# help='Connect a set of atoms by...')
Expand All @@ -31,26 +31,26 @@ parser.add_argument('-center', dest='center', action='store', default=None, narg

# Symgroup input flags
group_symgroup = parser.add_argument_group('Symgroup')
group_symgroup.add_argument('-measure',
group_symgroup.add_argument('-m', '--measure',
dest='measure',
action='store',
default=False,
help='Symgroup measure of input structure with reference group')
group_symgroup.add_argument('-structure',
group_symgroup.add_argument('-s', '--structure',
dest='structure',
action='store_true',
default=False,
help='return the closes input structure to the reference symmetry')
group_symgroup.add_argument('-labels',
group_symgroup.add_argument('-l', '--labels',
dest='labels',
action='store_true',
default=False,
help='return the possible symmetry labels that can be used in symgroup')
group_symgroup.add_argument('-quirality',
dest='quirality',
group_symgroup.add_argument('-chirality',
dest='chirality',
action='store_true',
default=False,
help='search for a possible quirality in molecule')
help='search for a possible chirality in molecule')


args = parser.parse_args(sys.argv[1:])
Expand Down
2 changes: 1 addition & 1 deletion scripts/symgroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
measure: "C3v"
structure: False
labels: False
quirality: False
chirality: False
# Optional command line
central_atom: 1
custom_ref: "external_file.ref"
Expand Down

0 comments on commit ce066ac

Please sign in to comment.